// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b86f(%rip), %rsi     # 0x33521
callq 0x1bd78
leaq 0x68(%rsp), %rdi
movq %rax, (%rdi)
callq 0x1b388
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movq $-0x1, %rsi
callq 0x76fa
movq %rax, %rdi
movq %rdx, %rsi
callq 0x1a5c4
movl %eax, 0xb8(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x1855d
leaq 0x174c0(%rip), %rsi     # 0x2f1bf
leaq 0x8(%rsp), %rdi
callq 0x1bd78
leaq 0x48(%rsp), %rdi
movq %rax, (%rdi)
callq 0x1b388
leaq 0x10(%rsp), %rdi
leaq 0x88(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
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 0x18583
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x1858f
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x1858f
testl %ecx, %ecx
jne 0x17d7e
movl %ebp, (%r15)
movl %eax, 0xbc(%rsp)
leaq 0x20(%rsp), %rbp
movq -0x10(%rbp), %rdi
cmpq %rbp, %rdi
je 0x17da0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x18a00(%rip), %rsi     # 0x307a7
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
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 0x1762a(%rip), %rsi     # 0x2f40d
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
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 0x1857e
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x1a995
leaq 0x100(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x5200
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17e72
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
cmpb $0x0, 0x44(%rsp)
je 0x17f26
movl 0xb8(%rsp), %eax
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
ja 0x17ef7
leaq 0x1891a(%rip), %rsi     # 0x307ad
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
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 0x185b3
movl (%r15), %eax
testl %eax, %eax
je 0x18033
cmpl $0x22, %eax
jne 0x18036
leaq 0x188ff(%rip), %rdi     # 0x307f1
callq 0x5590
cmpl $0x2, %eax
setae %al
movl 0x44(%rsp), %edx
movl %edx, %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x17f1e
movaps 0x1839f(%rip), %xmm0    # 0x302b0
movups %xmm0, 0x120(%rsp)
jmp 0x181e8
testb %dl, %dl
jne 0x1855d
movl 0xb8(%rsp), %eax
addl $-0x5, %eax
cmpl $0x1, %eax
ja 0x1855d
leaq 0x18872(%rip), %rsi     # 0x307b2
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
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 0x1859b
movl (%r15), %eax
testl %eax, %eax
je 0x17f9c
cmpl $0x22, %eax
jne 0x17f9f
leaq 0x1885a(%rip), %rdi     # 0x307f1
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x124(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17fbf
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x187f0(%rip), %rsi     # 0x307b6
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
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 0x185a7
movl (%r15), %eax
testl %eax, %eax
je 0x18022
cmpl $0x22, %eax
jne 0x18025
leaq 0x187d4(%rip), %rdi     # 0x307f1
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x128(%rsp)
jmp 0x181d1
movl %r12d, (%r15)
movss %xmm0, 0x120(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x18056
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x18755(%rip), %rsi     # 0x307b2
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
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 0x185bf
movl (%r15), %eax
testl %eax, %eax
je 0x180b9
cmpl $0x22, %eax
jne 0x180bc
leaq 0x1873d(%rip), %rdi     # 0x307f1
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x124(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x180dc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x186d3(%rip), %rsi     # 0x307b6
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
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 0x185cb
movl (%r15), %eax
testl %eax, %eax
je 0x1813f
cmpl $0x22, %eax
jne 0x18142
leaq 0x186b7(%rip), %rdi     # 0x307f1
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x128(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x18162
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x1b35d(%rip), %rsi     # 0x334c6
leaq 0x8(%rsp), %rdi
callq 0x1bfe0
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rax, %rsi
callq 0x762e
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 0x185d7
movl (%r15), %eax
testl %eax, %eax
je 0x181c5
cmpl $0x22, %eax
jne 0x181c8
leaq 0x18631(%rip), %rdi     # 0x307f1
callq 0x5590
movl %r12d, (%r15)
movss %xmm0, 0x12c(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x181e8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x18144(%rip), %rdx     # 0x30333
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1bbf6
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 0x20b60
testb %al, %al
je 0x1852f
movq %r15, %rdi
callq 0x20b76
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
movq %rbp, %rdi
leaq 0x17242(%rip), %rsi     # 0x2f4c2
callq 0x1bd78
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
callq 0x1b388
movq %r13, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x762e
movq %rbp, %rdi
callq 0x1bf94
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x762e
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
testq %rcx, %rcx
sete %dl
testq %rax, %rax
setne %sil
orb %dl, %sil
je 0x1857e
movq %rax, %rdx
addq %rcx, %rdx
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
testq %rcx, %rcx
je 0x18313
cmpb $0x2d, (%rax)
jne 0x18313
movl $0x1, %esi
movq %r14, %rdi
callq 0x9bd2
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
movq 0x88(%rsp), %rax
movq 0x90(%rsp), %rcx
cmpq %rax, %rcx
je 0x1834f
movb (%rax), %dl
addb $-0x30, %dl
cmpb $0x9, %dl
ja 0x1834f
incq %rax
cmpq %rcx, %rax
sete %dl
je 0x18351
movb (%rax), %sil
addb $-0x30, %sil
incq %rax
cmpb $0xa, %sil
jb 0x18335
jmp 0x18351
xorl %edx, %edx
testb %dl, %dl
je 0x18361
cmpq $0x0, 0x50(%rsp)
je 0x184ea
leaq 0x130(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x1aa42
movq %r13, %rdi
leaq 0x1843c(%rip), %rsi     # 0x307ba
callq 0x50f0
leaq 0x148(%rsp), %rdi
testl %eax, %eax
je 0x18443
movq %r13, %rdi
leaq 0x18422(%rip), %rsi     # 0x307bf
callq 0x50f0
testl %eax, %eax
je 0x18450
movq %r13, %rdi
leaq 0x1842b(%rip), %rsi     # 0x307df
callq 0x50f0
leaq 0x170(%rsp), %rdi
testl %eax, %eax
je 0x18443
movq %r13, %rdi
leaq 0x18418(%rip), %rsi     # 0x307e7
callq 0x50f0
testl %eax, %eax
jne 0x184ea
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
testq %rdx, %rdx
sete %al
testq %rsi, %rsi
setne %cl
orb %al, %cl
je 0x1857e
addq %rsi, %rdx
movq %r14, %rdi
callq 0x1a995
leaq 0x100(%rsp), %rdi
movq %r14, %rsi
callq 0x5200
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x184ea
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x184ea
movq %rbx, %rsi
callq 0x5200
jmp 0x184ea
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
sete %al
testq %rdi, %rdi
setne %cl
orb %al, %cl
je 0x1857e
addq %rdi, %rsi
callq 0x1a7ec
movl %eax, 0x168(%rsp)
cmpl $-0x1, %eax
jne 0x184ea
movl $0x7, %edx
movq 0x2ab62(%rip), %r12     # 0x42ff0
movq %r12, %rdi
leaq 0x1835e(%rip), %rsi     # 0x307f6
callq 0x53f0
movl $0x19, %edx
movq %r12, %rdi
leaq 0x18319(%rip), %rsi     # 0x307c5
callq 0x53f0
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %r12, %rdi
callq 0x53f0
movl $0x2, %edx
movq %r12, %rdi
leaq 0x16c56(%rip), %rsi     # 0x2f128
callq 0x53f0
movq %r14, %rdi
callq 0x1aada
movl $0x0, 0x168(%rsp)
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x18506
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x18522
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
movq %r15, %rdi
callq 0x20bca
jmp 0x1824b
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 0x1aafe
leaq 0xb8(%rsp), %rdi
callq 0x7f8e
movl %ebx, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x50e0
leaq 0x18218(%rip), %rdi     # 0x307a2
callq 0x5220
leaq 0x1820c(%rip), %rdi     # 0x307a2
callq 0x5590
leaq 0x1824f(%rip), %rdi     # 0x307f1
callq 0x5220
leaq 0x18243(%rip), %rdi     # 0x307f1
callq 0x5220
leaq 0x18237(%rip), %rdi     # 0x307f1
callq 0x5220
leaq 0x1822b(%rip), %rdi     # 0x307f1
callq 0x5220
leaq 0x1821f(%rip), %rdi     # 0x307f1
callq 0x5220
leaq 0x18213(%rip), %rdi     # 0x307f1
callq 0x5220
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x1870c
jmp 0x18629
jmp 0x18629
jmp 0x18629
jmp 0x18629
jmp 0x18629
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x18670
movl %r12d, (%r15)
jmp 0x18670
jmp 0x1870c
jmp 0x186c2
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x186c5
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x186c5
jmp 0x186c2
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
jne 0x186a3
jmp 0x1870f
jmp 0x1870c
jmp 0x1870c
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x18695
movl %ebp, (%r15)
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1870f
movq 0x20(%rsp), %rsi
jmp 0x186fe
jmp 0x1870c
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x1aada
jmp 0x186c5
jmp 0x1870c
jmp 0x1870c
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x186ea
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x186ea
jmp 0x1870c
jmp 0x186e7
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x1870f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x1870f
jmp 0x1870c
jmp 0x1870c
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x7f8e
movq %rbx, %rdi
callq 0x56d0