#include <perms.h>

//          Edinburgh IMP77 Compiler - Version 8.4
//
//     1  %begin

int main(int argc, char **argv) { /*%begin*/
  _imp_initialise(argc, argv);

  //     2  %conststring(10) fred="abcdefghij"

  const _imp_string10 FRED = _imp_str_init("abcdefghij");

  //     3  %string(10) a,b

  _imp_string10 A;
  _imp_string10 B;

  //     4
  //     5  	%if fred->a.("def").b %start

  if (!(_imp_resolve(*({
        _imp_string10 tmp = FRED;
        (_imp_string255 *)&tmp;
      }),
                     (_imp_string255 *)/*?*/ &A, *({
                       _imp_string tmp = _imp_str_literal("def");
                       (_imp_string255 *)&tmp;
                     }),
                     (_imp_string255 *)/*?*/ &B)))
    goto L_0001;

    //     6  	printstring("OK a=".a);

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string255) tmp = *({
          _imp_string255 tmp = _imp_join((_imp_string *)/*?*/ _imp_str_literal_ptr("OK a="), (_imp_string *)/*?*/ &A);
          (_imp_string255 *)&tmp;
        }) /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //     7  	newline

  _imp_NEWLINE();

  //     8  	%finish %else %start

  goto L_0002;
L_0001:;

//     9  		printstring("fail")

  _imp_PRINTSTRING(_imp_str_literal("fail"));

  //    10  		newline;

  _imp_NEWLINE();

  //    11  		printstring(a);

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string10) tmp = A /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //    12  		newline;

  _imp_NEWLINE();

  //    13  		printstring(b)

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string10) tmp = B /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //    14  		newline

  _imp_NEWLINE();

  //    15  		printstring(fred)

  _imp_PRINTSTRING(
      *({
        __typeof__(_imp_string10) tmp = FRED /*q*/;
        (_imp_string255 *)&tmp;
      })
  );

  //    16  		newline

  _imp_NEWLINE();

  //    17  	%finish

L_0002:;

//    18  %endofprogram

  _imp_stop(0);
  return 0;
end_0:;
}