// File: /workspace/github_cpp_makefile_star2_O2/calgagi[P]cp_gen/main.cpp
// Function: main
int main(int argc, char** argv) {
    ios_base::sync_with_stdio(false);  
    cin.tie(NULL);

    char cwdBuf[10000];
    string cwd = "";
    if (getcwd(cwdBuf, sizeof(cwdBuf)) == NULL) {
        error("Could not get current working directory");
    } 
    else {
        cwd = cwdBuf;
    }

    // Parse CLI arguments
    vector<string> cliArgs;
    string filename = "";
    for (int i = 1; i < argc; i++) {
        cliArgs.push_back(argv[i]);
        if (cliArgs.back()[0] != '-') {
            // we've found our filename
            filename = cliArgs.back();
            cliArgs.pop_back();
        }
        else {
            // remove leading '-'
            cliArgs.back().erase(cliArgs.back().begin());
        }
    }

    if (filename == "") {
        error("Could not find filename");
    }

    string path = cwd + "/" + filename;
    fstream new_file;
    new_file.open(path, ios_base::out);
    if (!new_file.is_open()) {
        error("Could not open file for output");
    }

    output(new_file, filename, cliArgs);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a18, %rsp           # imm = 0x2A18
movq %rsi, %rbx
movl %edi, %ebp
xorl %edi, %edi
callq 0x20e0
movq 0x540c(%rip), %rax      # 0x7fe0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
andq $0x0, 0xd8(%rax,%rcx)
leaq 0x25bb(%rip), %rsi      # 0x51a6
leaq 0x70(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x2ed8
leaq 0x300(%rsp), %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x2110
testq %rax, %rax
je 0x2dbf
leaq 0x70(%rsp), %rdi
leaq 0x300(%rsp), %rsi
callq 0x2300
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x2567(%rip), %rsi      # 0x51a6
leaq 0x30(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x2ed8
movslq %ebp, %rbp
pushq $0x1
popq %r13
leaq 0xf0(%rsp), %r14
leaq 0x50(%rsp), %r15
leaq 0x10(%rsp), %r12
cmpq %rbp, %r13
jge 0x2cd2
movq (%rbx,%r13,8), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x2ed8
movq %r12, %rdi
movq %r14, %rsi
callq 0x44d6
movq %r14, %rdi
callq 0x2338
movq 0x18(%rsp), %rax
movq -0x20(%rax), %rsi
addq $-0x20, %rax
cmpb $0x2d, (%rsi)
jne 0x2cad
movq %rax, %rdi
callq 0x2240
jmp 0x2ccd
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x2130
movq 0x18(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x18(%rsp)
callq 0x2338
incq %r13
jmp 0x2c6a
leaq 0x24cd(%rip), %rsi      # 0x51a6
leaq 0x30(%rsp), %rdi
callq 0x3194
testb %al, %al
jne 0x2de8
leaq 0x23d2(%rip), %rdx      # 0x50c4
leaq 0xf0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x31c0
leaq 0x50(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x31a1
leaq 0xf0(%rsp), %rdi
callq 0x2338
leaq 0xf0(%rsp), %rdi
callq 0x2210
leaq 0xf0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x2260
leaq 0x170(%rsp), %rdi
callq 0x2080
testb %al, %al
je 0x2e11
leaq 0xf0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x2aa9
leaq 0xf0(%rsp), %rdi
callq 0x2070
leaq 0x50(%rsp), %rdi
callq 0x2338
leaq 0x30(%rsp), %rdi
callq 0x2338
leaq 0x10(%rsp), %rdi
callq 0x2fe8
leaq 0x70(%rsp), %rdi
callq 0x2338
xorl %eax, %eax
addq $0x2a18, %rsp           # imm = 0x2A18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x23e1(%rip), %rsi      # 0x51a7
leaq 0xd0(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x2ed8
leaq 0xd0(%rsp), %rdi
callq 0x25ac
leaq 0x23e0(%rip), %rsi      # 0x51cf
leaq 0xb0(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x2ed8
leaq 0xb0(%rsp), %rdi
callq 0x25ac
leaq 0x23cf(%rip), %rsi      # 0x51e7
leaq 0x90(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2ed8
leaq 0x90(%rsp), %rdi
callq 0x25ac
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2338
jmp 0x2e84
jmp 0x2e81
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
jmp 0x2ea7
jmp 0x2eae
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x2338
jmp 0x2ec5
jmp 0x2e7c
movq %rax, %rbx
jmp 0x2e91
jmp 0x2e9c
jmp 0x2eae
movq %rax, %rbx
jmp 0x2ebb
movq %rax, %rbx
jmp 0x2ec5
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x2070
leaq 0x50(%rsp), %rdi
jmp 0x2ea7
jmp 0x2eae
jmp 0x2eae
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x2338
jmp 0x2eb1
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2338
leaq 0x10(%rsp), %rdi
callq 0x2fe8
leaq 0x70(%rsp), %rdi
callq 0x2338
movq %rbx, %rdi
callq 0x22d0
nop