#include <perms.h>

                                                                //      1  %begin
#line 1 "regression-run-tmp/clover.imp"
int main(int argc, char **argv) {
  _imp_initialise(argc, argv);
                                                                //      2  
                                                                //      3    %const %byte  TRUE  = 0
                                                                //      4    %const %byte  FALSE = 1
                                                                //      5  
                                                                //      6    %byte %fn tolower(%byte c)
#line 6 "regression-run-tmp/clover.imp"
unsigned char TOLOWER( unsigned char C )
#line 6 "regression-run-tmp/clover.imp"
{
                                                                //      7      %if 'A' <= c %and c <= 'Z' %then %result = c + 16_20
#line 7 "regression-run-tmp/clover.imp"
if (((65) > (C))) goto L_0002;
#line 7 "regression-run-tmp/clover.imp"
if (((C) > (90))) goto L_0002;
#line 7 "regression-run-tmp/clover.imp"
/* Remove %on %event handler here if present for this block */
return (((int)(C)) + (32));
#line 7 "regression-run-tmp/clover.imp"
L_0002:;
                                                                //      8      %result = c
#line 8 "regression-run-tmp/clover.imp"
/* Remove %on %event handler here if present for this block */
return C;
                                                                //      9    %end
#line 9 "regression-run-tmp/clover.imp"
} // End of block TOLOWER at level 2
                                                                //     10  
                                                                //     11    %byte i, a, ishex, size, num, n
#line 11 "regression-run-tmp/clover.imp"
unsigned char I;
#line 11 "regression-run-tmp/clover.imp"
unsigned char A;
#line 11 "regression-run-tmp/clover.imp"
unsigned char ISHEX;
#line 11 "regression-run-tmp/clover.imp"
unsigned char SIZE;
#line 11 "regression-run-tmp/clover.imp"
unsigned char NUM;
#line 11 "regression-run-tmp/clover.imp"
unsigned char N;
                                                                //     12    %byte %array s(0:2)
#line 12 "regression-run-tmp/clover.imp"
unsigned char S[3];
                                                                //     13  
                                                                //     14    size = 3; s(0)='$'; s(1) = '8'; s(2) = 'C'
#line 14 "regression-run-tmp/clover.imp"
SIZE = 3;
#line 14 "regression-run-tmp/clover.imp"
S[0] = 36;
#line 14 "regression-run-tmp/clover.imp"
S[1] = 56;
#line 14 "regression-run-tmp/clover.imp"
S[2] = 67;
                                                                //     15    
                                                                //     16    ishex = FALSE
#line 16 "regression-run-tmp/clover.imp"
ISHEX = 1;
                                                                //     17    i = 0;
#line 17 "regression-run-tmp/clover.imp"
I = 0;
                                                                //     18    
                                                                //     19    %if s(0) = '$' %then %start
#line 19 "regression-run-tmp/clover.imp"
if (((S[0]) != (36))) goto L_0003;
                                                                //     20      ishex = TRUE
#line 20 "regression-run-tmp/clover.imp"
ISHEX = 0;
                                                                //     21      i = 1
#line 21 "regression-run-tmp/clover.imp"
I = 1;
                                                                //     22    %finish
#line 22 "regression-run-tmp/clover.imp"
L_0003:;
                                                                //     23      
                                                                //     24    num = 0
#line 24 "regression-run-tmp/clover.imp"
NUM = 0;
                                                                //     25      
                                                                //     26    %while i < size %cycle
#line 26 "regression-run-tmp/clover.imp"
L_0004:;
#line 26 "regression-run-tmp/clover.imp"
if (((I) >= (SIZE))) goto L_0005;
                                                                //     27      n = s(i); i = i+1
#line 27 "regression-run-tmp/clover.imp"
N = S[I];
#line 27 "regression-run-tmp/clover.imp"
I = (((int)(I)) + (1));
                                                                //     28      %if '0' <= n %and n <= '9' %then %start
#line 28 "regression-run-tmp/clover.imp"
if (((48) > (N))) goto L_0007;
#line 28 "regression-run-tmp/clover.imp"
if (((N) > (57))) goto L_0007;
                                                                //     29        n = n - '0';
#line 29 "regression-run-tmp/clover.imp"
N = (((int)(N)) - (48));
                                                                //     30      %finish %else %start
#line 30 "regression-run-tmp/clover.imp"
goto L_0008;
#line 30 "regression-run-tmp/clover.imp"
L_0007:;
                                                                //     31        %if ishex = TRUE %then %start
#line 31 "regression-run-tmp/clover.imp"
if (((ISHEX) != (0))) goto L_0009;
                                                                //     32          n = tolower(n)
#line 32 "regression-run-tmp/clover.imp"
N = TOLOWER(N);
                                                                //     33          %if 'a' <= n %and n <= 'f' %then n = n - ('a' - 10) %else %stop
#line 33 "regression-run-tmp/clover.imp"
if (((97) > (N))) goto L_000a;
#line 33 "regression-run-tmp/clover.imp"
if (((N) > (102))) goto L_000a;
#line 33 "regression-run-tmp/clover.imp"
N = (((unsigned char)(N)) - (87));
#line 33 "regression-run-tmp/clover.imp"
goto L_000b;
#line 33 "regression-run-tmp/clover.imp"
L_000a:;
#line 33 "regression-run-tmp/clover.imp"
exit(0);
#line 33 "regression-run-tmp/clover.imp"
L_000b:;
                                                                //     34        %finish
#line 34 "regression-run-tmp/clover.imp"
L_0009:;
                                                                //     35      %finish
#line 35 "regression-run-tmp/clover.imp"
L_0008:;
                                                                //     36      %if ishex = TRUE %then num = num * 16 + n %else num = num * 10 + n
#line 36 "regression-run-tmp/clover.imp"
if (((ISHEX) != (0))) goto L_000c;
#line 36 "regression-run-tmp/clover.imp"
NUM = (((unsigned char)((((int)(NUM)) * (16)))) + (N));
#line 36 "regression-run-tmp/clover.imp"
goto L_000d;
#line 36 "regression-run-tmp/clover.imp"
L_000c:;
#line 36 "regression-run-tmp/clover.imp"
NUM = (((unsigned char)((((int)(NUM)) * (10)))) + (N));
#line 36 "regression-run-tmp/clover.imp"
L_000d:;
                                                                //     37    %repeat
#line 37 "regression-run-tmp/clover.imp"
goto L_0004;
#line 37 "regression-run-tmp/clover.imp"
L_0005:;
                                                                //     38    
                                                                //     39    a = num
#line 39 "regression-run-tmp/clover.imp"
A = NUM;
                                                                //     40    print string("a=")
#line 40 "regression-run-tmp/clover.imp"
_imp_PRINTSTRING(_imp_str_literal("a="));
                                                                //     41    write(a, 0)
#line 41 "regression-run-tmp/clover.imp"
_imp_WRITE(A, 0);
                                                                //     42    newline
#line 42 "regression-run-tmp/clover.imp"
_imp_NEWLINE();
                                                                //     43  
                                                                //     44  %end %of %program
#line 44 "regression-run-tmp/clover.imp"
/* Remove %on %event handler here if present for this block */
return 0;
} // End of block _imp_main at level 1
#line 44 "regression-run-tmp/clover.imp"
// End of file
