// File: NovaGL[P]HarmonyHubControl/HarmonyHubControl.cpp
// Function: parseFunction(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>> const&, std::vector<Function, std::allocator<Function>>&)
int parseFunction(const rapidjson::Value& controlGroup, std::vector<Function>& vecDeviceFunctions)
{
    rapidjson::Value::ConstMemberIterator itr = controlGroup.FindMember("function");
    if (itr != controlGroup.MemberEnd() && itr->value.IsArray())
    {
        Function f;
        f.m_strName = TryGetMemberString(controlGroup, "name");
        if (f.m_strName.empty())
        {
            return 1;
        }
        for (const auto& function : itr->value.GetArray())
        {
            if(parseAction(function, f.m_vecActions) != 0)
            {
                return 1;
            }
        }
        vecDeviceFunctions.push_back(f);
    }
    else
    {
        return 1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x10805(%rip), %rsi     # 0x169b3
callq 0x8ea0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8f10
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x8ee0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xb9(%rbp)
jne 0x61e2
jmp 0x61fd
leaq -0x20(%rbp), %rdi
callq 0x8f80
movq %rax, %rdi
addq $0x10, %rdi
callq 0x92c0
movb %al, -0xb9(%rbp)
movb -0xb9(%rbp), %al
testb $0x1, %al
jne 0x620c
jmp 0x63f1
leaq -0x60(%rbp), %rdi
callq 0x92e0
movq -0x10(%rbp), %rsi
leaq 0x10788(%rip), %rdx     # 0x169a8
leaq -0x80(%rbp), %rdi
callq 0x5eb0
jmp 0x622b
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3460
leaq -0x80(%rbp), %rdi
callq 0x3698
leaq -0x60(%rbp), %rdi
callq 0x35a0
testb $0x1, %al
jne 0x6250
jmp 0x627d
movl $0x1, -0x4(%rbp)
movl $0x1, -0x90(%rbp)
jmp 0x63cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x63e6
leaq -0x20(%rbp), %rdi
callq 0x8f80
movq %rax, -0xc8(%rbp)
jmp 0x628f
movq -0xc8(%rbp), %rsi
addq $0x10, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x9310
jmp 0x62a8
leaq -0xa0(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0x9380
movq %rax, -0xd0(%rbp)
jmp 0x62cb
movq -0xd0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x98(%rbp), %rdi
callq 0x93a0
movq %rax, -0xd8(%rbp)
jmp 0x62ee
movq -0xd8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0xb0(%rbp), %rax
jne 0x633e
movl $0x2, -0x90(%rbp)
jmp 0x639b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x93c0
jmp 0x63e6
movq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x5fa0
movl %eax, -0xdc(%rbp)
jmp 0x6364
movl -0xdc(%rbp), %eax
cmpl $0x0, %eax
je 0x6382
movl $0x1, -0x4(%rbp)
movl $0x1, -0x90(%rbp)
jmp 0x639b
jmp 0x6384
movq -0xa8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xa8(%rbp)
jmp 0x62fc
leaq -0xa0(%rbp), %rdi
callq 0x93c0
movl -0x90(%rbp), %eax
subl $0x2, %eax
jne 0x63cd
jmp 0x63b4
movq -0x18(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x93d0
jmp 0x63c3
movl $0x0, -0x90(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x9440
movl -0x90(%rbp), %eax
testl %eax, %eax
je 0x63e4
jmp 0x63e2
jmp 0x6401
jmp 0x63fa
leaq -0x60(%rbp), %rdi
callq 0x9440
jmp 0x640d
movl $0x1, -0x4(%rbp)
jmp 0x6401
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x35e0
nopl (%rax)