// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq 0x14c9e(%rip), %rax     # 0x3efb8
movq (%rax), %rdx
movq %rsp, %rcx
callq 0x2a621
movl $0x1c0, %edi            # imm = 0x1C0
callq 0x62f0
movq %rax, %rbx
movq %rax, %rdi
callq 0x1a788
movq %rbx, 0x150c7(%rip)     # 0x3f408
movq (%rsp), %r14
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2a886
movq %rax, %r15
movq %rax, %rdi
callq 0x2a8ff
movq %rax, %r12
btl $0x8, %r14d
jae 0x2a373
leaq 0x8761(%rip), %rdi      # 0x32acf
callq 0x2a983
leaq 0x15096(%rip), %rdi     # 0x3f410
movq 0x14c3f(%rip), %rbx     # 0x3efc0
movq %rbx, %rsi
callq 0x1a2fa
leaq 0x8749(%rip), %rsi      # 0x32ad9
movl $0x37, %edx
movq %rbx, %rdi
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
btl $0x8, %r14d
jae 0x2a401
leaq 0x8715(%rip), %rdi      # 0x32b11
callq 0x2a983
movq %r12, %rdi
movq %rbx, %rsi
callq 0x22c9c
leaq 0x86c6(%rip), %rsi      # 0x32ad9
movl $0x37, %edx
movq %rbx, %rdi
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
btl $0x10, %r14d
jae 0x2a514
btl $0x8, %r14d
jb 0x2a4f7
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq *(%rax)
leaq 0x8642(%rip), %rsi      # 0x32ad9
movl $0x37, %edx
movq %rbx, %rdi
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
jmp 0x2a514
leaq 0x861f(%rip), %rdi      # 0x32b1d
callq 0x2a983
movq (%r15), %rax
movq 0x14ab3(%rip), %rsi     # 0x3efc0
movq %r15, %rdi
xorl %edx, %edx
callq *(%rax)
movq 0x14eed(%rip), %rdi     # 0x3f408
callq 0x1ac2a
testb %al, %al
jne 0x2a5b8
movq %r14, %rdi
movq %r15, %rdx
callq 0x2aace
movq %rax, %r15
movq %rax, %rdi
callq 0x2b39e
movq %r15, %rdi
callq 0x2b3a6
movq %r14, %rdi
callq 0x2abb2
movq %r15, %rdi
callq 0x2b3b4
movq %rax, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x2b6ae
xorl %edi, %edi
callq 0x2a983
leaq 0x85bc(%rip), %rsi      # 0x32b30
movl $0xc, %edx
movq %rbx, %rdi
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x14e49(%rip), %rdi     # 0x3f408
movq 0x14a2a(%rip), %rbx     # 0x3eff0
movq %rbx, %rsi
callq 0x1ac2e
leaq 0x8504(%rip), %rsi      # 0x32ad9
movq %rbx, %rdi
callq 0x62d0
movq %rax, %rdi
callq 0x6140
movq %rax, %rdi
callq 0x6140
leaq 0x8531(%rip), %rsi      # 0x32b25
movq %rbx, %rdi
callq 0x62d0
movq %rax, %rdi
callq 0x6140
callq 0x61a0
movq %rax, %r14
movl $0x1c0, %esi            # imm = 0x1C0
movq %rbx, %rdi
callq 0x6300
movq %r14, %rdi
callq 0x6560