// File: /workspace/github_cpp_makefile_star2_O3/Merulo[P]CompilerJFTT/src/Main.cpp
// Function: main
int main(int argc, char** argv)
{
    if (argc < 3)
    {
        std::cout<<"USAGE: ./kompilator input output"<<std::endl;
        std::cout<<"Not enough arguments\n";
        return 1;
    }
    d.FIR->setSymbolTable(d.ST);
    yyin = fopen(argv[1], "r");
    yyparse();

    bool emulator = true;

    for(int i = 0; i < argc; i++)
    {
        std::string str = argv[i];
        std::string output;
        if (i + 1 < argc)
        {
            output = argv[i+1];
        }
        if (str == "-em")
        {
            emulator = false;
        }        
        if (str == "-FIR")
        {
            d.FIR->print(output);
            return 0;
        }
        if (str == "-SIR")
        {
            d.convertToSIR();
            d.SIR->print(output);   
            return 0;
        }
        if (str == "-TIR")
        {
            d.convertToSIR();
            d.convertToTIR();
            d.TIR->print(output);
            return 0;
        }
        if (str == "-FOIR")
        {
            d.convertToSIR();
            d.convertToTIR();
            d.convertToFOIR(argv[2], emulator);
            d.FOIR->print(output);
            return 0;
        }
    }

    d.convertToSIR();
    d.convertToTIR();
    d.convertToFOIR(argv[2], emulator);
    d.converToFIIR();
    d.FIIR->print(argv[2]);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, -0x38(%rbp)
cmpl $0x2, %edi
jg 0x34ccf
movq 0x10352(%rip), %rbx     # 0x44fc8
leaq 0x37f0(%rip), %rsi      # 0x3846d
movl $0x20, %edx
movq %rbx, %rdi
callq 0x4310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x41c0
leaq 0x37d6(%rip), %rsi      # 0x3848e
movl $0x15, %edx
movq %rbx, %rdi
callq 0x4310
movl $0x1, %eax
jmp 0x35005
movl %edi, %r14d
movq 0x10707(%rip), %rdi     # 0x453e0
movq 0x106f0(%rip), %rax     # 0x453d0
movq %rax, -0x88(%rbp)
movq 0x106ea(%rip), %rax     # 0x453d8
movq %rax, -0x80(%rbp)
testq %rax, %rax
je 0x34d0c
movq 0x102c2(%rip), %rcx     # 0x44fc0
cmpb $0x0, (%rcx)
je 0x34d08
incl 0x8(%rax)
jmp 0x34d0c
lock
incl 0x8(%rax)
leaq -0x88(%rbp), %rsi
callq 0x2bd48
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x34d26
callq 0xc11c
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3a2b(%rip), %rsi      # 0x38760
callq 0x4340
movq %rax, 0x10607(%rip)     # 0x45348
callq 0x31c7d
leaq -0x68(%rbp), %r12
movl %r14d, %r15d
movq %r15, -0x90(%rbp)
negq %r15
movb $0x1, %r13b
movl $0x1, %ebx
leaq -0x78(%rbp), %r14
movq -0x38(%rbp), %rax
movq -0x8(%rax,%rbx,8), %rsi
movq %r14, %rdi
leaq -0x58(%rbp), %rdx
callq 0x3515c
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
cmpq -0x90(%rbp), %rbx
jae 0x34dbc
movq -0x38(%rbp), %rax
movq (%rax,%rbx,8), %r12
movq %r12, %rdi
callq 0x4140
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r12, %rcx
leaq -0x68(%rbp), %r12
movq %rax, %r8
callq 0x4440
movq %r14, %rdi
leaq 0x36de(%rip), %rsi      # 0x384a4
callq 0x40d0
testl %eax, %eax
movzbl %r13b, %r13d
cmovel %eax, %r13d
movq %r14, %rdi
leaq 0x36c9(%rip), %rsi      # 0x384a8
callq 0x40d0
testl %eax, %eax
je 0x34f14
movq %r14, %rdi
leaq 0x36b7(%rip), %rsi      # 0x384ad
callq 0x40d0
testl %eax, %eax
je 0x34f20
movq %r14, %rdi
leaq 0x36a5(%rip), %rsi      # 0x384b2
callq 0x40d0
testl %eax, %eax
je 0x34f38
movq %r14, %rdi
leaq 0x3693(%rip), %rsi      # 0x384b7
callq 0x40d0
testl %eax, %eax
je 0x34f59
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x34e4a
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x42a0
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x34e5f
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x42a0
leaq (%r15,%rbx), %rax
incq %rax
incq %rbx
cmpq $0x1, %rax
jne 0x34d63
leaq 0x10556(%rip), %r14     # 0x453d0
movq %r14, %rdi
callq 0x352f0
movq %r14, %rdi
callq 0x353e2
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xb0(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x3515c
movzbl %r13b, %edx
andl $0x1, %edx
leaq 0x10520(%rip), %rdi     # 0x453d0
leaq -0xb0(%rbp), %rsi
callq 0x354d4
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34edb
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x42a0
leaq 0x104ee(%rip), %rdi     # 0x453d0
callq 0x35632
movq 0x10532(%rip), %r14     # 0x45420
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x78(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x3515c
leaq -0x78(%rbp), %rsi
movq %r14, %rdi
callq 0x2bd5c
jmp 0x34fee
leaq 0x104c5(%rip), %rax     # 0x453e0
jmp 0x34fc9
leaq 0x104a9(%rip), %rdi     # 0x453d0
callq 0x352f0
leaq 0x104bd(%rip), %rax     # 0x453f0
jmp 0x34fc9
leaq 0x10491(%rip), %rdi     # 0x453d0
callq 0x352f0
leaq 0x10485(%rip), %rdi     # 0x453d0
callq 0x353e2
leaq 0x104a9(%rip), %rax     # 0x45400
jmp 0x34fc9
leaq 0x10470(%rip), %rdi     # 0x453d0
callq 0x352f0
leaq 0x10464(%rip), %rdi     # 0x453d0
callq 0x353e2
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xd0(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3515c
movzbl %r13b, %edx
andl $0x1, %edx
leaq 0x10439(%rip), %rdi     # 0x453d0
leaq -0xd0(%rbp), %rsi
callq 0x354d4
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34fc2
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x42a0
leaq 0x10447(%rip), %rax     # 0x45410
movq (%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2bd5c
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x34fee
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x42a0
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x35003
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x42a0
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
jne 0x350b7
jmp 0x350c8
jmp 0x350c5
movq %rax, %rbx
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x350c8
movq -0xa0(%rbp), %rsi
jmp 0x350bb
jmp 0x350c5
movq %rax, %rbx
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35091
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x42a0
jmp 0x35091
jmp 0x3508e
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x350c8
callq 0xc11c
jmp 0x350c8
jmp 0x3508e
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x350aa
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x42a0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x350c8
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x42a0
jmp 0x350c8
movq %rax, %rbx
movq %rbx, %rdi
callq 0x44c0