// File: /workspace/github_c_makefile_star2_O0/sisshiki1969[P]monocc/src/monocc.c
// Function: main
int main(int argc, char **argv) {
  char *file;
  verbose = true;
  for (int i = 1; i < argc; i++) {
    if (strcmp(argv[i], "-test") == 0) {
      test_vec();
      return 0;
    } else if (strcmp(argv[i], "-string") == 0) {
      if (i + 2 > argc) {
        fprintf(stderr, "No input string.\n");
        return 1;
      }
      file = "input";
      source_text = argv[i + 1];
      output = fopen("tmp.s", "w");
      compile(file);
      return 0;
    } else if (strcmp(argv[i], "-v") == 0) {
      verbose = false;
    } else {
      file = argv[i];
      source_text = read_file(argv[i]);
      output_file_name = calloc(1, strlen(file) + 5);
      strcpy(output_file_name, file);
      char *dot = output_file_name + strlen(output_file_name) - 2;
      if (strcmp(dot, ".c") != 0) {
        fprintf(stderr, "Invalid aource file name.");
        return 1;
      }
      *(dot + 1) = 's';

      output = fopen(output_file_name, "w");
      if (!output) {
        fprintf(stderr, "Cannot open output file.\n");
        exit(1);
      }

      compile(file);
      return 0;
    }
  }

  fprintf(stderr, "Invalid arguments.\n");
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0xea73(%rip), %rax      # 0x151f0
movb $0x1, (%rax)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x69c0
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x994f(%rip), %rsi      # 0x100f5
callq 0x10e0
cmpl $0x0, %eax
jne 0x67c3
movb $0x0, %al
callq 0x40a0
movl $0x0, -0x4(%rbp)
jmp 0x69df
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9925(%rip), %rsi      # 0x100fb
callq 0x10e0
cmpl $0x0, %eax
jne 0x6865
movl -0x1c(%rbp), %eax
addl $0x2, %eax
cmpl -0x8(%rbp), %eax
jle 0x6813
movq 0xe802(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq 0x9903(%rip), %rsi      # 0x10103
movb $0x0, %al
callq 0x10f0
movl $0x1, -0x4(%rbp)
jmp 0x69df
leaq 0x98fb(%rip), %rax      # 0x10115
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0xe9ca(%rip)      # 0x15200
leaq 0x98de(%rip), %rdi      # 0x1011b
leaq 0x9804(%rip), %rsi      # 0x10048
callq 0x1150
movq %rax, 0xe9c0(%rip)      # 0x15210
movq -0x18(%rbp), %rdi
callq 0x6310
movl $0x0, -0x4(%rbp)
jmp 0x69df
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x98a9(%rip), %rsi      # 0x10121
callq 0x10e0
cmpl $0x0, %eax
jne 0x6891
leaq 0xe967(%rip), %rax      # 0x151f0
movb $0x0, (%rax)
jmp 0x69ac
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x6160
movq %rax, 0xe947(%rip)      # 0x15200
movq -0x18(%rbp), %rdi
callq 0x1090
movq %rax, %rsi
addq $0x5, %rsi
movl $0x1, %edi
callq 0x10d0
movq %rax, 0xe956(%rip)      # 0x15230
movq 0xe94f(%rip), %rdi      # 0x15230
movq -0x18(%rbp), %rsi
callq 0x1060
movq 0xe93f(%rip), %rax      # 0x15230
movq %rax, -0x30(%rbp)
movq 0xe934(%rip), %rdi      # 0x15230
callq 0x1090
movq %rax, %rcx
movq -0x30(%rbp), %rax
addq %rcx, %rax
addq $-0x2, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x9806(%rip), %rsi      # 0x10124
callq 0x10e0
cmpl $0x0, %eax
je 0x694c
movq 0xe6c9(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq 0x97ee(%rip), %rsi      # 0x10127
movb $0x0, %al
callq 0x10f0
movl $0x1, -0x4(%rbp)
jmp 0x69df
movq -0x28(%rbp), %rax
movb $0x73, 0x1(%rax)
movq 0xe8d5(%rip), %rdi      # 0x15230
leaq 0x96e6(%rip), %rsi      # 0x10048
callq 0x1150
movq %rax, 0xe8a2(%rip)      # 0x15210
cmpq $0x0, 0xe89a(%rip)      # 0x15210
jne 0x699a
movq 0xe679(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq 0x97b8(%rip), %rsi      # 0x10141
movb $0x0, %al
callq 0x10f0
movl $0x1, %edi
callq 0x1180
movq -0x18(%rbp), %rdi
callq 0x6310
movl $0x0, -0x4(%rbp)
jmp 0x69df
jmp 0x69ae
jmp 0x69b0
jmp 0x69b2
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6787
movq 0xe631(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq 0x978a(%rip), %rsi      # 0x1015b
movb $0x0, %al
callq 0x10f0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)