#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %begin
int main(int argc, char **argv) { /*%begin*/
_imp_initialise(argc, argv);
// 2 %integerfn sigma(%integerfn x(%integer param), %integer low, %integer high)
int SIGMA(int (*X)(void), int LOW, int HIGH) {
auto int X(int PARAM);
// 3 %integer result = 0;
int RESULT;
RESULT = 0;
// 4 %cycle
L_0001:;
// 5 result = result + x(low)
RESULT = RESULT + X(LOW);
// 6 low = low+1
LOW = LOW + 1;
// 7 %repeat %until low>high
if (LOW > HIGH) goto L_0002;
goto L_0001;
L_0002:;
// 8 %result = result
return RESULT;
// 9 %end
} /* end of SIGMA */
// 10
// 11 %integerfn square(%integer n)
int SQUARE(int N) {
// 12 %result = n*n
return N * N;
// 13 %end
} /* end of SQUARE */
// 14
// 15 write(sigma(square, 1, 5), 0)
_imp_WRITE(SIGMA(SQUARE, 1, 5), 0);
// 16
// 17 %endofprogram
_imp_stop(0);
return 0;
end_0:;
}