// File: /workspace/github_c_makefile_star2_O0/RodionGork[P]tinyscheme/scheme.c
// Function: main
int main(int argc, char **argv) {
  scheme sc;
  FILE *fin = NULL;
  char *file_name = InitFile;
  char *executable_name = argv[0];
  int retcode;
  int isfile = 1;

  initFromEnv();
  if (argc == 1) {
    printf("%s", get_version());
  }
  if (argc == 2 && str_eq(argv[1], "-?")) {
    printf("Usage: tinyscheme -?\n");
    printf("or:    tinyscheme [<file1> <file2> ...]\n");
    printf("followed by\n");
    printf("          -1 <file> [<arg1> <arg2> ...]\n");
    printf("          -c <Scheme commands> [<arg1> <arg2> ...]\n");
    printf("assuming that the executable is named tinyscheme.\n");
    printf("Use - as filename for stdin.\n");
    return 1;
  }
  if (!scheme_init(&sc)) {
    fprintf(stderr, "Could not initialize!\n");
    return 2;
  }
  scheme_set_input_port_file(&sc, stdin);
  scheme_set_output_port_file(&sc, stdout);
#if USE_DL
  scheme_define(&sc, sc.global_env, mk_symbol(&sc, "load-extension"),
      mk_foreign_func(&sc, scm_load_ext));
#endif
  argv++;
  if (access(file_name, 0) != 0) {
    char *p = getenv("TINYSCHEMEINIT");
    if (p != 0) {
      file_name = p;
    } else {
      strcpy(sc.strbuff, executable_name);
      p = strrchr(sc.strbuff, '/');
      if (p != 0) {
        strcpy(p + 1, file_name);
        file_name = sc.strbuff;
      }
    }
  }
  evalcnt = 0;
  do {
    if (str_eq(file_name, "-1") || str_eq(file_name, "-c")) {
      pointer args = sc.NIL;
      isfile = file_name[1] == '1';
      file_name = *argv++;
      if (isfile) {
        fin = open_file(file_name);
      }
      for (; *argv; argv++) {
        pointer value = mk_string(&sc, *argv);
        args = cons(&sc, value, args);
      }
      args = reverse_in_place(&sc, sc.NIL, args);
      scheme_define(&sc, sc.global_env, mk_symbol(&sc, "*args*"), args);

    } else {
      fin = open_file(file_name);
    }
    if (isfile && fin == 0) {
      fprintf(stderr, "Could not open file %s\n", file_name);
    } else {
      if (isfile) {
        scheme_load_named_file(&sc, fin, file_name);
      } else {
        scheme_load_string(&sc, file_name);
      }
      if (!isfile || fin != stdin) {
        if (sc.retcode != 0) {
          fprintf(stderr, "Errors encountered reading %s\n", file_name);
        }
        if (isfile) {
          fclose(fin);
        }
      }
    }
    file_name = *argv++;
  } while (file_name != 0);
  if (argc == 1) {
    scheme_load_named_file(&sc, stdin, "-");
  }
  retcode = sc.retcode;
  scheme_deinit(&sc);

  return retcode;
}

// Assembly:
subq $0xf48, %rsp            # imm = 0xF48
movl $0x0, 0xf44(%rsp)
movl %edi, 0xf40(%rsp)
movq %rsi, 0xf38(%rsp)
movq $0x0, 0x38(%rsp)
leaq 0xfef6(%rip), %rax      # 0x177d7
movq %rax, 0x30(%rsp)
movq 0xf38(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movl $0x1, 0x20(%rsp)
callq 0x7820
cmpl $0x1, 0xf40(%rsp)
jne 0x7923
callq 0x77a0
movq %rax, %rsi
leaq 0x106e5(%rip), %rdi     # 0x18001
movb $0x0, %al
callq 0x40b0
cmpl $0x2, 0xf40(%rsp)
jne 0x79c0
movq 0xf38(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0xfe9c(%rip), %rsi      # 0x177e0
callq 0x4180
cmpl $0x0, %eax
jne 0x79c0
leaq 0xfe8e(%rip), %rdi      # 0x177e3
movb $0x0, %al
callq 0x40b0
leaq 0xfe96(%rip), %rdi      # 0x177f9
movb $0x0, %al
callq 0x40b0
leaq 0xfeb1(%rip), %rdi      # 0x17822
movb $0x0, %al
callq 0x40b0
leaq 0xfeb0(%rip), %rdi      # 0x1782f
movb $0x0, %al
callq 0x40b0
leaq 0xfecb(%rip), %rdi      # 0x17858
movb $0x0, %al
callq 0x40b0
leaq 0xfef1(%rip), %rdi      # 0x1788c
movb $0x0, %al
callq 0x40b0
leaq 0xff16(%rip), %rdi      # 0x178bf
movb $0x0, %al
callq 0x40b0
movl $0x1, 0xf44(%rsp)
jmp 0x7d26
leaq 0x40(%rsp), %rdi
callq 0x59a0
cmpl $0x0, %eax
jne 0x79f7
movq 0x13622(%rip), %rax     # 0x1aff8
movq (%rax), %rdi
leaq 0xfefd(%rip), %rsi      # 0x178dd
movb $0x0, %al
callq 0x4190
movl $0x2, 0xf44(%rsp)
jmp 0x7d26
movq 0x135d2(%rip), %rax     # 0x1afd0
movq (%rax), %rsi
leaq 0x40(%rsp), %rdi
callq 0x65b0
movq 0x135b6(%rip), %rax     # 0x1afc8
movq (%rax), %rsi
leaq 0x40(%rsp), %rdi
callq 0x6700
movq 0xf38(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xf38(%rsp)
movq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x4220
cmpl $0x0, %eax
je 0x7abe
leaq 0xfea9(%rip), %rdi      # 0x178f4
callq 0x4030
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x7a69
movq 0x18(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x7abc
movq 0xee0(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x4040
movq 0xee0(%rsp), %rdi
movl $0x2f, %esi
callq 0x40e0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x7aba
movq 0x18(%rsp), %rdi
addq $0x1, %rdi
movq 0x30(%rsp), %rsi
callq 0x4040
movq 0xee0(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x7abc
jmp 0x7abe
movq $0x0, 0x14faf(%rip) # 0x1ca78
movq 0x30(%rsp), %rdi
leaq 0xfe2e(%rip), %rsi      # 0x17903
callq 0x4180
cmpl $0x0, %eax
je 0x7af9
movq 0x30(%rsp), %rdi
leaq 0xfe1b(%rip), %rsi      # 0x17906
callq 0x4180
cmpl $0x0, %eax
jne 0x7bff
movq 0xd0(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x31, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x20(%rsp)
movq 0xf38(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0xf38(%rsp)
movq (%rax), %rax
movq %rax, 0x30(%rsp)
cmpl $0x0, 0x20(%rsp)
je 0x7b53
movq 0x30(%rsp), %rdi
callq 0x77b0
movq %rax, 0x38(%rsp)
jmp 0x7b55
movq 0xf38(%rsp), %rax
cmpq $0x0, (%rax)
je 0x7bae
movq 0xf38(%rsp), %rax
movq (%rax), %rsi
leaq 0x40(%rsp), %rdi
callq 0x4bc0
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x40(%rsp), %rdi
xorl %ecx, %ecx
callq 0x4950
movq %rax, 0x10(%rsp)
movq 0xf38(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xf38(%rsp)
jmp 0x7b55
movq 0xd0(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x40(%rsp), %rdi
callq 0x7d40
movq %rax, 0x10(%rsp)
movq 0x140(%rsp), %rax
movq %rax, (%rsp)
leaq 0x40(%rsp), %rdi
leaq 0xfd27(%rip), %rsi      # 0x17909
callq 0x4e50
movq (%rsp), %rsi
movq %rax, %rdx
movq 0x10(%rsp), %rcx
leaq 0x40(%rsp), %rdi
callq 0x7490
jmp 0x7c0e
movq 0x30(%rsp), %rdi
callq 0x77b0
movq %rax, 0x38(%rsp)
cmpl $0x0, 0x20(%rsp)
je 0x7c3c
cmpq $0x0, 0x38(%rsp)
jne 0x7c3c
movq 0x133d4(%rip), %rax     # 0x1aff8
movq (%rax), %rdi
movq 0x30(%rsp), %rdx
leaq 0xfcdd(%rip), %rsi      # 0x17910
movb $0x0, %al
callq 0x4190
jmp 0x7cb9
cmpl $0x0, 0x20(%rsp)
je 0x7c59
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x40(%rsp), %rdi
callq 0x6d40
jmp 0x7c68
movq 0x30(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x7350
cmpl $0x0, 0x20(%rsp)
je 0x7c80
movq 0x38(%rsp), %rax
movq 0x13355(%rip), %rcx     # 0x1afd0
cmpq (%rcx), %rax
je 0x7cb7
cmpl $0x0, 0x50(%rsp)
je 0x7ca4
movq 0x1336a(%rip), %rax     # 0x1aff8
movq (%rax), %rdi
movq 0x30(%rsp), %rdx
leaq 0xfc8b(%rip), %rsi      # 0x17928
movb $0x0, %al
callq 0x4190
cmpl $0x0, 0x20(%rsp)
je 0x7cb5
movq 0x38(%rsp), %rdi
callq 0x4090
jmp 0x7cb7
jmp 0x7cb9
movq 0xf38(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0xf38(%rsp)
movq (%rax), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x7ac9
cmpl $0x1, 0xf40(%rsp)
jne 0x7d09
movq 0x132db(%rip), %rax     # 0x1afd0
movq (%rax), %rsi
leaq 0x40(%rsp), %rdi
leaq 0xfa9f(%rip), %rdx      # 0x177a3
callq 0x6d40
movl 0x50(%rsp), %eax
movl %eax, 0x24(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x67a0
movl 0x24(%rsp), %eax
movl %eax, 0xf44(%rsp)
movl 0xf44(%rsp), %eax
addq $0xf48, %rsp            # imm = 0xF48
retq
nopw %cs:(%rax,%rax)