#include <perms.h>

//          Edinburgh IMP77 Compiler - Version 8.4
//
//     1  ! A test of dynamic loading!  (not yet implemented.  See dltest.c for the mechanism.)
//     2  %begin

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

  //     3    %dynamic %routine %spec system(%longinteger pointer64)

  extern void SYSTEM(long int POINTER64);

  //     4    ! By making this dynamic, it is linked *at run time*
  //     5
  //     6    %string (255) command = "/bin/ls -la"

  _imp_string255 COMMAND;

  /* clang-format off */
_imp_strncpy(/*?*/&COMMAND, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = _imp_str_literal("/bin/ls -la"); (void *)&tmp;}), /*max:*/255);

  /* clang-format on */

  //     7
  //     8    charno(command, length(command)+1) = 0

  *_imp_CHARNO((_imp_string255 *)/*p*/ /*?*/ &COMMAND, *_imp_LENGTH((_imp_string255 *)/*p*/ /*?*/ &COMMAND) + 1) = 0;

  //     9    system(ADDR(command)+1)

  SYSTEM(_imp_ADDR(/*?*/ &COMMAND) + 1);

  //    10
  //    11  %endofprogram

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