// File: /workspace/github_cpp_makefile_star2_O1/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 0x26fa
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xb2a(%rip), %rcx       # 0x3014
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb7d(%rip), %rax       # 0x3077
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x250f
movl $0x1, (%rbx)
movl $0x1, (%rbx)
jmp 0x26f0
leaq 0xb64(%rip), %rax       # 0x3085
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x2536
movl $0x4, (%rbx)
leaq 0x30(%rbx), %rsi
leaq 0x58(%rbx), %rdi
callq 0x20b0
movq $0x0, 0x38(%rbx)
movq 0x30(%rbx), %rax
movb $0x0, (%rax)
jmp 0x26f0
movq 0x2a72(%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)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
movq %r14, %rdi
callq 0x2170
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)
movzbl 0x50(%rbx), %edx
leaq 0xad2(%rip), %rax       # 0x3096
leaq 0xad0(%rip), %rsi       # 0x309b
testq %rdx, %rdx
cmovneq %rax, %rsi
xorq $0x5, %rdx
movq %r14, %rdi
callq 0x2170
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)
movq 0x58(%rbx), %rsi
movq 0x60(%rbx), %rdx
movq %r14, %rdi
callq 0x2170
movq 0x8(%rbx), %r15
testq %r15, %r15
je 0x26ba
movq %r15, %rdi
callq 0x20a0
movq 0x29a5(%rip), %rdi      # 0x4fd0
movq %r15, %rsi
movq %rax, %rdx
callq 0x2170
jmp 0x26d2
leaq 0xa3c(%rip), %rax       # 0x307e
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x2657
movl $0x4, (%rbx)
movq 0x30(%rbx), %r14
leaq 0xa34(%rip), %rdi       # 0x3096
movq %r14, %rsi
callq 0x21b0
testl %eax, %eax
sete 0x50(%rbx)
movq $0x0, 0x38(%rbx)
movb $0x0, (%r14)
jmp 0x26f0
leaq 0xa26(%rip), %rax       # 0x30ab
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x26f0
movl $0x2, (%rbx)
jmp 0x26f0
leaq 0x9eb(%rip), %rax       # 0x308e
movq %rsi, %rdi
movq %rax, %rsi
callq 0x21b0
testl %eax, %eax
jne 0x26f0
movl $0x4, (%rbx)
jmp 0x26f0
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2230
movq 0x28f7(%rip), %rdi      # 0x4fd0
leaq 0x9c1(%rip), %rsi       # 0x30a1
movl $0x1, %edx
callq 0x2170
movl $0x3, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq