First of all, the code is not so good even as C++:
1) use of all those immediate constants (89, 27, '1', etc.) makes the code very hard to maintain; 2) comparison with character '1' is bad way to represent pure logic, 3) some declarations are not shown: where is
ais_binary
(could be an instance of some class implementing indexing),
temp_s
?
The lack of some declarations makes literal translation uncertain, but you only need some ideas:
Probably that's it.
—SA