// File: /workspace/github_cpp_makefile_star2_O2/pstuifzand[P]magento-tools/src/magento-modules.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::ROOT:
            break;
        case State::IN_CONFIG:
            if (strcmp(name, "config") == 0) data->state = State::ROOT;
            data->state = State::ROOT;
            break;
        case State::IN_MODULES:
            if (strcmp(name, "modules") == 0) data->state = State::IN_CONFIG;
            break;
        case State::IN_MODULE:
            // output module info
            std::cout << std::setw(30) << std::left << data->current_name;
            std::cout << std::setw(6) << std::left << (data->active ? "true" : "false");
            std::cout << std::setw(10) << std::left << data->codepool;
            std::cout << data->filename << "\n";
            data->state = State::IN_MODULES;
            break;
        case State::IN_ACTIVE:
            if (strcmp(name, "active") == 0) data->state = State::IN_MODULE;
            data->active = strcmp("true", data->current_text.c_str()) == 0;
            data->current_text.clear();
            break;
        case State::IN_CODEPOOL:
            if (strcmp(name, "codePool") == 0) data->state = State::IN_MODULE;
            data->codepool = data->current_text;
            data->current_text.clear();
            break;
        case State::IN_DEPENDS:
            if (strcmp(name, "depends") == 0) data->state = State::IN_MODULE;
            break;
    }
}

// Assembly:
movl (%rdi), %eax
addl $-0x2, %eax
cmpl $0x5, %eax
ja 0x262b
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xb81(%rip), %rcx       # 0x3014
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, (%rbx)
jmp 0x2627
leaq 0xbd7(%rip), %rax       # 0x3085
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x24c3
movl $0x4, (%rbx)
leaq 0x30(%rbx), %rsi
leaq 0x58(%rbx), %rdi
callq 0x20b0
andq $0x0, 0x38(%rbx)
movq 0x30(%rbx), %rax
movb $0x0, (%rax)
jmp 0x2627
movq 0x2ae8(%rip), %r14      # 0x4fd0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0x1e, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl $0xffffff4f, %ebp       # imm = 0xFFFFFF4F
movl 0x18(%r14,%rax), %ecx
andl %ebp, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
leaq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x2130
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0x6, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl %ebp, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
leaq 0xb50(%rip), %rax       # 0x3096
leaq 0xb4e(%rip), %rsi       # 0x309b
cmpb $0x0, 0x50(%rbx)
cmovneq %rax, %rsi
movq %r14, %rdi
callq 0x2160
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xa, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
andl 0x18(%r14,%rax), %ebp
orl $0x20, %ebp
movl %ebp, 0x18(%r14,%rax)
leaq 0x58(%rbx), %rsi
movq %r14, %rdi
callq 0x2130
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x2160
leaq 0xb04(%rip), %rsi       # 0x30a1
movq %rax, %rdi
callq 0x2160
movl $0x3, (%rbx)
jmp 0x2627
leaq 0xaca(%rip), %rax       # 0x307e
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x25c9
movl $0x4, (%rbx)
movq 0x30(%rbx), %r14
leaq 0xac2(%rip), %rdi       # 0x3096
movq %r14, %rsi
callq 0x21b0
testl %eax, %eax
sete 0x50(%rbx)
andq $0x0, 0x38(%rbx)
movb $0x0, (%r14)
jmp 0x2627
leaq 0xab7(%rip), %rax       # 0x30ab
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x2627
movl $0x2, (%rbx)
jmp 0x2627
leaq 0xa7c(%rip), %rax       # 0x308e
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x2627
movl $0x4, (%rbx)
popq %rbx
popq %r14
popq %rbp
retq