// File: alan0201tw[P]RayTracer/src/triangle.cpp
// Function: triangle::bounding_box(float, float, aabb&) const
bool triangle::bounding_box(float t0, float t1, aabb& _box) const
{
    float minX = std::min(v0.x(), std::min(v1.x(), v2.x()));
    float minY = std::min(v0.y(), std::min(v1.y(), v2.y()));
    float minZ = std::min(v0.z(), std::min(v1.z(), v2.z()));

    float maxX = std::max(v0.x(), std::max(v1.x(), v2.x()));
    float maxY = std::max(v0.y(), std::max(v1.y(), v2.y()));
    float maxZ = std::max(v0.z(), std::max(v1.z(), v2.z()));

    vec3 min_point = vec3(minX, minY, minZ);
    vec3 max_point = vec3(maxX, maxY, maxZ);

    _box = aabb(min_point, max_point);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movss %xmm1, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
addq $0x8, %rdi
callq 0x8d70
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x20(%rbp)
addq $0x14, %rdi
callq 0x8d70
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x24(%rbp)
addq $0x20, %rdi
callq 0x8d70
movss %xmm0, -0x28(%rbp)
leaq -0x24(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x18c60
movq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x18c60
movq -0xb0(%rbp), %rdi
movss (%rax), %xmm0
movss %xmm0, -0x1c(%rbp)
addq $0x8, %rdi
callq 0x8d90
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x30(%rbp)
addq $0x14, %rdi
callq 0x8d90
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x34(%rbp)
addq $0x20, %rdi
callq 0x8d90
movss %xmm0, -0x38(%rbp)
leaq -0x34(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x18c60
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x18c60
movq -0xb0(%rbp), %rdi
movss (%rax), %xmm0
movss %xmm0, -0x2c(%rbp)
addq $0x8, %rdi
callq 0x8db0
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x40(%rbp)
addq $0x14, %rdi
callq 0x8db0
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x44(%rbp)
addq $0x20, %rdi
callq 0x8db0
movss %xmm0, -0x48(%rbp)
leaq -0x44(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x18c60
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x18c60
movq -0xb0(%rbp), %rdi
movss (%rax), %xmm0
movss %xmm0, -0x3c(%rbp)
addq $0x8, %rdi
callq 0x8d70
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x50(%rbp)
addq $0x14, %rdi
callq 0x8d70
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x54(%rbp)
addq $0x20, %rdi
callq 0x8d70
movss %xmm0, -0x58(%rbp)
leaq -0x54(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x18ca0
movq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0x18ca0
movq -0xb0(%rbp), %rdi
movss (%rax), %xmm0
movss %xmm0, -0x4c(%rbp)
addq $0x8, %rdi
callq 0x8d90
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x60(%rbp)
addq $0x14, %rdi
callq 0x8d90
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x64(%rbp)
addq $0x20, %rdi
callq 0x8d90
movss %xmm0, -0x68(%rbp)
leaq -0x64(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x18ca0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x18ca0
movq -0xb0(%rbp), %rdi
movss (%rax), %xmm0
movss %xmm0, -0x5c(%rbp)
addq $0x8, %rdi
callq 0x8db0
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x70(%rbp)
addq $0x14, %rdi
callq 0x8db0
movq -0xb0(%rbp), %rdi
movss %xmm0, -0x74(%rbp)
addq $0x20, %rdi
callq 0x8db0
movss %xmm0, -0x78(%rbp)
leaq -0x74(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x18ca0
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
callq 0x18ca0
movss (%rax), %xmm0
movss %xmm0, -0x6c(%rbp)
movss -0x1c(%rbp), %xmm0
movss -0x2c(%rbp), %xmm1
movss -0x3c(%rbp), %xmm2
leaq -0x84(%rbp), %rdi
callq 0xf9b0
movss -0x4c(%rbp), %xmm0
movss -0x5c(%rbp), %xmm1
movss -0x6c(%rbp), %xmm2
leaq -0x90(%rbp), %rdi
callq 0xf9b0
leaq -0xa8(%rbp), %rdi
leaq -0x84(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x9330
movq -0x18(%rbp), %rax
movq -0xa8(%rbp), %rcx
movq %rcx, (%rax)
movq -0xa0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x98(%rbp), %rcx
movq %rcx, 0x10(%rax)
movb $0x1, %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)