// File: /workspace/github_cpp_makefile_star2_O1/enferex[P]fnplot/main.cc
// Function: main
int main(int argc, char **argv)
{
    int opt;
    FILE *out;
    bool do_callees, do_callers;
    const char *fname, *fn_name, *out_fname;
    CS *cs;
    CSDB *db;
    int depth = 2;

    do_callers = do_callees = false;
    fname = out_fname = fn_name = NULL;

    while ((opt = getopt(argc, argv, "c:d:f:o:hxy")) != -1) {
        switch (opt) {
        case 'c': fname = optarg; break;
        case 'd': depth = atoi(optarg); break;
        case 'f': fn_name = optarg; break;
        case 'o': out_fname = optarg; break;
        case 'x': do_callers = true; break;
        case 'y': do_callees = true; break;
        case 'h': usage(argv[0]); break;
        default: return EXIT_FAILURE;
        }
    }

    if (!fname || !fn_name || depth < 0) {
        fprintf(stderr, "Invalid options, see '-h'\n");
        return EXIT_FAILURE;
    }

    // If the user did not specify callers or callees, do so for them!
    if (!do_callers && !do_callees)
      do_callees = true;

    if (out_fname && !(out = fopen(out_fname, "w"))) {
        fprintf(stderr, "Error opening output file %s: %s\n",
                out_fname, strerror(errno));
        exit(errno);
    }
    else if (!out_fname)
      out = stdout;

    // Load
    try {
        cs = new CS(fname);
    } 
    catch (const char *err) {
        fprintf(stderr, "Error loading cscope database: %s\n", err);
        exit(EXIT_FAILURE);
    }
    db = cs->buildDatabase();

    // Go!
    if (do_callers)
      csPrintCallers(out, db, fn_name, depth);
    if (do_callees)
      csPrintCallees(out, db, fn_name, depth);

    fclose(out);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r13
movl %edi, %ebp
movl $0x2, %ebx
movq $0x0, 0x10(%rsp)
leaq 0x2a70(%rip), %r14      # 0x5004
movq 0x5a1d(%rip), %r15      # 0x7fb8
movq $0x0, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
xorl %r12d, %r12d
movq $0x0, (%rsp)
movl %ebp, %edi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2090
cmpl $0x64, %eax
jne 0x25d6
movq (%r15), %rdi
callq 0x2290
movl %eax, %ebx
jmp 0x25b8
cmpl $0x67, %eax
jle 0x25f6
cmpl $0x77, %eax
jle 0x2613
cmpl $0x78, %eax
je 0x262b
cmpl $0x79, %eax
jne 0x2710
movb $0x1, %al
movq %rax, (%rsp)
jmp 0x25b8
cmpl $-0x1, %eax
je 0x2634
cmpl $0x63, %eax
je 0x2621
cmpl $0x66, %eax
jne 0x2710
movq (%r15), %rax
movq %rax, 0x20(%rsp)
jmp 0x25b8
cmpl $0x6f, %eax
jne 0x270b
movq (%r15), %r12
jmp 0x25b8
movq (%r15), %rax
movq %rax, 0x18(%rsp)
jmp 0x25b8
movb $0x1, %al
movq %rax, 0x10(%rsp)
jmp 0x25b8
movq 0x18(%rsp), %r15
testq %r15, %r15
movq 0x20(%rsp), %r13
je 0x2724
testq %r13, %r13
je 0x2724
testl %ebx, %ebx
js 0x2724
testq %r12, %r12
je 0x267e
leaq 0x29c7(%rip), %rsi      # 0x502b
movq %r12, %rdi
callq 0x2200
movq %rax, 0x8(%rsp)
testq %rax, %rax
jne 0x267e
movq %r12, %rdi
callq 0x2340
testq %r12, %r12
jne 0x2692
movq 0x591e(%rip), %rax      # 0x7fa8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl $0x78, %edi
callq 0x21b0
movq %rax, %r12
movq %r13, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x2774
movq 0x10(%rsp), %r13
movl %r13d, %ebp
orb (%rsp), %bpl
movq %r12, %rdi
callq 0x32f0
movq %rax, %r15
testb $0x1, %r13b
movq %r14, %r12
movq 0x8(%rsp), %r14
je 0x26e2
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %ebx, %ecx
callq 0x35f6
notb %bpl
orb (%rsp), %bpl
testb $0x1, %bpl
je 0x26ff
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %ebx, %ecx
callq 0x3872
movq %r14, %rdi
callq 0x21a0
xorl %eax, %eax
jmp 0x2715
cmpl $0x68, %eax
je 0x272b
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x23a9
jmp 0x2710
movq (%r13), %rsi
leaq 0x293c(%rip), %rdi      # 0x5072
xorl %eax, %eax
callq 0x2050
xorl %edi, %edi
callq 0x2220
movq %rdx, %rbx
movq %rax, %r14
movl $0x78, %esi
movq %r12, %rdi
callq 0x21c0
jmp 0x275f
movq %rdx, %rbx
movq %rax, %r14
movq %r14, %rdi
cmpl $0x1, %ebx
jne 0x276e
movl %ebx, %esi
callq 0x2380
callq 0x22f0
nop