// File: alan0201tw[P]RayTracer/src/box.cpp
// Function: box::box(vec3 const&, vec3 const&, std::shared_ptr<material>)
box::box(const vec3& _min, const vec3& _max, std::shared_ptr<material> _material)
    : min_point(_min), max_point(_max)
{
    std::vector<std::shared_ptr<hitable>> list;
    list.reserve(6);

    //std::cout << min_point << " , " << max_point << std::endl;

    list.push_back(std::make_shared<xy_rect>(
            min_point.x(), max_point.x(), min_point.y(), max_point.y(), max_point.z(), _material));
    list.push_back(std::make_shared<flip_normals>(std::make_shared<xy_rect>(
            min_point.x(), max_point.x(), min_point.y(), max_point.y(), min_point.z(), _material)));

    list.push_back(std::make_shared<xz_rect>(
            min_point.x(), max_point.x(), min_point.z(), max_point.z(), max_point.y(), _material));
    list.push_back(std::make_shared<flip_normals>(std::make_shared<xz_rect>(
            min_point.x(), max_point.x(), min_point.z(), max_point.z(), min_point.y(), _material)));

    list.push_back(std::make_shared<yz_rect>(
            min_point.y(), max_point.y(), min_point.z(), max_point.z(), max_point.x(), _material));
    list.push_back(std::make_shared<flip_normals>(std::make_shared<yz_rect>(
            min_point.y(), max_point.y(), min_point.z(), max_point.z(), min_point.x(), _material)));

    rect_list = hitable_list(list);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rcx, -0x210(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x8b20
movq -0x208(%rbp), %rdi
leaq 0xa6de8(%rip), %rax     # 0xaee28
movq %rax, (%rdi)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x10(%rdi)
movq (%rax), %rax
movq %rax, 0x8(%rdi)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x1c(%rdi)
movq (%rax), %rax
movq %rax, 0x14(%rdi)
addq $0x20, %rdi
movq %rdi, -0x200(%rbp)
callq 0x8b40
leaq -0x38(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x8b80
movq -0x1f8(%rbp), %rdi
movl $0x6, %esi
callq 0x8ba0
jmp 0x8098
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
callq 0x8d70
movss %xmm0, -0x214(%rbp)
jmp 0x80b2
movq -0x208(%rbp), %rdi
movss -0x214(%rbp), %xmm0
movss %xmm0, -0x6c(%rbp)
addq $0x14, %rdi
callq 0x8d70
movss %xmm0, -0x218(%rbp)
jmp 0x80d9
movq -0x208(%rbp), %rdi
movss -0x218(%rbp), %xmm0
movss %xmm0, -0x70(%rbp)
addq $0x8, %rdi
callq 0x8d90
movss %xmm0, -0x21c(%rbp)
jmp 0x8100
movq -0x208(%rbp), %rdi
movss -0x21c(%rbp), %xmm0
movss %xmm0, -0x74(%rbp)
addq $0x14, %rdi
callq 0x8d90
movss %xmm0, -0x220(%rbp)
jmp 0x8127
movq -0x208(%rbp), %rdi
movss -0x220(%rbp), %xmm0
movss %xmm0, -0x78(%rbp)
addq $0x14, %rdi
callq 0x8db0
movss %xmm0, -0x224(%rbp)
jmp 0x814e
movq -0x210(%rbp), %rcx
movss -0x224(%rbp), %xmm0
movss %xmm0, -0x7c(%rbp)
movq %rsp, %rax
movq %rcx, (%rax)
leaq -0x68(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0x74(%rbp), %rcx
leaq -0x78(%rbp), %r8
leaq -0x7c(%rbp), %r9
callq 0x8cd0
jmp 0x8187
leaq -0x58(%rbp), %rdi
movq %rdi, -0x230(%rbp)
leaq -0x68(%rbp), %rsi
callq 0x8dd0
movq -0x230(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x8ca0
jmp 0x81ad
leaq -0x58(%rbp), %rdi
callq 0x8e00
leaq -0x68(%rbp), %rdi
callq 0x8e20
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
callq 0x8d70
movss %xmm0, -0x234(%rbp)
jmp 0x81d9
movq -0x208(%rbp), %rdi
movss -0x234(%rbp), %xmm0
movss %xmm0, -0xb4(%rbp)
addq $0x14, %rdi
callq 0x8d70
movss %xmm0, -0x238(%rbp)
jmp 0x8203
movq -0x208(%rbp), %rdi
movss -0x238(%rbp), %xmm0
movss %xmm0, -0xb8(%rbp)
addq $0x8, %rdi
callq 0x8d90
movss %xmm0, -0x23c(%rbp)
jmp 0x822d
movq -0x208(%rbp), %rdi
movss -0x23c(%rbp), %xmm0
movss %xmm0, -0xbc(%rbp)
addq $0x14, %rdi
callq 0x8d90
movss %xmm0, -0x240(%rbp)
jmp 0x8257
movq -0x208(%rbp), %rdi
movss -0x240(%rbp), %xmm0
movss %xmm0, -0xc0(%rbp)
addq $0x8, %rdi
callq 0x8db0
movss %xmm0, -0x244(%rbp)
jmp 0x8281
movq -0x210(%rbp), %rcx
movss -0x244(%rbp), %xmm0
movss %xmm0, -0xc4(%rbp)
movq %rsp, %rax
movq %rcx, (%rax)
leaq -0xb0(%rbp), %rdi
leaq -0xb4(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
leaq -0xbc(%rbp), %rcx
leaq -0xc0(%rbp), %r8
leaq -0xc4(%rbp), %r9
callq 0x8cd0
jmp 0x82cf
leaq -0xa0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x8e40
jmp 0x82e4
leaq -0x90(%rbp), %rdi
movq %rdi, -0x250(%rbp)
leaq -0xa0(%rbp), %rsi
callq 0x8eb0
movq -0x250(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x8ca0
jmp 0x8310
leaq -0x90(%rbp), %rdi
callq 0x8e00
leaq -0xa0(%rbp), %rdi
callq 0x8ee0
leaq -0xb0(%rbp), %rdi
callq 0x8e20
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
callq 0x8d70
movss %xmm0, -0x254(%rbp)
jmp 0x834e
movq -0x208(%rbp), %rdi
movss -0x254(%rbp), %xmm0
movss %xmm0, -0xec(%rbp)
addq $0x14, %rdi
callq 0x8d70
movss %xmm0, -0x258(%rbp)
jmp 0x8378
movq -0x208(%rbp), %rdi
movss -0x258(%rbp), %xmm0
movss %xmm0, -0xf0(%rbp)
addq $0x8, %rdi
callq 0x8db0
movss %xmm0, -0x25c(%rbp)
jmp 0x83a2
movq -0x208(%rbp), %rdi
movss -0x25c(%rbp), %xmm0
movss %xmm0, -0xf4(%rbp)
addq $0x14, %rdi
callq 0x8db0
movss %xmm0, -0x260(%rbp)
jmp 0x83cc
movq -0x208(%rbp), %rdi
movss -0x260(%rbp), %xmm0
movss %xmm0, -0xf8(%rbp)
addq $0x14, %rdi
callq 0x8d90
movss %xmm0, -0x264(%rbp)
jmp 0x83f6
movq -0x210(%rbp), %rcx
movss -0x264(%rbp), %xmm0
movss %xmm0, -0xfc(%rbp)
movq %rsp, %rax
movq %rcx, (%rax)
leaq -0xe8(%rbp), %rdi
leaq -0xec(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
leaq -0xf4(%rbp), %rcx
leaq -0xf8(%rbp), %r8
leaq -0xfc(%rbp), %r9
callq 0x8f00
jmp 0x8444
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x270(%rbp)
leaq -0xe8(%rbp), %rsi
callq 0x8fa0
movq -0x270(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x8ca0
jmp 0x8470
leaq -0xd8(%rbp), %rdi
callq 0x8e00
leaq -0xe8(%rbp), %rdi
callq 0x8fd0
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
callq 0x8d70
movss %xmm0, -0x274(%rbp)
jmp 0x84a2
movq -0x208(%rbp), %rdi
movss -0x274(%rbp), %xmm0
movss %xmm0, -0x134(%rbp)
addq $0x14, %rdi
callq 0x8d70
movss %xmm0, -0x278(%rbp)
jmp 0x84cc
movq -0x208(%rbp), %rdi
movss -0x278(%rbp), %xmm0
movss %xmm0, -0x138(%rbp)
addq $0x8, %rdi
callq 0x8db0
movss %xmm0, -0x27c(%rbp)
jmp 0x84f6
movq -0x208(%rbp), %rdi
movss -0x27c(%rbp), %xmm0
movss %xmm0, -0x13c(%rbp)
addq $0x14, %rdi
callq 0x8db0
movss %xmm0, -0x280(%rbp)
jmp 0x8520
movq -0x208(%rbp), %rdi
movss -0x280(%rbp), %xmm0
movss %xmm0, -0x140(%rbp)
addq $0x8, %rdi
callq 0x8d90
movss %xmm0, -0x284(%rbp)
jmp 0x854a
movq -0x210(%rbp), %rcx
movss -0x284(%rbp), %xmm0
movss %xmm0, -0x144(%rbp)
movq %rsp, %rax
movq %rcx, (%rax)
leaq -0x130(%rbp), %rdi
leaq -0x134(%rbp), %rsi
leaq -0x138(%rbp), %rdx
leaq -0x13c(%rbp), %rcx
leaq -0x140(%rbp), %r8
leaq -0x144(%rbp), %r9
callq 0x8f00
jmp 0x8598
leaq -0x120(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x8ff0
jmp 0x85ad
leaq -0x110(%rbp), %rdi
movq %rdi, -0x290(%rbp)
leaq -0x120(%rbp), %rsi
callq 0x8eb0
movq -0x290(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x8ca0
jmp 0x85d9
leaq -0x110(%rbp), %rdi
callq 0x8e00
leaq -0x120(%rbp), %rdi
callq 0x8ee0
leaq -0x130(%rbp), %rdi
callq 0x8fd0
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
callq 0x8d90
movss %xmm0, -0x294(%rbp)
jmp 0x8617
movq -0x208(%rbp), %rdi
movss -0x294(%rbp), %xmm0
movss %xmm0, -0x16c(%rbp)
addq $0x14, %rdi
callq 0x8d90
movss %xmm0, -0x298(%rbp)
jmp 0x8641
movq -0x208(%rbp), %rdi
movss -0x298(%rbp), %xmm0
movss %xmm0, -0x170(%rbp)
addq $0x8, %rdi
callq 0x8db0
movss %xmm0, -0x29c(%rbp)
jmp 0x866b
movq -0x208(%rbp), %rdi
movss -0x29c(%rbp), %xmm0
movss %xmm0, -0x174(%rbp)
addq $0x14, %rdi
callq 0x8db0
movss %xmm0, -0x2a0(%rbp)
jmp 0x8695
movq -0x208(%rbp), %rdi
movss -0x2a0(%rbp), %xmm0
movss %xmm0, -0x178(%rbp)
addq $0x14, %rdi
callq 0x8d70
movss %xmm0, -0x2a4(%rbp)
jmp 0x86bf
movq -0x210(%rbp), %rcx
movss -0x2a4(%rbp), %xmm0
movss %xmm0, -0x17c(%rbp)
movq %rsp, %rax
movq %rcx, (%rax)
leaq -0x168(%rbp), %rdi
leaq -0x16c(%rbp), %rsi
leaq -0x170(%rbp), %rdx
leaq -0x174(%rbp), %rcx
leaq -0x178(%rbp), %r8
leaq -0x17c(%rbp), %r9
callq 0x9060
jmp 0x870d
leaq -0x158(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
leaq -0x168(%rbp), %rsi
callq 0x9100
movq -0x2b0(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x8ca0
jmp 0x8739
leaq -0x158(%rbp), %rdi
callq 0x8e00
leaq -0x168(%rbp), %rdi
callq 0x9130
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
callq 0x8d90
movss %xmm0, -0x2b4(%rbp)
jmp 0x876b
movq -0x208(%rbp), %rdi
movss -0x2b4(%rbp), %xmm0
movss %xmm0, -0x1b4(%rbp)
addq $0x14, %rdi
callq 0x8d90
movss %xmm0, -0x2b8(%rbp)
jmp 0x8795
movq -0x208(%rbp), %rdi
movss -0x2b8(%rbp), %xmm0
movss %xmm0, -0x1b8(%rbp)
addq $0x8, %rdi
callq 0x8db0
movss %xmm0, -0x2bc(%rbp)
jmp 0x87bf
movq -0x208(%rbp), %rdi
movss -0x2bc(%rbp), %xmm0
movss %xmm0, -0x1bc(%rbp)
addq $0x14, %rdi
callq 0x8db0
movss %xmm0, -0x2c0(%rbp)
jmp 0x87e9
movq -0x208(%rbp), %rdi
movss -0x2c0(%rbp), %xmm0
movss %xmm0, -0x1c0(%rbp)
addq $0x8, %rdi
callq 0x8d70
movss %xmm0, -0x2c4(%rbp)
jmp 0x8813
movq -0x210(%rbp), %rcx
movss -0x2c4(%rbp), %xmm0
movss %xmm0, -0x1c4(%rbp)
movq %rsp, %rax
movq %rcx, (%rax)
leaq -0x1b0(%rbp), %rdi
leaq -0x1b4(%rbp), %rsi
leaq -0x1b8(%rbp), %rdx
leaq -0x1bc(%rbp), %rcx
leaq -0x1c0(%rbp), %r8
leaq -0x1c4(%rbp), %r9
callq 0x9060
jmp 0x8861
leaq -0x1a0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x9150
jmp 0x8876
leaq -0x190(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
leaq -0x1a0(%rbp), %rsi
callq 0x8eb0
movq -0x2d0(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x8ca0
jmp 0x88a2
leaq -0x190(%rbp), %rdi
callq 0x8e00
leaq -0x1a0(%rbp), %rdi
callq 0x8ee0
leaq -0x1b0(%rbp), %rdi
callq 0x9130
leaq -0x1f0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x91c0
jmp 0x88d8
movq -0x208(%rbp), %rdi
addq $0x20, %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x9250
leaq -0x1f0(%rbp), %rdi
callq 0x92a0
leaq -0x38(%rbp), %rdi
callq 0x92d0
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x8e00
leaq -0x68(%rbp), %rdi
callq 0x8e20
jmp 0x8a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8973
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x8e00
leaq -0xa0(%rbp), %rdi
callq 0x8ee0
leaq -0xb0(%rbp), %rdi
callq 0x8e20
jmp 0x8a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x8e00
leaq -0xe8(%rbp), %rdi
callq 0x8fd0
jmp 0x8a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x89df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x8e00
leaq -0x120(%rbp), %rdi
callq 0x8ee0
leaq -0x130(%rbp), %rdi
callq 0x8fd0
jmp 0x8a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x8e00
leaq -0x168(%rbp), %rdi
callq 0x9130
jmp 0x8a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8a45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x8e00
leaq -0x1a0(%rbp), %rdi
callq 0x8ee0
leaq -0x1b0(%rbp), %rdi
callq 0x9130
leaq -0x38(%rbp), %rdi
callq 0x92d0
movq -0x200(%rbp), %rdi
callq 0x92a0
movq -0x40(%rbp), %rdi
callq 0x7860
nop