// File: /workspace/github_c_makefile_star2_O3/stickyPiston[P]ti-basic-compiler/src/main.c
// Function: main
int main(int argc, char *argv[]) {
  for (int i = 1; i < argc; i++) {
    if (strcmp(argv[i], "-o") == 0) {
      outputFile = argv[++i];
    } else if (strcmp(argv[i], "-i") == 0) {
      ignoreWhitespace = true;
    } else if (strcmp(argv[i], "-d") == 0) {
      disassembleMode = true;
    } else if (strcmp(argv[i], "-n") == 0) {
      strncpy(programName, argv[++i], 8);
    } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
      openHelp(argv[0]);
      return 0;
    } else if (strcmp(argv[i], "-l") == 0 || strcmp(argv[i], "--lang") == 0) {
      i++;
      if (strcmp(argv[i], "SE") == 0 || strcmp(argv[i], "se") == 0) lang = LANG_SE;
      if (strcmp(argv[i], "EN") == 0 || strcmp(argv[i], "en") == 0) lang = LANG_EN;
      if (strcmp(argv[i], "NL") == 0 || strcmp(argv[i], "nl") == 0) lang = LANG_NL;
    } else {
      if (argv[i][0] == '-') {
        printf("Unknown flag: %s\n", argv[i]);
        return 1;
      } else {
        inputFile = argv[i];
      }
    }
  }

  if (outputFile == NULL) outputFile = "out.8xp";
  if (inputFile == NULL) { openHelp(argv[0]); return 0;}
  if (*programName == 0) strcpy(programName, "PROG");

  if (disassembleMode) {
    disassemble();
  } else {
    compile();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, -0x2c(%rbp)
cmpl $0x2, %edi
jl 0xe4df
movl $0x1, %r13d
movslq %r13d, %r12
movq (%rbx,%r12,8), %r15
movb (%r15), %r14b
cmpb $0x2d, %r14b
jne 0xe371
cmpb $0x6f, 0x1(%r15)
jne 0xe311
cmpb $0x0, 0x2(%r15)
je 0xe44d
cmpb $0x69, 0x1(%r15)
jne 0xe323
cmpb $0x0, 0x2(%r15)
je 0xe460
cmpb $0x64, 0x1(%r15)
jne 0xe335
cmpb $0x0, 0x2(%r15)
je 0xe469
cmpb $0x6e, 0x1(%r15)
jne 0xe347
cmpb $0x0, 0x2(%r15)
je 0xe49f
cmpb $0x68, 0x1(%r15)
jne 0xe3b1
cmpb $0x0, 0x2(%r15)
je 0xe52f
movq %r15, %rdi
leaq 0xca1(%rip), %rsi       # 0xf004
callq 0xe0d0
testl %eax, %eax
jne 0xe3ce
jmp 0xe52f
movq %r15, %rdi
leaq 0xc89(%rip), %rsi       # 0xf004
callq 0xe0d0
testl %eax, %eax
je 0xe52f
movq %r15, %rdi
leaq 0xc79(%rip), %rsi       # 0xf00b
callq 0xe0d0
testl %eax, %eax
je 0xe3f3
cmpb $0x2d, %r14b
je 0xe546
movq %r15, 0xb844(%rip)      # 0x19bf0
jmp 0xe4d2
movq %r15, %rdi
leaq 0xc49(%rip), %rsi       # 0xf004
callq 0xe0d0
testl %eax, %eax
je 0xe52f
cmpb $0x2d, %r14b
jne 0xe388
cmpb $0x6c, 0x1(%r15)
jne 0xe3dc
cmpb $0x0, 0x2(%r15)
je 0xe3f3
movq %r15, %rdi
leaq 0xc25(%rip), %rsi       # 0xf00b
callq 0xe0d0
testl %eax, %eax
jne 0xe546
leal 0x1(%r12), %r13d
movq 0x8(%rbx,%r12,8), %rax
movzbl (%rax), %ecx
cmpl $0x73, %ecx
je 0xe415
cmpl $0x53, %ecx
jne 0xe435
cmpb $0x45, 0x1(%rax)
je 0xe41f
jmp 0xe4d2
cmpb $0x65, 0x1(%rax)
jne 0xe4d2
cmpb $0x0, 0x2(%rax)
jne 0xe4d2
movl $0x2, 0xb7b5(%rip)      # 0x19be8
movb (%rax), %cl
cmpb $0x65, %cl
je 0xe472
movzbl %cl, %edx
cmpl $0x45, %edx
jne 0xe48a
cmpb $0x4e, 0x1(%rax)
je 0xe478
jmp 0xe4d2
leal 0x1(%r12), %r13d
movq 0x8(%rbx,%r12,8), %rax
movq %rax, 0xb7aa(%rip)      # 0x19c08
jmp 0xe4d2
movb $0x1, 0xb7a9(%rip)      # 0x19c10
jmp 0xe4d2
movb $0x1, 0xb7a1(%rip)      # 0x19c11
jmp 0xe4d2
cmpb $0x6e, 0x1(%rax)
jne 0xe4d2
cmpb $0x0, 0x2(%rax)
jne 0xe4d2
movl $0x0, 0xb760(%rip)      # 0x19be8
movb (%rax), %cl
cmpb $0x6e, %cl
je 0xe4bc
movzbl %cl, %ecx
cmpl $0x4e, %ecx
jne 0xe4d2
cmpb $0x4c, 0x1(%rax)
je 0xe4c2
jmp 0xe4d2
leal 0x1(%r12), %r13d
movq 0x8(%rbx,%r12,8), %rsi
movl $0x8, %edx
leaq 0xb743(%rip), %rdi      # 0x19bf8
callq 0xe050
jmp 0xe4d2
cmpb $0x6c, 0x1(%rax)
jne 0xe4d2
cmpb $0x0, 0x2(%rax)
jne 0xe4d2
movl $0x1, 0xb716(%rip)      # 0x19be8
incl %r13d
cmpl -0x2c(%rbp), %r13d
jl 0xe2ef
cmpq $0x0, 0xb721(%rip)      # 0x19c08
jne 0xe4f7
leaq 0xb34(%rip), %rax       # 0xf024
movq %rax, 0xb711(%rip)      # 0x19c08
cmpq $0x0, 0xb6f1(%rip)      # 0x19bf0
je 0xe52f
cmpb $0x0, 0xb6f0(%rip)      # 0x19bf8
jne 0xe51b
movb $0x0, 0xb6eb(%rip)      # 0x19bfc
movl $0x474f5250, 0xb6dd(%rip) # imm = 0x474F5250
cmpb $0x1, 0xb6ef(%rip)      # 0x19c11
jne 0xe53b
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xea8e
jmp 0xe55c
movq (%rbx), %rdi
callq 0xe56d
xorl %ebx, %ebx
jmp 0xe55c
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xe689
jmp 0xe55c
leaq 0xac5(%rip), %rdi       # 0xf012
movq %r15, %rsi
xorl %eax, %eax
callq 0xe0b0
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq