// File: /workspace/github_cpp_makefile_star2_O2/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 $0x88, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xd07(%rip), %rsi       # 0x2004
movq %r14, %rdi
callq 0x1130
testl %eax, %eax
je 0x1421
leaq 0xcf7(%rip), %rsi       # 0x200b
movq %r14, %rdi
callq 0x1130
testl %eax, %eax
jne 0x1428
cmpl $0x0, 0x8(%rbx)
jne 0x1428
movq %rbx, (%rsp)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %r14d, %r14d
movb %r14b, (%rax)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %r14b, (%rax)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %r14b, (%rax)
leaq 0x78(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %r14b, (%rax)
addq $0x8, %r12
leaq 0xc8d(%rip), %rbp       # 0x2011
leaq 0xc8b(%rip), %r13       # 0x2016
xorl %ebx, %ebx
movq -0x8(%r12), %r15
testq %r15, %r15
je 0x143a
movq %r15, %rdi
movq %rbp, %rsi
callq 0x1130
testl %eax, %eax
je 0x13f5
movq %r15, %rdi
movq %r13, %rsi
callq 0x1130
testl %eax, %eax
je 0x1408
movq %r15, %rdi
leaq 0xc58(%rip), %rsi       # 0x201b
callq 0x1130
leaq 0x48(%rsp), %rdi
testl %eax, %eax
je 0x13ea
cmpb $0x61, (%r15)
jne 0x1418
cmpb $0x73, 0x1(%r15)
jne 0x1418
cmpb $0x0, 0x2(%r15)
leaq 0x68(%rsp), %rdi
jne 0x1418
movq (%r12), %rsi
callq 0x11a0
jmp 0x1418
movq (%r12), %rsi
movb $0x1, %r14b
leaq 0x8(%rsp), %rdi
callq 0x11a0
jmp 0x1418
movq (%r12), %rsi
movb $0x1, %bl
leaq 0x28(%rsp), %rdi
callq 0x11a0
addq $0x10, %r12
jmp 0x138d
movl $0x1, 0x8(%rbx)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b8f(%rip), %rdi      # 0x3fd0
leaq 0x8(%rsp), %rsi
callq 0x10c0
movq (%rsp), %r15
leaq 0xc0c(%rip), %rsi       # 0x2062
movq %rax, %rdi
callq 0x10e0
movq %rax, %rdi
leaq 0x28(%rsp), %rsi
callq 0x10c0
leaq 0xbf0(%rip), %rsi       # 0x2062
movq %rax, %rdi
callq 0x10e0
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x10c0
leaq 0xbd4(%rip), %rsi       # 0x2062
movq %rax, %rdi
callq 0x10e0
movq %rax, %rdi
leaq 0x48(%rsp), %rsi
callq 0x10c0
leaq 0xb92(%rip), %rsi       # 0x203c
movq %rax, %rdi
callq 0x10e0
testb $0x1, %bl
jne 0x14d5
movq (%r15), %rsi
movq 0x2b2f(%rip), %rdi      # 0x3ff0
callq 0x10e0
leaq 0xb57(%rip), %rsi       # 0x2024
movq %rax, %rdi
callq 0x10e0
testb $0x1, %r14b
jne 0x14f9
movq (%r15), %rsi
movq 0x2b0b(%rip), %rdi      # 0x3ff0
callq 0x10e0
leaq 0xb4d(%rip), %rsi       # 0x203e
movq %rax, %rdi
callq 0x10e0
leaq 0x8(%rsp), %rdi
callq 0x173a
jmp 0x1428
jmp 0x150a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x173a
movq %rbx, %rdi
callq 0x1170