// File: /workspace/github_c_makefile_star2_O0/AlexCharlton[P]Hyperscene/src/aabb-tree.c
// Function: inPlanes
static Intersection inPlanes(AABBtree *t, Plane *planes, int inMask, int *outMask){
    float a, b; int i, k = 1 << t->lastChecked;
    Point p, n;
    Intersection result = INSIDE;
    Plane plane = planes[t->lastChecked];
    Point min, max;
    getAABBtreeExtents(t, &min, &max);
    if (k & inMask) {
        setPNvectors(&plane, &p, &n, &min, &max);
        a = (plane.a * p.x) + (plane.b * p.y) + (plane.c * p.z) + plane.d;
        if (a < 0) return OUTSIDE;
        b = (plane.a * n.x) + (plane.b * n.y) + (plane.c * n.z) + plane.d;
        if (b < 0) { *outMask |= k; result = INTERSECT; }
    }
    for (i = 0, k = 1; k <= inMask; i++, k += k){
        if ((i != t->lastChecked) && (k & inMask)){
            plane = planes[i];
            setPNvectors(&plane, &p, &n, &min, &max);
            a = (plane.a * p.x) + (plane.b * p.y) + (plane.c * p.z) + plane.d;
            if (a < 0) { t->lastChecked = i; return OUTSIDE; }
            b = (plane.a * n.x) + (plane.b * n.y) + (plane.c * n.z) + plane.d;
            if (b < 0) { *outMask |= k; result = INTERSECT; }
        }
    }
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movzwl 0xea(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movzwl 0xea(%rcx), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x64(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x5c(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x7c(%rbp), %rdx
callq 0xa7a0
movl -0x38(%rbp), %eax
andl -0x1c(%rbp), %eax
cmpl $0x0, %eax
je 0xa5a6
leaq -0x64(%rbp), %rdi
leaq -0x44(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x70(%rbp), %rcx
leaq -0x7c(%rbp), %r8
callq 0xa830
movss -0x64(%rbp), %xmm1
movss -0x44(%rbp), %xmm2
movss -0x60(%rbp), %xmm0
mulss -0x40(%rbp), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss -0x5c(%rbp), %xmm0
movss -0x3c(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
addss -0x58(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x2c(%rbp), %xmm0
jbe 0xa551
movl $0x1, -0x4(%rbp)
jmp 0xa6eb
movss -0x64(%rbp), %xmm1
movss -0x50(%rbp), %xmm2
movss -0x60(%rbp), %xmm0
mulss -0x4c(%rbp), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss -0x5c(%rbp), %xmm0
movss -0x48(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
addss -0x58(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x30(%rbp), %xmm0
jbe 0xa5a4
movl -0x38(%rbp), %ecx
movq -0x28(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movl $0x2, -0x54(%rbp)
jmp 0xa5a6
movl $0x0, -0x34(%rbp)
movl $0x1, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0xa6e5
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0xea(%rcx), %ecx
cmpl %ecx, %eax
je 0xa6cc
movl -0x38(%rbp), %eax
andl -0x1c(%rbp), %eax
cmpl $0x0, %eax
je 0xa6cc
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x64(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x5c(%rbp)
leaq -0x64(%rbp), %rdi
leaq -0x44(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x70(%rbp), %rcx
leaq -0x7c(%rbp), %r8
callq 0xa830
movss -0x64(%rbp), %xmm1
movss -0x44(%rbp), %xmm2
movss -0x60(%rbp), %xmm0
mulss -0x40(%rbp), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss -0x5c(%rbp), %xmm0
movss -0x3c(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
addss -0x58(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x2c(%rbp), %xmm0
jbe 0xa677
movl -0x34(%rbp), %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0xea(%rax)
movl $0x1, -0x4(%rbp)
jmp 0xa6eb
movss -0x64(%rbp), %xmm1
movss -0x50(%rbp), %xmm2
movss -0x60(%rbp), %xmm0
mulss -0x4c(%rbp), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss -0x5c(%rbp), %xmm0
movss -0x48(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
addss -0x58(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x30(%rbp), %xmm0
jbe 0xa6ca
movl -0x38(%rbp), %ecx
movq -0x28(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movl $0x2, -0x54(%rbp)
jmp 0xa6cc
jmp 0xa6ce
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x38(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0xa5b4
movl -0x54(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)