// File: alan0201tw[P]RayTracer/src/util.cpp
// Function: two_perlin_sphere()
std::shared_ptr<hitable> two_perlin_sphere()
{
    std::shared_ptr<texture> _perlin_texture = std::make_shared<perlin_noise_texture>(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)));

    return std::make_shared<bvh_node>(list, 0.0f, 1.0f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x110(%rbp)
movq %rdi, %rax
movq %rax, -0x108(%rbp)
movq %rdi, -0x8(%rbp)
movl $0x40800000, -0x2c(%rbp) # imm = 0x40800000
leaq -0x28(%rbp), %rdi
movq %rdi, -0x100(%rbp)
leaq -0x2c(%rbp), %rsi
callq 0x2d610
movq -0x100(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0x2d680
movq -0x100(%rbp), %rdi
callq 0x2d6b0
leaq -0x48(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x8b80
movq -0xf8(%rbp), %rdi
movl $0x32, %esi
callq 0x8ba0
jmp 0x2612a
leaq -0x84(%rbp), %rdi
movss 0x583a3(%rip), %xmm1    # 0x7e4dc
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
callq 0xf9b0
jmp 0x26146
movl $0x447a0000, -0x88(%rbp) # imm = 0x447A0000
leaq -0x98(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x2cea0
jmp 0x26162
leaq -0x78(%rbp), %rdi
leaq -0x84(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x2d590
jmp 0x26182
leaq -0x68(%rbp), %rdi
movq %rdi, -0x118(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x2cf10
movq -0x118(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x8ca0
jmp 0x261a8
leaq -0x68(%rbp), %rdi
callq 0x8e00
leaq -0x78(%rbp), %rdi
callq 0x2cf40
leaq -0x98(%rbp), %rdi
callq 0x2cf60
leaq -0xc4(%rbp), %rdi
movss 0x5828f(%rip), %xmm1    # 0x7e464
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
callq 0xf9b0
jmp 0x261e2
movl $0x40000000, -0xc8(%rbp) # imm = 0x40000000
leaq -0xd8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x2cea0
jmp 0x261fe
leaq -0xb8(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
leaq -0xd8(%rbp), %rcx
callq 0x2d590
jmp 0x26221
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x120(%rbp)
leaq -0xb8(%rbp), %rsi
callq 0x2cf10
movq -0x120(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x8ca0
jmp 0x2624d
leaq -0xa8(%rbp), %rdi
callq 0x8e00
leaq -0xb8(%rbp), %rdi
callq 0x2cf40
leaq -0xd8(%rbp), %rdi
callq 0x2cf60
movl $0x0, -0xec(%rbp)
movl $0x3f800000, -0xf0(%rbp) # imm = 0x3F800000
leaq -0xe8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0xec(%rbp), %rdx
leaq -0xf0(%rbp), %rcx
callq 0x2d4e0
jmp 0x262a5
movq -0x110(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2d560
leaq -0xe8(%rbp), %rdi
callq 0x13be0
leaq -0x48(%rbp), %rdi
callq 0x92d0
leaq -0x18(%rbp), %rdi
callq 0x12a50
movq -0x108(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2636c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x26320
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8e00
leaq -0x78(%rbp), %rdi
callq 0x2cf40
leaq -0x98(%rbp), %rdi
callq 0x2cf60
jmp 0x2636c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x26360
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x8e00
leaq -0xb8(%rbp), %rdi
callq 0x2cf40
leaq -0xd8(%rbp), %rdi
callq 0x2cf60
leaq -0x48(%rbp), %rdi
callq 0x92d0
leaq -0x18(%rbp), %rdi
callq 0x12a50
movq -0x50(%rbp), %rdi
callq 0x7860
nopw (%rax,%rax)