// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Box.cpp
// Function: gaps::R3Box::Corner(int) const
const R3Point R3Box::
Corner (RNOctant octant) const
{
    // Return corner point 
    switch (octant) {
    case RN_NNN_OCTANT: return minpt;
    case RN_NNP_OCTANT: return R3Point(minpt.X(), minpt.Y(), maxpt.Z());
    case RN_NPN_OCTANT: return R3Point(minpt.X(), maxpt.Y(), minpt.Z());
    case RN_NPP_OCTANT: return R3Point(minpt.X(), maxpt.Y(), maxpt.Z());
    case RN_PNN_OCTANT: return R3Point(maxpt.X(), minpt.Y(), minpt.Z());
    case RN_PNP_OCTANT: return R3Point(maxpt.X(), minpt.Y(), maxpt.Z());
    case RN_PPN_OCTANT: return R3Point(maxpt.X(), maxpt.Y(), minpt.Z());
    case RN_PPP_OCTANT: return maxpt;
    default: RNAbort("Invalid octant for box corner"); return R3null_point;
    }
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x60(%rsp)
movq %rdi, %rax
movq %rax, 0x68(%rsp)
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movl %edx, 0x84(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x70(%rsp)
movl 0x84(%rsp), %eax
movq %rax, 0x78(%rsp)
subq $0x7, %rax
ja 0x430c3
movq 0x78(%rsp), %rax
leaq 0xf0e36(%rip), %rcx     # 0x133cd0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x60(%rsp), %rdi
movq 0x70(%rsp), %rsi
addq $0x8, %rsi
callq 0x6eb90
jmp 0x430e2
movq 0x70(%rsp), %rdi
addq $0x8, %rdi
callq 0x37820
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x58(%rsp)
addq $0x8, %rdi
callq 0x37870
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x50(%rsp)
addq $0x20, %rdi
callq 0x378c0
movq 0x60(%rsp), %rdi
movsd 0x50(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x58(%rsp), %xmm0
callq 0x6eb50
jmp 0x430e2
movq 0x70(%rsp), %rdi
addq $0x8, %rdi
callq 0x37820
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x48(%rsp)
addq $0x20, %rdi
callq 0x37870
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x40(%rsp)
addq $0x8, %rdi
callq 0x378c0
movq 0x60(%rsp), %rdi
movsd 0x40(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x48(%rsp), %xmm0
callq 0x6eb50
jmp 0x430e2
movq 0x70(%rsp), %rdi
addq $0x8, %rdi
callq 0x37820
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x38(%rsp)
addq $0x20, %rdi
callq 0x37870
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x30(%rsp)
addq $0x20, %rdi
callq 0x378c0
movq 0x60(%rsp), %rdi
movsd 0x30(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x38(%rsp), %xmm0
callq 0x6eb50
jmp 0x430e2
movq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x37820
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x28(%rsp)
addq $0x8, %rdi
callq 0x37870
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x20(%rsp)
addq $0x8, %rdi
callq 0x378c0
movq 0x60(%rsp), %rdi
movsd 0x20(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x28(%rsp), %xmm0
callq 0x6eb50
jmp 0x430e2
movq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x37820
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x18(%rsp)
addq $0x8, %rdi
callq 0x37870
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x10(%rsp)
addq $0x20, %rdi
callq 0x378c0
movq 0x60(%rsp), %rdi
movsd 0x10(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
callq 0x6eb50
jmp 0x430e2
movq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x37820
movq 0x70(%rsp), %rdi
movsd %xmm0, 0x8(%rsp)
addq $0x20, %rdi
callq 0x37870
movq 0x70(%rsp), %rdi
movsd %xmm0, (%rsp)
addq $0x8, %rdi
callq 0x378c0
movq 0x60(%rsp), %rdi
movsd (%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x8(%rsp), %xmm0
callq 0x6eb50
jmp 0x430e2
movq 0x60(%rsp), %rdi
movq 0x70(%rsp), %rsi
addq $0x20, %rsi
callq 0x6eb90
jmp 0x430e2
leaq 0xf0c3a(%rip), %rdi     # 0x133d04
movb $0x0, %al
callq 0xd4e20
movq 0x60(%rsp), %rdi
leaq 0x5363d3(%rip), %rsi    # 0x5794b0
callq 0x6eb90
movq 0x68(%rsp), %rax
addq $0x98, %rsp
retq
nop