// File: /workspace/github_cpp_makefile_star2_O1/jpcima[P]faustmd/metadata.cpp
// Function: extract_metadata(pugi::xml_document const&, Metadata&)
int extract_metadata(const pugi::xml_document &doc, Metadata &md)
{
    pugi::xml_node root = doc.child("faust");

    md.name = root.child_value("name");
    md.author = root.child_value("author");
    md.copyright = root.child_value("copyright");
    md.license = root.child_value("license");
    md.version = root.child_value("version");
    md.classname = root.child_value("classname");
    md.inputs = std::stoi(root.child_value("inputs"));
    md.outputs = std::stoi(root.child_value("outputs"));

    for (pugi::xml_node meta : root.children("meta")) {
        std::string key = meta.attribute("key").value();
        std::string value = meta.child_value();
        md.metadata.emplace_back(key, value);
    }

    for (pugi::xml_node node : root.child("ui").child("activewidgets").children("widget")) {
        if (extract_widget(node, true, md) == -1)
            return -1;
    }

    for (pugi::xml_node node : root.child("ui").child("passivewidgets").children("widget")) {
        if (extract_widget(node, false, md) == -1)
            return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %r13
leaq 0x17e23(%rip), %rsi     # 0x2f3d6
callq 0x1bc36
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
leaq 0x1bcd3(%rip), %rsi     # 0x3329a
movq %r14, %rdi
callq 0x1bfe0
movq %rax, %rbx
movq 0x8(%r13), %r15
movq %rax, %rdi
callq 0x51a0
movq %r13, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x55d0
leaq 0x18d00(%rip), %rsi     # 0x302f8
movq %r14, %rdi
callq 0x1bfe0
movq %rax, %rbx
leaq 0x20(%r13), %r15
movq 0x28(%r13), %r12
movq %rax, %rdi
callq 0x51a0
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x55d0
leaq 0x18cd2(%rip), %rsi     # 0x302ff
movq %r14, %rdi
callq 0x1bfe0
movq %rax, %rbx
leaq 0x40(%r13), %r15
movq 0x48(%r13), %r12
movq %rax, %rdi
callq 0x51a0
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x55d0
leaq 0x18ca7(%rip), %rsi     # 0x30309
movq %r14, %rdi
callq 0x1bfe0
movq %rax, %rbx
leaq 0x60(%r13), %r15
movq 0x68(%r13), %r12
movq %rax, %rdi
callq 0x51a0
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x55d0
leaq 0x18c7a(%rip), %rsi     # 0x30311
movq %r14, %rdi
callq 0x1bfe0
movq %rax, %rbx
leaq 0x80(%r13), %r15
movq 0x88(%r13), %r12
movq %rax, %rdi
callq 0x51a0
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x55d0
leaq 0x18c47(%rip), %rsi     # 0x30319
movq %r14, %rdi
callq 0x1bfe0
movq %rax, %rbx
leaq 0xa0(%r13), %r15
movq 0xa8(%r13), %r12
movq %rax, %rdi
callq 0x51a0
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x55d0
leaq 0x18c16(%rip), %rsi     # 0x30323
movq %r14, %rdi
callq 0x1bfe0
leaq 0x58(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
movq 0x58(%rsp), %rbx
callq 0x5070
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x5540
cmpq %rbx, (%r15)
je 0x17b4c
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x17b58
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x17b58
testl %ecx, %ecx
jne 0x17779
movl %ebp, (%r14)
movl %eax, 0xd8(%r13)
leaq 0x68(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x1779c
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x18b87(%rip), %rsi     # 0x3032a
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
leaq 0x58(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
movq 0x58(%rsp), %rbx
movl (%r14), %ebp
movl $0x0, (%r14)
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x5540
cmpq %rbx, (%r15)
je 0x17b64
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%rax), %rdx
cmpq %rcx, %rdx
jb 0x17b70
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x17b70
testl %ecx, %ecx
jne 0x17819
movl %ebp, (%r14)
movq %r13, 0x50(%rsp)
movl %eax, 0xdc(%r13)
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x1783c
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x18af0(%rip), %rdx     # 0x30333
leaq 0x58(%rsp), %rbx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1bbf6
movq 0x10(%rbx), %rax
leaq 0xb0(%rsp), %rdi
movq %rax, 0x10(%rdi)
movups (%rbx), %xmm0
movaps %xmm0, (%rdi)
movq 0x28(%rbx), %rax
leaq 0x90(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x18(%rbx), %xmm0
movaps %xmm0, (%rsi)
callq 0x20b60
testb %al, %al
je 0x17973
movq 0x50(%rsp), %rax
leaq 0xc0(%rax), %r14
leaq 0xb0(%rsp), %r15
leaq 0x88(%rsp), %r13
leaq 0x30(%rsp), %rbp
leaq 0x10(%rsp), %rbx
leaq 0x7(%rsp), %r12
movq %r15, %rdi
callq 0x20b76
movq (%rax), %rax
movq %rax, 0x88(%rsp)
movq %r13, %rdi
leaq 0x17beb(%rip), %rsi     # 0x2f4c2
callq 0x1bd78
movq %rax, 0x30(%rsp)
movq %rbp, %rdi
callq 0x1b388
movq %rbx, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x762e
movq %r13, %rdi
callq 0x1bf94
movq %rbp, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x762e
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x1aa42
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x17937
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x17953
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
movq %r15, %rdi
callq 0x20bca
movq %r15, %rdi
leaq 0x90(%rsp), %rsi
callq 0x20b60
testb %al, %al
jne 0x178ba
leaq 0x17a7b(%rip), %rsi     # 0x2f3f5
leaq 0x8(%rsp), %rdi
callq 0x1bc36
leaq 0x30(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x17a65(%rip), %rsi     # 0x2f3f8
movq %rbx, %rdi
callq 0x1bc36
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
leaq 0x17a5c(%rip), %rdx     # 0x2f406
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1bbf6
movq 0x10(%r15), %rax
movq %rax, 0x10(%r14)
movups (%r15), %xmm0
movaps %xmm0, (%r14)
movq 0x28(%r15), %rax
movq %rax, 0x10(%rbx)
movups 0x18(%r15), %xmm0
movaps %xmm0, (%rbx)
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x20b60
testb %al, %al
movq 0x50(%rsp), %r12
je 0x17a60
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x20b76
movq (%rax), %rdi
movl $0x1, %esi
movq %r12, %rdx
callq 0x17c08
cmpl $-0x1, %eax
je 0x17a53
leaq 0x10(%rsp), %r14
leaq 0x30(%rsp), %r15
movq %r14, %rdi
callq 0x20bca
movq %r14, %rdi
movq %r15, %rsi
callq 0x20b60
testb %al, %al
je 0x17a60
movl %eax, %ebx
movq %r14, %rdi
callq 0x20b76
movq (%rax), %rdi
movl $0x1, %esi
movq %r12, %rdx
callq 0x17c08
cmpl $-0x1, %eax
jne 0x17a1d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %bl, %bl
jne 0x17b3a
leaq 0x1798e(%rip), %rsi     # 0x2f3f5
leaq 0x8(%rsp), %rdi
callq 0x1bc36
leaq 0x30(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x17995(%rip), %rsi     # 0x2f415
movq %rbx, %rdi
callq 0x1bc36
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
leaq 0x1796f(%rip), %rdx     # 0x2f406
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1bbf6
movq 0x10(%r15), %rax
movq %rax, 0x10(%r14)
movups (%r15), %xmm0
movaps %xmm0, (%r14)
movq 0x28(%r15), %rax
movq %rax, 0x10(%rbx)
movups 0x18(%r15), %xmm0
movaps %xmm0, (%rbx)
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x20b60
movl %eax, %ebx
testb %al, %al
je 0x17b35
leaq 0x10(%rsp), %rdi
callq 0x20b76
movq (%rax), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x17c08
cmpl $-0x1, %eax
je 0x17b35
leaq 0x10(%rsp), %r14
leaq 0x30(%rsp), %r15
movq %r14, %rdi
callq 0x20bca
movq %r14, %rdi
movq %r15, %rsi
callq 0x20b60
movl %eax, %ebx
testb %al, %al
je 0x17b35
movq %r14, %rdi
callq 0x20b76
movq (%rax), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x17c08
cmpl $-0x1, %eax
jne 0x17b02
movzbl %bl, %eax
negl %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18c4f(%rip), %rdi     # 0x307a2
callq 0x5220
leaq 0x18c43(%rip), %rdi     # 0x307a2
callq 0x5590
leaq 0x18c37(%rip), %rdi     # 0x307a2
callq 0x5220
leaq 0x18c2b(%rip), %rdi     # 0x307a2
callq 0x5590
jmp 0x17bb9
jmp 0x17bb9
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x17b8c
movl %ebp, (%r14)
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
jne 0x17bb2
jmp 0x17c00
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x17ba4
movl %ebp, (%r14)
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17c00
movq 0x68(%rsp), %rsi
jmp 0x17bf8
movq %rax, %rbx
jmp 0x17c00
jmp 0x17bc0
movq %rax, %rbx
jmp 0x17be4
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x17be4
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x17c00
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
movq %rbx, %rdi
callq 0x56d0