#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %begin
int main(int argc, char **argv) { /*%begin*/
_imp_enter(main);
_imp_initialise(argc, argv);
// 2 %string (255) s, a, b
_imp_string255 S;
_imp_string255 A;
_imp_string255 B;
// 3
// 4 s = "A string with xxx in the middle"
_imp_strcpy(&S, _imp_strp(_imp_str_literal("A string with xxx in the middle")), /*max:*/ 255);
// 5
// 6 s -> a.("xxx").b
if (!_imp_resolve2(_imp_strp(S), &A, 255, _imp_strp(_imp_str_literal("xxx")), &B, 255))
_imp_signal(7, 1, 0, "string resolution fails");
// 7
// 8 newline
_imp_NEWLINE();
// 9
// 10 %if s -> a.("xxx").b %start
if (!(_imp_resolve2(_imp_strp(S), &A, 255, _imp_strp(_imp_str_literal("xxx")), &B, 255))) goto L_0001;
// 11 newline
_imp_NEWLINE();
// 12 %finish
L_0001:;
// 13
// 14 s -> ("xxx").b
if (!_imp_resolve2(_imp_strp(S), 0, 0, _imp_strp(_imp_str_literal("xxx")), &B, 255))
_imp_signal(7, 1, 0, "string resolution fails");
// 15
// 16 newline
_imp_NEWLINE();
// 17
// 18 %if s -> ("xxx").b %start
if (!(_imp_resolve2(_imp_strp(S), 0, 0, _imp_strp(_imp_str_literal("xxx")), &B, 255))) goto L_0002;
// 19 newline
_imp_NEWLINE();
// 20 %finish
L_0002:;
// 21
// 22 s -> a.("xxx")
if (!_imp_resolve2(_imp_strp(S), &A, 255, _imp_strp(_imp_str_literal("xxx")), 0, 0))
_imp_signal(7, 1, 0, "string resolution fails");
// 23
// 24 newline
_imp_NEWLINE();
// 25
// 26 %if s -> a.("xxx") %start
if (!(_imp_resolve2(_imp_strp(S), &A, 255, _imp_strp(_imp_str_literal("xxx")), 0, 0))) goto L_0003;
// 27 newline
_imp_NEWLINE();
// 28 %finish
L_0003:;
// 29
// 30 %endofprogram
_imp_stop(0);
end_0:;
_imp_begin_backtrace(main);
_imp_diagf("\n\nArguments:\n\n");
_imp_diagf("ARGC = %d\n", argc);
_imp_diagf("ARGV @[%p]\n", argv);
for (int i = 0; i < argc; i++) {
_imp_diagf(" ARGV(%d) = \"%s\"\n", i, argv[i]);
}
if (argv[argc] == 0) {
_imp_diagf(" ARGV(%d) = NULL\n", argc);
} else {
_imp_diagf(" ARGV(%d) = \"%s\"\n", argc, argv[argc]);
}
_imp_diagf("\nLocal Variables:\n\n");
_imp_diagf("S = \"%.*s\"\n", S.cstr.len, S.cstr.s);
_imp_diagf("A = \"%.*s\"\n", A.cstr.len, A.cstr.s);
_imp_diagf("B = \"%.*s\"\n", B.cstr.len, B.cstr.s);
_imp_end_backtrace();
_imp_stop(0);
}