// File: /workspace/github_cpp_makefile_star2_O2/pstuifzand[P]magento-tools/src/xml-lister.cpp
// Function: main
int main(int argc, char** argv)
{
    // remove program name
    argc--;
    argv++;

    // no arguments
    if (!argc) return 0;

    int keys_only = 0;
    int show_filename = 0;

    while (argv[0][0] == '-' && argv[0][1] == '-') {
        if (strcmp(*argv, "--keys") == 0) {
            keys_only = 1;
            ++argv;
            --argc;
        }
        if (strcmp(*argv, "--filename") == 0) {
            show_filename = 1;
            ++argv;
            --argc;
        }
    }

    // create parser
    xml_parser parser;

    while (argc) {
        user_data data;
        data.filename = *argv;
        data.keys_only = keys_only;
        data.show_filename = show_filename;

        XML_SetUserData(parser.handle(), &data);
        XML_SetElementHandler(parser.handle(), root_start_element_handler, root_end_element_handler);
        XML_SetCharacterDataHandler(parser.handle(), character_data_handler);

        std::ifstream in{data.filename};
        if (in) parse_xml(parser, in, &data);
        parser.reset();

        argc--;
        argv++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movl %edi, %ebp
decl %ebp
je 0x276a
movq %rsi, %rbx
addq $0x8, %rbx
movl $0x0, 0x14(%rsp)
leaq 0xa10(%rip), %r12       # 0x3014
pushq $0x1
popq %r13
leaq 0xa0c(%rip), %r15       # 0x301b
xorl %r14d, %r14d
movq (%rbx), %rdi
cmpb $0x2d, (%rdi)
jne 0x265f
cmpb $0x2d, 0x1(%rdi)
jne 0x265f
movq %r12, %rsi
callq 0x21d0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leaq (%rbx,%rcx,8), %rbx
movl 0x14(%rsp), %eax
cmovel %r13d, %eax
movl %eax, 0x14(%rsp)
subl %ecx, %ebp
movq (%rbx), %rdi
movq %r15, %rsi
callq 0x21d0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmovel %r13d, %r14d
subl %ecx, %ebp
leaq (%rbx,%rcx,8), %rbx
jmp 0x2612
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x2220
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x28(%rsp), %r13
movl %ebp, %eax
movq %rax, 0x18(%rsp)
leaq 0x20(%rsp), %rbp
leaq 0x80(%rsp), %r12
cmpl %r15d, 0x18(%rsp)
je 0x2760
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r13)
movups %xmm0, 0x10(%r13)
movups %xmm0, (%r13)
leaq 0x68(%rsp), %rax
movq %rax, 0x58(%rsp)
andq $0x0, 0x60(%rsp)
movb $0x0, 0x68(%rsp)
movq (%rbx,%r15,8), %rax
movq %rax, 0x20(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x78(%rsp)
movl %r14d, 0x7c(%rsp)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x2040
movq 0x8(%rsp), %rdi
leaq -0x2b4(%rip), %rsi      # 0x2437
leaq -0x25f(%rip), %rdx      # 0x2493
callq 0x2140
movq 0x8(%rsp), %rdi
leaq -0x24e(%rip), %rsi      # 0x24b5
callq 0x2190
movq 0x20(%rsp), %rsi
movq %r12, %rdi
pushq $0x8
popq %rdx
callq 0x2260
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xa0(%rsp,%rax)
jne 0x273e
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x24ef
leaq 0x8(%rsp), %rdi
callq 0x2982
movq %r12, %rdi
callq 0x2050
movq %rbp, %rdi
callq 0x298c
incq %r15
jmp 0x268a
leaq 0x8(%rsp), %rdi
callq 0x29b0
xorl %eax, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2792
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x2050
jmp 0x2795
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x298c
leaq 0x8(%rsp), %rdi
callq 0x29b0
movq %rbx, %rdi
callq 0x2230