// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %r14
callq 0x3c478
movq %rax, %rdi
callq 0x6d330
mulsd 0xb20c2(%rip), %xmm0    # 0xda020
mulsd 0xb20ca(%rip), %xmm0    # 0xda030
movsd %xmm0, (%rsp)
leaq 0xa8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x753da
leaq 0x48(%r14), %rsi
leaq 0x120(%rsp), %r15
movq %r15, %rdi
callq 0x76a98
leaq 0x30(%r14), %rsi
leaq 0x108(%rsp), %rbx
movq %rbx, %rdi
callq 0x75e6e
leaq 0x18(%r14), %rsi
leaq 0xf0(%rsp), %r12
movq %r12, %rdi
callq 0x75e6e
movsd 0x60(%r14), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x68(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x767fa
leaq 0xd8(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x7570f
leaq 0x78(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movsd (%rsp), %xmm0
callq 0x767fa
movsd 0x8(%rsp), %xmm0
callq 0x214c0
leaq 0x90(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x767fa
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movsd (%rsp), %xmm0
callq 0x767fa
movsd 0x10(%rsp), %xmm0
callq 0x214c0
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x767fa
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x7570f
leaq 0x60(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x7570f
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x7570f
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x75deb
leaq 0x48(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x75deb
leaq 0x18(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x7570f
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x75deb
leaq 0x48(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x75deb
movl $0x2, %edi
callq 0x21190
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movsd 0x10(%r12), %xmm2
callq 0x21e60
leaq 0x18(%rsp), %r14
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
movsd 0x10(%r14), %xmm2
callq 0x21e60
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movsd 0x10(%r13), %xmm2
callq 0x21e60
leaq 0x30(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movq %rax, %r15
callq 0x21e60
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movsd 0x10(%r12), %xmm2
callq 0x21e60
leaq 0xa8(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movq %rax, %rbx
callq 0x21e60
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movsd 0x10(%r15), %xmm2
callq 0x21e60
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movsd 0x10(%r13), %xmm2
callq 0x21e60
movsd (%rbx), %xmm0
movsd 0x8(%rbx), %xmm1
movsd 0x10(%rbx), %xmm2
callq 0x21e60
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
movsd 0x10(%r14), %xmm2
callq 0x21e60
callq 0x21c50
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq