// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
pushq %rax
movl (%rdi), %r15d
cmpq $0xa, %r15
ja 0x2684
movq %rsi, %r14
movq %rdi, %rbx
movl $0x124, %eax            # imm = 0x124
btl %r15d, %eax
jb 0x261c
movl $0x248, %eax            # imm = 0x248
btl %r15d, %eax
jb 0x2677
movl $0x490, %eax            # imm = 0x490
btl %r15d, %eax
jae 0x2684
leaq 0xae8(%rip), %rdi       # 0x3024
movq %r14, %rsi
callq 0x2150
testl %eax, %eax
jne 0x2684
leaq 0x27dd(%rip), %rax      # 0x4d30
movq (%rax,%r15,8), %r14
movq %r14, %rdi
callq 0x2090
movq 0x2a6a(%rip), %r15      # 0x4fd0
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2110
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %r15, %rdi
callq 0x2110
movq %rax, %r15
leaq 0xa9c(%rip), %rsi       # 0x302a
movl $0x4, %edx
movq %rax, %rdi
callq 0x2110
leaq 0x28(%rbx), %r14
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
movq %r15, %rdi
callq 0x2110
movq %rax, %r15
leaq 0xa76(%rip), %rsi       # 0x302f
movl $0x2, %edx
movq %rax, %rdi
callq 0x2110
movslq 0x50(%rbx), %rax
leaq 0x27bf(%rip), %rcx      # 0x4d90
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
callq 0x2090
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2110
leaq 0xa40(%rip), %rsi       # 0x3032
movl $0x2, %edx
movq %r15, %rdi
callq 0x2110
movq 0x30(%rbx), %rdx
leaq 0xa2a(%rip), %rcx       # 0x3034
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x2170
movslq (%rbx), %r15
jmp 0x2677
leaq 0x9eb(%rip), %rdi       # 0x300e
movq %r14, %rsi
callq 0x2150
testl %eax, %eax
jne 0x263d
leaq 0xa8a(%rip), %rax       # 0x30c0
movl (%rax,%r15,4), %r15d
movl %r15d, (%rbx)
leaq 0x9d2(%rip), %rdi       # 0x3016
movq %r14, %rsi
callq 0x2150
testl %eax, %eax
jne 0x2661
movslq %r15d, %rax
leaq 0xa66(%rip), %rcx       # 0x30c0
movl (%rcx,%rax,4), %r15d
movl %r15d, (%rbx)
leaq 0x9b5(%rip), %rdi       # 0x301d
movq %r14, %rsi
callq 0x2150
testl %eax, %eax
jne 0x2684
movslq %r15d, %r15
leaq 0xa42(%rip), %rax       # 0x30c0
movl (%rax,%r15,4), %eax
movl %eax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq