// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movl (%rdi), %r15d
cmpq $0xa, %r15
ja 0x15e6
movq %rsi, %r14
movq %rdi, %rbx
movl $0x124, %eax            # imm = 0x124
btl %r15d, %eax
jb 0x157e
movl $0x248, %eax            # imm = 0x248
btl %r15d, %eax
jb 0x15d9
movl $0x490, %eax            # imm = 0x490
btl %r15d, %eax
jae 0x15e6
leaq 0xb46(%rip), %rdi       # 0x2024
movq %r14, %rsi
callq 0x1160
testl %eax, %eax
jne 0x15e6
leaq 0xbf7(%rip), %rax       # 0x20ec
movslq (%rax,%r15,4), %rsi
addq %rax, %rsi
movq 0x2acd(%rip), %rdi      # 0x3fd0
callq 0x1110
leaq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x10f0
leaq 0xb0f(%rip), %rsi       # 0x202a
movq %rax, %rdi
callq 0x1110
leaq 0x28(%rbx), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x10f0
leaq 0xaf6(%rip), %rsi       # 0x202f
movq %rax, %rdi
callq 0x1110
movslq 0x50(%rbx), %rcx
leaq 0xbcc(%rip), %rdx       # 0x2118
movslq (%rdx,%rcx,4), %rsi
addq %rdx, %rsi
movq %rax, %rdi
callq 0x1110
leaq 0xad0(%rip), %rsi       # 0x2032
movq %rax, %rdi
callq 0x1110
leaq 0xac3(%rip), %rsi       # 0x2034
movq %r14, %rdi
callq 0x11d0
movslq (%rbx), %r15
jmp 0x15d9
leaq 0xa89(%rip), %rdi       # 0x200e
movq %r14, %rsi
callq 0x1160
testl %eax, %eax
jne 0x159f
leaq 0xb28(%rip), %rax       # 0x20c0
movl (%rax,%r15,4), %r15d
movl %r15d, (%rbx)
leaq 0xa70(%rip), %rdi       # 0x2016
movq %r14, %rsi
callq 0x1160
testl %eax, %eax
jne 0x15c3
movslq %r15d, %rax
leaq 0xb04(%rip), %rcx       # 0x20c0
movl (%rcx,%rax,4), %r15d
movl %r15d, (%rbx)
leaq 0xa53(%rip), %rdi       # 0x201d
movq %r14, %rsi
callq 0x1160
testl %eax, %eax
jne 0x15e6
movslq %r15d, %r15
leaq 0xae0(%rip), %rax       # 0x20c0
movl (%rax,%r15,4), %eax
movl %eax, (%rbx)
popq %rbx
popq %r14
popq %r15
retq