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

// Assembly:
subq $0x2f8, %rsp            # imm = 0x2F8
movq %rdi, 0xc0(%rsp)
movq %rdi, 0x2f0(%rsp)
callq 0xd9b20
testb $0x1, %al
jne 0x168239
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 0x1033d(%rip), %rsi     # 0x17836f
leaq 0x2d0(%rsp), %rdi
callq 0xd8b80
jmp 0x168041
leaq 0x278(%rsp), %rdi
callq 0x155e60
movq 0x278(%rsp), %rsi
movq 0x280(%rsp), %rdx
leaq 0x288(%rsp), %rdi
callq 0x15a2a0
jmp 0x16806d
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 0x1680b6
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 0x1680ff
movq 0xb0(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
leaq 0x298(%rsp), %rdx
leaq 0x250(%rsp), %rcx
callq 0x156180
jmp 0x168126
movq 0xb0(%rsp), %rdi
movb $0x0, 0x24e(%rsp)
leaq 0x43333(%rip), %rsi     # 0x1ab470
leaq -0x11db4(%rip), %rdx    # 0x156390
callq 0xd09b0
jmp 0x1688ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x16820e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x168201
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1681e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1681cd
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 0x168227
jmp 0x168234
movq 0xb0(%rsp), %rdi
callq 0xd0430
jmp 0x1688b5
movq 0xc0(%rsp), %rdi
leaq 0x100d6(%rip), %rsi     # 0x17831e
callq 0xd9b40
movq %rax, %rdi
callq 0xd9da0
testb $0x1, %al
jne 0x16825e
jmp 0x1683b1
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 0x100d3(%rip), %rsi     # 0x17836f
leaq 0x228(%rsp), %rdi
callq 0xd8b80
jmp 0x1682ab
leaq 0x1ff(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0xd0a20
movq 0x78(%rsp), %rdx
leaq 0x10055(%rip), %rsi     # 0x17831e
leaq 0x200(%rsp), %rdi
callq 0xd8b80
jmp 0x1682d8
movq 0x80(%rsp), %rdi
leaq 0x228(%rsp), %rsi
leaq 0x200(%rsp), %rdx
callq 0x15a2f0
jmp 0x1682f7
movq 0x80(%rsp), %rdi
movb $0x0, 0x1fe(%rsp)
leaq 0x432b2(%rip), %rsi     # 0x1ab5c0
leaq -0xdee5(%rip), %rdx     # 0x15a430
callq 0xd09b0
jmp 0x1688ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x168386
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x16836c
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 0x16839f
jmp 0x1683ac
movq 0x80(%rsp), %rdi
callq 0xd0430
jmp 0x1688b5
movq 0xc0(%rsp), %rdi
leaq 0xffa7(%rip), %rsi      # 0x178367
callq 0xd9b40
movq %rax, %rdi
callq 0xd9da0
testb $0x1, %al
jne 0x1683d6
jmp 0x168517
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 0xff64(%rip), %rsi      # 0x17836f
leaq 0x1d8(%rsp), %rdi
callq 0xd8b80
jmp 0x16841a
leaq 0x1af(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0xd0a20
movq 0x60(%rsp), %rdx
leaq 0xff2f(%rip), %rsi      # 0x178367
leaq 0x1b0(%rsp), %rdi
callq 0xd8b80
jmp 0x168447
movq 0x68(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x1b0(%rsp), %rdx
callq 0x15a2f0
jmp 0x168463
movq 0x68(%rsp), %rdi
movb $0x0, 0x1ae(%rsp)
leaq 0x43149(%rip), %rsi     # 0x1ab5c0
leaq -0xe04e(%rip), %rdx     # 0x15a430
callq 0xd09b0
jmp 0x1688ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1684ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1684d5
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 0x168508
jmp 0x168512
movq 0x68(%rsp), %rdi
callq 0xd0430
jmp 0x1688b5
movq 0xc0(%rsp), %rdi
leaq 0xfdf8(%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 0x168554
leaq 0x178(%rsp), %rdi
callq 0xd9f30
movq 0xc0(%rsp), %rdi
leaq 0xfdf7(%rip), %rsi      # 0x178367
callq 0xd9b40
movq %rax, 0x50(%rsp)
jmp 0x16857c
movq 0x50(%rsp), %rdi
callq 0x1565a0
movsd %xmm0, 0x48(%rsp)
jmp 0x16858e
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x170(%rsp)
jmp 0x168858
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0x178(%rsp), %rdi
callq 0xd9f30
jmp 0x1688b5
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 0x1688b5
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 0xfd35(%rip), %rsi      # 0x17836f
leaq 0x148(%rsp), %rdi
callq 0xd8b80
jmp 0x168649
leaq 0x11f(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xd0a20
movq 0x30(%rsp), %rdx
leaq 0xfd00(%rip), %rsi      # 0x178367
leaq 0x120(%rsp), %rdi
callq 0xd8b80
jmp 0x168676
leaq 0xf7(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xd0a20
movq 0x28(%rsp), %rdx
leaq 0xf2dd(%rip), %rsi      # 0x177971
leaq 0xf8(%rsp), %rdi
callq 0xd8b80
jmp 0x1686a3
movq 0xc0(%rsp), %rdi
leaq 0xfcb5(%rip), %rsi      # 0x178367
callq 0xd9b40
movq %rax, 0x20(%rsp)
jmp 0x1686be
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 0x1686f8
movq 0x38(%rsp), %rdi
leaq 0x148(%rsp), %rsi
leaq 0x120(%rsp), %rdx
leaq 0xf8(%rsp), %rcx
leaq 0xd0(%rsp), %r8
callq 0x15a4a0
jmp 0x168724
movq 0x38(%rsp), %rdi
movb $0x0, 0xce(%rsp)
leaq 0x42ea0(%rip), %rsi     # 0x1ab5d8
leaq -0xdf9f(%rip), %rdx     # 0x15a7a0
callq 0xd09b0
jmp 0x1688ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x16882c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x168812
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1687f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1687eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x1687de
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 0x168845
jmp 0x16884f
movq 0x38(%rsp), %rdi
callq 0xd0430
callq 0xd0940
jmp 0x168856
jmp 0x1688b5
movl $0x38, %edi
callq 0xd05d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x8(%rsp)
movsd 0x170(%rsp), %xmm0
leaq 0x188(%rsp), %rsi
callq 0x167720
jmp 0x168885
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)