// File: /workspace/github_cpp_makefile_star2_O3/coduin[P]epiphany-bin-info/epiphany-bin-info.cpp
// Function: main
int main(int argc, char* argv[]) {
    if (cmdOptionExists(argv, argv + argc, "-h")) {
        showHelp(argv[0]);
        return 0;
    }

    // Retrieve the filename
    if ((argc <= 1) || (argv[argc - 1] == NULL) || (argv[argc - 1][0] == '-')) {
        showHelp(argv[0]);
        return 1;
    }

    if (cmdOptionExists(argv, argv + argc, "-p"))
        showProgramHeaders = true;

    if (cmdOptionExists(argv, argv + argc, "-sec"))
        showSections = true;

    if (cmdOptionExists(argv, argv + argc, "-s"))
        showSymbols = true;

    if (cmdOptionExists(argv, argv + argc, "-a")) {
        showProgramHeaders = true;
        showSections = true;
        showSymbols = true;
    }

    if (cmdOptionExists(argv, argv + argc, "--nodemangle")) {
        demangleNames = false;
    }

    if (isatty(fileno(stdout)))
        colorOutput = true;

    std::ifstream file(argv[argc - 1], ios::binary);

    if (!file.is_open()) {
        cerr << "Could not open file " << argv[1] << endl;
        return 1;
    }

    streampos fsize = 0;
    file.seekg(0, ios::beg);
    fsize = file.tellg();
    file.seekg(0, ios::end);
    fsize = file.tellg() - fsize;
    file.seekg(0, ios::beg);

    char* buffer = new char[fsize];
    file.read(buffer, fsize);
    file.close();

    int ret = parseFile(buffer, fsize);
    delete[] buffer;

    if (ret) {
        cerr << "Error while parsing file '" << argv[argc - 1] << "'" << endl;
        cerr << "File is not a valid Epiphany executable." << endl;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x20cd(%rip), %rsi      # 0x542f
leaq 0x20c8(%rip), %rdx      # 0x5431
movq %rsp, %rdi
callq 0x4a6c
movslq %ebp, %rax
leaq (%rbx,%rax,8), %r14
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4974
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x339f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
cmpq %r14, %r15
je 0x33b0
movq (%rbx), %rdi
callq 0x31d8
xorl %ebp, %ebp
jmp 0x33d4
cmpl $0x2, %ebp
jl 0x33c7
movl %ebp, %r12d
movq -0x8(%rbx,%r12,8), %rax
testq %rax, %rax
je 0x33c7
cmpb $0x2d, (%rax)
jne 0x33e8
movq (%rbx), %rdi
callq 0x31d8
movl $0x1, %ebp
movl %ebp, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsp, %rdi
movq %r13, (%rdi)
leaq 0x203d(%rip), %rsi      # 0x5432
leaq 0x2038(%rip), %rdx      # 0x5434
callq 0x4a6c
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4974
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x3428
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
cmpq %r14, %r15
je 0x3434
movb $0x1, 0x4d4e(%rip)      # 0x8182
movq %rsp, %rdi
movq %r13, (%rdi)
leaq 0x1ff4(%rip), %rsi      # 0x5435
leaq 0x1ff1(%rip), %rdx      # 0x5439
callq 0x4a6c
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4974
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x3474
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
cmpq %r14, %r15
je 0x3480
movb $0x1, 0x4d03(%rip)      # 0x8183
movq %rsp, %rdi
movq %r13, (%rdi)
leaq 0x1fad(%rip), %rsi      # 0x543a
leaq 0x1fa8(%rip), %rdx      # 0x543c
callq 0x4a6c
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4974
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x34c0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
cmpq %r14, %r15
je 0x34cc
movb $0x1, 0x4cb8(%rip)      # 0x8184
movq %rsp, %rdi
movq %r13, (%rdi)
leaq 0x1f64(%rip), %rsi      # 0x543d
leaq 0x1f5f(%rip), %rdx      # 0x543f
callq 0x4a6c
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4974
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x350c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
cmpq %r14, %r15
je 0x3525
movb $0x1, %al
movb %al, 0x4c69(%rip)       # 0x8182
movb %al, 0x4c64(%rip)       # 0x8183
movb %al, 0x4c5f(%rip)       # 0x8184
movq %rsp, %rdi
movq %r13, (%rdi)
leaq 0x1f0e(%rip), %rsi      # 0x5440
leaq 0x1f13(%rip), %rdx      # 0x544c
callq 0x4a6c
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4974
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x3565
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
cmpq %r14, %r15
je 0x3571
movb $0x0, 0x4bf7(%rip)      # 0x8168
movq 0x4a40(%rip), %rax      # 0x7fb8
movq (%rax), %rdi
callq 0x2190
movl %eax, %edi
callq 0x2270
testl %eax, %eax
je 0x3592
movb $0x1, 0x4bef(%rip)      # 0x8181
movq -0x8(%rbx,%r12,8), %rsi
movq %rsp, %rdi
movl $0x4, %edx
callq 0x22a0
leaq 0x78(%rsp), %rdi
callq 0x2060
testb %al, %al
je 0x367c
movq %rsp, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21f0
movq %rsp, %rdi
callq 0x2260
movq %rax, %r15
movq %rsp, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x21f0
movq %rsp, %rdi
callq 0x2260
movq %rax, %r14
movq %rsp, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21f0
subq %r15, %r14
movq %r14, %rdi
callq 0x2030
movq %rax, %r15
movq %rsp, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x21d0
movq %rsp, %rdi
callq 0x2050
movq %r15, %rdi
movq %r14, %rsi
callq 0x3058
movl %eax, %ebp
movq %r15, %rdi
callq 0x21e0
testl %ebp, %ebp
je 0x3709
movq 0x49b5(%rip), %r14      # 0x7ff0
leaq 0x1e20(%rip), %rsi      # 0x5462
movl $0x1a, %edx
movq %r14, %rdi
callq 0x21a0
movq -0x8(%rbx,%r12,8), %rbx
testq %rbx, %rbx
je 0x3710
movq %rbx, %rdi
callq 0x20c0
movq 0x4984(%rip), %rdi      # 0x7ff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21a0
jmp 0x3728
movq 0x496d(%rip), %r14      # 0x7ff0
leaq 0x1dc3(%rip), %rsi      # 0x544d
movl $0x14, %edx
movq %r14, %rdi
callq 0x21a0
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x36bc
movq %rbx, %rdi
callq 0x20c0
movq 0x4941(%rip), %rdi      # 0x7ff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21a0
jmp 0x36d4
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2240
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x48fe(%rip), %rdi      # 0x7ff0
callq 0x2040
movl $0x1, %ebp
movq %rax, %rdi
callq 0x2100
jmp 0x37b4
xorl %ebp, %ebp
jmp 0x37b4
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2240
movq 0x48c1(%rip), %rbx      # 0x7ff0
leaq 0x1d45(%rip), %rsi      # 0x547b
movl $0x1, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x488f(%rip), %rdi      # 0x7ff0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq 0x487b(%rip), %rbx      # 0x7ff0
leaq 0x1d01(%rip), %rsi      # 0x547d
movl $0x28, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x4849(%rip), %rdi      # 0x7ff0
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq %rsp, %rdi
callq 0x2070
jmp 0x33d4
jmp 0x37df
jmp 0x37df
jmp 0x37ec
jmp 0x3807
jmp 0x37ec
jmp 0x3807
jmp 0x37ec
jmp 0x3807
jmp 0x37ec
jmp 0x3807
jmp 0x37ec
jmp 0x3807
jmp 0x37df
jmp 0x37df
jmp 0x37df
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2070
jmp 0x380a
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x380a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
jmp 0x380a
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2280