#include <perms.h>

                                                                //      1  !* Program name : LOOP
                                                                //      2  
                                                                //      3  !*   Title      :  XI    The Imp  Iterative Statements
                                                                //      4  !*   Version    :  II
                                                                //      5  !*   Date       :  24 August 1985
                                                                //      6  !*   Description:  Tests the use of the %FOR, %WHILE and %UNTIL cycles.
                                                                //      7   
                                                                //      8  %Begin
int main(int argc, char **argv) {
  _imp_initialise(argc, argv);
                                                                //      9  
                                                                //     10      %string(255) param    { Used to get input from CLI}
_imp_string /*%string(255)*/ PARAM;
                                                                //     11  
                                                                //     12      %Integer  J
int J;
                                                                //     13      %Integer  K
int K;
                                                                //     14      %Integer  L
int L;
                                                                //     15      %Integer  M
int M;
                                                                //     16      %Integer  N
int N;
                                                                //     17      %Integer  P
int P;
                                                                //     18      %Integer  Q
int Q;
                                                                //     19  
                                                                //     20      %Integer  Acc
int ACC;
                                                                //     21  
                                                                //     22  
                                                                //     23  %owninteger failures=0
static int FAILURES = 0;
                                                                //     24  
                                                                //     25  %routine pass
void PASS( void )
{
                                                                //     26    printstring("Pass")
_imp_PRINTSTRING(_imp_str_literal("Pass"));
                                                                //     27    New Line
_imp_NEWLINE();
                                                                //     28  %end
/* Remove %on %event handler here if present for this block */
return;
} // End of block PASS at level 2
                                                                //     29  %routine fail
void FAIL( void )
{
                                                                //     30    printstring("FAIL")
_imp_PRINTSTRING(_imp_str_literal("FAIL"));
                                                                //     31    New Line
_imp_NEWLINE();
                                                                //     32    failures = failures+1
FAILURES = (((int)(FAILURES)) + (1));
                                                                //     33  %end
/* Remove %on %event handler here if present for this block */
return;
} // End of block FAIL at level 2
                                                                //     34  
                                                                //     35  
                                                                //     36     ! Code to find out where the output is to be sent
                                                                //     37     ! -----------------------------------------------
                                                                //     38     ! Where the output goes to depends on the parameter after the
                                                                //     39     ! name used to run the program.
                                                                //     40     !                       Parameter   |   Result
                                                                //     41     !                       ------------|-------------
                                                                //     42     !                     No parameter  |  No output
                                                                //     43     !                          "s"      |  The screen
                                                                //     44     !                          "j"      |  "journal"
                                                                //     45     !                     anything else |  file name entered
                                                                //     46  
                                                                //     47     ! NOTE THAT THIS CODE USES STRING COMPARISONS, WHICH MAY NOT HAVE BEEN
                                                                //     48     ! TESTED YET. IF THE PROGRAM FAILS CHECK IT WAS NOT IN THIS PART.
                                                                //     49  
                                                                //     50     param=cliparam
PARAM = _imp_CLIPARAM();
                                                                //     51     %if param = "" %then select output (2) %c
if ((_imp_strcmp(PARAM, _imp_str_literal("")) != 0)) goto L_0002;
_imp_SELECTOUTPUT(2);
goto L_0003;
L_0002:;
if ((_imp_strcmp(PARAM, _imp_str_literal("s")) == 0)) goto L_0004;
if ((_imp_strcmp(PARAM, _imp_str_literal("S")) != 0)) goto L_0005;
L_0004:;
_imp_SELECTOUTPUT(1);
goto L_0003;
L_0005:;
if ((_imp_strcmp(PARAM, _imp_str_literal("j")) == 0)) goto L_0006;
if ((_imp_strcmp(PARAM, _imp_str_literal("J")) != 0)) goto L_0007;
L_0006:;
_imp_OPENOUTPUT(2, _imp_str_literal("journal"));
_imp_SELECTOUTPUT(2);
goto L_0003;
L_0007:;
_imp_OPENOUTPUT(2, PARAM);
_imp_SELECTOUTPUT(2);
L_0003:;
                                                                //     52     %else %if param="s" %or param="S" %then select output(1) %c
                                                                //     53     %else %if param="j" %or param="J" %then  %c
                                                                //     54        open output(2,"journal") %and select output (2) %c
                                                                //     55     %else open output(2,param) %and select output (2)
                                                                //     56     
                                                                //     57  
                                                                //     58  
                                                                //     59     New Lines(2)
_imp_NEWLINES(2);
                                                                //     60     Print String ("Iterative Statements");   New Line
_imp_PRINTSTRING(_imp_str_literal("Iterative Statements"));
_imp_NEWLINE();
                                                                //     61     Print String ("====================");   New Lines (3)
_imp_PRINTSTRING(_imp_str_literal("===================="));
_imp_NEWLINES(3);
                                                                //     62  
                                                                //     63  
                                                                //     64  
                                                                //     65      Print String ("Test the %FOR Statement");   New Line
_imp_PRINTSTRING(_imp_str_literal("Test the %FOR Statement"));
_imp_NEWLINE();
                                                                //     66      Print String ("-----------------------");   New Line
_imp_PRINTSTRING(_imp_str_literal("-----------------------"));
_imp_NEWLINE();
                                                                //     67  
                                                                //     68      Acc = 0
ACC = 0;
                                                                //     69      %For K = -10, 1, 10 %cycle  
K = (-11);
if ((((10)-((-10))) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle K = (-10), 1, 10");
L_0008:;
if (K == 10) goto L_0009;
K += 1;
                                                                //     70          Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //     71      %Repeat
goto L_0008;
L_0009:;
                                                                //     72      %If Acc = 21 %then pass %else fail
if (((ACC) != (21))) goto L_000b;
PASS();
goto L_000c;
L_000b:;
FAIL();
L_000c:;
                                                                //     73  
                                                                //     74  
                                                                //     75  
                                                                //     76      Acc = 0
ACC = 0;
                                                                //     77      J = 1
J = 1;
                                                                //     78      %For K = 2, 1, J %cycle
{static int _initial, _increment, _final, _control;
_initial = 2; _increment = 1; _final = J; K = _control = _initial;
if (((_final-_initial) % _increment) != 0) _imp_signal(5,1,0,"Illegal cycle K = 2, 1, J");
K -= _increment; _control -= _increment;
L_000d:;
if (K == _final) goto L_000e;
K += _increment; _control += _increment;
if (K != _control) _imp_signal(4,2,0,"Corrupt control variable K"); /* FOR loop control variable corrupted */
}
                                                                //     79          Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //     80      %Repeat
goto L_000d;
L_000e:;
                                                                //     81      %If Acc = 0 %and K = 1 %then pass %else fail
if (((ACC) != (0))) goto L_0010;
if (((K) != (1))) goto L_0010;
PASS();
goto L_0011;
L_0010:;
FAIL();
L_0011:;
                                                                //     82   
                                                                //     83  
                                                                //     84  
                                                                //     85      Acc = 0
ACC = 0;
                                                                //     86      L   = 1000000
L = 1000000;
                                                                //     87      M   = 5
M = 5;
                                                                //     88      N   = 3
N = 3;
                                                                //     89      %For K = Acc, L // 10, 10 ^^ M * (N * 3 + 1) %cycle
{static int _initial, _increment, _final, _control;
_initial = ACC; _increment = ((long)((long)((int)(L)) / (long)((int)(10)))); _final = (((_imp_IEXP(10, M))) * ((((int)((((int)(N)) * (3)))) + (1)))); K = _control = _initial;
if (((_final-_initial) % _increment) != 0) _imp_signal(5,1,0,"Illegal cycle K = ACC, ((long)((long)((int)(L)) / (long)((int)(10)))), (((_imp_IEXP(10, M))) * ((((int)((((int)(N)) * (3)))) + (1))))");
K -= _increment; _control -= _increment;
L_0012:;
if (K == _final) goto L_0013;
K += _increment; _control += _increment;
if (K != _control) _imp_signal(4,2,0,"Corrupt control variable K"); /* FOR loop control variable corrupted */
}
                                                                //     90         Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //     91      %Repeat
goto L_0012;
L_0013:;
                                                                //     92      %If Acc = 11 %and K = 1000000 %then pass %else fail
if (((ACC) != (11))) goto L_0015;
if (((K) != (1000000))) goto L_0015;
PASS();
goto L_0016;
L_0015:;
FAIL();
L_0016:;
                                                                //     93  
                                                                //     94  
                                                                //     95  
                                                                //     96      Acc = 0
ACC = 0;
                                                                //     97      %For K = -1, 2, 1 %cycle
K = (-3);
if ((((1)-((-1))) % (2)) != 0) _imp_signal(5,1,0,"Illegal cycle K = (-1), 2, 1");
L_0017:;
if (K == 1) goto L_0018;
K += 2;
                                                                //     98          %For L = 0, 3, 6 %cycle
L = (-3);
if ((((6)-(0)) % (3)) != 0) _imp_signal(5,1,0,"Illegal cycle L = 0, 3, 6");
L_001a:;
if (L == 6) goto L_001b;
L += 3;
                                                                //     99              %For M = 1, 1, 4 %cycle
M = 0;
if ((((4)-(1)) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle M = 1, 1, 4");
L_001d:;
if (M == 4) goto L_001e;
M += 1;
                                                                //    100                  %For N = 4, -2, -2 %cycle
N = 6;
if (((((-2))-(4)) % ((-2))) != 0) _imp_signal(5,1,0,"Illegal cycle N = 4, (-2), (-2)");
L_0020:;
if (N == (-2)) goto L_0021;
N += (-2);
                                                                //    101                      %For P = -1000, 1000, 1000 %cycle
P = (-2000);
if ((((1000)-((-1000))) % (1000)) != 0) _imp_signal(5,1,0,"Illegal cycle P = (-1000), 1000, 1000");
L_0023:;
if (P == 1000) goto L_0024;
P += 1000;
                                                                //    102                          Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    103                          %For Q = 2, 1, 1 %cycle
Q = 1;
if ((((1)-(2)) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle Q = 2, 1, 1");
L_0026:;
if (Q == 1) goto L_0027;
Q += 1;
                                                                //    104                               Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    105                          %Repeat
goto L_0026;
L_0027:;
                                                                //    106                      %Repeat
goto L_0023;
L_0024:;
                                                                //    107                  %Repeat
goto L_0020;
L_0021:;
                                                                //    108              %Repeat
goto L_001d;
L_001e:;
                                                                //    109          %Repeat
goto L_001a;
L_001b:;
                                                                //    110      %Repeat
goto L_0017;
L_0018:;
                                                                //    111      %If Acc = 288 %and K = 1  %and L = 6    %andc
if (((ACC) != (288))) goto L_0029;
if (((K) != (1))) goto L_0029;
if (((L) != (6))) goto L_0029;
if (((M) != (4))) goto L_0029;
if (((N) != ((-2)))) goto L_0029;
if (((P) != (1000))) goto L_0029;
PASS();
goto L_002a;
L_0029:;
FAIL();
L_002a:;
                                                                //    112          M = 4 %and N = -2 %and P = 1000             %c
                                                                //    113                    %then pass %else fail
                                                                //    114  
                                                                //    115      
                                                                //    116  
                                                                //    117      !*   Test the Simple Loop Forms
                                                                //    118  
                                                                //    119      Acc = 0
ACC = 0;
                                                                //    120      Acc = Acc + 1 %for K = -2, 1, 2
K = (-3);
if ((((2)-((-2))) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle K = (-2), 1, 2");
L_002b:;
if (K == 2) goto L_002c;
K += 1;
ACC = (((int)(ACC)) + (1));
goto L_002b;
L_002c:;
                                                                //    121      %If Acc = 5 %and K = 2 %then pass %else fail
if (((ACC) != (5))) goto L_002e;
if (((K) != (2))) goto L_002e;
PASS();
goto L_002f;
L_002e:;
FAIL();
L_002f:;
                                                                //    122   
                                                                //    123  
                                                                //    124  
                                                                //    125      Acc = 0
ACC = 0;
                                                                //    126      Acc = Acc + 1 %for K = 2, 1, 1
K = 1;
if ((((1)-(2)) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle K = 2, 1, 1");
L_0030:;
if (K == 1) goto L_0031;
K += 1;
ACC = (((int)(ACC)) + (1));
goto L_0030;
L_0031:;
                                                                //    127      %If Acc = 0 %and K = 1 %then pass %else fail
if (((ACC) != (0))) goto L_0033;
if (((K) != (1))) goto L_0033;
PASS();
goto L_0034;
L_0033:;
FAIL();
L_0034:;
                                                                //    128  
                                                                //    129  
                                                                //    130  
                                                                //    131      New Lines (2)
_imp_NEWLINES(2);
                                                                //    132      Print String ("Test the %WHILE Statement");   New Line
_imp_PRINTSTRING(_imp_str_literal("Test the %WHILE Statement"));
_imp_NEWLINE();
                                                                //    133      Print String ("-------------------------");   New Line
_imp_PRINTSTRING(_imp_str_literal("-------------------------"));
_imp_NEWLINE();
                                                                //    134  
                                                                //    135  
                                                                //    136      Acc = 0
ACC = 0;
                                                                //    137      K   = 3
K = 3;
                                                                //    138      %While  K > 3 %cycle
L_0035:;
if (((K) <= (3))) goto L_0036;
                                                                //    139         Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    140         K = K - 1
K = (((int)(K)) - (1));
                                                                //    141      %Repeat
goto L_0035;
L_0036:;
                                                                //    142      %If Acc = 0 %and K = 3 %then pass %else fail
if (((ACC) != (0))) goto L_0038;
if (((K) != (3))) goto L_0038;
PASS();
goto L_0039;
L_0038:;
FAIL();
L_0039:;
                                                                //    143  
                                                                //    144  
                                                                //    145      Acc = 0
ACC = 0;
                                                                //    146      K   = 10
K = 10;
                                                                //    147      %While  K > 0 %cycle
L_003a:;
if (((K) <= (0))) goto L_003b;
                                                                //    148         Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    149         K = K - 1
K = (((int)(K)) - (1));
                                                                //    150      %Repeat
goto L_003a;
L_003b:;
                                                                //    151      %If Acc = 10 %and K = 0 %then pass %else fail
if (((ACC) != (10))) goto L_003d;
if (((K) != (0))) goto L_003d;
PASS();
goto L_003e;
L_003d:;
FAIL();
L_003e:;
                                                                //    152  
                                                                //    153  
                                                                //    154     
                                                                //    155      Acc = 0
ACC = 0;
                                                                //    156      K   = 5
K = 5;
                                                                //    157      %While  K > 3  %cycle
L_003f:;
if (((K) <= (3))) goto L_0040;
                                                                //    158         L = 6
L = 6;
                                                                //    159         %While  L > 4  %cycle
L_0042:;
if (((L) <= (4))) goto L_0043;
                                                                //    160            M = 7
M = 7;
                                                                //    161            %While  M > 5  %cycle
L_0045:;
if (((M) <= (5))) goto L_0046;
                                                                //    162               N = 8
N = 8;
                                                                //    163               %While  N > 6  %cycle
L_0048:;
if (((N) <= (6))) goto L_0049;
                                                                //    164                  P = 9
P = 9;
                                                                //    165                  %While  P > 7  %cycle
L_004b:;
if (((P) <= (7))) goto L_004c;
                                                                //    166                     Q = 10
Q = 10;
                                                                //    167                     %While  Q > 8  %cycle
L_004e:;
if (((Q) <= (8))) goto L_004f;
                                                                //    168                        Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    169                        Q = Q - 1
Q = (((int)(Q)) - (1));
                                                                //    170                     %Repeat
goto L_004e;
L_004f:;
                                                                //    171                     P = P - 1
P = (((int)(P)) - (1));
                                                                //    172                  %Repeat
goto L_004b;
L_004c:;
                                                                //    173                  N = N - 1
N = (((int)(N)) - (1));
                                                                //    174               %Repeat
goto L_0048;
L_0049:;
                                                                //    175               M = M - 1
M = (((int)(M)) - (1));
                                                                //    176            %Repeat
goto L_0045;
L_0046:;
                                                                //    177            L = L - 1
L = (((int)(L)) - (1));
                                                                //    178         %Repeat
goto L_0042;
L_0043:;
                                                                //    179         K = K - 1
K = (((int)(K)) - (1));
                                                                //    180      %Repeat
goto L_003f;
L_0040:;
                                                                //    181              
                                                                //    182      %If Acc = 64 %then pass %else fail
if (((ACC) != (64))) goto L_0051;
PASS();
goto L_0052;
L_0051:;
FAIL();
L_0052:;
                                                                //    183  
                                                                //    184      
                                                                //    185  
                                                                //    186  
                                                                //    187     !*   Test the Simpler Loop Forms
                                                                //    188  
                                                                //    189      
                                                                //    190      Acc = 0
ACC = 0;
                                                                //    191      Acc = Acc + 1 %While Acc < 10
L_0053:;
if (((ACC) >= (10))) goto L_0054;
ACC = (((int)(ACC)) + (1));
goto L_0053;
L_0054:;
                                                                //    192      %If Acc = 10 %then pass %else fail
if (((ACC) != (10))) goto L_0056;
PASS();
goto L_0057;
L_0056:;
FAIL();
L_0057:;
                                                                //    193  
                                                                //    194  
                                                                //    195      Acc = 0
ACC = 0;
                                                                //    196      Acc = Acc + 1 %While Acc < 0
L_0058:;
if (((ACC) >= (0))) goto L_0059;
ACC = (((int)(ACC)) + (1));
goto L_0058;
L_0059:;
                                                                //    197      %If Acc = 0 %then pass %else fail
if (((ACC) != (0))) goto L_005b;
PASS();
goto L_005c;
L_005b:;
FAIL();
L_005c:;
                                                                //    198  
                                                                //    199  
                                                                //    200  
                                                                //    201  
                                                                //    202      New Lines (2)
_imp_NEWLINES(2);
                                                                //    203      Print String ("Test the %UNTIL Statement");   New Line
_imp_PRINTSTRING(_imp_str_literal("Test the %UNTIL Statement"));
_imp_NEWLINE();
                                                                //    204      Print String ("-------------------------");   New Line
_imp_PRINTSTRING(_imp_str_literal("-------------------------"));
_imp_NEWLINE();
                                                                //    205  
                                                                //    206      Acc = 0
ACC = 0;
                                                                //    207      K   = 0
K = 0;
                                                                //    208      %Cycle
L_005d:;
                                                                //    209         K = K - 1
K = (((int)(K)) - (1));
                                                                //    210         Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    211      %Repeat %until K <= 0
if (((K) <= (0))) goto L_005e;
goto L_005d;
L_005e:;
                                                                //    212  
                                                                //    213      %If Acc = 1 %and K = -1 %then pass %else fail
if (((ACC) != (1))) goto L_0060;
if (((K) != ((-1)))) goto L_0060;
PASS();
goto L_0061;
L_0060:;
FAIL();
L_0061:;
                                                                //    214  
                                                                //    215     
                                                                //    216      Acc = 0
ACC = 0;
                                                                //    217      K   = 10
K = 10;
                                                                //    218      %Cycle
L_0062:;
                                                                //    219         Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    220         K   = K   - 1
K = (((int)(K)) - (1));
                                                                //    221      %Repeat %until K = 0
if (((K) == (0))) goto L_0063;
goto L_0062;
L_0063:;
                                                                //    222    
                                                                //    223      %If Acc = 10 %and K = 0 %then pass %else fail
if (((ACC) != (10))) goto L_0065;
if (((K) != (0))) goto L_0065;
PASS();
goto L_0066;
L_0065:;
FAIL();
L_0066:;
                                                                //    224  
                                                                //    225      
                                                                //    226  
                                                                //    227      !*  Test the simpler version of the loop.
                                                                //    228  
                                                                //    229      
                                                                //    230      Acc = 0
ACC = 0;
                                                                //    231      Acc = Acc + 1 %Until Acc = 10
L_0067:;
ACC = (((int)(ACC)) + (1));
if (((ACC) == (10))) goto L_0068;
goto L_0067;
L_0068:;
                                                                //    232  
                                                                //    233      %If Acc = 10 %then pass %else fail
if (((ACC) != (10))) goto L_006a;
PASS();
goto L_006b;
L_006a:;
FAIL();
L_006b:;
                                                                //    234  
                                                                //    235  
                                                                //    236       
                                                                //    237    
                                                                //    238  
                                                                //    239      New Lines (2)
_imp_NEWLINES(2);
                                                                //    240      Print String ("Test the %EXIT and %CONTINUE Statements");   New Line
_imp_PRINTSTRING(_imp_str_literal("Test the %EXIT and %CONTINUE Statements"));
_imp_NEWLINE();
                                                                //    241      Print String ("---------------------------------------");   New Line
_imp_PRINTSTRING(_imp_str_literal("---------------------------------------"));
_imp_NEWLINE();
                                                                //    242  
                                                                //    243  
                                                                //    244      Acc = 0
ACC = 0;
                                                                //    245      K   = 0
K = 0;
                                                                //    246      %Cycle
L_006c:;
                                                                //    247         K = K + 1            { Just a dummy statement.
K = (((int)(K)) + (1));
                                                                //    248         %Exit
goto L_006d;
                                                                //    249         Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    250      %Repeat
goto L_006c;
L_006d:;
                                                                //    251  
                                                                //    252      %If Acc = 0 %then pass %else fail
if (((ACC) != (0))) goto L_006f;
PASS();
goto L_0070;
L_006f:;
FAIL();
L_0070:;
                                                                //    253  
                                                                //    254  
                                                                //    255  
                                                                //    256      Acc = 0
ACC = 0;
                                                                //    257      %Cycle
L_0071:;
                                                                //    258         %Exit %if Acc = 10
if (((ACC) != (10))) goto L_0074;
goto L_0072;
L_0074:;
                                                                //    259         Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    260      %Repeat
goto L_0071;
L_0072:;
                                                                //    261  
                                                                //    262      %If Acc = 10 %then pass %else fail
if (((ACC) != (10))) goto L_0075;
PASS();
goto L_0076;
L_0075:;
FAIL();
L_0076:;
                                                                //    263  
                                                                //    264  
                                                                //    265  
                                                                //    266      Acc = 0
ACC = 0;
                                                                //    267      K   = 0
K = 0;
                                                                //    268      %Cycle
L_0077:;
                                                                //    269         %Cycle
L_007a:;
                                                                //    270            K = K + 1              { Dummy statement again.
K = (((int)(K)) + (1));
                                                                //    271            %Exit
goto L_007b;
                                                                //    272            Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    273         %Repeat
goto L_007a;
L_007b:;
                                                                //    274         Acc = Acc + 10
ACC = (((int)(ACC)) + (10));
                                                                //    275         %Exit
goto L_0078;
                                                                //    276      %Repeat
goto L_0077;
L_0078:;
                                                                //    277  
                                                                //    278      %If Acc = 10 %then pass %else fail
if (((ACC) != (10))) goto L_007d;
PASS();
goto L_007e;
L_007d:;
FAIL();
L_007e:;
                                                                //    279  
                                                                //    280  
                                                                //    281  
                                                                //    282      Acc = 0
ACC = 0;
                                                                //    283      %For J = 1, 1, 5 %cycle
J = 0;
if ((((5)-(1)) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle J = 1, 1, 5");
L_007f:;
if (J == 5) goto L_0080;
J += 1;
                                                                //    284          %Exit %if J = 3
if (((J) != (3))) goto L_0082;
goto L_0080;
L_0082:;
                                                                //    285          %For K = 1, 1, 3 %cycle
K = 0;
if ((((3)-(1)) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle K = 1, 1, 3");
L_0083:;
if (K == 3) goto L_0084;
K += 1;
                                                                //    286              Acc = Acc + 1
ACC = (((int)(ACC)) + (1));
                                                                //    287              %Exit %if K = 2
if (((K) != (2))) goto L_0086;
goto L_0084;
L_0086:;
                                                                //    288          %Repeat
goto L_0083;
L_0084:;
                                                                //    289       %Repeat
goto L_007f;
L_0080:;
                                                                //    290  
                                                                //    291      %If Acc = 4 %and J = 3 %and K = 2 %then pass %else fail
if (((ACC) != (4))) goto L_0087;
if (((J) != (3))) goto L_0087;
if (((K) != (2))) goto L_0087;
PASS();
goto L_0088;
L_0087:;
FAIL();
L_0088:;
                                                                //    292  
                                                                //    293  
                                                                //    294  
                                                                //    295      Acc = 0
ACC = 0;
                                                                //    296      %For K = 1, 1, 10 %cycle
K = 0;
if ((((10)-(1)) % (1)) != 0) _imp_signal(5,1,0,"Illegal cycle K = 1, 1, 10");
L_0089:;
if (K == 10) goto L_008a;
K += 1;
                                                                //    297          Acc = Acc + K
ACC = (((int)(ACC)) + (K));
                                                                //    298          %Continue %if K = 5
if (((K) != (5))) goto L_008c;
goto L_008b;
L_008c:;
                                                                //    299          Acc = Acc - K
ACC = (((int)(ACC)) - (K));
                                                                //    300      %Repeat
L_008b:;
goto L_0089;
L_008a:;
                                                                //    301  
                                                                //    302      %If Acc = 5 %then pass %else fail
if (((ACC) != (5))) goto L_008d;
PASS();
goto L_008e;
L_008d:;
FAIL();
L_008e:;
                                                                //    303  
                                                                //    304  
                                                                //    305  
                                                                //    306  
                                                                //    307  select output(1)
_imp_SELECTOUTPUT(1);
                                                                //    308  write(failures,1);  printstring(" failure(s)");  newline
_imp_WRITE(FAILURES, 1);
_imp_PRINTSTRING(_imp_str_literal(" failure(s)"));
_imp_NEWLINE();
                                                                //    309  
                                                                //    310  %End %of %Program
/* Remove %on %event handler here if present for this block */
return 0;
} // End of block _imp_main at level 1
// End of file
