// File: /workspace/github_cpp_makefile_star2_O3/jpcima[P]faustmd/metadata.cpp
// Function: extract_widget(pugi::xml_node, bool, Metadata&)
static int extract_widget(pugi::xml_node node, bool is_active, Metadata &md)
{
    Metadata::Widget w;
    w.type = Metadata::Widget::type_from_name(node.attribute("type").value());
    if (w.type == (Metadata::Widget::Type)-1)
        return -1;

    w.id = std::stoi(node.attribute("id").value());
    w.label = node.child_value("label");
    w.var = node.child_value("varname");

    w.symbol = mangle(w.label);

    if (is_active && (w.type == Metadata::Widget::Type::HSlider ||
                      w.type == Metadata::Widget::Type::VSlider ||
                      w.type == Metadata::Widget::Type::NEntry)) {
        w.init = std::stof(node.child_value("init"));
        w.min = std::stof(node.child_value("min"));
        w.max = std::stof(node.child_value("max"));
        w.step = std::stof(node.child_value("step"));
    }
    else if (is_active && (w.type == Metadata::Widget::Type::Button ||
                           w.type == Metadata::Widget::Type::CheckBox)) {
        w.init = 0;
        w.min = 0;
        w.max = 1;
        w.step = 1;
    }
    else if (!is_active && (w.type == Metadata::Widget::Type::VBarGraph ||
                            w.type == Metadata::Widget::Type::HBarGraph)) {
        w.min = std::stof(node.child_value("min"));
        w.max = std::stof(node.child_value("max"));
    }
    else
        return -1;

    for (pugi::xml_node meta : node.children("meta")) {
        std::string key = meta.attribute("key").value();
        std::string value = meta.child_value();
        if (is_decint_string(key) && value.empty())
            continue;
        w.metadata.emplace_back(key, value);

        if (key == "unit")
            w.unit = value;
        else if (key == "scale") {
            w.scale = Metadata::Widget::scale_from_name(value);
            if (w.scale == (Metadata::Widget::Scale)-1) {
                warns() << "Unrecognized scale type `" << value << "`\n";
                w.scale = Metadata::Widget::Scale::Linear;
            }
        }
        else if (key == "tooltip")
            w.tooltip = value;
        else if (key == "md.symbol")
            w.symbol = mangle(value);
    }

    (is_active ? md.active : md.passive).push_back(std::move(w));
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdx, 0xa8(%rsp)
movl %esi, 0x44(%rsp)
movq %rdi, %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0xd0(%rsp), %rcx
movq %rax, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xf0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x110(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x158(%rsp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, -0x38(%rcx)
movups %xmm0, -0x28(%rcx)
movq %rax, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movl $0x0, 0x10(%rcx)
leaq 0x180(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x1a7eb(%rip), %rsi     # 0x32387
callq 0x1bad4
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
callq 0x1b0dc
xorl %ecx, %ecx
testq %rax, %rax
je 0x17bcb
cmpb $0x0, (%rax,%rcx)
je 0x17bcb
incq %rcx
cmpq $-0x1, %rcx
jne 0x17bb5
movq $-0x1, %rcx
movq %rax, %rsi
addq %rcx, %rsi
movq %rax, %rdi
callq 0x1a4ba
movl %eax, 0xb8(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x18427
leaq 0x165ca(%rip), %rsi     # 0x2e1bf
leaq 0x8(%rsp), %rdi
callq 0x1bad4
leaq 0x48(%rsp), %rdi
movq %rax, (%rdi)
callq 0x1b0dc
leaq 0x10(%rsp), %rdi
leaq 0x88(%rsp), %rdx
movq %rax, %rsi
callq 0x76b4
movq 0x10(%rsp), %r14
callq 0x5070
movq %rax, %r15
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x68(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x5540
cmpq %r14, (%r12)
je 0x1844d
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x18459
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x18459
testl %ecx, %ecx
jne 0x17c74
movl %ebp, (%r15)
movl %eax, 0xbc(%rsp)
leaq 0x20(%rsp), %rbp
movq -0x10(%rbp), %rdi
cmpq %rbp, %rdi
je 0x17c96
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x17b1a(%rip), %rsi     # 0x2f7b7
leaq 0x8(%rsp), %rdi
callq 0x1bd3a
movq %rax, %r14
leaq 0xc0(%rsp), %r12
movq 0x8(%r12), %r13
movq %rax, %rdi
callq 0x51a0
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x55d0
leaq 0x16734(%rip), %rsi     # 0x2e40d
leaq 0x8(%rsp), %rdi
callq 0x1bd3a
movq %rax, %r14
leaq 0xe0(%rsp), %r12
movq 0x8(%r12), %r13
movq %rax, %rdi
callq 0x51a0
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x55d0
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
testq %rdx, %rdx
sete %al
testq %rsi, %rsi
setne %cl
orb %al, %cl
je 0x18448
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x1a707
leaq 0x100(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x5200
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17d68
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
movl 0xb8(%rsp), %eax
cmpb $0x0, 0x44(%rsp)
je 0x17ded
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
ja 0x17e64
leaq 0x17a34(%rip), %rsi     # 0x2f7bd
leaq 0x8(%rsp), %rdi
callq 0x1bd3a
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x76b4
movq 0x10(%rsp), %rbx
movl (%r15), %r12d
movl $0x0, (%r15)
leaq 0x68(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54e0
cmpq %rbx, (%r14)
je 0x18465
movl (%r15), %eax
testl %eax, %eax
je 0x17e81
cmpl $0x22, %eax
jne 0x17e84
leaq 0x17a19(%rip), %rdi     # 0x2f801
callq 0x5590
addl $-0x5, %eax
cmpl $0x1, %eax
ja 0x18427
leaq 0x179c2(%rip), %rsi     # 0x2f7c2
leaq 0x8(%rsp), %rdi
callq 0x1bd3a
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x76b4
movq 0x10(%rsp), %rbx
movl (%r15), %r12d
movl $0x0, (%r15)
leaq 0x68(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54e0
cmpq %rbx, (%r14)
je 0x18471
movl (%r15), %eax
testl %eax, %eax
je 0x17f0f
cmpl $0x22, %eax
jne 0x17f12
leaq 0x179a2(%rip), %rdi     # 0x2f801
callq 0x5590
cmpl $0x1, %eax
ja 0x18427
movaps 0x1743c(%rip), %xmm0    # 0x2f2b0
movups %xmm0, 0x120(%rsp)
jmp 0x180dd
movl %r12d, (%r15)
movss %xmm0, 0x120(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17ea4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x17917(%rip), %rsi     # 0x2f7c2
leaq 0x8(%rsp), %rdi
callq 0x1bd3a
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x76b4
movq 0x10(%rsp), %rbx
movl (%r15), %r12d
movl $0x0, (%r15)
leaq 0x68(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54e0
cmpq %rbx, (%r14)
je 0x1847d
movl (%r15), %eax
testl %eax, %eax
je 0x17f9d
cmpl $0x22, %eax
jne 0x17fa0
leaq 0x178f7(%rip), %rdi     # 0x2f801
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x124(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17f32
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x1788d(%rip), %rsi     # 0x2f7c6
leaq 0x8(%rsp), %rdi
callq 0x1bd3a
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x76b4
movq 0x10(%rsp), %rbx
movl (%r15), %r12d
movl $0x0, (%r15)
leaq 0x68(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54e0
cmpq %rbx, (%r14)
je 0x18489
movl (%r15), %eax
testl %eax, %eax
je 0x18023
cmpl $0x22, %eax
jne 0x18026
leaq 0x17869(%rip), %rdi     # 0x2f801
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x124(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17fc0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x177ff(%rip), %rsi     # 0x2f7c6
leaq 0x8(%rsp), %rdi
callq 0x1bd3a
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x76b4
movq 0x10(%rsp), %rbx
movl (%r15), %r12d
movl $0x0, (%r15)
leaq 0x68(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54e0
cmpq %rbx, (%r14)
je 0x18495
movl (%r15), %eax
testl %eax, %eax
je 0x18034
cmpl $0x22, %eax
jne 0x18037
leaq 0x177e3(%rip), %rdi     # 0x2f801
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x128(%rsp)
jmp 0x180c6
movl %r12d, (%r15)
movss %xmm0, 0x128(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x18057
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x1a2ce(%rip), %rsi     # 0x3232c
leaq 0x8(%rsp), %rdi
callq 0x1bd3a
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x76b4
movq 0x10(%rsp), %rbx
movl (%r15), %r12d
movl $0x0, (%r15)
leaq 0x68(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54e0
cmpq %rbx, (%r14)
je 0x184a1
movl (%r15), %eax
testl %eax, %eax
je 0x180ba
cmpl $0x22, %eax
jne 0x180bd
leaq 0x1774c(%rip), %rdi     # 0x2f801
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x12c(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x180dd
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x1725f(%rip), %rdx     # 0x2f343
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1b954
movq 0x20(%rsp), %rax
leaq 0x1b0(%rsp), %r15
movq %rax, 0x10(%r15)
movups 0x10(%rsp), %xmm0
movaps %xmm0, (%r15)
movq 0x38(%rsp), %rax
leaq 0x190(%rsp), %rcx
movq %rax, 0x10(%rcx)
movups 0x28(%rsp), %xmm0
movaps %xmm0, (%rcx)
leaq 0xb0(%rsp), %rbp
leaq 0x48(%rsp), %rbx
leaq 0x68(%rsp), %r13
leaq 0x88(%rsp), %r14
movq %r15, %rdi
leaq 0x190(%rsp), %rsi
callq 0x20522
testb %al, %al
je 0x183f9
movq %r15, %rdi
callq 0x20542
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
movq %rbp, %rdi
leaq 0x1634d(%rip), %rsi     # 0x2e4c2
callq 0x1bad4
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
callq 0x1b0dc
movq %r13, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x76b4
movq %rbp, %rdi
callq 0x1bcee
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x76b4
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
testq %rcx, %rcx
sete %dl
testq %rax, %rax
setne %sil
orb %dl, %sil
je 0x18448
movq %rax, %rdx
addq %rcx, %rdx
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
testq %rcx, %rcx
je 0x18208
cmpb $0x2d, (%rax)
jne 0x18208
movl $0x1, %esi
movq %r14, %rdi
callq 0x9ada
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
cmpq %rax, %rdx
je 0x1822b
movb (%rax), %cl
addb $-0x30, %cl
cmpb $0xa, %cl
jae 0x1822b
incq %rax
cmpq %rdx, %rax
jne 0x1820d
cmpq $0x0, 0x50(%rsp)
je 0x183b4
leaq 0x130(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x1a7b0
movq %r13, %rdi
leaq 0x17582(%rip), %rsi     # 0x2f7ca
callq 0x50f0
leaq 0x148(%rsp), %rdi
testl %eax, %eax
je 0x1830d
movq %r13, %rdi
leaq 0x17568(%rip), %rsi     # 0x2f7cf
callq 0x50f0
testl %eax, %eax
je 0x1831a
movq %r13, %rdi
leaq 0x17571(%rip), %rsi     # 0x2f7ef
callq 0x50f0
leaq 0x170(%rsp), %rdi
testl %eax, %eax
je 0x1830d
movq %r13, %rdi
leaq 0x1755e(%rip), %rsi     # 0x2f7f7
callq 0x50f0
testl %eax, %eax
jne 0x183b4
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
testq %rdx, %rdx
sete %al
testq %rsi, %rsi
setne %cl
orb %al, %cl
je 0x18448
addq %rsi, %rdx
movq %r14, %rdi
callq 0x1a707
leaq 0x100(%rsp), %rdi
movq %r14, %rsi
callq 0x5200
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x183b4
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x183b4
movq %rbx, %rsi
callq 0x5200
jmp 0x183b4
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
sete %al
testq %rdi, %rdi
setne %cl
orb %al, %cl
je 0x18448
addq %rdi, %rsi
callq 0x1a5c2
movl %eax, 0x168(%rsp)
cmpl $-0x1, %eax
jne 0x183b4
movl $0x7, %edx
movq 0x29c98(%rip), %r12     # 0x41ff0
movq %r12, %rdi
leaq 0x174a4(%rip), %rsi     # 0x2f806
callq 0x53f0
movl $0x19, %edx
movq %r12, %rdi
leaq 0x1745f(%rip), %rsi     # 0x2f7d5
callq 0x53f0
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %r12, %rdi
callq 0x53f0
movl $0x2, %edx
movq %r12, %rdi
leaq 0x15d8c(%rip), %rsi     # 0x2e128
callq 0x53f0
movq %r14, %rdi
callq 0x1a83a
movl $0x0, 0x168(%rsp)
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x183d0
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x183ec
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
movq %r15, %rdi
callq 0x20596
jmp 0x18140
movq 0xa8(%rsp), %rdi
leaq 0xf8(%rdi), %rax
addq $0xe0, %rdi
cmpb $0x0, 0x44(%rsp)
cmoveq %rax, %rdi
xorl %ebx, %ebx
leaq 0xb8(%rsp), %rsi
callq 0x1a85e
leaq 0xb8(%rsp), %rdi
callq 0x7f84
movl %ebx, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x50e0
leaq 0x1735e(%rip), %rdi     # 0x2f7b2
callq 0x5220
leaq 0x17352(%rip), %rdi     # 0x2f7b2
callq 0x5590
leaq 0x17395(%rip), %rdi     # 0x2f801
callq 0x5220
leaq 0x17389(%rip), %rdi     # 0x2f801
callq 0x5220
leaq 0x1737d(%rip), %rdi     # 0x2f801
callq 0x5220
leaq 0x17371(%rip), %rdi     # 0x2f801
callq 0x5220
leaq 0x17365(%rip), %rdi     # 0x2f801
callq 0x5220
leaq 0x17359(%rip), %rdi     # 0x2f801
callq 0x5220
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x185d3
jmp 0x184f3
jmp 0x184f3
jmp 0x184f3
jmp 0x184f3
jmp 0x184f3
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x18509
movl %r12d, (%r15)
jmp 0x18509
jmp 0x185d3
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
jne 0x1856a
jmp 0x185d6
jmp 0x185d3
jmp 0x185d3
jmp 0x18594
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x18597
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x18597
jmp 0x18594
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x1855c
movl %ebp, (%r15)
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x185d6
movq 0x20(%rsp), %rsi
jmp 0x185c7
jmp 0x185d3
jmp 0x185d3
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x1a83a
jmp 0x18597
jmp 0x185d3
jmp 0x185d3
jmp 0x1858d
movq %rax, %rbx
jmp 0x185b3
jmp 0x185d3
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x185b3
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x185d6
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x185d6
jmp 0x185d3
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x7f84
movq %rbx, %rdi
callq 0x56d0