// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/RenderObject.cpp
// Function: RayTracer::RenderObject::from_json(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>)
RenderObject* RenderObject::from_json(json json_obj) {
    // Check if the object has an object type
    if (!json_obj.is_object()) {
        throw InvalidObjectFormat("RenderObject", json::object().type_name(), json_obj.type_name());
    }

    // Check for the type field
    if (json_obj["type"].is_null()) {
        throw MissingFieldException("RenderObject", "type");
    }

    // Parse the raw type
    RenderObjectType type;
    try {
        type = (RenderObjectType) json_obj["type"].get<unsigned long>();
    } catch (nlohmann::detail::type_error&) {
        throw InvalidFieldFormat("RenderObject", "type", "unsigned long", json_obj["type"].type_name());
    }
    // If the animation field is defined, parse it as such
    RenderAnimation* animation = nullptr;
    if (!json_obj["animation"].is_null()) {
        animation = RenderAnimation::from_json(json_obj["animation"]);
    }

    // Parse the rest of the object based on the type field
    RenderObject* to_return;
    if (type == sphere) {
        to_return = (RenderObject*) Sphere::from_json(json_obj);
    } else if (type == render_object_collection) {
        to_return = (RenderObject*) RenderObjectCollection::from_json(json_obj);
    } else {
        throw UnknownSubtypeException("RenderObject", type);
    }

    // If needed, add the animation
    if (animation != nullptr) {
        to_return->set_animation(animation);
    }

    // Return
    return to_return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %r15
cmpb $0x1, (%rdi)
jne 0x74d56
leaq 0x147f9(%rip), %rsi     # 0x8942f
movq %r15, %rdi
callq 0x41392
cmpb $0x0, (%rax)
je 0x74dc0
leaq 0x147e1(%rip), %rsi     # 0x8942f
movq %r15, %rdi
callq 0x41392
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x75d4a
movq 0x8(%rsp), %r12
leaq 0xef9b(%rip), %rsi      # 0x83c0a
movq %r15, %rdi
callq 0x41392
cmpb $0x0, (%rax)
je 0x74cc0
leaq 0xef87(%rip), %rsi      # 0x83c0a
movq %r15, %rdi
callq 0x41392
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4155c
movq %rbx, %rdi
callq 0x7f3c4
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4861e
leaq 0x40(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x486c0
jmp 0x74cc2
xorl %ebx, %ebx
cmpl $0x1, %r12d
je 0x74cfd
testl %r12d, %r12d
jne 0x74e4b
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x4155c
movq %r14, %rdi
callq 0x7655a
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x4861e
leaq 0x30(%rsp), %rdi
jmp 0x74d27
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x4155c
movq %r14, %rdi
callq 0x77776
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x4861e
leaq 0x20(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0x486c0
testq %rbx, %rbx
je 0x74d41
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x48(%rax)
movq %r14, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x88, %edi
callq 0x3a210
movq %rax, %r14
leaq 0x98(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x155a1(%rip), %rsi     # 0x8a318
leaq 0x155a6(%rip), %rdx     # 0x8a324
leaq 0x88(%rsp), %rdi
callq 0x44390
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x73c9e
movzbl 0x8(%rsp), %eax
cmpq $0x8, %rax
ja 0x74eb2
leaq 0x2e4d1(%rip), %rcx     # 0xa3288
movq (%rcx,%rax,8), %rbx
jmp 0x74eb9
movl $0x68, %edi
callq 0x3a210
movq %rax, %r14
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1553b(%rip), %rsi     # 0x8a318
leaq 0x15540(%rip), %rdx     # 0x8a324
leaq 0x68(%rsp), %rdi
callq 0x44390
leaq 0x138(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1462d(%rip), %rsi     # 0x8942f
leaq 0x1462a(%rip), %rdx     # 0x89433
leaq 0x128(%rsp), %rdi
callq 0x44390
movb $0x1, %bpl
leaq 0x68(%rsp), %rsi
leaq 0x128(%rsp), %rdx
movq %r14, %rdi
callq 0x75298
xorl %ebp, %ebp
leaq 0x2e499(%rip), %rsi     # 0xa32d0
leaq 0x5ee(%rip), %rdx       # 0x7542c
movq %r14, %rdi
callq 0x3a760
jmp 0x751c9
movl $0x50, %edi
callq 0x3a210
movq %rax, %r14
leaq 0xd8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x154ad(%rip), %rsi     # 0x8a318
leaq 0x154b2(%rip), %rdx     # 0x8a324
leaq 0xc8(%rsp), %rdi
callq 0x44390
movl %r12d, %edx
movb $0x1, %bpl
leaq 0xc8(%rsp), %rsi
movq %r14, %rdi
callq 0x759b0
xorl %ebp, %ebp
leaq 0x2e462(%rip), %rsi     # 0xa3300
leaq -0x173f(%rip), %rdx     # 0x73766
movq %r14, %rdi
callq 0x3a760
jmp 0x751c9
leaq 0x11342(%rip), %rbx     # 0x861fb
leaq 0x178(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rbx, %rdi
callq 0x3a1f0
leaq (%rax,%rbx), %rdx
leaq 0x168(%rsp), %rdi
movq %rbx, %rsi
callq 0x44390
movzbl (%r15), %eax
cmpq $0x8, %rax
ja 0x74ef8
leaq 0x2e396(%rip), %rcx     # 0xa3288
movq (%rcx,%rax,8), %rbx
jmp 0x74eff
leaq 0x112fc(%rip), %rbx     # 0x861fb
leaq 0x158(%rsp), %r15
movq %r15, -0x10(%r15)
movq %rbx, %rdi
callq 0x3a1f0
leaq (%rax,%rbx), %rdx
leaq 0x148(%rsp), %rdi
movq %rbx, %rsi
callq 0x44390
movb $0x1, %bpl
leaq 0x88(%rsp), %rsi
leaq 0x168(%rsp), %rdx
leaq 0x148(%rsp), %rcx
movq %r14, %rdi
callq 0x72fb0
xorl %ebp, %ebp
leaq 0x2e1e5(%rip), %rsi     # 0xa3138
leaq -0x1cd6(%rip), %rdx     # 0x73284
movq %r14, %rdi
callq 0x3a760
jmp 0x751c9
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r15, %rdi
je 0x74f8f
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x3a480
jmp 0x74f8f
movq %rax, %rbx
movb $0x1, %bpl
movq 0x168(%rsp), %rdi
cmpq %r13, %rdi
je 0x74fb4
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3a480
jmp 0x74fb4
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x8(%rsp), %rdi
callq 0x415d4
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x7502b
movq 0x98(%rsp), %rsi
jmp 0x75023
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x7502b
movq 0xd8(%rsp), %rsi
jmp 0x75023
jmp 0x75081
movq %rax, %rbx
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0x75014
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3a480
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x7502b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3a480
testb %bpl, %bpl
jne 0x75084
jmp 0x75287
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x75084
movq 0x78(%rsp), %rsi
jmp 0x75061
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x75084
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3a480
jmp 0x75084
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
jmp 0x75099
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x75099
jmp 0x75081
movq %rax, %rbx
movq %r14, %rdi
callq 0x3a340
jmp 0x75287
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x415d4
jmp 0x75287
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x75287
movq %rbx, %rdi
callq 0x3a1c0
movl $0xa8, %edi
callq 0x3a210
movq %rax, %r14
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15243(%rip), %rsi     # 0x8a318
leaq 0x15248(%rip), %rdx     # 0x8a324
leaq 0x48(%rsp), %rdi
callq 0x44390
leaq 0x118(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x14336(%rip), %rsi     # 0x8942f
leaq 0x14333(%rip), %rdx     # 0x89433
leaq 0x108(%rsp), %rdi
callq 0x44390
leaq 0xf8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x15205(%rip), %rsi     # 0x8a325
leaq 0x1520b(%rip), %rdx     # 0x8a332
leaq 0xe8(%rsp), %rdi
callq 0x44390
leaq 0x142f4(%rip), %rsi     # 0x8942f
movq %r15, %rdi
callq 0x41392
movzbl (%rax), %eax
cmpq $0x8, %rax
ja 0x75159
leaq 0x2e135(%rip), %rcx     # 0xa3288
movq (%rcx,%rax,8), %rbx
jmp 0x75160
leaq 0x1109b(%rip), %rbx     # 0x861fb
leaq 0xb8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbx, %rdi
callq 0x3a1f0
leaq (%rax,%rbx), %rdx
leaq 0xa8(%rsp), %rdi
movq %rbx, %rsi
callq 0x44390
movb $0x1, %r15b
leaq 0x48(%rsp), %rsi
leaq 0x108(%rsp), %rdx
leaq 0xe8(%rsp), %rcx
leaq 0xa8(%rsp), %r8
movq %r14, %rdi
callq 0x75496
xorl %r15d, %r15d
leaq 0x2e12e(%rip), %rsi     # 0xa32e8
leaq 0x745(%rip), %rdx       # 0x75906
movq %r14, %rdi
callq 0x3a760
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x751fb
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3a480
jmp 0x751fb
jmp 0x751f5
movq %rax, %rbx
movb $0x1, %r15b
movq 0xe8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x75220
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x3a480
jmp 0x75220
movq %rax, %rbx
movb $0x1, %r15b
movq 0x108(%rsp), %rdi
cmpq %r13, %rdi
je 0x7523d
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x3a480
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x75254
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3a480
testb %r15b, %r15b
jne 0x7527a
jmp 0x75282
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x7527a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3a480
jmp 0x7527a
movq %rax, %rbx
movq %r14, %rdi
callq 0x3a340
callq 0x3a720
movq %rbx, %rdi
callq 0x3a790
movq %rax, %rdi
callq 0x4116b
nop