// File: /workspace/github_cpp_makefile_star2_O3/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 0x15a6
leaq 0xce7(%rip), %rsi       # 0x200b
movq %r15, %rdi
callq 0x1130
testl %eax, %eax
jne 0x15ad
cmpl $0x0, 0x8(%rbx)
jne 0x15ad
movq %rbx, 0x88(%rsp)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
xorl %edx, %edx
movq %rdx, -0x8(%r15)
movb %dl, (%r15)
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rdx, -0x8(%r12)
movb %dl, (%r12)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rdx, -0x8(%rax)
movb %dl, (%rax)
leaq 0x78(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rdx, -0x8(%rax)
movb %dl, (%rax)
movq (%r14), %r13
movq %r15, %rsi
movl $0x0, %ebx
movl $0x0, %ebp
testq %r13, %r13
je 0x14d8
leaq 0x48(%rsp), %r12
addq $0x8, %r14
xorl %ebp, %ebp
xorl %ebx, %ebx
movq %r13, %rdi
leaq 0xc58(%rip), %rsi       # 0x2011
callq 0x1130
testl %eax, %eax
je 0x1462
movq %r13, %rdi
leaq 0xc46(%rip), %rsi       # 0x2016
callq 0x1130
testl %eax, %eax
je 0x148b
movq %r13, %rdi
leaq 0xc34(%rip), %rsi       # 0x201b
callq 0x1130
leaq 0x50(%rsp), %rcx
movq %r12, %r15
testl %eax, %eax
je 0x1423
cmpb $0x61, (%r13)
jne 0x14b3
cmpb $0x73, 0x1(%r13)
jne 0x14b3
cmpb $0x0, 0x2(%r13)
leaq 0x70(%rsp), %rcx
leaq 0x68(%rsp), %r15
jne 0x14b3
movq (%r14), %r13
movq %rbx, 0x90(%rsp)
movq %r12, %rbx
movq %rbp, %r12
movq (%rcx), %rbp
movq %r13, %rdi
callq 0x1080
movq %r15, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %r12, %rbp
movq %rbx, %r12
movq 0x90(%rsp), %rbx
movq %r13, %rcx
movq %rax, %r8
callq 0x1150
jmp 0x14b3
movq (%r14), %r15
movq 0x10(%rsp), %r13
movq %r15, %rdi
callq 0x1080
movb $0x1, %bl
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x1150
jmp 0x14b3
movq (%r14), %r15
movq 0x30(%rsp), %r13
movq %r15, %rdi
callq 0x1080
movb $0x1, %bpl
leaq 0x28(%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 0x13af
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %r15
leaq 0x38(%rsp), %r12
movq 0x2af1(%rip), %rdi      # 0x3fd0
callq 0x10f0
movq 0x88(%rsp), %r13
movq %rax, %r14
leaq 0xb6c(%rip), %rsi       # 0x2062
movl $0x1, %edx
movq %rax, %rdi
callq 0x10f0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r14, %rdi
callq 0x10f0
movq %rax, %r14
leaq 0xb43(%rip), %rsi       # 0x2062
movl $0x1, %edx
movq %rax, %rdi
callq 0x10f0
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq %r14, %rdi
callq 0x10f0
movq %rax, %r14
leaq 0xb1a(%rip), %rsi       # 0x2062
movl $0x1, %edx
movq %rax, %rdi
callq 0x10f0
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %r14, %rdi
callq 0x10f0
leaq 0xace(%rip), %rsi       # 0x203c
movl $0x1, %edx
movq %rax, %rdi
callq 0x10f0
testb $0x1, %bpl
jne 0x15f5
movq (%r13), %r14
testq %r14, %r14
je 0x15bf
movq %r14, %rdi
callq 0x1080
movq 0x2a57(%rip), %rdi      # 0x3ff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x10f0
jmp 0x15dd
movl $0x1, 0x8(%rbx)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2a2a(%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 0x2a0c(%rip), %rdi      # 0x3ff0
leaq 0xa39(%rip), %rsi       # 0x2024
movl $0x19, %edx
callq 0x10f0
testb $0x1, %bl
jne 0x1655
movq (%r13), %rbx
testq %rbx, %rbx
je 0x161f
movq %rbx, %rdi
callq 0x1080
movq 0x29de(%rip), %rdi      # 0x3ff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x10f0
jmp 0x163d
movq 0x29ca(%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 0x29ac(%rip), %rdi      # 0x3ff0
leaq 0x9f3(%rip), %rsi       # 0x203e
movl $0x19, %edx
callq 0x10f0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x1671
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x10d0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x168d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x10d0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x16a4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x10d0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x15ad
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x10d0
jmp 0x15ad
jmp 0x16c6
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1974
movq %rbx, %rdi
callq 0x1190