// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/util.cpp
// Function: simple_light()
std::shared_ptr<hitable> simple_light()
{
    std::shared_ptr<texture> _perlin_texture = std::make_shared<perlin_noise_texture>(4.0f);
    std::shared_ptr<texture> _color_texture = std::make_shared<constant_texture>(vec3(4.0f, 4.0f, 4.0f));

    std::vector<std::shared_ptr<hitable>> list;
    list.reserve(50);

    list.push_back(std::make_shared<sphere>(
        vec3(0.0f, -1000.0f, 0.0f), 1000.0f, std::make_shared<lambertian>(_perlin_texture)));
    list.push_back(std::make_shared<sphere>(vec3(0.0f,  2.0f, 0.0f), 2.0f, std::make_shared<lambertian>(_perlin_texture)));

    auto light = std::make_shared<diffuse_light>(_color_texture);
    list.push_back(std::make_shared<sphere>(vec3(0.0f, 7.0f, 0.0f), 2.0f, light));
    list.push_back(std::make_shared<xy_rect>(3.0f, 5.0f, 1.0f, 3.0f, -2.0f, light));
    
    return std::make_shared<bvh_node>(list, 0.0f, 1.0f);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movl $0x20, %edi
callq 0x63f0
movabsq $0x100000001, %r14      # imm = 0x100000001
movq %r14, 0x8(%rax)
leaq 0x37b96(%rip), %rcx     # 0x4e740
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
leaq 0x375a8(%rip), %rdx     # 0x4e160
addq $0x10, %rdx
movq %rdx, 0x10(%rax)
movl $0x40800000, 0x18(%rax) # imm = 0x40800000
movq %rcx, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movl $0x28, %edi
callq 0x63f0
movq %r14, 0x8(%rax)
leaq 0x3788a(%rip), %rcx     # 0x4e470
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x37509(%rip), %rdx     # 0x4e100
addq $0x10, %rdx
movq %rdx, 0x10(%rax)
movsd 0x258f9(%rip), %xmm0    # 0x3c500
movsd %xmm0, 0x18(%rax)
movl $0x40800000, 0x20(%rax) # imm = 0x40800000
movq %rcx, 0x80(%rsp)
movq %rax, 0x88(%rsp)
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl $0x32, %esi
callq 0x7602
movabsq $-0x3b86000000000000, %rax # imm = 0xC47A000000000000
movq %rax, 0x34(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x447a0000, 0x4(%rsp)  # imm = 0x447A0000
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0x215a2
leaq 0x10(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x8(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
leaq 0x34(%rsp), %rcx
leaq 0x4(%rsp), %r8
leaq 0x20(%rsp), %r9
callq 0x2217e
movups 0x8(%rsp), %xmm0
leaq 0x40(%rsp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x7c02
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x16cd9
callq 0x7768
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x16ce8
callq 0x7768
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16cf7
callq 0x7768
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x34(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x40000000, 0x4(%rsp)  # imm = 0x40000000
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0x215a2
leaq 0x10(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x8(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
leaq 0x34(%rsp), %rcx
leaq 0x4(%rsp), %r8
leaq 0x20(%rsp), %r9
callq 0x2217e
movups 0x8(%rsp), %xmm0
leaq 0x40(%rsp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x7c02
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x16d90
callq 0x7768
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x16d9f
callq 0x7768
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16dae
callq 0x7768
leaq 0x48(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x40(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x80(%rsp), %rcx
callq 0x21da8
movabsq $0x40e0000000000000, %rax # imm = 0x40E0000000000000
leaq 0x34(%rsp), %rcx
movq %rax, (%rcx)
movl $0x0, 0x8(%rcx)
leaq 0x4(%rsp), %r8
movl $0x40000000, (%r8)      # imm = 0x40000000
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
leaq 0x40(%rsp), %r14
movq %r14, %r9
callq 0x222ce
movups 0x20(%rsp), %xmm0
leaq 0x8(%rsp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x7c02
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x16e49
callq 0x7768
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16e58
callq 0x7768
movl $0x40400000, %eax       # imm = 0x40400000
leaq 0x34(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x4(%rsp), %r8
movl $0x40a00000, (%r8)      # imm = 0x40A00000
leaq 0x1c(%rsp), %r9
movl $0x3f800000, (%r9)      # imm = 0x3F800000
leaq 0x94(%rsp), %r10
movl %eax, (%r10)
leaq 0x90(%rsp), %rax
movl $0xc0000000, (%rax)     # imm = 0xC0000000
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
subq $0x8, %rsp
leaq 0x28(%rsp), %rsi
leaq 0x3b(%rsp), %rdx
pushq %r14
pushq %rax
pushq %r10
callq 0x223f6
addq $0x20, %rsp
movups 0x20(%rsp), %xmm0
leaq 0x8(%rsp), %rsi
movups %xmm0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x7c02
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x16eec
callq 0x7768
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16efb
callq 0x7768
leaq 0x20(%rsp), %r8
movl $0x0, (%r8)
leaq 0x34(%rsp), %r9
movl $0x3f800000, (%r9)      # imm = 0x3F800000
leaq 0x10(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0x220f0
movq 0x8(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x10(%rsp), %rcx
movq %rax, 0x10(%rsp)
movq %rcx, 0x8(%rbx)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x16f5f
callq 0x7768
leaq 0x60(%rsp), %rdi
callq 0x7720
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x16f7b
callq 0x7768
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x16f8a
callq 0x7768
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r14
retq
jmp 0x16fdd
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x16fac
callq 0x7768
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16fe0
jmp 0x16fd6
jmp 0x16fdd
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x16fcc
callq 0x7768
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16fe0
callq 0x7768
jmp 0x16fe0
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1705e
jmp 0x17052
jmp 0x1705b
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x17000
callq 0x7768
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x17014
callq 0x7768
jmp 0x17014
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1705e
jmp 0x17052
jmp 0x1705b
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x17034
callq 0x7768
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x17048
callq 0x7768
jmp 0x17048
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1705e
callq 0x7768
jmp 0x1705e
jmp 0x1705b
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x7720
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x1707a
callq 0x7768
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x17089
callq 0x7768
movq %rbx, %rdi
callq 0x66e0
movq %rax, %rbx
jmp 0x1707a