// File: tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: DrawCamera(gaps::R3Scene*, gaps::R3Camera const&, double)
static void 
DrawCamera(R3Scene *scene, const R3Camera& camera, RNScalar radius = 0)
{
  // Compute default radius
  if (radius == 0) radius = 0.025 * scene->BBox().DiagonalRadius();
  
  // Draw view frustum
  R3Point eye = camera.Origin();
  R3Vector towards = camera.Towards();
  R3Vector up = camera.Up();
  R3Vector right = camera.Right();
  RNAngle xfov = camera.XFOV();
  RNAngle yfov = camera.YFOV();
  R3Point org = eye + towards * radius;
  R3Vector dx = right * radius * tan(xfov);
  R3Vector dy = up * radius * tan(yfov);
  R3Point ur = org + dx + dy;
  R3Point lr = org + dx - dy;
  R3Point ul = org - dx + dy;
  R3Point ll = org - dx - dy;
  RNGrfxBegin(RN_GRFX_LINE_LOOP);
  R3LoadPoint(ur[0], ur[1], ur[2]);
  R3LoadPoint(ul[0], ul[1], ul[2]);
  R3LoadPoint(ll[0], ll[1], ll[2]);
  R3LoadPoint(lr[0], lr[1], lr[2]);
  R3LoadPoint(ur[0], ur[1], ur[2]);
  R3LoadPoint(eye[0], eye[1], eye[2]);
  R3LoadPoint(lr[0], lr[1], lr[2]);
  R3LoadPoint(ll[0], ll[1], ll[2]);
  R3LoadPoint(eye[0], eye[1], eye[2]);
  R3LoadPoint(ul[0], ul[1], ul[2]);
  RNGrfxEnd();
}

// Assembly:
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x270(%rsp)
movq %rsi, 0x268(%rsp)
movsd %xmm0, 0x260(%rsp)
movsd 0x260(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2ae91
jp 0x2ae91
movq 0x270(%rsp), %rdi
callq 0x2b590
movq %rax, %rdi
callq 0x2b5b0
movaps %xmm0, %xmm1
movsd 0x1631bc(%rip), %xmm0   # 0x18e040
mulsd %xmm1, %xmm0
movsd %xmm0, 0x260(%rsp)
movq 0x268(%rsp), %rdi
callq 0x2b900
movq %rax, %rsi
leaq 0x248(%rsp), %rdi
callq 0xcc8b0
movq 0x268(%rsp), %rsi
leaq 0x230(%rsp), %rdi
callq 0x2b770
movq 0x268(%rsp), %rdi
callq 0x2b890
movq %rax, %rsi
leaq 0x218(%rsp), %rdi
callq 0xcda10
movq 0x268(%rsp), %rdi
callq 0x2b720
movq %rax, %rsi
leaq 0x200(%rsp), %rdi
callq 0xcda10
movq 0x268(%rsp), %rdi
callq 0x2b940
movsd %xmm0, 0x1f8(%rsp)
movq 0x268(%rsp), %rdi
callq 0x2b950
movsd %xmm0, 0x1f0(%rsp)
movsd 0x260(%rsp), %xmm0
leaq 0x1c0(%rsp), %rdi
leaq 0x230(%rsp), %rsi
callq 0xce8a0
leaq 0x1d8(%rsp), %rdi
leaq 0x248(%rsp), %rsi
leaq 0x1c0(%rsp), %rdx
callq 0xcce30
movsd 0x260(%rsp), %xmm0
leaq 0x190(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0xce8a0
movsd 0x1f8(%rsp), %xmm0
callq 0x22520
leaq 0x1a8(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0xce8a0
movsd 0x260(%rsp), %xmm0
leaq 0x160(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0xce8a0
movsd 0x1f0(%rsp), %xmm0
callq 0x22520
leaq 0x178(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0xce8a0
leaq 0x130(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
callq 0xcce30
leaq 0x148(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0x178(%rsp), %rdx
callq 0xcce30
leaq 0x100(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
callq 0xcce30
leaq 0x118(%rsp), %rdi
leaq 0x100(%rsp), %rsi
leaq 0x178(%rsp), %rdx
callq 0xcd7d0
leaq 0xd0(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
callq 0xcd7d0
leaq 0xe8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x178(%rsp), %rdx
callq 0xcce30
leaq 0xa0(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
callq 0xcd7d0
leaq 0xb8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x178(%rsp), %rdx
callq 0xcd7d0
movl $0x2, %edi
callq 0x2b960
leaq 0x148(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
leaq 0x148(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x148(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0xe8(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0xe8(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0xe8(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0xb8(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0xb8(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0xb8(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0x118(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
leaq 0x118(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0x148(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
leaq 0x148(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0x148(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0x248(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0x248(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
leaq 0x248(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x50(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0x118(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
leaq 0x118(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
leaq 0x118(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x60(%rsp), %xmm0
movsd 0x68(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0xb8(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
leaq 0xb8(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
leaq 0xb8(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x70(%rsp), %xmm0
movsd 0x78(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0x248(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
leaq 0x248(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
leaq 0x248(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x80(%rsp), %xmm0
movsd 0x88(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
leaq 0xe8(%rsp), %rdi
xorl %esi, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x90(%rsp)
leaq 0xe8(%rsp), %rdi
movl $0x1, %esi
callq 0x2b9b0
movsd (%rax), %xmm0
movsd %xmm0, 0x98(%rsp)
leaq 0xe8(%rsp), %rdi
movl $0x2, %esi
callq 0x2b9b0
movsd 0x90(%rsp), %xmm0
movsd 0x98(%rsp), %xmm1
movsd (%rax), %xmm2
callq 0x2b980
callq 0x2b9d0
addq $0x278, %rsp            # imm = 0x278
retq
nopw %cs:(%rax,%rax)
nopl (%rax)