// File: /workspace/github_cpp_makefile_star2_O3/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 $0xa8, %rsp
movq %rdi, %rbx
movl $0x20, %edi
callq 0x63f0
movabsq $0x100000001, %r14      # imm = 0x100000001
movq %r14, 0x8(%rax)
leaq 0x38401(%rip), %rcx     # 0x4e728
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
leaq 0x37e13(%rip), %rdx     # 0x4e148
addq $0x10, %rdx
movq %rdx, 0x10(%rax)
movl $0x40800000, 0x18(%rax) # imm = 0x40800000
movq %rcx, 0x60(%rsp)
movq %rax, 0x68(%rsp)
movl $0x28, %edi
callq 0x63f0
movq %r14, 0x8(%rax)
leaq 0x380f5(%rip), %rcx     # 0x4e458
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x37d74(%rip), %rdx     # 0x4e0e8
addq $0x10, %rdx
movq %rdx, 0x10(%rax)
movsd 0x2620c(%rip), %xmm0    # 0x3c590
movsd %xmm0, 0x18(%rax)
movl $0x40800000, 0x20(%rax) # imm = 0x40800000
movq %rcx, 0x90(%rsp)
movq %rax, 0x98(%rsp)
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl $0x32, %esi
callq 0x7616
movsd 0x2619b(%rip), %xmm0    # 0x3c560
movsd %xmm0, 0x40(%rsp)
movl $0x0, 0x48(%rsp)
movl $0x447a0000, 0x8(%rsp)  # imm = 0x447A0000
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0x20b4e
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x40(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x10(%rsp), %r9
callq 0x2172a
movaps 0x20(%rsp), %xmm0
leaq 0x50(%rsp), %rsi
movaps %xmm0, (%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x7c1c
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x16455
callq 0x7774
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16464
callq 0x7774
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16473
callq 0x7774
movsd 0x26185(%rip), %xmm0    # 0x3c600
movsd %xmm0, 0x40(%rsp)
movl $0x0, 0x48(%rsp)
movl $0x40000000, 0x8(%rsp)  # imm = 0x40000000
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0x20b4e
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x40(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x10(%rsp), %r9
callq 0x2172a
movaps 0x20(%rsp), %xmm0
leaq 0x50(%rsp), %rsi
movaps %xmm0, (%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x7c1c
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x1650b
callq 0x7774
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1651a
callq 0x7774
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16529
callq 0x7774
leaq 0x58(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x50(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x90(%rsp), %rcx
callq 0x21348
movsd 0x260bb(%rip), %xmm0    # 0x3c610
leaq 0x40(%rsp), %rcx
movsd %xmm0, (%rcx)
movl $0x0, 0x8(%rcx)
leaq 0x8(%rsp), %r8
movl $0x40000000, (%r8)      # imm = 0x40000000
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x50(%rsp), %r14
movq %r14, %r9
callq 0x21874
movaps 0x10(%rsp), %xmm0
leaq 0x20(%rsp), %rsi
movaps %xmm0, (%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x7c1c
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x165c3
callq 0x7774
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x165d2
callq 0x7774
movl $0x40400000, %eax       # imm = 0x40400000
leaq 0x40(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x8(%rsp), %r8
movl $0x40a00000, (%r8)      # imm = 0x40A00000
leaq 0xc(%rsp), %r9
movl $0x3f800000, (%r9)      # imm = 0x3F800000
leaq 0xa4(%rsp), %r10
movl %eax, (%r10)
leaq 0xa0(%rsp), %rax
movl $0xc0000000, (%rax)     # imm = 0xC0000000
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
subq $0x8, %rsp
leaq 0x18(%rsp), %rsi
leaq 0x47(%rsp), %rdx
pushq %r14
pushq %rax
pushq %r10
callq 0x219c8
addq $0x20, %rsp
movaps 0x10(%rsp), %xmm0
leaq 0x20(%rsp), %rsi
movaps %xmm0, (%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x7c1c
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16666
callq 0x7774
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16675
callq 0x7774
leaq 0x10(%rsp), %r8
movl $0x0, (%r8)
leaq 0x40(%rsp), %r9
movl $0x3f800000, (%r9)      # imm = 0x3F800000
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x70(%rsp), %rcx
callq 0x2169c
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rbx)
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x166c5
callq 0x7774
leaq 0x70(%rsp), %rdi
callq 0x7726
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x166e1
callq 0x7774
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x166f0
callq 0x7774
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r14
retq
jmp 0x16743
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16712
callq 0x7774
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16746
jmp 0x1673c
jmp 0x16743
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x16732
callq 0x7774
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x16746
callq 0x7774
jmp 0x16746
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x167c4
jmp 0x167b8
jmp 0x167c1
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x16766
callq 0x7774
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1677a
callq 0x7774
jmp 0x1677a
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x167c4
jmp 0x167b8
jmp 0x167c1
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x1679a
callq 0x7774
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x167ae
callq 0x7774
jmp 0x167ae
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x167c4
callq 0x7774
jmp 0x167c4
jmp 0x167c1
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x7726
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x167e0
callq 0x7774
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x167ef
callq 0x7774
movq %rbx, %rdi
callq 0x66e0
movq %rax, %rbx
jmp 0x167e0