// File: Lut99[P]RayTracer/src/lib/materials/Metal.cpp
// Function: RayTracer::Metal::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>)
Metal* Metal::from_json(json json_obj) {
    // Check if the object has an object type
    if (!json_obj.is_object()) {
        throw InvalidObjectFormat("Metal", json::object().type_name(), json_obj.type_name());
    }

    // Check if the required fields are there
    if (json_obj["albedo"].is_null()) {
        throw MissingFieldException("Metal", "albedo");
    }
    if (json_obj["fuzz"].is_null()) {
        throw MissingFieldException("Metal", "fuzz");
    }

    // Parse it
    Vec3 albedo = Vec3::from_json(json_obj["albedo"]);
    double fuzz;
    try {
        fuzz = json_obj["fuzz"].get<double>();
    } catch (nlohmann::detail::type_error&) {
        throw InvalidFieldFormat("Metal", "fuzz", "double", json_obj["fuzz"].type_name());
    }

    return new Metal(albedo, fuzz);
}

// Assembly:
subq $0x2f8, %rsp            # imm = 0x2F8
movq %rdi, 0xc0(%rsp)
movq %rdi, 0x2f0(%rsp)
callq 0xd9b20
testb $0x1, %al
jne 0x166fe9
movb $0x1, 0x24e(%rsp)
movl $0x88, %edi
callq 0xd02b0
movq %rax, 0xb0(%rsp)
leaq 0x2cf(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0xd0a20
movq 0xb8(%rsp), %rdx
leaq 0x1156c(%rip), %rsi     # 0x17834e
leaq 0x2d0(%rsp), %rdi
callq 0xd8b80
jmp 0x166df1
leaq 0x278(%rsp), %rdi
callq 0x155e60
movq 0x278(%rsp), %rsi
movq 0x280(%rsp), %rdx
leaq 0x288(%rsp), %rdi
callq 0x15a2a0
jmp 0x166e1d
leaq 0x288(%rsp), %rdi
callq 0x1302d0
movq %rax, 0xa0(%rsp)
leaq 0x277(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0xd0a20
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
leaq 0x298(%rsp), %rdi
callq 0xd8b80
jmp 0x166e66
movq 0xc0(%rsp), %rdi
callq 0x1302d0
movq %rax, 0x90(%rsp)
leaq 0x24f(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0xd0a20
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
leaq 0x250(%rsp), %rdi
callq 0xd8b80
jmp 0x166eaf
movq 0xb0(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
leaq 0x298(%rsp), %rdx
leaq 0x250(%rsp), %rcx
callq 0x156180
jmp 0x166ed6
movq 0xb0(%rsp), %rdi
movb $0x0, 0x24e(%rsp)
leaq 0x44583(%rip), %rsi     # 0x1ab470
leaq -0x10b64(%rip), %rdx    # 0x156390
callq 0xd09b0
jmp 0x16767a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x166fbe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x166fb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x166f97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x166f7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0x250(%rsp), %rdi
callq 0xd0b38
leaq 0x24f(%rsp), %rdi
callq 0xd0630
leaq 0x298(%rsp), %rdi
callq 0xd0b38
leaq 0x277(%rsp), %rdi
callq 0xd0630
leaq 0x288(%rsp), %rdi
callq 0xd9f30
leaq 0x2d0(%rsp), %rdi
callq 0xd0b38
leaq 0x2cf(%rsp), %rdi
callq 0xd0630
testb $0x1, 0x24e(%rsp)
jne 0x166fd7
jmp 0x166fe4
movq 0xb0(%rsp), %rdi
callq 0xd0430
jmp 0x167665
movq 0xc0(%rsp), %rdi
leaq 0x11326(%rip), %rsi     # 0x17831e
callq 0xd9b40
movq %rax, %rdi
callq 0xd9da0
testb $0x1, %al
jne 0x16700e
jmp 0x167161
movb $0x1, 0x1fe(%rsp)
movl $0x68, %edi
callq 0xd02b0
movq %rax, 0x80(%rsp)
leaq 0x227(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0xd0a20
movq 0x88(%rsp), %rdx
leaq 0x11302(%rip), %rsi     # 0x17834e
leaq 0x228(%rsp), %rdi
callq 0xd8b80
jmp 0x16705b
leaq 0x1ff(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0xd0a20
movq 0x78(%rsp), %rdx
leaq 0x112a5(%rip), %rsi     # 0x17831e
leaq 0x200(%rsp), %rdi
callq 0xd8b80
jmp 0x167088
movq 0x80(%rsp), %rdi
leaq 0x228(%rsp), %rsi
leaq 0x200(%rsp), %rdx
callq 0x15a2f0
jmp 0x1670a7
movq 0x80(%rsp), %rdi
movb $0x0, 0x1fe(%rsp)
leaq 0x44502(%rip), %rsi     # 0x1ab5c0
leaq -0xcc95(%rip), %rdx     # 0x15a430
callq 0xd09b0
jmp 0x16767a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x167136
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x16711c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0x200(%rsp), %rdi
callq 0xd0b38
leaq 0x1ff(%rsp), %rdi
callq 0xd0630
leaq 0x228(%rsp), %rdi
callq 0xd0b38
leaq 0x227(%rsp), %rdi
callq 0xd0630
testb $0x1, 0x1fe(%rsp)
jne 0x16714f
jmp 0x16715c
movq 0x80(%rsp), %rdi
callq 0xd0430
jmp 0x167665
movq 0xc0(%rsp), %rdi
leaq 0x111d9(%rip), %rsi     # 0x178349
callq 0xd9b40
movq %rax, %rdi
callq 0xd9da0
testb $0x1, %al
jne 0x167186
jmp 0x1672c7
movb $0x1, 0x1ae(%rsp)
movl $0x68, %edi
callq 0xd02b0
movq %rax, 0x68(%rsp)
leaq 0x1d7(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0xd0a20
movq 0x70(%rsp), %rdx
leaq 0x11193(%rip), %rsi     # 0x17834e
leaq 0x1d8(%rsp), %rdi
callq 0xd8b80
jmp 0x1671ca
leaq 0x1af(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0xd0a20
movq 0x60(%rsp), %rdx
leaq 0x11161(%rip), %rsi     # 0x178349
leaq 0x1b0(%rsp), %rdi
callq 0xd8b80
jmp 0x1671f7
movq 0x68(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x1b0(%rsp), %rdx
callq 0x15a2f0
jmp 0x167213
movq 0x68(%rsp), %rdi
movb $0x0, 0x1ae(%rsp)
leaq 0x44399(%rip), %rsi     # 0x1ab5c0
leaq -0xcdfe(%rip), %rdx     # 0x15a430
callq 0xd09b0
jmp 0x16767a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x16729f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x167285
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0x1b0(%rsp), %rdi
callq 0xd0b38
leaq 0x1af(%rsp), %rdi
callq 0xd0630
leaq 0x1d8(%rsp), %rdi
callq 0xd0b38
leaq 0x1d7(%rsp), %rdi
callq 0xd0630
testb $0x1, 0x1ae(%rsp)
jne 0x1672b8
jmp 0x1672c2
movq 0x68(%rsp), %rdi
callq 0xd0430
jmp 0x167665
movq 0xc0(%rsp), %rdi
leaq 0x11048(%rip), %rsi     # 0x17831e
callq 0xd9b40
movq %rax, %rsi
leaq 0x178(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0xd9dc0
movq 0x58(%rsp), %rsi
leaq 0x188(%rsp), %rdi
callq 0x155110
jmp 0x167304
leaq 0x178(%rsp), %rdi
callq 0xd9f30
movq 0xc0(%rsp), %rdi
leaq 0x11029(%rip), %rsi     # 0x178349
callq 0xd9b40
movq %rax, 0x50(%rsp)
jmp 0x16732c
movq 0x50(%rsp), %rdi
callq 0x1565a0
movsd %xmm0, 0x48(%rsp)
jmp 0x16733e
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x170(%rsp)
jmp 0x167608
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0x178(%rsp), %rdi
callq 0xd9f30
jmp 0x167665
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
movl 0x2bc(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x167665
movq 0x2c0(%rsp), %rdi
callq 0xd0210
movq %rax, 0x168(%rsp)
movb $0x1, 0xce(%rsp)
movl $0xa8, %edi
callq 0xd02b0
movq %rax, 0x38(%rsp)
leaq 0x147(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0xd0a20
movq 0x40(%rsp), %rdx
leaq 0x10f64(%rip), %rsi     # 0x17834e
leaq 0x148(%rsp), %rdi
callq 0xd8b80
jmp 0x1673f9
leaq 0x11f(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xd0a20
movq 0x30(%rsp), %rdx
leaq 0x10f32(%rip), %rsi     # 0x178349
leaq 0x120(%rsp), %rdi
callq 0xd8b80
jmp 0x167426
leaq 0xf7(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xd0a20
movq 0x28(%rsp), %rdx
leaq 0x1052d(%rip), %rsi     # 0x177971
leaq 0xf8(%rsp), %rdi
callq 0xd8b80
jmp 0x167453
movq 0xc0(%rsp), %rdi
leaq 0x10ee7(%rip), %rsi     # 0x178349
callq 0xd9b40
movq %rax, 0x20(%rsp)
jmp 0x16746e
movq 0x20(%rsp), %rdi
callq 0x1302d0
movq %rax, 0x10(%rsp)
leaq 0xcf(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xd0a20
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0xd0(%rsp), %rdi
callq 0xd8b80
jmp 0x1674a8
movq 0x38(%rsp), %rdi
leaq 0x148(%rsp), %rsi
leaq 0x120(%rsp), %rdx
leaq 0xf8(%rsp), %rcx
leaq 0xd0(%rsp), %r8
callq 0x15a4a0
jmp 0x1674d4
movq 0x38(%rsp), %rdi
movb $0x0, 0xce(%rsp)
leaq 0x440f0(%rip), %rsi     # 0x1ab5d8
leaq -0xcd4f(%rip), %rdx     # 0x15a7a0
callq 0xd09b0
jmp 0x16767a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1675dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1675c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1675a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x16759b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x16758e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xd0b38
leaq 0xcf(%rsp), %rdi
callq 0xd0630
leaq 0xf8(%rsp), %rdi
callq 0xd0b38
leaq 0xf7(%rsp), %rdi
callq 0xd0630
leaq 0x120(%rsp), %rdi
callq 0xd0b38
leaq 0x11f(%rsp), %rdi
callq 0xd0630
leaq 0x148(%rsp), %rdi
callq 0xd0b38
leaq 0x147(%rsp), %rdi
callq 0xd0630
testb $0x1, 0xce(%rsp)
jne 0x1675f5
jmp 0x1675ff
movq 0x38(%rsp), %rdi
callq 0xd0430
callq 0xd0940
jmp 0x167606
jmp 0x167665
movl $0x38, %edi
callq 0xd05d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x8(%rsp)
movsd 0x170(%rsp), %xmm0
leaq 0x188(%rsp), %rsi
callq 0x1669c0
jmp 0x167635
movq 0x8(%rsp), %rax
addq $0x2f8, %rsp            # imm = 0x2F8
retq
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
movl $0x38, %esi
callq 0xd05e0
movq 0x2c0(%rsp), %rdi
callq 0xd0a10
movq %rax, %rdi
callq 0xd9890
nopw (%rax,%rax)