// File: pstuifzand[P]magento-tools/src/magento-helpers.cpp
// Function: root_end_element_handler(void*, char const*)
void root_end_element_handler(void* udata, const XML_Char* name) {
    user_data* data = (user_data*)udata;

    switch (data->state) {
        case State::IN_HELPERS:
        case State::IN_MODELS:
        case State::IN_BLOCKS:
            if (strcmp("helpers", name) == 0) data->state = end_element_next_state[int(data->state)];
            if (strcmp("models", name) == 0) data->state = end_element_next_state[int(data->state)];
            if (strcmp("blocks", name) == 0) data->state = end_element_next_state[int(data->state)];
            break;
        case State::IN_HELPER:
        case State::IN_MODEL:
        case State::IN_BLOCK:
            // here is a tag with a variable name
            // expat checks mismatched tags
            data->state = end_element_next_state[int(data->state)];
            break;
        case State::IN_HELPER_CLASS:
        case State::IN_MODEL_CLASS:
        case State::IN_BLOCK_CLASS:
            // where about to leave the <class> block, so print the info we gathered
            if (strcmp("class", name) == 0) {
                std::cout << section_name[int(data->state)] << data->name << " => " << data->current_text << " (" << pool_name[int(data->pool)] << ")\n";
                data->current_text = "";
                data->state = end_element_next_state[int(data->state)];
            }
            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
subl $0x2, %eax
je 0x2663
jmp 0x25f8
movl -0x1c(%rbp), %eax
subl $0x3, %eax
je 0x26ec
jmp 0x2606
movl -0x1c(%rbp), %eax
subl $0x4, %eax
je 0x2708
jmp 0x2614
movl -0x1c(%rbp), %eax
subl $0x5, %eax
je 0x2663
jmp 0x261e
movl -0x1c(%rbp), %eax
subl $0x6, %eax
je 0x26ec
jmp 0x262c
movl -0x1c(%rbp), %eax
subl $0x7, %eax
je 0x2708
jmp 0x263a
movl -0x1c(%rbp), %eax
subl $0x8, %eax
je 0x2663
jmp 0x2644
movl -0x1c(%rbp), %eax
subl $0x9, %eax
je 0x26ec
jmp 0x2652
movl -0x1c(%rbp), %eax
subl $0xa, %eax
je 0x2708
jmp 0x27d4
movq -0x10(%rbp), %rsi
leaq 0x9ac(%rip), %rdi       # 0x301a
callq 0x2190
cmpl $0x0, %eax
jne 0x268f
movq -0x18(%rbp), %rax
movslq (%rax), %rcx
leaq 0xa3a(%rip), %rax       # 0x30c0
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rsi
leaq 0x988(%rip), %rdi       # 0x3022
callq 0x2190
cmpl $0x0, %eax
jne 0x26bb
movq -0x18(%rbp), %rax
movslq (%rax), %rcx
leaq 0xa0e(%rip), %rax       # 0x30c0
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rsi
leaq 0x963(%rip), %rdi       # 0x3029
callq 0x2190
cmpl $0x0, %eax
jne 0x26e7
movq -0x18(%rbp), %rax
movslq (%rax), %rcx
leaq 0x9e2(%rip), %rax       # 0x30c0
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x27d4
movq -0x18(%rbp), %rax
movslq (%rax), %rcx
leaq 0x9c6(%rip), %rax       # 0x30c0
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x27d4
movq -0x10(%rbp), %rsi
leaq 0x91d(%rip), %rdi       # 0x3030
callq 0x2190
cmpl $0x0, %eax
jne 0x27d2
movq -0x18(%rbp), %rax
movslq (%rax), %rcx
leaq 0x29f1(%rip), %rax      # 0x5120
movq (%rax,%rcx,8), %rsi
movq 0x2896(%rip), %rdi      # 0x4fd0
callq 0x2110
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
callq 0x20f0
movq %rax, %rdi
leaq 0x8dd(%rip), %rsi       # 0x3036
callq 0x2110
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x28, %rsi
callq 0x20f0
movq %rax, %rdi
leaq 0x8c3(%rip), %rsi       # 0x303b
callq 0x2110
movq %rax, %rdi
movq -0x18(%rbp), %rax
movslq 0x50(%rax), %rcx
leaq 0x29f1(%rip), %rax      # 0x5180
movq (%rax,%rcx,8), %rsi
callq 0x2110
movq %rax, %rdi
leaq 0x89c(%rip), %rsi       # 0x303e
callq 0x2110
movq -0x18(%rbp), %rdi
addq $0x28, %rdi
leaq 0x88a(%rip), %rsi       # 0x3040
callq 0x2170
movq -0x18(%rbp), %rax
movslq (%rax), %rcx
leaq 0x8f7(%rip), %rax       # 0x30c0
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x27d4
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)