// File: /workspace/github_c_makefile_star2_O0/crcx[P]retroforth/vm/nga-c/retro.c
// Function: main
int main(int argc, char **argv) {
  int i;
  int modes[16];
  NgaState *vm = calloc(sizeof(NgaState), sizeof(char));
  verbose = 0;

  register_signal_handlers();

  initialize(vm);               /* Initialize Nga & image    */
  register_devices(vm);
  vm->sys_argc = argc;           /* Point the global argc and */
  vm->sys_argv = argv;           /* argv to the actual ones   */

  strlcpy(vm->scripting_sources[0], "<none>", 8192);


  /* Check arguments. If no flags were passed, load & run the
     file specified and exit. */
  if (argc >= 2 && argv[1][0] != '-') {
    update_rx(vm);
    include_file(vm, argv[1], 0);
    if (ACTIVE.sp >= 1)  dump_stack(vm);
    exit(0);
  }

  /* Clear startup modes       */
  for (i = 0; i < 16; i++)
    modes[i] = 0;

  if (argc <= 1) modes[FLAG_INTERACTIVE] = 1;

  update_rx(vm);

  /* Process Arguments */
  for (i = 1; i < argc; i++) {
    if ARG("-h") {
      help(argv[0]);
      exit(0);
    } else if ARG("-v") {
      verbose = 1;
    } else if ARG("-i") {
      modes[FLAG_INTERACTIVE] = 1;
      vm->interactive = -1;
    } else if ARG("-f") {
      include_file(vm, argv[i + 1], 0);
      i++;
    } else if ARG("-p") {
      include_plain_file(vm, argv[i + 1], 0);
      i++;
    } else if ARG("-u") {
      i++;
      load_image(vm, argv[i]);
      update_rx(vm);
    } else if ARG("-r") {
      i++;
      load_image(vm, argv[i]);
      modes[FLAG_INTERACTIVE] = 1;
      update_rx(vm);
    } else if ARG("-t") {
      include_file(vm, argv[i + 1], 1);
      i++;
    } else if (ARG("--code-start") || ARG("-cs")) {
      i++;
      strlcpy(vm->code_start, argv[i], 256);
    } else if (ARG("--code-end") || ARG("-ce")) {
      i++;
      strlcpy(vm->code_end, argv[i], 256);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x288ff0, %edi         # imm = 0x288FF0
movl $0x1, %esi
callq 0x3210
movq %rax, -0x68(%rbp)
movl $0x0, 0x565fd(%rip)     # 0x5fbb0
callq 0x94f0
movq -0x68(%rbp), %rdi
callq 0x8d90
movq -0x68(%rbp), %rdi
callq 0x9330
movl -0x8(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x207ad0(%rax)
movq -0x10(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x207ac8(%rax)
movq -0x68(%rbp), %rdi
addq $0x207ad4, %rdi         # imm = 0x207AD4
leaq 0x3d2b(%rip), %rsi      # 0xd323
movl $0x2000, %edx           # imm = 0x2000
callq 0x4010
cmpl $0x2, -0x8(%rbp)
jl 0x9668
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x9668
movq -0x68(%rbp), %rdi
callq 0x9ad0
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x75f0
movq -0x68(%rbp), %rax
addq $0x200004, %rax         # imm = 0x200004
movq -0x68(%rbp), %rcx
movslq 0x2043a4(%rcx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
addq %rcx, %rax
cmpl $0x1, (%rax)
jl 0x9661
movq -0x68(%rbp), %rdi
callq 0x8920
xorl %edi, %edi
callq 0x33a0
movl $0x0, -0x14(%rbp)
cmpl $0x10, -0x14(%rbp)
jge 0x968c
movslq -0x14(%rbp), %rax
movl $0x0, -0x60(%rbp,%rax,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x966f
cmpl $0x1, -0x8(%rbp)
jg 0x9699
movl $0x1, -0x5c(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9ad0
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x9a7b
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4053(%rip), %rsi      # 0xd71b
callq 0x3230
cmpl $0x0, %eax
jne 0x96e5
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x9200
xorl %edi, %edi
callq 0x33a0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4026(%rip), %rsi      # 0xd71e
callq 0x3230
cmpl $0x0, %eax
jne 0x9711
movl $0x1, 0x564a4(%rip)     # 0x5fbb0
jmp 0x9a69
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3ffd(%rip), %rsi      # 0xd721
callq 0x3230
cmpl $0x0, %eax
jne 0x9748
movl $0x1, -0x5c(%rbp)
movq -0x68(%rbp), %rax
movl $0xffffffff, 0x288adc(%rax) # imm = 0xFFFFFFFF
jmp 0x9a67
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3fc9(%rip), %rsi      # 0xd724
callq 0x3230
cmpl $0x0, %eax
jne 0x978f
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
xorl %edx, %edx
callq 0x75f0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x9a65
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3f85(%rip), %rsi      # 0xd727
callq 0x3230
cmpl $0x0, %eax
jne 0x97d6
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
xorl %edx, %edx
callq 0x7c60
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x9a63
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3f41(%rip), %rsi      # 0xd72a
callq 0x3230
cmpl $0x0, %eax
jne 0x981f
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x9b20
movq -0x68(%rbp), %rdi
callq 0x9ad0
jmp 0x9a61
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3efb(%rip), %rsi      # 0xd72d
callq 0x3230
cmpl $0x0, %eax
jne 0x986f
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x9b20
movl $0x1, -0x5c(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9ad0
jmp 0x9a5f
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3eae(%rip), %rsi      # 0xd730
callq 0x3230
cmpl $0x0, %eax
jne 0x98b9
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
movl $0x1, %edx
callq 0x75f0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x9a5d
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3e67(%rip), %rsi      # 0xd733
callq 0x3230
cmpl $0x0, %eax
je 0x98f3
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3e57(%rip), %rsi      # 0xd740
callq 0x3230
cmpl $0x0, %eax
jne 0x9922
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x68(%rbp), %rdi
addq $0x288aec, %rdi         # imm = 0x288AEC
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4010
jmp 0x9a5b
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3e0f(%rip), %rsi      # 0xd744
callq 0x3230
cmpl $0x0, %eax
je 0x995c
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3dfd(%rip), %rsi      # 0xd74f
callq 0x3230
cmpl $0x0, %eax
jne 0x998b
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x68(%rbp), %rdi
addq $0x288bec, %rdi         # imm = 0x288BEC
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4010
jmp 0x9a59
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3db5(%rip), %rsi      # 0xd753
callq 0x3230
cmpl $0x0, %eax
je 0x99c5
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3da5(%rip), %rsi      # 0xd760
callq 0x3230
cmpl $0x0, %eax
jne 0x99f1
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x68(%rbp), %rdi
addq $0x288cec, %rdi         # imm = 0x288CEC
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4010
jmp 0x9a57
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3d60(%rip), %rsi      # 0xd764
callq 0x3230
cmpl $0x0, %eax
je 0x9a2b
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3d4e(%rip), %rsi      # 0xd76f
callq 0x3230
cmpl $0x0, %eax
jne 0x9a55
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x68(%rbp), %rdi
addq $0x288dec, %rdi         # imm = 0x288DEC
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4010
jmp 0x9a57
jmp 0x9a59
jmp 0x9a5b
jmp 0x9a5d
jmp 0x9a5f
jmp 0x9a61
jmp 0x9a63
jmp 0x9a65
jmp 0x9a67
jmp 0x9a69
jmp 0x9a6b
jmp 0x9a6d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x96a9
cmpl $0x1, -0x5c(%rbp)
jne 0x9a8c
movq -0x68(%rbp), %rdi
xorl %esi, %esi
callq 0x3bb0
movq -0x68(%rbp), %rax
addq $0x200004, %rax         # imm = 0x200004
movq -0x68(%rbp), %rcx
movslq 0x2043a4(%rcx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
addq %rcx, %rax
cmpl $0x1, (%rax)
jl 0x9ab9
movq -0x68(%rbp), %rdi
callq 0x8920
movq -0x68(%rbp), %rdi
callq 0x3040
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)