// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Cont.cpp
// Function: gaps::R3Contains(gaps::R3Box const&, gaps::R3Sphere const&)
RNBoolean R3Contains(const R3Box& box, const R3Sphere& sphere)
{
    // Return whether box contains sphere 
    if (box.IsEmpty()) return FALSE;
    if (sphere.IsEmpty()) return TRUE;
    if (RNIsLess(sphere.Center().X() - sphere.Radius(), box.XMin())) return FALSE;
    if (RNIsLess(sphere.Center().Y() - sphere.Radius(), box.YMin())) return FALSE;
    if (RNIsLess(sphere.Center().Z() - sphere.Radius(), box.ZMin())) return FALSE;
    if (RNIsGreater(sphere.Center().X() + sphere.Radius(), box.XMax())) return FALSE;
    if (RNIsGreater(sphere.Center().Y() + sphere.Radius(), box.YMax())) return FALSE;
    if (RNIsGreater(sphere.Center().Z() + sphere.Radius(), box.ZMax())) return FALSE;
    return TRUE;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq 0x68(%rsp), %rdi
callq 0x44d80
cmpl $0x0, %eax
je 0x8536a
movl $0x0, 0x74(%rsp)
jmp 0x85602
movq 0x60(%rsp), %rdi
callq 0x86b90
cmpl $0x0, %eax
je 0x85386
movl $0x1, 0x74(%rsp)
jmp 0x85602
movq 0x60(%rsp), %rdi
callq 0x42710
movq %rax, %rdi
callq 0x37820
movsd %xmm0, 0x50(%rsp)
movq 0x60(%rsp), %rdi
callq 0x39f50
movaps %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x68(%rsp), %rdi
callq 0x37830
movaps %xmm0, %xmm1
movsd 0x58(%rsp), %xmm0
leaq 0xf310b(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x39630
cmpl $0x0, %eax
je 0x853f0
movl $0x0, 0x74(%rsp)
jmp 0x85602
movq 0x60(%rsp), %rdi
callq 0x42710
movq %rax, %rdi
callq 0x37870
movsd %xmm0, 0x40(%rsp)
movq 0x60(%rsp), %rdi
callq 0x39f50
movaps %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x68(%rsp), %rdi
callq 0x37880
movaps %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
leaq 0xf30a1(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x39630
cmpl $0x0, %eax
je 0x8545a
movl $0x0, 0x74(%rsp)
jmp 0x85602
movq 0x60(%rsp), %rdi
callq 0x42710
movq %rax, %rdi
callq 0x378c0
movsd %xmm0, 0x30(%rsp)
movq 0x60(%rsp), %rdi
callq 0x39f50
movaps %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x68(%rsp), %rdi
callq 0x378d0
movaps %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
leaq 0xf3037(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x39630
cmpl $0x0, %eax
je 0x854c4
movl $0x0, 0x74(%rsp)
jmp 0x85602
movq 0x60(%rsp), %rdi
callq 0x42710
movq %rax, %rdi
callq 0x37820
movsd %xmm0, 0x20(%rsp)
movq 0x60(%rsp), %rdi
callq 0x39f50
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x68(%rsp), %rdi
callq 0x44f80
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
leaq 0xf2fcd(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0x8552e
movl $0x0, 0x74(%rsp)
jmp 0x85602
movq 0x60(%rsp), %rdi
callq 0x42710
movq %rax, %rdi
callq 0x37870
movsd %xmm0, 0x10(%rsp)
movq 0x60(%rsp), %rdi
callq 0x39f50
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x68(%rsp), %rdi
callq 0x44fa0
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
leaq 0xf2f63(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0x85595
movl $0x0, 0x74(%rsp)
jmp 0x85602
movq 0x60(%rsp), %rdi
callq 0x42710
movq %rax, %rdi
callq 0x378c0
movsd %xmm0, (%rsp)
movq 0x60(%rsp), %rdi
callq 0x39f50
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x68(%rsp), %rdi
callq 0x44fc0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
leaq 0xf2efe(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0x855fa
movl $0x0, 0x74(%rsp)
jmp 0x85602
movl $0x1, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax,%rax)