#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %BEGIN
int main(int argc, char **argv) { /*%begin*/
_imp_initialise(argc, argv);
// 2 %owninteger fail=0
static int FAIL = 0;
// 3 %STRING(5) %ARRAY a(1:10)
_imp_string5 A[10];
// 4 %STRING(5) %NAME ap
_imp_string5 *AP;
// 5 %INTEGER i
int I;
// 6 %ROUTINE conc(%STRING(5) %NAME x)
void CONC(_imp_string5 * X) {
// 7 x=x."a"
*X = *
*({
_imp_string255 tmp = _imp_join(({
__typeof__(_imp_string5) tmp; /*D*/
tmp = *X;
(void *)&tmp;
}),
(_imp_string *)/*?*/ _imp_str_literal_ptr("a"));
(_imp_string255 *)&tmp;
})
;
// 8 %END
return;
} /* end of CONC */
// 9 a(i)=tostring(i+'0') %FOR i=1,1,10
// %for I = 1, 1, 10 %cycle
{
I = 0;
L_0001:
if (I == 10) goto L_0002;
I += 1;
_imp_strncpy(/*?*/ &A[I - 1], ({
__typeof__(_imp_string1) tmp; /*B*/
tmp = _imp_TOSTRING(I + 48);
(void *)&tmp;
}),
/*max:*/ 5);
goto L_0001;
}
L_0002:;
// 10 conc(a(i)) %FOR i=1,1,10
// %for I = 1, 1, 10 %cycle
{
I = 0;
L_0004:
if (I == 10) goto L_0005;
I += 1;
CONC((_imp_string5 *)/*p*/ /*?*/ &A[I - 1]);
goto L_0004;
}
L_0005:;
// 11 %FOR i=1,1,10 %CYCLE
// %for I = 1, 1, 10 %cycle
{
I = 0;
L_0006:
if (I == 10) goto L_0007;
I += 1;
// 12 ap==a(i)
AP = (_imp_string5 *)/*?*/ &A[I - 1];
// 13 ap=ap."b"
*AP = *
*({
_imp_string255 tmp = _imp_join(({
__typeof__(_imp_string5) tmp; /*D*/
tmp = *AP;
(void *)&tmp;
}),
(_imp_string *)/*?*/ _imp_str_literal_ptr("b"));
(_imp_string255 *)&tmp;
})
;
// 14 printstring(a(i)) %and fail=1 %UNLESS a(i)=tostring(i+'0')."ab"
if (_imp_strcmp((_imp_string *)/*?*/ &A[I - 1], (_imp_string *)/*?*/ &*({
_imp_string255 tmp = _imp_join(({
__typeof__(_imp_string1) tmp; /*D*/
tmp = _imp_TOSTRING(I + 48);
(void *)&tmp;
}),
(_imp_string *)/*?*/ _imp_str_literal_ptr("ab"));
(_imp_string255 *)&tmp;
})) == 0)
goto L_0008;
_imp_PRINTSTRING(
*({
__typeof__(_imp_string5) tmp = A[I - 1] /*q*/;
(_imp_string255 *)&tmp;
})
);
FAIL = 1;
L_0008:;
// 15 %REPEAT
goto L_0006;
}
L_0007:;
// 16 printstring("TEST OK") %if fail=0
if (FAIL != 0) goto L_0009;
_imp_PRINTSTRING(_imp_str_literal("TEST OK"));
L_0009:;
// 17 %ENDOFPROGRAM
_imp_stop(0);
return 0;
end_0:;
}