// File: /workspace/github_cpp_makefile_star2_O3/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 $0x278, %rsp            # imm = 0x278
movl %edi, %ebp
decl %ebp
je 0x288f
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
addq $0x8, %rbx
xorl %r13d, %r13d
cmpb $0x2d, (%rdi)
jne 0x2769
xorl %r12d, %r12d
movl $0x1, %r14d
leaq 0x8fe(%rip), %r15       # 0x301b
xorl %r13d, %r13d
cmpb $0x2d, 0x1(%rdi)
jne 0x276c
leaq 0x8e7(%rip), %rsi       # 0x3014
callq 0x21b0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leaq (%rbx,%rcx,8), %rbx
cmovel %r14d, %r13d
subl %ecx, %ebp
movq (%rbx), %rdi
movq %r15, %rsi
callq 0x21b0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmovel %r14d, %r12d
subl %ecx, %ebp
leaq (%rbx,%rcx,8), %rbx
movq (%rbx), %rdi
cmpb $0x2d, (%rdi)
je 0x2720
jmp 0x276c
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x2210
movq %rax, %r14
movq %rax, 0x8(%rsp)
testl %ebp, %ebp
je 0x2887
leaq 0x18(%rsp), %r15
movl %ebp, %eax
movq %rax, (%rsp)
xorl %ebp, %ebp
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
movb $0x0, 0x58(%rsp)
movq (%rbx,%rbp,8), %rax
movq %rax, 0x10(%rsp)
movl %r13d, 0x68(%rsp)
movl %r12d, 0x6c(%rsp)
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2050
movq %r14, %rdi
leaq -0x33b(%rip), %rsi      # 0x24a8
leaq -0x2de(%rip), %rdx      # 0x250c
callq 0x2120
movq %r14, %rdi
leaq -0x2ae(%rip), %rsi      # 0x254b
callq 0x2180
movq 0x10(%rsp), %rsi
leaq 0x70(%rsp), %rdi
movl $0x8, %edx
callq 0x2250
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x90(%rsp,%rax)
jne 0x2839
leaq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x2588
movq %r14, %rdi
xorl %esi, %esi
callq 0x2150
leaq 0x70(%rsp), %rdi
callq 0x2060
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x2869
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x30(%rsp), %rdi
callq 0x2b4a
movq %r15, %rdi
callq 0x2b4a
incq %rbp
cmpl %ebp, (%rsp)
jne 0x2790
movq %r14, %rdi
callq 0x2100
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x28d3
jmp 0x28b6
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x2060
jmp 0x28b9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2b0c
movq %r14, %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x2b3e