#include <perms.h>

                                                                //      1  %systemintegerfn stoi(%string(255) S)
#line 1 "regression-bugs-tmp/stoi.imp"
extern int stoi( _imp_string /*%string(255)*/ S )
#line 1 "regression-bugs-tmp/stoi.imp"
{
  __label__ _imp_endofblock;
                                                                //      2  %integer i,k
_imp_current_line = 2; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 2 "regression-bugs-tmp/stoi.imp"
int I;
#line 2 "regression-bugs-tmp/stoi.imp"
int K;
                                                                //      3  %integer sign=0, val=0
_imp_current_line = 3; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 3 "regression-bugs-tmp/stoi.imp"
int SIGN;
#line 3 "regression-bugs-tmp/stoi.imp"
SIGN = 0;
#line 3 "regression-bugs-tmp/stoi.imp"
int VAL;
#line 3 "regression-bugs-tmp/stoi.imp"
VAL = 0;
                                                                //      4    i = 0
_imp_current_line = 4; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 4 "regression-bugs-tmp/stoi.imp"
I = 0;
                                                                //      5    %while i < length(s) %cycle
_imp_current_line = 5; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 5 "regression-bugs-tmp/stoi.imp"
L_0002:;
#line 5 "regression-bugs-tmp/stoi.imp"
if (((I) >= (*_imp_LENGTH(&S)))) goto L_0003;
                                                                //      6      i = i+1;  k = charno(s,i)
_imp_current_line = 6; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 6 "regression-bugs-tmp/stoi.imp"
I = (((int)(I)) + (1));
_imp_current_line = 6; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 6 "regression-bugs-tmp/stoi.imp"
K = *_imp_CHARNO(&S, I);
                                                                //      7      %continue %if k <= ' '
_imp_current_line = 7; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 7 "regression-bugs-tmp/stoi.imp"
if (((K) > (32))) goto L_0005;
#line 7 "regression-bugs-tmp/stoi.imp"
goto L_0004;
#line 7 "regression-bugs-tmp/stoi.imp"
L_0005:;
                                                                //      8      %if k = '-' %start
_imp_current_line = 8; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 8 "regression-bugs-tmp/stoi.imp"
if (((K) != (45))) goto L_0006;
                                                                //      9        sign = 1
_imp_current_line = 9; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 9 "regression-bugs-tmp/stoi.imp"
SIGN = 1;
                                                                //     10      %else %if '0' <= k <= '9'
_imp_current_line = 10; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 10 "regression-bugs-tmp/stoi.imp"
goto L_0007;
#line 10 "regression-bugs-tmp/stoi.imp"
L_0006:;
#line 10 "regression-bugs-tmp/stoi.imp"
if ((((48) > (K))) || (((K) > (57)))) goto L_0008;
                                                                //     11        val = val<<3+val+val+k-'0'
_imp_current_line = 11; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 11 "regression-bugs-tmp/stoi.imp"
VAL = (((int)((((int)((((int)((((int)(((VAL) << (3)))) + (VAL)))) + (VAL)))) + (K)))) - (48));
                                                                //     12      %else
_imp_current_line = 12; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 12 "regression-bugs-tmp/stoi.imp"
goto L_0007;
#line 12 "regression-bugs-tmp/stoi.imp"
L_0008:;
                                                                //     13        %signal 4, 1, k{, "Non-numeric character"
_imp_current_line = 13; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 13 "regression-bugs-tmp/stoi.imp"
_imp_signal(4, 1, K, "");
                                                                //     14      %finish
_imp_current_line = 14; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 14 "regression-bugs-tmp/stoi.imp"
L_0007:;
                                                                //     15    %repeat
_imp_current_line = 15; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 15 "regression-bugs-tmp/stoi.imp"
L_0004:;
#line 15 "regression-bugs-tmp/stoi.imp"
goto L_0002;
#line 15 "regression-bugs-tmp/stoi.imp"
L_0003:;
                                                                //     16    %result = val %if sign = 0
_imp_current_line = 16; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 16 "regression-bugs-tmp/stoi.imp"
if (((SIGN) != (0))) goto L_0009;
#line 16 "regression-bugs-tmp/stoi.imp"
return VAL;
#line 16 "regression-bugs-tmp/stoi.imp"
L_0009:;
                                                                //     17    %result = -val
_imp_current_line = 17; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 17 "regression-bugs-tmp/stoi.imp"
return (-(VAL));
                                                                //     18  %end
_imp_current_line = 18; _imp_current_file = "regression-bugs-tmp/stoi.imp";
#line 18 "regression-bugs-tmp/stoi.imp"
_imp_endofblock: ;
} // End of block stoi at level 1
                                                                //     19  
                                                                //     20  %endoffile
#line 20 "regression-bugs-tmp/stoi.imp"
// End of file
