// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r15
movl $0x40800000, %ebp       # imm = 0x40800000
leaq 0x80(%rsp), %rsi
movl %ebp, (%rsi)
leaq 0x50(%rsp), %rdi
callq 0x16d98
leaq 0x98(%rsp), %rbx
leaq 0x58(%rsp), %rdi
movaps -0x8(%rdi), %xmm0
movaps %xmm0, -0x8(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rdi)
callq 0x7426
movsd 0x1d54a(%rip), %xmm0    # 0x305a0
leaq 0x40(%rsp), %rsi
movsd %xmm0, (%rsi)
movl %ebp, 0x8(%rsi)
leaq 0x50(%rsp), %rdi
callq 0x16b90
leaq 0x88(%rsp), %r14
leaq 0x58(%rsp), %r12
movaps -0x8(%r12), %xmm0
movaps %xmm0, -0x8(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r12)
movq %r12, %rdi
callq 0x7426
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r12)
andq $0x0, 0x8(%r12)
leaq 0x50(%rsp), %rdi
pushq $0x32
popq %rsi
callq 0x71e8
movsd 0x1d4b7(%rip), %xmm0    # 0x30570
movsd %xmm0, 0x20(%rsp)
andl $0x0, 0x28(%rsp)
movl $0x447a0000, 0xc(%rsp)  # imm = 0x447A0000
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x16bf0
leaq 0x30(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x16d74
leaq 0x48(%rsp), %r13
leaq 0x38(%rsp), %r12
movaps -0x8(%r12), %xmm0
movaps %xmm0, -0x8(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r12)
leaq 0x50(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x7b8a
movq %r13, %rdi
callq 0x7426
movq %r12, %rdi
callq 0x7426
leaq 0x18(%rsp), %rdi
callq 0x7426
movsd 0x1d4ca(%rip), %xmm0    # 0x30610
movsd %xmm0, 0x20(%rsp)
andl $0x0, 0x28(%rsp)
movl $0x40000000, 0xc(%rsp)  # imm = 0x40000000
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x16bf0
leaq 0x30(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x16d74
leaq 0x48(%rsp), %r13
leaq 0x38(%rsp), %r12
movaps -0x8(%r12), %xmm0
movaps %xmm0, -0x8(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r12)
leaq 0x50(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x7b8a
movq %r13, %rdi
callq 0x7426
movq %r12, %rdi
callq 0x7426
leaq 0x18(%rsp), %rdi
callq 0x7426
leaq 0x40(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x16d0e
movsd 0x1d43b(%rip), %xmm0    # 0x30620
leaq 0x20(%rsp), %rsi
movsd %xmm0, (%rsi)
andl $0x0, 0x8(%rsi)
leaq 0xc(%rsp), %rdx
movl $0x40000000, (%rdx)     # imm = 0x40000000
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %r12
movq %r12, %rcx
callq 0x16db6
leaq 0x38(%rsp), %rbp
leaq 0x18(%rsp), %r13
movaps -0x8(%r13), %xmm0
movaps %xmm0, -0x8(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r13)
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x7b8a
movq %rbp, %rdi
callq 0x7426
movq %r13, %rdi
callq 0x7426
movl $0x40400000, %eax       # imm = 0x40400000
leaq 0x20(%rsp), %rsi
movl %eax, (%rsi)
leaq 0xc(%rsp), %rdx
movl $0x40a00000, (%rdx)     # imm = 0x40A00000
leaq 0x7c(%rsp), %rcx
movl $0x3f800000, (%rcx)     # imm = 0x3F800000
leaq 0x78(%rsp), %r8
movl %eax, (%r8)
leaq 0x74(%rsp), %r9
movl $0xc0000000, (%r9)      # imm = 0xC0000000
movq %r12, (%rsp)
leaq 0x10(%rsp), %rdi
callq 0x16dda
leaq 0x38(%rsp), %r13
leaq 0x18(%rsp), %r12
movaps -0x8(%r12), %xmm0
movaps %xmm0, -0x8(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r12)
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x7b8a
movq %r13, %rdi
callq 0x7426
movq %r12, %rdi
callq 0x7426
leaq 0x10(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x20(%rsp), %rcx
movl $0x3f800000, (%rcx)     # imm = 0x3F800000
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x16d50
leaq 0x38(%rsp), %rdi
movaps -0x8(%rdi), %xmm0
andq $0x0, (%rdi)
movups %xmm0, (%r15)
andq $0x0, -0x8(%rdi)
callq 0x7426
leaq 0x48(%rsp), %rdi
callq 0x7426
leaq 0x50(%rsp), %rdi
callq 0x7404
movq %r14, %rdi
callq 0x7426
movq %rbx, %rdi
callq 0x7426
movq %r15, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13369
movq %rax, %r15
movq %r13, %rdi
callq 0x7426
movq %r12, %rdi
jmp 0x13362
jmp 0x13369
movq %rax, %r15
movq %rbp, %rdi
callq 0x7426
movq %r13, %rdi
callq 0x7426
jmp 0x1336c
movq %rax, %r15
leaq 0x48(%rsp), %rdi
jmp 0x13398
jmp 0x133a1
jmp 0x1337b
jmp 0x13390
jmp 0x133a1
movq %rax, %r15
movq %r13, %rdi
callq 0x7426
movq %r12, %rdi
callq 0x7426
jmp 0x13393
movq %rax, %r15
leaq 0x18(%rsp), %rdi
callq 0x7426
jmp 0x133a4
jmp 0x133a1
movq %rax, %r15
leaq 0x50(%rsp), %rdi
callq 0x7404
movq %r14, %rdi
callq 0x7426
movq %rbx, %rdi
callq 0x7426
movq %r15, %rdi
callq 0x6710
movq %rax, %r15
jmp 0x133b6