#include "aabb.cuh"

#include <math.h>
#include <stdio.h>

__host__ __device__ AABB3::AABB3() {
    min = Vec3();
    max = Vec3();
}

__host__ __device__ AABB3::AABB3(Vec3 min, Vec3 max) {
    this->min = min;
    this->max = max;
}

__host__ __device__ void AABB3::get_vertices(Vec3* vertices)
{
    vertices[0] = this->min;
    vertices[1] = Vec3(max.x, min.y, min.z);
    vertices[2] = Vec3(min.x, max.y, min.z);
    vertices[3] = Vec3(min.x, min.y, max.z);
    vertices[4] = Vec3(max.x, max.y, min.z);
    vertices[5] = Vec3(min.x, max.y, max.z);
    vertices[6] = Vec3(max.x, min.y, max.z);
    vertices[7] = this->max;
}

__host__ __device__ AABB3 AABB3::get_union(AABB3* other) {
    return AABB3(min.minimum(other->min), max.maximum(other->max));
}

__host__ __device__ bool AABB3::intersects(Vec3 ray_origin, Vec3 ray_direction, float* distance) {
    #ifndef max
    #define max( a, b ) ( ((a) > (b)) ? (a) : (b) )
    #endif

    #ifndef min
    #define min( a, b ) ( ((a) < (b)) ? (a) : (b) )
    #endif

    ray_direction = ray_direction.normalize();
    Vec3 dirfrac = Vec3(1.0 / ray_direction.x, 1.0 / ray_direction.y, 1.0 / ray_direction.z);
    float t1 = (min.x - ray_origin.x) * dirfrac.x;
    float t2 = (max.x - ray_origin.x) * dirfrac.x;
    float t3 = (min.y - ray_origin.y) * dirfrac.y;
    float t4 = (max.y - ray_origin.y) * dirfrac.y;
    float t5 = (min.z - ray_origin.z) * dirfrac.z;
    float t6 = (max.z - ray_origin.z) * dirfrac.z;
    
    float tmin = max(max(min(t1, t2), min(t3, t4)), min(t5, t6));
    float tmax = min(min(max(t1, t2), max(t3, t4)), max(t5, t6));

    if (tmax < 0) // box behind us
        return false;
    
    if (tmin > tmax) // no intersection
        return false;

    *distance = tmin;
    return true;
}

__host__ __device__ float AABB3::surface() {
    float x = max.x - min.x;
    float y = max.y - min.y;
    float z = max.z - min.z;

    return (x * y + y * z + z * x) * 2.0;

}

__host__ __device__ void AABB3::print() {
    printf("AABB3(%f, %f, %f)(%f, %f, %f)\n", min.x, min.y, min.z, max.x, max.y, max.z);
}

__host__ __device__ Vec3 AABB3::center() {
    return Vec3((max.x + min.x) / 2.0, (max.y + min.y) / 2.0, (max.z + min.z) / 2.0);
}

__host__ __device__ AABB2::AABB2() {
    min = Vec2();
    max = Vec2();
}

__host__ __device__ AABB2::AABB2(Vec2 min, Vec2 max) {
    this->min = min;
    this->max = max;
}

	.file	"tmpxft_002c6aaf_00000000-6_aabb.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2058:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2058:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.globl	_ZN5AABB3C2Ev
	.type	_ZN5AABB3C2Ev, @function
_ZN5AABB3C2Ev:
.LFB2039:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rbp
	call	_ZN4Vec3C1Ev@PLT
	leaq	12(%rbx), %rdi
	call	_ZN4Vec3C1Ev@PLT
	movq	%rbp, %rdi
	call	_ZN4Vec3C1Ev@PLT
	movq	12(%rsp), %rax
	movq	%rbp, %rdi
	movq	%rax, (%rbx)
	movl	20(%rsp), %eax
	movl	%eax, 8(%rbx)
	call	_ZN4Vec3C1Ev@PLT
	movq	12(%rsp), %rax
	movq	%rax, 12(%rbx)
	movl	20(%rsp), %eax
	movl	%eax, 20(%rbx)
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	addq	$40, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2039:
	.size	_ZN5AABB3C2Ev, .-_ZN5AABB3C2Ev
	.globl	_ZN5AABB3C1Ev
	.set	_ZN5AABB3C1Ev,_ZN5AABB3C2Ev
	.align 2
	.globl	_ZN5AABB3C2E4Vec3S0_
	.type	_ZN5AABB3C2E4Vec3S0_, @function
_ZN5AABB3C2E4Vec3S0_:
.LFB2042:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%xmm0, 16(%rsp)
	movss	%xmm1, 24(%rsp)
	movq	%xmm2, (%rsp)
	movss	%xmm3, 8(%rsp)
	call	_ZN4Vec3C1Ev@PLT
	leaq	12(%rbx), %rdi
	call	_ZN4Vec3C1Ev@PLT
	movq	16(%rsp), %rax
	movq	%rax, (%rbx)
	movl	24(%rsp), %eax
	movl	%eax, 8(%rbx)
	movq	(%rsp), %rax
	movq	%rax, 12(%rbx)
	movl	8(%rsp), %eax
	movl	%eax, 20(%rbx)
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2042:
	.size	_ZN5AABB3C2E4Vec3S0_, .-_ZN5AABB3C2E4Vec3S0_
	.globl	_ZN5AABB3C1E4Vec3S0_
	.set	_ZN5AABB3C1E4Vec3S0_,_ZN5AABB3C2E4Vec3S0_
	.align 2
	.globl	_ZN5AABB312get_verticesEP4Vec3
	.type	_ZN5AABB312get_verticesEP4Vec3, @function
_ZN5AABB312get_verticesEP4Vec3:
.LFB2044:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	movq	(%rdi), %rax
	leaq	12(%rsp), %r12
	movq	%rax, (%rsi)
	movl	8(%rdi), %eax
	movss	12(%rdi), %xmm0
	movss	4(%rdi), %xmm1
	movl	%eax, 8(%rsi)
	movss	8(%rdi), %xmm2
	movq	%r12, %rdi
	call	_ZN4Vec3C1Efff@PLT
	movq	12(%rsp), %rax
	movq	%r12, %rdi
	movq	%rax, 12(%rbp)
	movl	20(%rsp), %eax
	movss	16(%rbx), %xmm1
	movss	(%rbx), %xmm0
	movl	%eax, 20(%rbp)
	movss	8(%rbx), %xmm2
	call	_ZN4Vec3C1Efff@PLT
	movq	12(%rsp), %rax
	movq	%r12, %rdi
	movq	%rax, 24(%rbp)
	movl	20(%rsp), %eax
	movss	4(%rbx), %xmm1
	movss	(%rbx), %xmm0
	movl	%eax, 32(%rbp)
	movss	20(%rbx), %xmm2
	call	_ZN4Vec3C1Efff@PLT
	movq	12(%rsp), %rax
	movq	%r12, %rdi
	movq	%rax, 36(%rbp)
	movl	20(%rsp), %eax
	movss	12(%rbx), %xmm0
	movss	16(%rbx), %xmm1
	movl	%eax, 44(%rbp)
	movss	8(%rbx), %xmm2
	call	_ZN4Vec3C1Efff@PLT
	movq	12(%rsp), %rax
	movq	%r12, %rdi
	movq	%rax, 48(%rbp)
	movl	20(%rsp), %eax
	movss	16(%rbx), %xmm1
	movss	(%rbx), %xmm0
	movl	%eax, 56(%rbp)
	movss	20(%rbx), %xmm2
	call	_ZN4Vec3C1Efff@PLT
	movq	12(%rsp), %rax
	movq	%r12, %rdi
	movq	%rax, 60(%rbp)
	movl	20(%rsp), %eax
	movss	12(%rbx), %xmm0
	movss	4(%rbx), %xmm1
	movl	%eax, 68(%rbp)
	movss	20(%rbx), %xmm2
	call	_ZN4Vec3C1Efff@PLT
	movq	12(%rsp), %rax
	movq	%rax, 72(%rbp)
	movl	20(%rsp), %eax
	movl	%eax, 80(%rbp)
	movq	12(%rbx), %rax
	movq	%rax, 84(%rbp)
	movl	20(%rbx), %eax
	movl	%eax, 92(%rbp)
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2044:
	.size	_ZN5AABB312get_verticesEP4Vec3, .-_ZN5AABB312get_verticesEP4Vec3
	.align 2
	.globl	_ZN5AABB39get_unionEPS_
	.type	_ZN5AABB39get_unionEPS_, @function
_ZN5AABB39get_unionEPS_:
.LFB2045:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	leaq	12(%rsi), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdx, %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	12(%rdx), %xmm0
	movss	20(%rdx), %xmm1
	call	_ZN4Vec37maximumES_@PLT
	movq	%r12, %rdi
	movq	%xmm0, 8(%rsp)
	movq	(%rbx), %xmm0
	movss	%xmm1, 16(%rsp)
	movss	8(%rbx), %xmm1
	call	_ZN4Vec37minimumES_@PLT
	movq	8(%rsp), %xmm2
	movss	16(%rsp), %xmm3
	movq	%rbp, %rdi
	call	_ZN5AABB3C1E4Vec3S0_
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	movq	%rbp, %rax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2045:
	.size	_ZN5AABB39get_unionEPS_, .-_ZN5AABB39get_unionEPS_
	.align 2
	.globl	_ZN5AABB310intersectsE4Vec3S0_Pf
	.type	_ZN5AABB310intersectsE4Vec3S0_Pf, @function
_ZN5AABB310intersectsE4Vec3S0_Pf:
.LFB2046:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	subq	$88, %rsp
	.cfi_def_cfa_offset 112
	movq	%xmm0, 32(%rsp)
	movss	32(%rsp), %xmm5
	leaq	16(%rsp), %rdi
	movss	36(%rsp), %xmm4
	movss	%xmm1, 12(%rsp)
	movq	%xmm2, 16(%rsp)
	movss	%xmm3, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	movss	%xmm5, 8(%rsp)
	movss	%xmm4, 4(%rsp)
	call	_ZN4Vec39normalizeEv@PLT
	leaq	60(%rsp), %rdi
	movaps	%xmm0, %xmm2
	movss	%xmm1, 24(%rsp)
	movaps	%xmm1, %xmm0
	movss	.LC0(%rip), %xmm1
	movq	%xmm2, 16(%rsp)
	movaps	%xmm1, %xmm2
	movaps	%xmm1, %xmm3
	divss	16(%rsp), %xmm3
	divss	20(%rsp), %xmm1
	divss	%xmm0, %xmm2
	movaps	%xmm3, %xmm0
	call	_ZN4Vec3C1Efff@PLT
	movss	(%rbx), %xmm1
	movss	12(%rbx), %xmm3
	xorl	%eax, %eax
	movss	8(%rsp), %xmm5
	movss	4(%rsp), %xmm4
	movss	16(%rbx), %xmm2
	movss	60(%rsp), %xmm0
	subss	%xmm5, %xmm1
	subss	%xmm5, %xmm3
	movss	4(%rbx), %xmm5
	movss	12(%rsp), %xmm6
	subss	%xmm4, %xmm2
	movss	68(%rsp), %xmm7
	subss	%xmm4, %xmm5
	movss	8(%rbx), %xmm4
	mulss	%xmm0, %xmm3
	mulss	%xmm0, %xmm1
	movss	64(%rsp), %xmm0
	subss	%xmm6, %xmm4
	mulss	%xmm0, %xmm2
	mulss	%xmm0, %xmm5
	movss	20(%rbx), %xmm0
	mulss	%xmm7, %xmm4
	subss	%xmm6, %xmm0
	movaps	%xmm1, %xmm6
	maxss	%xmm3, %xmm1
	minss	%xmm3, %xmm6
	mulss	%xmm7, %xmm0
	movaps	%xmm5, %xmm7
	maxss	%xmm2, %xmm5
	minss	%xmm2, %xmm7
	movaps	%xmm1, %xmm3
	xorps	%xmm1, %xmm1
	minss	%xmm5, %xmm3
	maxss	%xmm7, %xmm6
	movaps	%xmm3, %xmm2
	movaps	%xmm6, %xmm7
	movaps	%xmm4, %xmm6
	maxss	%xmm0, %xmm4
	minss	%xmm0, %xmm6
	minss	%xmm4, %xmm2
	maxss	%xmm6, %xmm7
	comiss	%xmm2, %xmm1
	ja	.L13
	comiss	%xmm2, %xmm7
	ja	.L13
	movss	%xmm7, 0(%rbp)
	movb	$1, %al
.L13:
	movq	72(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	addq	$88, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2046:
	.size	_ZN5AABB310intersectsE4Vec3S0_Pf, .-_ZN5AABB310intersectsE4Vec3S0_Pf
	.align 2
	.globl	_ZN5AABB37surfaceEv
	.type	_ZN5AABB37surfaceEv, @function
_ZN5AABB37surfaceEv:
.LFB2047:
	.cfi_startproc
	endbr64
	movss	12(%rdi), %xmm1
	subss	(%rdi), %xmm1
	movss	16(%rdi), %xmm2
	movss	20(%rdi), %xmm3
	subss	4(%rdi), %xmm2
	subss	8(%rdi), %xmm3
	movaps	%xmm1, %xmm0
	mulss	%xmm2, %xmm0
	mulss	%xmm3, %xmm2
	mulss	%xmm3, %xmm1
	addss	%xmm2, %xmm0
	addss	%xmm1, %xmm0
	addss	%xmm0, %xmm0
	ret
	.cfi_endproc
.LFE2047:
	.size	_ZN5AABB37surfaceEv, .-_ZN5AABB37surfaceEv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"AABB3(%f, %f, %f)(%f, %f, %f)\n"
	.text
	.align 2
	.globl	_ZN5AABB35printEv
	.type	_ZN5AABB35printEv, @function
_ZN5AABB35printEv:
.LFB2048:
	.cfi_startproc
	endbr64
	cvtss2sd	(%rdi), %xmm0
	cvtss2sd	20(%rdi), %xmm5
	cvtss2sd	16(%rdi), %xmm4
	cvtss2sd	12(%rdi), %xmm3
	cvtss2sd	8(%rdi), %xmm2
	cvtss2sd	4(%rdi), %xmm1
	leaq	.LC2(%rip), %rsi
	movb	$6, %al
	movl	$2, %edi
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2048:
	.size	_ZN5AABB35printEv, .-_ZN5AABB35printEv
	.align 2
	.globl	_ZN5AABB36centerEv
	.type	_ZN5AABB36centerEv, @function
_ZN5AABB36centerEv:
.LFB2049:
	.cfi_startproc
	endbr64
	subq	$56, %rsp
	.cfi_def_cfa_offset 64
	movss	20(%rdi), %xmm2
	movss	16(%rdi), %xmm1
	addss	8(%rdi), %xmm2
	addss	4(%rdi), %xmm1
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movss	12(%rdi), %xmm0
	addss	(%rdi), %xmm0
	leaq	16(%rsp), %rdi
	movss	.LC3(%rip), %xmm3
	mulss	%xmm3, %xmm0
	mulss	%xmm3, %xmm1
	mulss	%xmm3, %xmm2
	call	_ZN4Vec3C1Efff@PLT
	movl	24(%rsp), %eax
	movq	16(%rsp), %xmm0
	movl	%eax, 36(%rsp)
	movss	36(%rsp), %xmm1
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L55
	call	__stack_chk_fail@PLT
.L55:
	addq	$56, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2049:
	.size	_ZN5AABB36centerEv, .-_ZN5AABB36centerEv
	.align 2
	.globl	_ZN5AABB2C2Ev
	.type	_ZN5AABB2C2Ev, @function
_ZN5AABB2C2Ev:
.LFB2051:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	call	_ZN4Vec2C1Ev@PLT
	leaq	8(%rbx), %rdi
	call	_ZN4Vec2C1Ev@PLT
	movq	%rbp, %rdi
	call	_ZN4Vec2C1Ev@PLT
	movq	(%rsp), %rax
	movq	%rbp, %rdi
	movq	%rax, (%rbx)
	call	_ZN4Vec2C1Ev@PLT
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L58
	call	__stack_chk_fail@PLT
.L58:
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2051:
	.size	_ZN5AABB2C2Ev, .-_ZN5AABB2C2Ev
	.globl	_ZN5AABB2C1Ev
	.set	_ZN5AABB2C1Ev,_ZN5AABB2C2Ev
	.align 2
	.globl	_ZN5AABB2C2E4Vec2S0_
	.type	_ZN5AABB2C2E4Vec2S0_, @function
_ZN5AABB2C2E4Vec2S0_:
.LFB2054:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%xmm0, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%xmm1, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	call	_ZN4Vec2C1Ev@PLT
	leaq	8(%rbx), %rdi
	call	_ZN4Vec2C1Ev@PLT
	movq	%r12, (%rbx)
	movq	%rbp, 8(%rbx)
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2054:
	.size	_ZN5AABB2C2E4Vec2S0_, .-_ZN5AABB2C2E4Vec2S0_
	.globl	_ZN5AABB2C1E4Vec2S0_
	.set	_ZN5AABB2C1E4Vec2S0_,_ZN5AABB2C2E4Vec2S0_
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2081:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2081:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1065353216
	.align 4
.LC3:
	.long	1056964608
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#ifndef HEADER_AABB
#define HEADER_AABB

#include "vector.cuh"

class AABB3 {
public:
    __host__ __device__ AABB3();
    __host__ __device__ AABB3(Vec3 min, Vec3 max);

    Vec3 min;
    Vec3 max;

    __host__ __device__ void get_vertices(Vec3* vertices);
    __host__ __device__ AABB3 get_union(AABB3* other);
    __host__ __device__ bool intersects(Vec3 ray_origin, Vec3 ray_direction, float* distance);
    __host__ __device__ float surface();
    __host__ __device__ Vec3 center();
    __host__ __device__ void print();
};

class AABB2 {
public:
    __host__ __device__ AABB2();
    __host__ __device__ AABB2(Vec2 min, Vec2 max);

    Vec2 min;
    Vec2 max;
};


#endif
	.text
	.file	"aabb.hip"
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
