// File: /workspace/github_cpp_makefile_star2_O1/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/main.cpp
// Function: main
int main (int argc,char **argv)
{
    main_args args;
    main_read_args(argc, argv, stdin, args);

    logger = new llog();
    AST *ast = main_ast_create(args);
    
    string_table* strings = main_ast_check(ast);
    
    if (args.to_separate_archives) {
        main_redirect_stdout("bla.types");
    }
    types.dump(cout);
    cout << "-------------------------------------------------------" << endl << endl;
    if (args.to_separate_archives) {
        main_redirect_stdout("bla.strings");
    }
    strings->dump(cout);
    cout << "-------------------------------------------------------" << endl << endl;
    
    if (args.ast) {
        if (args.to_separate_archives) {
            main_redirect_stdout("bla.ast");
        }
        ast->dump(cout, 0);

        if (!args.to_separate_archives) {
            cout << "-------------------------------------------------------" << endl << endl;
        }
    }
    
    if ( logger->exists_registered_error() ){
        logger->dump(cerr);
        cerr << "-------------------------------------------------------" << endl << endl;
        cerr << "Epic fail!" << endl;
        abort();
        return 1;
    }
    
    Tac* tac = main_tac_create(args, ast);

    main_tac_optimize(tac);

    main_tac_dump(args, tac);

    Spim* spim = main_spim_create(tac);

    main_spim_dump(spim);

    main_redirect_stdout();
    cout << "Like a boss!" << endl;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x14091(%rip), %rax     # 0x3dfb8
movq (%rax), %rdx
leaq 0x8(%rsp), %rcx
callq 0x2a232
movl $0x1c0, %edi            # imm = 0x1C0
callq 0x62e0
movq %rax, %rbx
movq %rax, %rdi
callq 0x1a728
movq %rbx, 0x144b0(%rip)     # 0x3e400
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x2a473
movq %rax, %r15
movq %rax, %rdi
callq 0x2a4ec
movq %rax, %r12
movb 0x9(%rsp), %bpl
cmpb $0x1, %bpl
jne 0x29f87
leaq 0x7b4d(%rip), %rdi      # 0x31acf
callq 0x2a570
leaq 0x1447a(%rip), %rdi     # 0x3e408
movq 0x1402b(%rip), %rbx     # 0x3dfc0
movq %rbx, %rsi
callq 0x1a2a2
leaq 0x7b35(%rip), %rsi      # 0x31ad9
movl $0x37, %edx
movq %rbx, %rdi
callq 0x6360
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61f0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x62b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61f0
testb %bpl, %bpl
je 0x2a013
leaq 0x7b03(%rip), %rdi      # 0x31b11
callq 0x2a570
movq %r12, %rdi
movq %rbx, %rsi
callq 0x22c46
leaq 0x7ab4(%rip), %rsi      # 0x31ad9
movl $0x37, %edx
movq %rbx, %rdi
callq 0x6360
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x62b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61f0
cmpb $0x1, 0xa(%rsp)
jne 0x2a124
testb %bpl, %bpl
je 0x2a0b2
leaq 0x7a83(%rip), %rdi      # 0x31b1d
callq 0x2a570
movq (%r15), %rax
movq 0x13f17(%rip), %rsi     # 0x3dfc0
movq %r15, %rdi
xorl %edx, %edx
callq *(%rax)
jmp 0x2a124
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq *(%rax)
leaq 0x7a13(%rip), %rsi      # 0x31ad9
movl $0x37, %edx
movq %rbx, %rdi
callq 0x6360
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x62b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61f0
movq 0x142d5(%rip), %rdi     # 0x3e400
callq 0x1abd4
testb %al, %al
jne 0x2a1c9
movq %r14, %rdi
movq %r15, %rdx
callq 0x2a6bc
movq %rax, %r15
movq %rax, %rdi
callq 0x2af8c
movq %r15, %rdi
callq 0x2af94
movq %r14, %rdi
callq 0x2a7a0
movq %r15, %rdi
callq 0x2afa2
movq %rax, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x2b2ca
xorl %edi, %edi
callq 0x2a570
leaq 0x79ac(%rip), %rsi      # 0x31b30
movl $0xc, %edx
movq %rbx, %rdi
callq 0x6360
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61f0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x14230(%rip), %rdi     # 0x3e400
movq 0x13e19(%rip), %rbx     # 0x3dff0
movq %rbx, %rsi
callq 0x1abd8
leaq 0x78f3(%rip), %rsi      # 0x31ad9
movq %rbx, %rdi
callq 0x62c0
movq %rax, %rdi
callq 0x6140
movq %rax, %rdi
callq 0x6140
leaq 0x7920(%rip), %rsi      # 0x31b25
movq %rbx, %rdi
callq 0x62c0
movq %rax, %rdi
callq 0x6140
callq 0x61a0
movq %rax, %r14
movl $0x1c0, %esi            # imm = 0x1C0
movq %rbx, %rdi
callq 0x62f0
movq %r14, %rdi
callq 0x6550