// File: /workspace/github_cpp_makefile_star2_O1/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 $0xb8, %rsp
movq %rsi, -0x38(%rbp)
cmpl $0x2, %edi
jg 0x35102
movq 0x10f20(%rip), %rbx     # 0x45fc8
leaq 0x43be(%rip), %rsi      # 0x3946d
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 0x43a4(%rip), %rsi      # 0x3948e
movl $0x15, %edx
movq %rbx, %rdi
callq 0x4310
movl $0x1, %r14d
jmp 0x3547d
movl %edi, %r14d
movq 0x112d4(%rip), %rdi     # 0x463e0
movq 0x112bd(%rip), %rax     # 0x463d0
movq %rax, -0x90(%rbp)
movq 0x112b7(%rip), %rax     # 0x463d8
movq %rax, -0x88(%rbp)
testq %rax, %rax
je 0x35142
movq 0x10e8c(%rip), %rcx     # 0x45fc0
cmpb $0x0, (%rcx)
je 0x3513e
incl 0x8(%rax)
jmp 0x35142
lock
incl 0x8(%rax)
leaq -0x90(%rbp), %rsi
callq 0x2bffc
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x3515f
callq 0xc384
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x45f2(%rip), %rsi      # 0x39760
callq 0x4340
movq %rax, 0x111ce(%rip)     # 0x46348
callq 0x32089
leaq -0x68(%rbp), %r12
movl %r14d, %eax
movq %rax, -0x80(%rbp)
cmpl $0x2, %r14d
movl $0x1, %eax
cmovgel %r14d, %eax
negq %rax
movq %rax, -0x98(%rbp)
movb $0x1, %r15b
movl $0x1, %ebx
leaq -0x78(%rbp), %r14
movb $0x1, %r13b
movq -0x38(%rbp), %rax
movq -0x8(%rax,%rbx,8), %rsi
movq %r14, %rdi
leaq -0x58(%rbp), %rdx
callq 0x355c6
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
cmpq -0x80(%rbp), %rbx
jae 0x35206
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 0x4294(%rip), %rsi      # 0x394a4
callq 0x40d0
testl %eax, %eax
movzbl %r13b, %r13d
cmovel %eax, %r13d
movq %r14, %rdi
leaq 0x427f(%rip), %rsi      # 0x394a8
callq 0x40d0
testl %eax, %eax
je 0x352d0
movq %r14, %rdi
leaq 0x426d(%rip), %rsi      # 0x394ad
callq 0x40d0
testl %eax, %eax
je 0x352dc
movq %r14, %rdi
leaq 0x425b(%rip), %rsi      # 0x394b2
callq 0x40d0
testl %eax, %eax
je 0x352f4
movq %r14, %rdi
leaq 0x4249(%rip), %rsi      # 0x394b7
callq 0x40d0
testl %eax, %eax
je 0x35315
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x35294
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x42a0
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x352a9
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x42a0
cmpq -0x80(%rbp), %rbx
setb %r15b
movq -0x98(%rbp), %rax
addq %rbx, %rax
incq %rax
incq %rbx
cmpq $0x1, %rax
jne 0x351b0
jmp 0x353bf
leaq 0x11109(%rip), %rax     # 0x463e0
jmp 0x35385
leaq 0x110ed(%rip), %rdi     # 0x463d0
callq 0x3575a
leaq 0x11101(%rip), %rax     # 0x463f0
jmp 0x35385
leaq 0x110d5(%rip), %rdi     # 0x463d0
callq 0x3575a
leaq 0x110c9(%rip), %rdi     # 0x463d0
callq 0x3584c
leaq 0x110ed(%rip), %rax     # 0x46400
jmp 0x35385
leaq 0x110b4(%rip), %rdi     # 0x463d0
callq 0x3575a
leaq 0x110a8(%rip), %rdi     # 0x463d0
callq 0x3584c
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xd8(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x355c6
movzbl %r13b, %edx
andl $0x1, %edx
leaq 0x1107d(%rip), %rdi     # 0x463d0
leaq -0xd8(%rbp), %rsi
callq 0x3593e
leaq -0xc8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3537e
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x42a0
leaq 0x1108b(%rip), %rax     # 0x46410
movq (%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2c010
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x353aa
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x42a0
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x353bf
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x42a0
xorl %r14d, %r14d
testb $0x1, %r15b
jne 0x3547d
leaq 0x10ffd(%rip), %r15     # 0x463d0
movq %r15, %rdi
callq 0x3575a
movq %r15, %rdi
callq 0x3584c
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xb8(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x355c6
movzbl %r13b, %edx
andl $0x1, %edx
leaq 0x10fc7(%rip), %rdi     # 0x463d0
leaq -0xb8(%rbp), %rsi
callq 0x3593e
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35434
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x42a0
leaq 0x10f95(%rip), %rdi     # 0x463d0
callq 0x35a9c
movq 0x10fd9(%rip), %r15     # 0x46420
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x78(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x355c6
leaq -0x78(%rbp), %rsi
movq %r15, %rdi
callq 0x2c010
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x3547d
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x42a0
movl %r14d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xc8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35501
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x42a0
jmp 0x35501
jmp 0x354fe
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
jne 0x35527
jmp 0x35538
jmp 0x35535
movq %rax, %rbx
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35538
movq -0xa8(%rbp), %rsi
jmp 0x3552b
jmp 0x35535
movq %rax, %rbx
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x35538
callq 0xc384
jmp 0x35538
jmp 0x354fe
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3551a
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x42a0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x35538
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x42a0
jmp 0x35538
movq %rax, %rbx
movq %rbx, %rdi
callq 0x44c0