// File: /workspace/github_cpp_makefile_star2_O1/pstuifzand[P]magento-tools/src/block-lister.cpp
// Function: root_start_element_handler(void*, char const*, char const**)
void root_start_element_handler(void* udata, const XML_Char* name, const XML_Char** atts)
{
    user_data* data = (user_data*)udata;

    if (strcmp(name, "action") == 0) {
        data->in_action = 1;
    }
    else if (strcmp(name, "block") == 0) {
        if (data->in_action) return;

        bool type_found = false;
        bool name_found = false;

        Block block;

        while (*atts) {
            if (strcmp(*atts, "type") == 0) {
                ++atts;
                block.type = *atts;
                type_found = true;
            }
            else if (strcmp(*atts, "name") == 0) {
                ++atts;
                block.name = *atts;
                name_found = true;
            }
            else if (strcmp(*atts, "template") == 0) {
                ++atts;
                block.tmpl = *atts;
            }
            else if (strcmp(*atts, "as") == 0) {
                ++atts;
                block.as = *atts;
            }
            else {
                ++atts;
            }

            ++atts;
        }

        std::cout << block.type << " " << block.name << " " << block.as << " " << block.tmpl << "\n";

        if (!name_found) {
            std::cerr << data->filename << ": No name found in block\n";
        }

        if (!type_found) {
            std::cerr << data->filename << ": No type found in block\n";
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xcf7(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x1130
testl %eax, %eax
je 0x159e
leaq 0xce7(%rip), %rsi       # 0x200b
movq %r15, %rdi
callq 0x1130
testl %eax, %eax
jne 0x15a5
cmpl $0x0, 0x8(%rbx)
jne 0x15a5
movq %rbx, 0x90(%rsp)
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
xorl %ebx, %ebx
movq %rbx, -0x8(%r15)
movb %bl, (%r15)
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rbx, -0x8(%r12)
movb %bl, (%r12)
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbx, -0x8(%rax)
movb %bl, (%rax)
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbx, -0x8(%rax)
movb %bl, (%rax)
movq (%r14), %r13
movl $0x0, %eax
movq %rax, (%rsp)
testq %r13, %r13
je 0x14c6
addq $0x8, %r14
movq $0x0, (%rsp)
leaq 0xc5d(%rip), %rbx       # 0x2011
leaq 0xc5b(%rip), %rbp       # 0x2016
movq $0x0, 0x8(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1130
testl %eax, %eax
je 0x144d
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1130
testl %eax, %eax
je 0x147b
movq %r13, %rdi
leaq 0xc2b(%rip), %rsi       # 0x201b
callq 0x1130
leaq 0x58(%rsp), %rcx
leaq 0x50(%rsp), %r15
testl %eax, %eax
je 0x1424
movq %r13, %rdi
leaq 0xc17(%rip), %rsi       # 0x2024
callq 0x1130
leaq 0x78(%rsp), %rcx
leaq 0x70(%rsp), %r15
testl %eax, %eax
jne 0x14a6
movq (%r14), %r13
movq %rbp, %r12
movq (%rcx), %rbp
movq %r13, %rdi
callq 0x1080
movq %r15, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %r12, %rbp
movq %r13, %rcx
movq %rax, %r8
callq 0x1150
jmp 0x14a6
movq (%r14), %r15
movq 0x18(%rsp), %r13
movq %r15, %rdi
callq 0x1080
movb $0x1, %cl
movq %rcx, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x1150
jmp 0x14a6
movq (%r14), %r15
movq 0x38(%rsp), %r13
movq %r15, %rdi
callq 0x1080
movb $0x1, %cl
movq %rcx, (%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x1150
movq 0x8(%r14), %r13
addq $0x10, %r14
testq %r13, %r13
jne 0x13c4
leaq 0x20(%rsp), %r15
leaq 0x40(%rsp), %r12
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x2af9(%rip), %rdi      # 0x3fd0
callq 0x10f0
movq 0x90(%rsp), %r13
movq %rax, %r14
leaq 0xb77(%rip), %rsi       # 0x2065
movl $0x1, %edx
movq %rax, %rdi
callq 0x10f0
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r14, %rdi
callq 0x10f0
movq %rax, %r14
leaq 0xb4e(%rip), %rsi       # 0x2065
movl $0x1, %edx
movq %rax, %rdi
callq 0x10f0
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq %r14, %rdi
callq 0x10f0
movq %rax, %r14
leaq 0xb25(%rip), %rsi       # 0x2065
movl $0x1, %edx
movq %rax, %rdi
callq 0x10f0
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq %r14, %rdi
callq 0x10f0
leaq 0xad9(%rip), %rsi       # 0x203f
movl $0x1, %edx
movq %rax, %rdi
callq 0x10f0
testb $0x1, (%rsp)
jne 0x15ed
movq (%r13), %r14
testq %r14, %r14
je 0x15b7
movq %r14, %rdi
callq 0x1080
movq 0x2a5f(%rip), %rdi      # 0x3ff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x10f0
jmp 0x15d5
movl $0x1, 0x8(%rbx)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2a32(%rip), %rax      # 0x3ff0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
leaq (%rax,%rcx), %rdi
movl 0x20(%rax,%rcx), %esi
orl $0x1, %esi
callq 0x1160
movq 0x2a14(%rip), %rdi      # 0x3ff0
leaq 0xa44(%rip), %rsi       # 0x2027
movl $0x19, %edx
callq 0x10f0
testb $0x1, %bl
jne 0x164d
movq (%r13), %rbx
testq %rbx, %rbx
je 0x1617
movq %rbx, %rdi
callq 0x1080
movq 0x29e6(%rip), %rdi      # 0x3ff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x10f0
jmp 0x1635
movq 0x29d2(%rip), %rax      # 0x3ff0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
leaq (%rax,%rcx), %rdi
movl 0x20(%rax,%rcx), %esi
orl $0x1, %esi
callq 0x1160
movq 0x29b4(%rip), %rdi      # 0x3ff0
leaq 0x9fe(%rip), %rsi       # 0x2041
movl $0x19, %edx
callq 0x10f0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x166f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x10d0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x168b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x10d0
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x16a2
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x10d0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x15a5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x10d0
jmp 0x15a5
jmp 0x16c4
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x19a8
movq %rbx, %rdi
callq 0x1190