// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/gapsview/gapsview.cpp
// Function: DrawImageRay(ImageData*, gaps::R2Point const&)
static void
DrawImageRay(ImageData *data,
  const R2Point& image_position)
{               
  // Check image position
  R2Box b = data->ray_origin_images[0].GridBox();
  if (!R2Contains(b, image_position)) return;

  // Get ray parameter from images
  RNScalar ox = data->ray_origin_images[0].GridValue(image_position);
  RNScalar oy = data->ray_origin_images[1].GridValue(image_position);
  RNScalar oz = data->ray_origin_images[2].GridValue(image_position);
  RNScalar dx = data->ray_direction_images[0].GridValue(image_position);
  RNScalar dy = data->ray_direction_images[1].GridValue(image_position);
  RNScalar dz = data->ray_direction_images[2].GridValue(image_position);

  // Create ray
  R3Point ray_origin(ox, oy, oz);
  R3Vector ray_direction(dx, dy, dz);
  R3Ray ray(ray_origin, ray_direction);

  // Find projection of selected position onto ray
  RNScalar t = ray.T(selected_position);
  if (t <= 0) return;
  R3Point p = ray.Point(t);

  // Draw ray
  glDisable(GL_LIGHTING);
  RNLoadRgb(0, 1, 1);
  R3Span(ray_origin, p).Draw();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rsi, %r14
movq %rdi, %rbx
movl 0x348(%rdi), %eax
decl %eax
cvtsi2sd %eax, %xmm2
movl 0x34c(%rdi), %eax
decl %eax
cvtsi2sd %eax, %xmm3
leaq 0x78(%rsp), %r15
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %r15, %rdi
callq 0xeea08
movq %r15, %rdi
movq %r14, %rsi
callq 0xde3c0
testl %eax, %eax
je 0x321b6
leaq 0x288(%rbx), %rdi
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
callq 0xe0f74
movsd %xmm0, 0x28(%rsp)
leaq 0x358(%rbx), %rdi
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
callq 0xe0f74
movsd %xmm0, 0x20(%rsp)
leaq 0x428(%rbx), %rdi
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
callq 0xe0f74
movsd %xmm0, 0x18(%rsp)
leaq 0x4f8(%rbx), %rdi
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
callq 0xe0f74
movsd %xmm0, 0x10(%rsp)
leaq 0x5c8(%rbx), %rdi
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
callq 0xe0f74
movsd %xmm0, 0x8(%rsp)
addq $0x698, %rbx            # imm = 0x698
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
movq %rbx, %rdi
callq 0xe0f74
movsd %xmm0, (%rsp)
leaq 0x30(%rsp), %rdi
movsd 0x28(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
callq 0xd43de
leaq 0x60(%rsp), %rdi
movsd 0x10(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm2
callq 0xd4e72
leaq 0xa0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x60(%rsp), %rdx
xorl %ecx, %ecx
callq 0xd3fcc
leaq 0x1a8bfe(%rip), %rsi    # 0x1dad48
leaq 0xa0(%rsp), %rdi
callq 0xd401a
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x321b6
leaq 0x48(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xd3fde
movl $0xb50, %edi            # imm = 0xB50
callq 0x27200
movss 0x119fa7(%rip), %xmm1   # 0x14c12c
xorpd %xmm0, %xmm0
movapd %xmm1, %xmm2
callq 0x28380
leaq 0xd0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0xd3862
leaq 0xd0(%rsp), %rdi
callq 0x8fe86
leaq 0x78(%rsp), %rdi
callq 0xef280
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r14
popq %r15
retq
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
jmp 0x321e5
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0xef280
movq %rbx, %rdi
callq 0x28150