// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
leaq 0x15673(%rip), %rsi     # 0x2a4a6
callq 0x184a2
leaq 0x8(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x194e3(%rip), %rsi     # 0x2e32a
movq %rbx, %rdi
callq 0x18864
movq %r15, %rdi
movq %rax, %rsi
callq 0x67e0
leaq 0x16573(%rip), %rsi     # 0x2b3d4
movq %rbx, %rdi
callq 0x18864
leaq 0x20(%r15), %rdi
movq %rax, %rsi
callq 0x67e0
leaq 0x1655f(%rip), %rsi     # 0x2b3db
movq %rbx, %rdi
callq 0x18864
leaq 0x40(%r15), %rdi
movq %rax, %rsi
callq 0x67e0
leaq 0x1654e(%rip), %rsi     # 0x2b3e5
movq %rbx, %rdi
callq 0x18864
leaq 0x60(%r15), %rdi
movq %rax, %rsi
callq 0x67e0
leaq 0x1653b(%rip), %rsi     # 0x2b3ed
movq %rbx, %rdi
callq 0x18864
leaq 0x80(%r15), %rdi
movq %rax, %rsi
callq 0x67e0
leaq 0x16525(%rip), %rsi     # 0x2b3f5
movq %rbx, %rdi
callq 0x18864
leaq 0xa0(%r15), %rdi
movq %rax, %rsi
callq 0x67e0
leaq 0x16511(%rip), %rsi     # 0x2b3ff
movq %rbx, %rdi
callq 0x18864
leaq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rdx
movq %rax, %rsi
callq 0x70be
leaq 0x20(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x17240
movl %eax, 0xd8(%r15)
leaq 0x20(%rsp), %rdi
callq 0x61d0
leaq 0x164d7(%rip), %rsi     # 0x2b406
leaq 0x8(%rsp), %rdi
callq 0x18864
leaq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rdx
movq %rax, %rsi
callq 0x70be
leaq 0x20(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x17240
movl %eax, 0xdc(%r15)
leaq 0x20(%rsp), %rdi
callq 0x61d0
leaq 0x1649d(%rip), %rdx     # 0x2b40f
leaq 0x20(%rsp), %rbx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x18464
movq 0x10(%rbx), %rax
leaq 0xb0(%rsp), %r14
movq %rax, 0x10(%r14)
movups (%rbx), %xmm0
movaps %xmm0, (%r14)
movq 0x28(%rbx), %rax
leaq 0x90(%rsp), %rcx
movq %rax, 0x10(%rcx)
movups 0x18(%rbx), %xmm0
movaps %xmm0, (%rcx)
movq %r15, 0x10(%rsp)
leaq 0xc0(%r15), %r12
leaq 0x18(%rsp), %rbp
leaq 0x70(%rsp), %rbx
leaq 0x50(%rsp), %r13
leaq 0x7(%rsp), %r15
movq %r14, %rdi
leaq 0x90(%rsp), %rsi
callq 0x1c2de
testb %al, %al
je 0x15061
movq %r14, %rdi
callq 0x1c2fe
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq %rbp, %rdi
leaq 0x15592(%rip), %rsi     # 0x2a592
callq 0x185de
movq %rax, 0x70(%rsp)
movq %rbx, %rdi
callq 0x17d46
movq %r13, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x70be
movq %rbp, %rdi
callq 0x18814
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x70be
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x1725c
movq %rbx, %rdi
callq 0x61d0
movq %r13, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x1c352
jmp 0x14fd2
leaq 0x1545d(%rip), %rsi     # 0x2a4c5
leaq 0x8(%rsp), %rdi
callq 0x184a2
leaq 0x70(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x15447(%rip), %rsi     # 0x2a4c8
movq %rbx, %rdi
callq 0x184a2
leaq 0x50(%rsp), %r14
movq %rax, (%r14)
leaq 0x1543e(%rip), %rdx     # 0x2a4d6
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x18464
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)
pushq $0x1
popq %rbp
movq 0x10(%rsp), %r12
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c2de
testb %al, %al
je 0x15107
movq %r14, %rdi
callq 0x1c2fe
movq (%rax), %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x151fb
cmpl $-0x1, %eax
je 0x151ab
movq %r14, %rdi
callq 0x1c352
jmp 0x150d0
leaq 0x153b7(%rip), %rsi     # 0x2a4c5
leaq 0x8(%rsp), %rdi
callq 0x184a2
leaq 0x70(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x153be(%rip), %rsi     # 0x2a4e5
movq %rbx, %rdi
callq 0x184a2
leaq 0x50(%rsp), %r14
movq %rax, (%r14)
leaq 0x15398(%rip), %rdx     # 0x2a4d6
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x18464
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)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c2de
movl %eax, %ebp
testb %al, %al
je 0x151a3
movq %r14, %rdi
callq 0x1c2fe
movq (%rax), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x151fb
cmpl $-0x1, %eax
je 0x151a3
movq %r14, %rdi
callq 0x1c352
jmp 0x1516e
movzbl %bpl, %eax
negl %eax
jmp 0x151ae
pushq $-0x1
popq %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x151c4
jmp 0x151e1
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x151ee
jmp 0x151e1
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x61d0
jmp 0x151e9
jmp 0x151e6
movq %rax, %rbx
jmp 0x151f3
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x61d0
movq %rbx, %rdi
callq 0x6730