#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    ! see if we can remove redundant *& in assignment of 'that == buff(0)'
  //     3    %recordformat bfm(%integer i, j)

  struct BFM {
    union {
      struct {
        int I;
        int J;
      };
    };
  };

  //     4
  //     5    %record (bfm) this, that

  struct BFM THIS;
  struct BFM THAT;

  //     6
  //     7    ! need to implement with memset
  //     8    that = 0

  THAT = (struct BFM){0};

  //     9    ! need to implement with memcpy
  //    10    this = that

  THIS = THAT;

  //    11
  //    12  %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("THIS = \"<RECORD>\"\n");
  _imp_diagf("THAT = \"<RECORD>\"\n");
  _imp_end_backtrace();
  _imp_stop(0);
}