#include <perms.h>

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

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

  //     2    %string (6) s

  _imp_string6 S;

  //     3    s = "hello"

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = _imp_str_literal("hello");
                 (void *)&tmp;
               }),
               /*max:*/ 6);

  //     4    s = string(addr(s))

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string255) tmp; /*B*/
                 tmp = *_imp_STRING(_imp_ADDR(/*?*/ &S));
                 (void *)&tmp;
               }),
               /*max:*/ 6);

  //     5    s <- "longer string"

  _imp_strncpy(/*?*/ &S, ({
                 __typeof__(_imp_string255) tmp; /*C*/
                 tmp = _imp_str_literal("longer string");
                 (void *)&tmp;
               }),
               /*max:*/ 6);

  /* truncated copy of no more than 6 chars */
  if (*_imp_LENGTH((_imp_string *)/*?*/ &S) > 6) *_imp_LENGTH((_imp_string *)/*?*/ &S) = 6;

    //     6  %endofprogram

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