// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3OrientedBox.cpp
// Function: gaps::R3OrientedBox::Union(gaps::R3OrientedBox const&)
void R3OrientedBox::
Union(const R3OrientedBox& box) 
{
  // Check boxes
  if (box.IsEmpty()) return;
  if (this->IsEmpty()) return;

  // Grow ranges
  R3Box r(-Radius(0), -Radius(1), -Radius(2), Radius(0), Radius(1), Radius(2));
  for (int i = 0; i < RN_NUM_OCTANTS; i++) {
    R3Vector v = box.Corner(i) - Center();
    RNLength r0 = v.Dot(Axis(0));
    RNLength r1 = v.Dot(Axis(1));
    RNLength r2 = v.Dot(Axis(2));
    r.Union(R3Point(r0, r1, r2));
  }

  // Compute center
  R3Point c = r.Centroid();
  R3Point center = cs.Origin() + Axis(0)*c[0] + Axis(1)*c[1] + Axis(2)*c[2];

  // Initialize everything
  Reset(center, Axis(0), Axis(1), r.XRadius(), r.YRadius(), r.ZRadius());
}

// Assembly:
subq $0x238, %rsp            # imm = 0x238
movq %rdi, 0x230(%rsp)
movq %rsi, 0x228(%rsp)
movq 0x230(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x228(%rsp), %rdi
callq 0x3c180
cmpl $0x0, %eax
je 0xa09be
jmp 0xa0ed0
movq 0xc8(%rsp), %rdi
callq 0x3c180
cmpl $0x0, %eax
je 0xa09d5
jmp 0xa0ed0
movq 0xc8(%rsp), %rdi
xorl %esi, %esi
callq 0x3c1d0
movq 0xc8(%rsp), %rdi
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0xc0(%rsp)
movl $0x1, %esi
callq 0x3c1d0
movq 0xc8(%rsp), %rdi
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0xa0(%rsp)
movl $0x2, %esi
callq 0x3c1d0
movq 0xc8(%rsp), %rdi
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0xa8(%rsp)
xorl %esi, %esi
callq 0x3c1d0
movq 0xc8(%rsp), %rdi
movsd %xmm0, 0xb0(%rsp)
movl $0x1, %esi
callq 0x3c1d0
movq 0xc8(%rsp), %rdi
movsd %xmm0, 0xb8(%rsp)
movl $0x2, %esi
callq 0x3c1d0
movsd 0xa0(%rsp), %xmm1
movsd 0xa8(%rsp), %xmm2
movsd 0xb0(%rsp), %xmm3
movsd 0xb8(%rsp), %xmm4
movaps %xmm0, %xmm5
movsd 0xc0(%rsp), %xmm0
leaq 0x1f0(%rsp), %rdi
callq 0x429c0
movl $0x0, 0x1ec(%rsp)
cmpl $0x8, 0x1ec(%rsp)
jge 0xa0cab
movq 0x228(%rsp), %rsi
movl 0x1ec(%rsp), %edx
leaq 0x1b8(%rsp), %rdi
callq 0x39cf0
jmp 0xa0b21
movq 0xc8(%rsp), %rdi
callq 0x3c1b0
movq %rax, 0x98(%rsp)
jmp 0xa0b38
movq 0x98(%rsp), %rdx
leaq 0x1d0(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x6eeb0
jmp 0xa0b57
movq 0xc8(%rsp), %rdi
xorl %esi, %esi
callq 0x3c1f0
movq %rax, 0x90(%rsp)
jmp 0xa0b70
movq 0x90(%rsp), %rsi
leaq 0x1d0(%rsp), %rdi
callq 0x702c0
movsd %xmm0, 0x88(%rsp)
jmp 0xa0b90
movq 0xc8(%rsp), %rdi
movsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x1a0(%rsp)
movl $0x1, %esi
callq 0x3c1f0
movq %rax, 0x80(%rsp)
jmp 0xa0bbe
movq 0x80(%rsp), %rsi
leaq 0x1d0(%rsp), %rdi
callq 0x702c0
movsd %xmm0, 0x78(%rsp)
jmp 0xa0bdb
movq 0xc8(%rsp), %rdi
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x198(%rsp)
movl $0x2, %esi
callq 0x3c1f0
movq %rax, 0x70(%rsp)
jmp 0xa0c03
movq 0x70(%rsp), %rsi
leaq 0x1d0(%rsp), %rdi
callq 0x702c0
movsd %xmm0, 0x68(%rsp)
jmp 0xa0c1d
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x190(%rsp)
movsd 0x1a0(%rsp), %xmm0
movsd 0x198(%rsp), %xmm1
movsd 0x190(%rsp), %xmm2
leaq 0x178(%rsp), %rdi
callq 0x6eb50
jmp 0xa0c56
leaq 0x1f0(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0x444b0
jmp 0xa0c6d
jmp 0xa0c6f
movl 0x1ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ec(%rsp)
jmp 0xa0af5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b0(%rsp)
movl %eax, 0x1ac(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x36a80
jmp 0xa0ed8
leaq 0x160(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x44260
jmp 0xa0cc2
movq 0xc8(%rsp), %rdi
addq $0x8, %rdi
callq 0x3c2b0
movq %rax, 0x60(%rsp)
jmp 0xa0cda
movq 0xc8(%rsp), %rdi
xorl %esi, %esi
callq 0x3c1f0
movq %rax, 0x58(%rsp)
jmp 0xa0cf0
leaq 0x160(%rsp), %rdi
xorl %esi, %esi
callq 0x36be0
movq %rax, 0x50(%rsp)
jmp 0xa0d06
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rax
movsd (%rax), %xmm0
leaq 0x100(%rsp), %rdi
callq 0x70b80
jmp 0xa0d23
movq 0x60(%rsp), %rsi
leaq 0x118(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0x6f110
jmp 0xa0d3f
movq 0xc8(%rsp), %rdi
movl $0x1, %esi
callq 0x3c1f0
movq %rax, 0x48(%rsp)
jmp 0xa0d58
leaq 0x160(%rsp), %rdi
movl $0x1, %esi
callq 0x36be0
movq %rax, 0x40(%rsp)
jmp 0xa0d71
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rax
movsd (%rax), %xmm0
leaq 0xe8(%rsp), %rdi
callq 0x70b80
jmp 0xa0d8e
leaq 0x130(%rsp), %rdi
leaq 0x118(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x6f110
jmp 0xa0dad
movq 0xc8(%rsp), %rdi
movl $0x2, %esi
callq 0x3c1f0
movq %rax, 0x38(%rsp)
jmp 0xa0dc6
leaq 0x160(%rsp), %rdi
movl $0x2, %esi
callq 0x36be0
movq %rax, 0x30(%rsp)
jmp 0xa0ddf
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rax
movsd (%rax), %xmm0
leaq 0xd0(%rsp), %rdi
callq 0x70b80
jmp 0xa0dfc
leaq 0x148(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x6f110
jmp 0xa0e1b
movq 0xc8(%rsp), %rdi
xorl %esi, %esi
callq 0x3c1f0
movq %rax, 0x28(%rsp)
jmp 0xa0e31
movq 0xc8(%rsp), %rdi
movl $0x1, %esi
callq 0x3c1f0
movq %rax, 0x20(%rsp)
jmp 0xa0e4a
leaq 0x1f0(%rsp), %rdi
callq 0xa1150
movsd %xmm0, 0x18(%rsp)
jmp 0xa0e5f
leaq 0x1f0(%rsp), %rdi
callq 0xa1170
movsd %xmm0, 0x10(%rsp)
jmp 0xa0e74
leaq 0x1f0(%rsp), %rdi
callq 0xa1190
movsd %xmm0, 0x8(%rsp)
jmp 0xa0e89
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rdx
movq 0xc8(%rsp), %rdi
movq (%rdi), %rax
movq 0x268(%rax), %rax
leaq 0x148(%rsp), %rsi
callq *%rax
jmp 0xa0ec3
leaq 0x1f0(%rsp), %rdi
callq 0x36a80
addq $0x238, %rsp            # imm = 0x238
retq
movq 0x1b0(%rsp), %rdi
callq 0xf890
nopw %cs:(%rax,%rax)