LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::FindClosest(gaps::R3Point const&, gaps::R3Shape**, gaps::R3Point*, gaps::R3Vector*, double*, double, double) const
RNBoolean R3SceneElement::
FindClosest(const R3Point& point, R3Shape **hit_shape,
  R3Point *hit_point, R3Vector *hit_normal, RNLength *hit_d,
  RNLength min_d, RNLength max_d) const
{
  // Check if bounding box is within max_d
  RNScalar bbox_d = R3Distance(point, BBox());
  if (bbox_d > max_d) return FALSE;

  // Find distance to closest shape
  RNBoolean found = FALSE;
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    R3Point closest = shape->ClosestPoint(point);
    RNLength d = R3Distance(closest, point);
    if ((d >= min_d) && (d <= max_d)) {
      if (hit_shape) *hit_shape = shape;
      if (hit_point) *hit_point = closest;
      if (hit_normal) *hit_normal = R3zero_vector; // ???
      if (hit_d) *hit_d = d;
      found = TRUE;
      max_d = d;
    }
  }

  // Return whether hit any shape
  return found;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq %rdx, 0x78(%rsp)
movq %rcx, 0x70(%rsp)
movq %r8, 0x68(%rsp)
movq %r9, 0x60(%rsp)
movsd %xmm0, 0x58(%rsp)
movsd %xmm1, 0x50(%rsp)
movq 0x88(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x58430
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x77e60
movsd %xmm0, 0x48(%rsp)
movsd 0x48(%rsp), %xmm0
ucomisd 0x50(%rsp), %xmm0
jbe 0x595d7
movl $0x0, 0x94(%rsp)
jmp 0x596fb
movl $0x0, 0x44(%rsp)
movl $0x0, 0x40(%rsp)
movq 0x8(%rsp), %rdi
movl 0x40(%rsp), %eax
movl %eax, 0x4(%rsp)
callq 0x2bbf0
movl %eax, %ecx
movl 0x4(%rsp), %eax
cmpl %ecx, %eax
jge 0x596f0
movq 0x8(%rsp), %rdi
movl 0x40(%rsp), %esi
callq 0x2bc10
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rsi
movq 0x80(%rsp), %rdx
movq (%rsi), %rax
leaq 0x20(%rsp), %rdi
callq *0x70(%rax)
movq 0x80(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x779c0
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
ucomisd 0x58(%rsp), %xmm0
jb 0x596de
movsd 0x18(%rsp), %xmm1
movsd 0x50(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x596de
cmpq $0x0, 0x78(%rsp)
je 0x59683
movq 0x38(%rsp), %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
cmpq $0x0, 0x70(%rsp)
je 0x5969a
movq 0x70(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xccf00
cmpq $0x0, 0x68(%rsp)
je 0x596b3
movq 0x68(%rsp), %rdi
leaq 0x1a5c22(%rip), %rsi    # 0x1ff2d0
callq 0xce690
cmpq $0x0, 0x60(%rsp)
je 0x596ca
movsd 0x18(%rsp), %xmm0
movq 0x60(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x44(%rsp)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
jmp 0x596e0
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x595e7
movl 0x44(%rsp), %eax
movl %eax, 0x94(%rsp)
movl 0x94(%rsp), %eax
addq $0x98, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::Draw(gaps::RNFlags, gaps::RNArray<gaps::R3Material*> const*) const
void R3SceneElement::
Draw(const R3DrawFlags draw_flags, const RNArray<R3Material *> *materials) const
{
  // Check shapes
  if (NShapes() == 0) return;

  // Draw material
  if (material && draw_flags[R3_SURFACE_MATERIAL_DRAW_FLAG]) {
    int material_index = material->SceneIndex();
    if (materials && (material_index >= 0) && (material_index < materials->NEntries()) && materials->Kth(material_index)) materials->Kth(material_index)->Draw();
    else material->Draw();
  }

  // Draw shapes
  if (0 && (draw_flags == R3_DEFAULT_DRAW_FLAGS)) {
    // Create display list
    if (opengl_id == 0) {
      // Begin display list
      R3SceneElement *element = (R3SceneElement *) this;
      element->opengl_id = glGenLists(1);
      glNewList(opengl_id, GL_COMPILE);
      
      // Draw shapes
      for (int i = 0; i < NShapes(); i++) {
        R3Shape *shape = Shape(i);
        shape->Draw(draw_flags);
      }

      // End display list
      glEndList();
    }

    // Call display list
    glCallList(opengl_id);
  }
  else {
    // Draw shapes with non-default draw flags
    for (int i = 0; i < NShapes(); i++) {
      R3Shape *shape = Shape(i);
      shape->Draw(draw_flags);
    }
  }
}

// Assembly:
subq $0x48, %rsp
movq %rsi, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x38(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x2bbf0
cmpl $0x0, %eax
jne 0x5997c
jmp 0x59a8b
movq 0x8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x59a2c
leaq 0x28(%rsp), %rdi
movl $0x40, %esi
callq 0x2b520
movq 0x28(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x2bdb0
cmpl $0x0, %eax
je 0x59a2c
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x49d90
movl %eax, 0x24(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x59a1a
cmpl $0x0, 0x24(%rsp)
jl 0x59a1a
movl 0x24(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x30(%rsp), %rdi
callq 0x2b8b0
movl %eax, %ecx
movl 0x4(%rsp), %eax
cmpl %ecx, %eax
jge 0x59a1a
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x49ca0
cmpq $0x0, %rax
je 0x59a1a
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x49ca0
movq %rax, %rdi
xorl %esi, %esi
callq 0x64360
jmp 0x59a2a
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x64360
jmp 0x59a2c
movl $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rdi
movl 0x20(%rsp), %eax
movl %eax, (%rsp)
callq 0x2bbf0
movl %eax, %ecx
movl (%rsp), %eax
cmpl %ecx, %eax
jge 0x59a8b
movq 0x8(%rsp), %rdi
movl 0x20(%rsp), %esi
callq 0x2bc10
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rsi
movq (%rdi), %rax
callq *0xa8(%rax)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x59a34
addq $0x48, %rsp
retq
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::UpdateBBox()
void R3SceneElement::
UpdateBBox(void)
{
  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    bbox.Union(shape->BBox());
  }
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq 0x80(%rsp), %rdi
movq %rdi, 0x20(%rsp)
addq $0x28, %rdi
leaq 0x1a4db1(%rip), %rsi    # 0x1fe868
callq 0x585e0
movl $0x0, 0x7c(%rsp)
movq 0x20(%rsp), %rdi
movl 0x7c(%rsp), %eax
movl %eax, 0x1c(%rsp)
callq 0x2bbf0
movl %eax, %ecx
movl 0x1c(%rsp), %eax
cmpl %ecx, %eax
jge 0x59b68
movq 0x20(%rsp), %rdi
movl 0x7c(%rsp), %esi
callq 0x2bc10
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x70(%rsp)
addq $0x28, %rax
movq %rax, 0x8(%rsp)
movq 0x70(%rsp), %rsi
movq (%rsi), %rax
movq 0x88(%rax), %rax
leaq 0x38(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq *%rax
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb9110
jmp 0x59b34
leaq 0x38(%rsp), %rdi
callq 0x2c1a0
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x59ac4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x2c1a0
jmp 0x59b70
addq $0x88, %rsp
retq
movq 0x30(%rsp), %rdi
callq 0x23290
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::RotateWorld(gaps::R3Point const&, gaps::R3Vector const&, double)
void R3Viewer::
RotateWorld (const R3Point& origin, const R3Vector& axis, RNAngle dtheta)
{
    // Rotate camera around line (origin, axis)
    R3Line axis_line = R3Line(origin, axis);
    R3Point apex = camera.Origin();
    apex.Rotate(axis_line, dtheta);
    R3Vector towards = camera.Towards();
    towards.Rotate(axis, dtheta);
    R3Vector up = camera.Up();
    up.Rotate(axis, dtheta);
    camera.Reset(apex, towards, up);
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movsd %xmm0, 0x88(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x98(%rsp), %rsi
movq 0x90(%rsp), %rdx
leaq 0x58(%rsp), %rdi
xorl %ecx, %ecx
callq 0xcc440
movq 0x8(%rsp), %rdi
addq $0x8, %rdi
callq 0x2b900
movq %rax, %rsi
leaq 0x40(%rsp), %rdi
callq 0xcc8b0
movsd 0x88(%rsp), %xmm0
leaq 0x40(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xcd450
movq 0x8(%rsp), %rsi
addq $0x8, %rsi
leaq 0x28(%rsp), %rdi
callq 0x2b770
movq 0x90(%rsp), %rsi
movsd 0x88(%rsp), %xmm0
leaq 0x28(%rsp), %rdi
callq 0xce6d0
movq 0x8(%rsp), %rdi
addq $0x8, %rdi
callq 0x2b890
movq %rax, %rsi
leaq 0x10(%rsp), %rdi
callq 0xcda10
movq 0x90(%rsp), %rsi
movsd 0x88(%rsp), %xmm0
leaq 0x10(%rsp), %rdi
callq 0xce6d0
movq 0x8(%rsp), %rdi
addq $0x8, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x5e3b0
addq $0xa8, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::TranslateWorld(double, gaps::R3Point const&, int, int, int, int)
void R3Viewer::
TranslateWorld(RNScalar factor, const R3Point& origin, int, int, int dx, int dy)
{
    // Translate world based on mouse (dx,dy)
    if ((dx == 0) && (dy == 0)) return;
    RNLength length = factor * R3Distance(origin, camera.Origin()) * tan(camera.XFOV());
    RNLength vx = length * (RNLength) dx / (RNLength) viewport.Width();
    RNLength vy = length * (RNLength) dy / (RNLength) viewport.Height();
    R3Vector vector = (camera.Right() * vx) + (camera.Up() * vy);
    TranslateWorld(vector);
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movsd %xmm0, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movl %edx, 0x9c(%rsp)
movl %ecx, 0x98(%rsp)
movl %r8d, 0x94(%rsp)
movl %r9d, 0x90(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpl $0x0, 0x94(%rsp)
jne 0x5a934
cmpl $0x0, 0x90(%rsp)
jne 0x5a934
jmp 0x5aa92
movq 0x28(%rsp), %rdi
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, (%rsp)
addq $0x8, %rdi
callq 0x2b900
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x779c0
movq 0x28(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
addq $0x8, %rdi
callq 0x2b940
callq 0x22520
movq 0x28(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x88(%rsp)
movsd 0x88(%rsp), %xmm0
cvtsi2sdl 0x94(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x98, %rdi
callq 0x2be50
movsd 0x18(%rsp), %xmm0
movq 0x28(%rsp), %rdi
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x88(%rsp), %xmm0
cvtsi2sdl 0x90(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
addq $0x98, %rdi
callq 0x2be60
movsd 0x20(%rsp), %xmm0
movq 0x28(%rsp), %rdi
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rsp)
addq $0x8, %rdi
callq 0x2b720
movq %rax, %rsi
movsd 0x80(%rsp), %xmm0
leaq 0x48(%rsp), %rdi
callq 0xce8a0
movq 0x28(%rsp), %rdi
addq $0x8, %rdi
callq 0x2b890
movq %rax, %rsi
movsd 0x78(%rsp), %xmm0
leaq 0x30(%rsp), %rdi
callq 0xce8a0
leaq 0x60(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0xced50
movq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x5a6f0
addq $0xb8, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::ScaleWorld(double, gaps::R3Point const&, int, int, int, int)
void R3Viewer::
ScaleWorld(RNScalar factor, const R3Point& origin, int, int, int dx, int dy)
{
    // Scale world based on mouse dx
    if ((dx == 0) && (dy == 0)) return;
    RNScalar motion = (RNScalar) dx / (RNScalar) viewport.Width() + (RNScalar) dy / (RNScalar) viewport.Height();
    RNScalar scale = exp(2.0 * factor * motion);
    ScaleWorld(origin, scale);
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movsd %xmm0, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movl %edx, 0x3c(%rsp)
movl %ecx, 0x38(%rsp)
movl %r8d, 0x34(%rsp)
movl %r9d, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpl $0x0, 0x34(%rsp)
jne 0x5aae3
cmpl $0x0, 0x30(%rsp)
jne 0x5aae3
jmp 0x5ab81
movq 0x18(%rsp), %rdi
cvtsi2sdl 0x34(%rsp), %xmm0
movsd %xmm0, (%rsp)
addq $0x98, %rdi
callq 0x2be50
movsd (%rsp), %xmm0
movq 0x18(%rsp), %rdi
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
cvtsi2sdl 0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
addq $0x98, %rdi
callq 0x2be60
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x1334fb(%rip), %xmm0   # 0x18e050
mulsd 0x48(%rsp), %xmm0
mulsd 0x28(%rsp), %xmm0
callq 0x232f0
movq 0x18(%rsp), %rdi
movsd %xmm0, 0x20(%rsp)
movq 0x40(%rsp), %rsi
movsd 0x20(%rsp), %xmm0
callq 0x5a730
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::RotateWorld(double, gaps::R3Point const&, int, int, int, int)
void R3Viewer::
RotateWorld(RNScalar factor, const R3Point& origin, int, int, int dx, int dy)
{
    // Rotate world based on mouse (dx)
    if ((dx == 0) && (dy == 0)) return;
    RNLength vx = (RNLength) dx / (RNLength) viewport.Width();
    RNLength vy = (RNLength) dy / (RNLength) viewport.Height();
    RNAngle theta = factor * 4.0 * (fabs(vx) + fabs(vy));
    R3Vector vector = (camera.Right() * vx) + (camera.Up() * vy);
    R3Vector axis = camera.Towards() % vector;
    axis.Normalize();
    RotateWorld(origin, axis, theta);
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movsd %xmm0, 0xc8(%rsp)
movq %rsi, 0xc0(%rsp)
movl %edx, 0xbc(%rsp)
movl %ecx, 0xb8(%rsp)
movl %r8d, 0xb4(%rsp)
movl %r9d, 0xb0(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpl $0x0, 0xb4(%rsp)
jne 0x5abf4
cmpl $0x0, 0xb0(%rsp)
jne 0x5abf4
jmp 0x5ad5f
movq 0x18(%rsp), %rdi
cvtsi2sdl 0xb4(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
addq $0x98, %rdi
callq 0x2be50
movsd 0x8(%rsp), %xmm0
movq 0x18(%rsp), %rdi
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xa8(%rsp)
cvtsi2sdl 0xb0(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
addq $0x98, %rdi
callq 0x2be60
movsd 0x10(%rsp), %xmm0
movq 0x18(%rsp), %rdi
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
movsd 0x135021(%rip), %xmm0   # 0x18fc90
mulsd 0xc8(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
movaps 0x135028(%rip), %xmm2   # 0x18fcb0
pand %xmm2, %xmm1
movsd 0xa0(%rsp), %xmm2
movaps 0x135014(%rip), %xmm3   # 0x18fcb0
pand %xmm3, %xmm2
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x98(%rsp)
addq $0x8, %rdi
callq 0x2b720
movq %rax, %rsi
movsd 0xa8(%rsp), %xmm0
leaq 0x68(%rsp), %rdi
callq 0xce8a0
movq 0x18(%rsp), %rdi
addq $0x8, %rdi
callq 0x2b890
movq %rax, %rsi
movsd 0xa0(%rsp), %xmm0
leaq 0x50(%rsp), %rdi
callq 0xce8a0
leaq 0x80(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0xced50
movq 0x18(%rsp), %rsi
addq $0x8, %rsi
leaq 0x20(%rsp), %rdi
callq 0x2b770
leaq 0x38(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0xce810
leaq 0x38(%rsp), %rdi
callq 0xce130
movq 0x18(%rsp), %rdi
movq 0xc0(%rsp), %rsi
movsd 0x98(%rsp), %xmm0
leaq 0x38(%rsp), %rdx
callq 0x5a7c0
addq $0xd8, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::RotateCamera(double, int, int, int, int)
void R3Viewer::
RotateCamera(RNScalar factor, int x, int y, int, int)
{
    // Rotate camera based on mouse (x,y)                                                                                           
    RNLength vx = (RNLength) ((2 * x) - viewport.Width()) / (RNLength) viewport.Width();
    RNLength vy = (RNLength) ((2 * y) - viewport.Height()) / (RNLength) viewport.Height();
    RNAngle theta = factor * (RN_PI/64.0) * (vx*vx + vy*vy);
    R3Vector vector = (camera.Right() * vx) + (camera.Up() * vy);
    R3Vector axis = camera.Towards() % vector;
    axis.Normalize();
    RotateCamera(axis, theta);
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movsd %xmm0, 0xc8(%rsp)
movl %esi, 0xc4(%rsp)
movl %edx, 0xc0(%rsp)
movl %ecx, 0xbc(%rsp)
movl %r8d, 0xb8(%rsp)
movq 0xd0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movl 0xc4(%rsp), %eax
shll %eax
movl %eax, 0x4(%rsp)
addq $0x98, %rdi
callq 0x2be50
movq 0x20(%rsp), %rdi
movl %eax, %ecx
movl 0x4(%rsp), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
addq $0x98, %rdi
callq 0x2be50
movsd 0x8(%rsp), %xmm0
movq 0x20(%rsp), %rdi
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xb0(%rsp)
movl 0xc0(%rsp), %eax
shll %eax
movl %eax, 0x14(%rsp)
addq $0x98, %rdi
callq 0x2be60
movq 0x20(%rsp), %rdi
movl %eax, %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x98, %rdi
callq 0x2be60
movsd 0x18(%rsp), %xmm0
movq 0x20(%rsp), %rdi
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xa8(%rsp)
movsd 0xc8(%rsp), %xmm0
leaq 0x136b7e(%rip), %rax    # 0x191c00
movsd (%rax), %xmm1
movsd 0x134c0a(%rip), %xmm2   # 0x18fc98
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd 0xb0(%rsp), %xmm1
movsd 0xb0(%rsp), %xmm3
movsd 0xa8(%rsp), %xmm2
mulsd 0xa8(%rsp), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
addq $0x8, %rdi
callq 0x2b720
movq %rax, %rsi
movsd 0xb0(%rsp), %xmm0
leaq 0x70(%rsp), %rdi
callq 0xce8a0
movq 0x20(%rsp), %rdi
addq $0x8, %rdi
callq 0x2b890
movq %rax, %rsi
movsd 0xa8(%rsp), %xmm0
leaq 0x58(%rsp), %rdi
callq 0xce8a0
leaq 0x88(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xced50
movq 0x20(%rsp), %rsi
addq $0x8, %rsi
leaq 0x28(%rsp), %rdi
callq 0x2b770
leaq 0x40(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0xce810
leaq 0x40(%rsp), %rdi
callq 0xce130
movq 0x20(%rsp), %rdi
movsd 0xa0(%rsp), %xmm0
leaq 0x40(%rsp), %rsi
callq 0x2b6f0
addq $0xd8, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::RotateCameraPitch(double, int, int, int, int)
void R3Viewer::
RotateCameraPitch(RNScalar factor, int x, int, int, int)
{
    // Rotate camera based on mouse (x)
    RNLength vx = (RNLength) ((2 * x) - viewport.Width()) / (RNLength) viewport.Width();
    RNAngle dpitch = factor * (RN_PI/64.0) * vx * ((vx < 0.0) ? -vx : vx); // vx*vx*vx;
    camera.RotatePitch(-dpitch);
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movsd %xmm0, 0x48(%rsp)
movl %esi, 0x44(%rsp)
movl %edx, 0x40(%rsp)
movl %ecx, 0x3c(%rsp)
movl %r8d, 0x38(%rsp)
movq 0x50(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movl 0x44(%rsp), %eax
shll %eax
movl %eax, 0x14(%rsp)
addq $0x98, %rdi
callq 0x2be50
movq 0x8(%rsp), %rdi
movl %eax, %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x98, %rdi
callq 0x2be50
movsd 0x18(%rsp), %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x48(%rsp), %xmm0
leaq 0x1369fc(%rip), %rax    # 0x191c00
movsd (%rax), %xmm1
movsd 0x134a88(%rip), %xmm2   # 0x18fc98
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x30(%rsp), %xmm0
jbe 0x5b253
movsd 0x30(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, (%rsp)
jmp 0x5b25e
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x8(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
addq $0x8, %rdi
movsd 0x28(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
callq 0x5d2a0
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::RotateCameraYaw(double, int, int, int, int)
void R3Viewer::
RotateCameraYaw(RNScalar factor, int, int y, int, int)
{
    // Rotate camera based on mouse (x,y)
    RNLength vy = (RNLength) ((2 * y) - viewport.Height()) / (RNLength) viewport.Height();
    RNAngle dyaw = factor * (RN_PI/64.0) * vy * ((vy < 0.0) ? -vy : vy); // vy*vy*vy;
    camera.RotateYaw(dyaw);
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movsd %xmm0, 0x48(%rsp)
movl %esi, 0x44(%rsp)
movl %edx, 0x40(%rsp)
movl %ecx, 0x3c(%rsp)
movl %r8d, 0x38(%rsp)
movq 0x50(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movl 0x40(%rsp), %eax
shll %eax
movl %eax, 0x14(%rsp)
addq $0x98, %rdi
callq 0x2be60
movq 0x8(%rsp), %rdi
movl %eax, %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x98, %rdi
callq 0x2be60
movsd 0x18(%rsp), %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x48(%rsp), %xmm0
leaq 0x1368cc(%rip), %rax    # 0x191c00
movsd (%rax), %xmm1
movsd 0x134958(%rip), %xmm2   # 0x18fc98
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x30(%rsp), %xmm0
jbe 0x5b383
movsd 0x30(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, (%rsp)
jmp 0x5b38e
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x8(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
addq $0x8, %rdi
movsd 0x28(%rsp), %xmm0
callq 0x5d2d0
addq $0x58, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::RotateCameraRoll(double, int, int, int, int)
void R3Viewer::
RotateCameraRoll(RNScalar factor, int x, int, int, int)
{
    // Rotate camera based on mouse (x,y)
    RNLength vx = (RNLength) ((2 * x) - viewport.Width()) / (RNLength) viewport.Width();
    RNAngle droll = factor * (RN_PI/64.0) * vx * ((vx < 0.0) ? -vx : vx); // vx*vx*vx;
    camera.RotateRoll(droll);
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movsd %xmm0, 0x48(%rsp)
movl %esi, 0x44(%rsp)
movl %edx, 0x40(%rsp)
movl %ecx, 0x3c(%rsp)
movl %r8d, 0x38(%rsp)
movq 0x50(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movl 0x44(%rsp), %eax
shll %eax
movl %eax, 0x14(%rsp)
addq $0x98, %rdi
callq 0x2be50
movq 0x8(%rsp), %rdi
movl %eax, %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x98, %rdi
callq 0x2be50
movsd 0x18(%rsp), %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x48(%rsp), %xmm0
leaq 0x1367bc(%rip), %rax    # 0x191c00
movsd (%rax), %xmm1
movsd 0x134848(%rip), %xmm2   # 0x18fc98
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x30(%rsp), %xmm0
jbe 0x5b493
movsd 0x30(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, (%rsp)
jmp 0x5b49e
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x8(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
addq $0x8, %rdi
movsd 0x28(%rsp), %xmm0
callq 0x5d310
addq $0x58, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::ViewportPoint(gaps::R3Point const&) const
const R2Point R3Viewer::
ViewportPoint(const R3Point& point) const 
{
    // Transform 3D point into canonical coordinate system
    R3Point p = Camera().CoordSystem().InverseMatrix() * point;
    if (RNIsPositiveOrZero(p.Z())) return R2infinite_point;

    // Compute 2D point projected onto viewport
    RNCoord x = viewport.XCenter() + 0.5 * viewport.Width() * p.X() / -(p.Z() * tan(Camera().XFOV()));
    RNCoord y = viewport.YCenter() + 0.5 * viewport.Height() * p.Y() / -(p.Z() * tan(Camera().YFOV()));

    // Return point projected onto viewport
    return R2Point(x, y);
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x40(%rsp)
movq %rdi, %rax
movq %rax, 0x48(%rsp)
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq %rdx, 0x100(%rsp)
movq 0x108(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x2b4d0
movq %rax, %rdi
callq 0x5d410
movq %rax, %rsi
leaq 0x68(%rsp), %rdi
callq 0xc2c20
movq 0x100(%rsp), %rdx
leaq 0xe8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0xc9810
leaq 0xe8(%rsp), %rdi
callq 0x2b840
leaq 0x19a2b7(%rip), %rax    # 0x1f62a8
movsd (%rax), %xmm1
callq 0x49e70
cmpl $0x0, %eax
je 0x5c015
movq 0x40(%rsp), %rdi
leaq 0x1a3a25(%rip), %rsi    # 0x1ffa30
callq 0xe3db0
jmp 0x5c1bd
movq 0x50(%rsp), %rdi
addq $0x98, %rdi
callq 0x5d3b0
movq 0x50(%rsp), %rdi
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x98, %rdi
callq 0x2be50
cvtsi2sd %eax, %xmm1
movsd 0x131fd3(%rip), %xmm0   # 0x18e020
mulsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x2b820
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x2b840
movq 0x50(%rsp), %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x2b4d0
movq %rax, %rdi
callq 0x2b940
callq 0x22520
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm1
movq 0x50(%rsp), %rdi
movaps %xmm0, %xmm3
movsd 0x18(%rsp), %xmm0
mulsd %xmm3, %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
addq $0x98, %rdi
callq 0x5d3e0
movq 0x50(%rsp), %rdi
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x38(%rsp)
addq $0x98, %rdi
callq 0x2be60
cvtsi2sd %eax, %xmm1
movsd 0x131f0b(%rip), %xmm0   # 0x18e020
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x2b830
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x2b840
movq 0x50(%rsp), %rdi
movsd %xmm0, 0x28(%rsp)
callq 0x2b4d0
movq %rax, %rdi
callq 0x2b950
callq 0x22520
movsd 0x28(%rsp), %xmm2
movsd 0x30(%rsp), %xmm1
movq 0x40(%rsp), %rdi
movaps %xmm0, %xmm3
movsd 0x38(%rsp), %xmm0
mulsd %xmm3, %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x60(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
callq 0xe3d80
movq 0x48(%rsp), %rax
addq $0x118, %rsp            # imm = 0x118
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::ViewportArea(gaps::R3Shape const&) const
const RNArea R3Viewer::
ViewportArea(const R3Shape& shape) const 
{
    // Return area of shape projection on viewport
    R2Circle bcircle(ViewportBCircle(shape));
    if (bcircle.IsFinite()) return bcircle.Area();
    else return 0.0;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0x30(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x5ca90
movq 0x10(%rsp), %rdi
callq 0x5d4f0
movl %eax, 0x1c(%rsp)
jmp 0x5d077
movl 0x1c(%rsp), %eax
cmpl $0x0, %eax
je 0x5d0c2
leaq 0x30(%rsp), %rdi
callq 0xe0240
movsd %xmm0, 0x8(%rsp)
jmp 0x5d092
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movl $0x1, 0x20(%rsp)
jmp 0x5d0d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x5d510
jmp 0x5d0e8
xorps %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
movl $0x1, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x5d510
movsd 0x60(%rsp), %xmm0
addq $0x68, %rsp
retq
movq 0x28(%rsp), %rdi
callq 0x23290
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::R3Camera(gaps::R3Point const&, double, double, double, double, double, double, double)
R3Camera::
R3Camera(const R3Point& origin, RNAngle pitch, RNAngle yaw, RNAngle roll,
		  RNAngle xfov, RNAngle yfov, RNLength neardist, RNLength fardist)
    : xfov(xfov),
      yfov(yfov),
      neardist(neardist),
      fardist(fardist),
      value(0),
      data(NULL)
{
    // Clamp yaw (roll is undefined at +-PI/2)
    const RNAngle max_yaw = 0.99 * RN_PI_OVER_TWO;
    if (yaw > max_yaw) yaw = max_yaw;
    if (yaw < -max_yaw) yaw = -max_yaw;

    // Derive  triad from pitch, yaw, and roll
    RNScalar cos_yaw = cos(yaw);
    R3Vector towards = R3Vector(cos_yaw * cos(pitch), cos_yaw * sin(pitch), sin(yaw));
    R3Vector up = R3posz_vector;
    up.Rotate(towards, roll);
    R3Triad triad(towards, up);

    // Set coordinate system
    cs = R3CoordSystem(origin, triad);
}

// Assembly:
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x150(%rsp)
movq %rsi, 0x148(%rsp)
movsd %xmm0, 0x140(%rsp)
movsd %xmm1, 0x138(%rsp)
movsd %xmm2, 0x130(%rsp)
movsd %xmm3, 0x128(%rsp)
movsd %xmm4, 0x120(%rsp)
movsd %xmm5, 0x118(%rsp)
movsd %xmm6, 0x110(%rsp)
movq 0x150(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xc2ae0
movq 0x20(%rsp), %rax
movsd 0x128(%rsp), %xmm0
movsd %xmm0, 0x60(%rax)
movsd 0x120(%rsp), %xmm0
movsd %xmm0, 0x68(%rax)
movsd 0x118(%rsp), %xmm0
movsd %xmm0, 0x70(%rax)
movsd 0x110(%rsp), %xmm0
movsd %xmm0, 0x78(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x80(%rax)
movq $0x0, 0x88(%rax)
movsd 0x13223d(%rip), %xmm0   # 0x18fcf0
leaq 0x134156(%rip), %rax    # 0x191c10
mulsd (%rax), %xmm0
movsd %xmm0, 0x108(%rsp)
movsd 0x138(%rsp), %xmm0
ucomisd 0x108(%rsp), %xmm0
jbe 0x5daed
movsd 0x108(%rsp), %xmm0
movsd %xmm0, 0x138(%rsp)
movsd 0x138(%rsp), %xmm1
movsd 0x108(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5db45
movsd 0x108(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x138(%rsp)
movsd 0x138(%rsp), %xmm0
callq 0x233b0
movsd %xmm0, 0x100(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x140(%rsp), %xmm0
callq 0x233b0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x140(%rsp), %xmm0
callq 0x22190
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x138(%rsp), %xmm0
callq 0x22190
movsd 0x10(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
leaq 0xe8(%rsp), %rdi
callq 0xcd9d0
leaq 0xd0(%rsp), %rdi
leaq 0x1a173d(%rip), %rsi    # 0x1ff330
callq 0xcda10
movsd 0x130(%rsp), %xmm0
leaq 0xd0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xce6d0
leaq 0x88(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0xc3340
movq 0x148(%rsp), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0xc2b50
movq 0x20(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x5ede0
addq $0x158, %rsp            # imm = 0x158
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::Pitch() const
const RNAngle R3Camera::
Pitch(void) const
{
    // Return pitch angle
    R3Vector v1(Towards());
    RNAngle yaw = Yaw();
    if (RNIsNotZero(yaw)) v1.Rotate(Left(), yaw);
    RNAngle pitch = R3InteriorAngle(R3default_camera_towards_vector, v1);
    if (v1.Dot(R3default_camera_right_vector) > 0.0) pitch = -pitch;
    return pitch;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq 0x50(%rsp), %rsi
movq %rsi, 0x8(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x2b770
movq 0x8(%rsp), %rdi
callq 0x5dd40
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
leaq 0x1985fe(%rip), %rax    # 0x1f62a8
movsd (%rax), %xmm1
callq 0x48a80
cmpl $0x0, %eax
je 0x5dcdc
movq 0x8(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x2b850
movsd 0x30(%rsp), %xmm0
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xce6d0
leaq 0x19e0ad(%rip), %rdi    # 0x1fbd90
leaq 0x38(%rsp), %rsi
callq 0x7d040
movsd %xmm0, 0x10(%rsp)
leaq 0x38(%rsp), %rdi
leaq 0x19e079(%rip), %rsi    # 0x1fbd78
callq 0xcdfe0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x5dd30
movsd 0x10(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
addq $0x58, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::Roll() const
const RNAngle R3Camera::
Roll(void) const
{
#if FALSE
    // Return roll angle
    R3Vector v2(Right());
    RNAngle yaw = Yaw();
    if (RNIsNotZero(yaw)) v2.Rotate(Left(), yaw);
    RNAngle roll = R3InteriorAngle(R3default_camera_up_vector, v2) - RN_PI_OVER_TWO;
    return roll;
#else
    // Return roll angle
    R3Vector v2 = Towards() % R3default_camera_up_vector; // Right vector if no roll
    RNAngle roll = R3InteriorAngle(Right(), v2);
    if (v2.Dot(Up()) > 0.0) roll = -roll;
    return roll;
#endif
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rsi
movq %rsi, (%rsp)
leaq 0x10(%rsp), %rdi
callq 0x2b770
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x19dfeb(%rip), %rdx    # 0x1fbda8
callq 0xce810
movq (%rsp), %rdi
callq 0x2b720
movq %rax, %rdi
leaq 0x28(%rsp), %rsi
callq 0x7d040
movq (%rsp), %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x2b890
movq %rax, %rsi
leaq 0x28(%rsp), %rdi
callq 0xcdfe0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x5de20
movsd 0x8(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
addq $0x48, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::Perspective() const
const R4Matrix R3Camera::
Perspective(void) const
{
#if FALSE
    // Return 4x4 perspective matrix
    double m[4][4];
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    gluPerspective(2.0 * RN_RAD2DEG(yfov), tan(xfov) / tan(yfov), neardist, fardist);
    glGetDoublev(GL_PROJECTION_MATRIX, m);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    return R4Matrix(m);
#else 
    // Return 4x4 perspective matrix -- derived from OpenGL Programming Guide
    RNScalar A = 1.0 / tan(xfov);
    RNScalar B = 1.0 / tan(yfov);
    RNScalar C = -(fardist + neardist) / (fardist - neardist);
    RNScalar D = -2.0 * neardist * fardist / (fardist - neardist);
    return R4Matrix(  A, 0.0,  0.0, 0.0,
		    0.0,   B,  0.0, 0.0,
		    0.0, 0.0,    C,   D,
		    0.0, 0.0, -1.0, 0.0);
#endif
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x48(%rsp)
movq %rdi, %rax
movq %rax, 0x50(%rsp)
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x40(%rsp)
movsd 0x60(%rax), %xmm0
callq 0x22520
movq 0x40(%rsp), %rax
movaps %xmm0, %xmm1
movsd 0x12fe3b(%rip), %xmm0   # 0x18e010
divsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x68(%rax), %xmm0
callq 0x22520
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x12fe12(%rip), %xmm0   # 0x18e010
divsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x78(%rax), %xmm0
addsd 0x70(%rax), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
movsd 0x78(%rax), %xmm1
subsd 0x70(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x131ab3(%rip), %xmm0   # 0x18fcf8
mulsd 0x70(%rax), %xmm0
mulsd 0x78(%rax), %xmm0
movsd 0x78(%rax), %xmm1
subsd 0x70(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x70(%rsp), %xmm0
movsd 0x68(%rsp), %xmm5
movsd 0x60(%rsp), %xmm11
movsd 0x58(%rsp), %xmm10
xorps %xmm8, %xmm8
movsd 0x130326(%rip), %xmm9   # 0x18e5b0
movaps %xmm8, %xmm1
movaps %xmm8, %xmm2
movaps %xmm8, %xmm3
movaps %xmm8, %xmm4
movaps %xmm8, %xmm6
movaps %xmm8, %xmm7
movsd %xmm8, (%rsp)
movsd %xmm8, 0x8(%rsp)
movsd %xmm11, 0x10(%rsp)
movsd %xmm10, 0x18(%rsp)
movsd %xmm8, 0x20(%rsp)
movsd %xmm8, 0x28(%rsp)
movsd %xmm9, 0x30(%rsp)
movsd %xmm8, 0x38(%rsp)
callq 0xc6220
movq 0x50(%rsp), %rax
addq $0x88, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::operator==(gaps::R3Camera const&) const
const RNBoolean R3Camera::
operator==(const R3Camera& camera) const
{
    // Return whether camera is equal
    return (cs == camera.cs) && 
           (xfov == camera.xfov) &&
           (yfov == camera.yfov) &&
           (neardist == camera.neardist) &&
           (fardist == camera.fardist);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq 0x18(%rsp), %rsi
callq 0x5ee20
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0x17(%rsp)
je 0x5e399
movq 0x8(%rsp), %rax
movsd 0x60(%rax), %xmm0
movq 0x18(%rsp), %rcx
xorl %eax, %eax
ucomisd 0x60(%rcx), %xmm0
movb %al, 0x17(%rsp)
jne 0x5e399
jp 0x5e399
movq 0x8(%rsp), %rax
movsd 0x68(%rax), %xmm0
movq 0x18(%rsp), %rcx
xorl %eax, %eax
ucomisd 0x68(%rcx), %xmm0
movb %al, 0x17(%rsp)
jne 0x5e399
jp 0x5e399
movq 0x8(%rsp), %rax
movsd 0x70(%rax), %xmm0
movq 0x18(%rsp), %rcx
xorl %eax, %eax
ucomisd 0x70(%rcx), %xmm0
movb %al, 0x17(%rsp)
jne 0x5e399
jp 0x5e399
movq 0x8(%rsp), %rax
movsd 0x78(%rax), %xmm0
movq 0x18(%rsp), %rax
ucomisd 0x78(%rax), %xmm0
sete %al
setnp %cl
andb %cl, %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::Transform(gaps::R3Transformation const&)
void R3Camera::
Transform(const R3Transformation& transformation)
{
    // Transform near and far distances
    R3Vector zaxis(cs.Axes().Axis(RN_Z));
    zaxis.Transform(transformation);
    RNLength scale = zaxis.Length();
    neardist *= scale;
    fardist *= scale;
    
    // Transform coordinate system
    cs.Transform(transformation);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x2bf20
movq %rax, %rdi
movl $0x2, %esi
callq 0x2bf30
movq %rax, %rsi
leaq 0x10(%rsp), %rdi
callq 0xcda10
movq 0x28(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0xceb30
leaq 0x10(%rsp), %rdi
callq 0xcdbb0
movq (%rsp), %rdi
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
mulsd 0x70(%rdi), %xmm0
movsd %xmm0, 0x70(%rdi)
movsd 0x8(%rsp), %xmm0
mulsd 0x78(%rdi), %xmm0
movsd %xmm0, 0x78(%rdi)
movq 0x28(%rsp), %rsi
callq 0xc2e90
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::operator=(gaps::R3Camera const&)
R3Camera& R3Camera::
operator=(const R3Camera& camera)
{
    // Copy camera 
    this->cs = camera.cs;
    this->xfov = camera.xfov;
    this->yfov = camera.yfov;
    this->neardist = camera.neardist;
    this->fardist = camera.fardist;
    this->value = camera.value;
    return *this;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, (%rsp)
movq 0x8(%rsp), %rsi
callq 0x5ede0
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movsd 0x60(%rcx), %xmm0
movsd %xmm0, 0x60(%rax)
movq 0x8(%rsp), %rcx
movsd 0x68(%rcx), %xmm0
movsd %xmm0, 0x68(%rax)
movq 0x8(%rsp), %rcx
movsd 0x70(%rcx), %xmm0
movsd %xmm0, 0x70(%rax)
movq 0x8(%rsp), %rcx
movsd 0x78(%rcx), %xmm0
movsd %xmm0, 0x78(%rax)
movq 0x8(%rsp), %rcx
movsd 0x80(%rcx), %xmm0
movsd %xmm0, 0x80(%rax)
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::Load(int) const
void R3Camera::
Load(RNBoolean select_mode) const
{
    // Set the perspective projection
#if (RN_3D_GRFX == RN_IRISGL)
    perspective(20.0 * RN_RAD2DEG(yfov), tan(xfov) / tan(yfov), neardist, fardist);
#elif (RN_3D_GRFX == RN_OPENGL)
    if (!select_mode) {
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
    }
    gluPerspective(2.0 * RN_RAD2DEG(yfov), tan(xfov) / tan(yfov), neardist, fardist);
    glMatrixMode(GL_MODELVIEW);
#elif ((RN_3D_GRFX == RN_3DR) && (RN_MATH_PRECISION == RN_FLOAT_PRECISION))
    PointFW_t loc;
    PointF_t dir, up;
    loc.x = Origin().X();   loc.y = Origin().Y();   loc.z = Origin().Z();   loc.w = 1.0;
    dir.x = Towards().X();  dir.y = Towards().Y();  dir.z = Towards().Z();
    up.x = Up().X();        up.y = Up().Y();        up.z = Up().Z();
    G3dSetCameraPosition(R3dr_gc, &loc, &dir, &up);
#else
    RNAbort("Not Implemented");
#endif

    // Load the rotation matrix
    cs.InverseMatrix().Load();
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movl %esi, 0x9c(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpl $0x0, 0x9c(%rsp)
jne 0x5ea2c
movl $0x1701, %edi           # imm = 0x1701
callq 0x22e50
callq 0x22dd0
movq 0x10(%rsp), %rax
movsd 0x68(%rax), %xmm1
movsd 0x1312c2(%rip), %xmm0   # 0x18fd00
leaq 0x1331bb(%rip), %rcx    # 0x191c00
divsd (%rcx), %xmm0
mulsd %xmm0, %xmm1
movsd 0x12f5fb(%rip), %xmm0   # 0x18e050
mulsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x60(%rax), %xmm0
callq 0x22520
movq 0x10(%rsp), %rax
movsd %xmm0, (%rsp)
movsd 0x68(%rax), %xmm0
callq 0x22520
movsd (%rsp), %xmm1
movq 0x10(%rsp), %rax
movaps %xmm0, %xmm2
movsd 0x8(%rsp), %xmm0
divsd %xmm2, %xmm1
movsd 0x70(%rax), %xmm2
movsd 0x78(%rax), %xmm3
callq 0x22c40
movl $0x1700, %edi           # imm = 0x1700
callq 0x22e50
movq 0x10(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0xc2c20
leaq 0x18(%rsp), %rdi
callq 0x66300
addq $0xa8, %rsp
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3Camera::Draw(double) const
void R3Camera::
Draw(RNScalar scale) const
{
#if TRUE
    // Draw pyramid to near plane
    // static float pyramid_color[3] = { 1.0, 0.0, 0.0 };
    // R3LoadRgb(pyramid_color);
    R3Point org = Origin() + Towards() * scale;
    R3Vector dx = Right() * scale * tan(xfov);
    R3Vector dy = Up() * scale * tan(yfov);
    R3Point ur = org + dx + dy;
    R3Point lr = org + dx - dy;
    R3Point ul = org - dx + dy;
    R3Point ll = org - dx - dy;
    R3BeginLine();
    R3LoadPoint(ur);
    R3LoadPoint(ul);
    R3LoadPoint(ll);
    R3LoadPoint(lr);
    R3LoadPoint(ur);
    R3LoadPoint(Origin());
    R3LoadPoint(lr);
    R3LoadPoint(ll);
    R3LoadPoint(Origin());
    R3LoadPoint(ul);
    R3EndLine();
#endif

#if FALSE
    // Draw coordinate system 
    // static float cs_color[3] = { 0.0, 1.0, 0.0 };
    // R3LoadRgb(cs_color);
    cs.Draw();
#endif
}

// Assembly:
subq $0x188, %rsp            # imm = 0x188
movq %rdi, 0x180(%rsp)
movsd %xmm0, 0x178(%rsp)
movq 0x180(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x2b900
movq 0x8(%rsp), %rsi
movq %rax, (%rsp)
leaq 0x130(%rsp), %rdi
callq 0x2b770
movsd 0x178(%rsp), %xmm0
leaq 0x148(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0xce8a0
movq (%rsp), %rsi
leaq 0x160(%rsp), %rdi
leaq 0x148(%rsp), %rdx
callq 0xcce30
movq 0x8(%rsp), %rdi
callq 0x2b720
movq %rax, %rsi
movsd 0x178(%rsp), %xmm0
leaq 0x100(%rsp), %rdi
callq 0xce8a0
movq 0x8(%rsp), %rax
movsd 0x60(%rax), %xmm0
callq 0x22520
leaq 0x118(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0xce8a0
movq 0x8(%rsp), %rdi
callq 0x2b890
movq %rax, %rsi
movsd 0x178(%rsp), %xmm0
leaq 0xd0(%rsp), %rdi
callq 0xce8a0
movq 0x8(%rsp), %rax
movsd 0x68(%rax), %xmm0
callq 0x22520
leaq 0xe8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0xce8a0
leaq 0xa0(%rsp), %rdi
leaq 0x160(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0xcce30
leaq 0xb8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0xcce30
leaq 0x70(%rsp), %rdi
leaq 0x160(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0xcce30
leaq 0x88(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0xcd7d0
leaq 0x40(%rsp), %rdi
leaq 0x160(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0xcd7d0
leaq 0x58(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0xcce30
leaq 0x10(%rsp), %rdi
leaq 0x160(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0xcd7d0
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0xcd7d0
callq 0x2b5d0
leaq 0xb8(%rsp), %rdi
callq 0x2b610
leaq 0x58(%rsp), %rdi
callq 0x2b610
leaq 0x28(%rsp), %rdi
callq 0x2b610
leaq 0x88(%rsp), %rdi
callq 0x2b610
leaq 0xb8(%rsp), %rdi
callq 0x2b610
movq 0x8(%rsp), %rdi
callq 0x2b900
movq %rax, %rdi
callq 0x2b610
leaq 0x88(%rsp), %rdi
callq 0x2b610
leaq 0x28(%rsp), %rdi
callq 0x2b610
movq 0x8(%rsp), %rdi
callq 0x2b900
movq %rax, %rdi
callq 0x2b610
leaq 0x58(%rsp), %rdi
callq 0x2b610
callq 0x2b670
addq $0x188, %rsp            # imm = 0x188
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Camera.cpp
// Function: gaps::R3CompareCameras(void const*, void const*)
int R3CompareCameras(const void *data1, const void *data2)
{
  // Sort the cameras according to highest value first
  R3Camera *camera1 = *((R3Camera **) data1);
  R3Camera *camera2 = *((R3Camera **) data2);
  if (camera1->Value() > camera2->Value()) return -1;
  else if (camera1->Value() < camera2->Value()) return 1;
  return 0;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
callq 0x5ee80
movsd %xmm0, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x5ee80
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5ed9b
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x5edd3
movq 0x18(%rsp), %rdi
callq 0x5ee80
movsd %xmm0, (%rsp)
movq 0x10(%rsp), %rdi
callq 0x5ee80
movsd (%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x5edc9
movl $0x1, 0x34(%rsp)
jmp 0x5edd3
jmp 0x5edcb
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R2Viewport.cpp
// Function: gaps::R2Viewport::Resize(int, int, int, int)
void R2Viewport::
Resize(int xmin, int ymin, int width, int height)
{
    // Set viewport variables
    this->xmin = xmin;
    this->ymin = ymin;
    this->width = width;
    this->height = height;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movl %edx, -0x10(%rsp)
movl %ecx, -0x14(%rsp)
movl %r8d, -0x18(%rsp)
movq -0x8(%rsp), %rax
movl -0xc(%rsp), %ecx
movl %ecx, (%rax)
movl -0x10(%rsp), %ecx
movl %ecx, 0x4(%rax)
movl -0x14(%rsp), %ecx
movl %ecx, 0x8(%rax)
movl -0x18(%rsp), %ecx
movl %ecx, 0xc(%rax)
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3AreaLight.cpp
// Function: gaps::R3AreaLight::RadiusOfInfluence(double) const
RNScalar R3AreaLight::
RadiusOfInfluence(RNScalar intensity_threshhold) const
{
    // Return distance beyond which intensity is below threshold
    // kq*d^2 + kl*d + (kc - 1/a) = 0 (use quadratic formula)
    if (!IsActive()) return 0.0;
    if (RNIsZero(Intensity())) return 0.0;
    if (RNIsZero(intensity_threshhold)) return RN_INFINITY;
    RNScalar A = quadratic_attenuation;
    RNScalar B = linear_attenuation;
    RNScalar C = constant_attenuation - Intensity() / intensity_threshhold;
    RNScalar r = (-B + sqrt(B*B - 4.0*A*C)) / (2.0*A);
    return r + Radius();
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movsd %xmm0, 0x40(%rsp)
movq 0x48(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x60940
cmpl $0x0, %eax
jne 0x5f911
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
jmp 0x5fa6f
movq 0x18(%rsp), %rdi
callq 0x60980
leaq 0x196986(%rip), %rax    # 0x1f62a8
movsd (%rax), %xmm1
callq 0x48790
cmpl $0x0, %eax
je 0x5f93e
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
jmp 0x5fa6f
movsd 0x40(%rsp), %xmm0
leaq 0x19695d(%rip), %rax    # 0x1f62a8
movsd (%rax), %xmm1
callq 0x48790
cmpl $0x0, %eax
je 0x5f96f
leaq 0x196958(%rip), %rax    # 0x1f62b8
movsd (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
jmp 0x5fa6f
movq 0x18(%rsp), %rdi
movsd 0xa8(%rdi), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0xa0(%rdi), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x98(%rdi), %xmm0
movsd %xmm0, (%rsp)
callq 0x60980
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
divsd 0x40(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x30(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0x30(%rsp), %xmm2
movsd 0x13029f(%rip), %xmm1   # 0x18fc90
mulsd 0x38(%rsp), %xmm1
mulsd 0x28(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x22780
movq 0x18(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd 0x12e615(%rip), %xmm1   # 0x18e050
mulsd 0x38(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
callq 0x4e720
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x50(%rsp), %xmm0
addq $0x58, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SpotLight.cpp
// Function: gaps::R3SpotLight::IntensityAtPoint(gaps::R3Point const&) const
RNScalar R3SpotLight::
IntensityAtPoint(const R3Point& point) const
{
    // Return intensity at point
    RNScalar I = R3PointLight::IntensityAtPoint(point);
    R3Vector ML = point - Position();
    ML.Normalize();
    RNScalar cos_alpha = ML.Dot(Direction());
    if (cos(cutoffangle) > cos_alpha) return 0.0;
    else return (I * pow(cos_alpha, dropoffrate));
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x48(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movq 0x40(%rsp), %rsi
callq 0x61580
movq 0x10(%rsp), %rdi
movsd %xmm0, 0x38(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x2ba60
movq 0x8(%rsp), %rsi
movq %rax, %rdx
leaq 0x20(%rsp), %rdi
callq 0xccbd0
leaq 0x20(%rsp), %rdi
callq 0xce130
movq 0x10(%rsp), %rdi
callq 0x2ba80
movq %rax, %rsi
leaq 0x20(%rsp), %rdi
callq 0xcdfe0
movq 0x10(%rsp), %rax
movsd %xmm0, 0x18(%rsp)
movsd 0xa0(%rax), %xmm0
callq 0x233b0
ucomisd 0x18(%rsp), %xmm0
jbe 0x60f2a
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
jmp 0x60f5f
movq 0x10(%rsp), %rax
movsd 0x38(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x18(%rsp), %xmm0
movsd 0x98(%rax), %xmm1
callq 0x23260
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x50(%rsp), %xmm0
addq $0x58, %rsp
retq
nopw (%rax,%rax)