// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/gapsview/gapsview.cpp
// Function: DrawImageInset(ImageData*, double, double, double)
static void
DrawImageInset(ImageData *data,
  double x, double y, double scale)
{
  // Check if drawing image insets
  if (!show_image_insets) return;

  // Get convenient variables
  double w = scale * data->image_width;
  double h = scale * data->image_height;
  if ((w == 0) || (h == 0)) return;

  // Load texture
  LoadTexture(data);
  if (data->texture_id == 0) return;

  // Set viewing transformation
  glMatrixMode(GL_PROJECTION);  
  glPushMatrix();
  glLoadIdentity();
  glOrtho(0, GLUTwindow_width, 0, GLUTwindow_height, 0, 1);
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();

  // Enable texture
  glBindTexture(GL_TEXTURE_2D, data->texture_id);
  glEnable(GL_TEXTURE_2D);

  // Draw textured polygon
  RNLoadRgb(1, 1, 1);
  RNGrfxBegin(RN_GRFX_POLYGON);
  R3LoadTextureCoords(0, 0);
  R3LoadPoint(x, y, -0.5);
  R3LoadTextureCoords(1, 0);
  R3LoadPoint(x+w, y, -0.5);
  R3LoadTextureCoords(1, 1);
  R3LoadPoint(x+w, y+h, -0.5);
  R3LoadTextureCoords(0, 1);
  R3LoadPoint(x, y+h, -0.5);
  RNGrfxEnd();

  // Disable texture
  glDisable(GL_TEXTURE_2D);

  // Restore viewing transformation
  glMatrixMode(GL_PROJECTION);  
  glPopMatrix();
  glMatrixMode(GL_MODELVIEW);  
  glPopMatrix();
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
cmpl $0x0, 0x1ac044(%rip)    # 0x1dd3bc
je 0x3152c
movq %rdi, %rbx
cvtdq2pd 0x768(%rdi), %xmm2
mulpd 0x11cfdf(%rip), %xmm2   # 0x14e370
xorpd %xmm1, %xmm1
movapd %xmm2, 0x10(%rsp)
cmpeqpd %xmm2, %xmm1
movmskpd %xmm1, %eax
testl %eax, %eax
jne 0x3152c
movq %rbx, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x3237d
cmpl $0x0, 0x770(%rbx)
je 0x3152c
movl $0x1701, %edi           # imm = 0x1701
callq 0x27d40
callq 0x27ff0
callq 0x27cd0
xorps %xmm1, %xmm1
cvtsi2sdl 0x1a661a(%rip), %xmm1 # 0x1d7a00
cvtsi2sdl 0x1a6616(%rip), %xmm3 # 0x1d7a04
movsd 0x11cc92(%rip), %xmm5   # 0x14e088
xorps %xmm0, %xmm0
xorpd %xmm2, %xmm2
xorps %xmm4, %xmm4
callq 0x28280
movl $0x1700, %edi           # imm = 0x1700
callq 0x27d40
callq 0x27ff0
callq 0x27cd0
movl 0x770(%rbx), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq 0x27bf0
movl $0xde1, %edi            # imm = 0xDE1
callq 0x27880
movss 0x11ccf9(%rip), %xmm0   # 0x14e134
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x28390
movl $0x9, %edi
callq 0x271a0
xorl %edi, %edi
xorl %esi, %esi
callq 0x276d0
movsd 0x11cc8f(%rip), %xmm2   # 0x14e0f0
xorps %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x27ef0
movl $0x1, %edi
xorl %esi, %esi
callq 0x276d0
movapd 0x10(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movapd %xmm0, 0x20(%rsp)
xorps %xmm1, %xmm1
movsd 0x11cc58(%rip), %xmm2   # 0x14e0f0
callq 0x27ef0
movl $0x1, %edi
movl $0x1, %esi
callq 0x276d0
movapd 0x10(%rsp), %xmm1
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd 0x11cb82(%rip), %xmm1   # 0x14e040
movapd %xmm1, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movsd 0x11cc1f(%rip), %xmm2   # 0x14e0f0
callq 0x27ef0
xorl %edi, %edi
movl $0x1, %esi
callq 0x276d0
movsd 0x8(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movsd 0x11cbfb(%rip), %xmm2   # 0x14e0f0
callq 0x27ef0
callq 0x27ce0
movl $0xde1, %edi            # imm = 0xDE1
callq 0x27200
movl $0x1701, %edi           # imm = 0x1701
callq 0x27d40
callq 0x28260
movl $0x1700, %edi           # imm = 0x1700
callq 0x27d40
addq $0x30, %rsp
popq %rbx
jmp 0x28260
addq $0x30, %rsp
popq %rbx
retq