// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/grdview/grdview.cpp
// Function: GLUTSpecial(int, int, int)
void GLUTSpecial(int key, int x, int y)
{
  // Invert y coordinate
  y = GLUTwindow_height - y;

  // Set useful variables
  static RNBoolean first = TRUE;
  static RNScalar threshold_step = 1;
  static RNInterval threshold_range(0,0);
  if (first) {
    RNInterval grid_range = grid->Range();
    threshold_step = grid->StandardDeviation() / 10;
    threshold_range.Reset(grid_range.Min() + 1.0E-20, grid_range.Max() - 1.0E-20);
    first = FALSE;
  }

  // Process keyboard button event 
  switch (key) {
  case GLUT_KEY_DOWN:
    grid_threshold -= threshold_step;
    if (grid_threshold < threshold_range.Min()) grid_threshold = threshold_range.Min();
    break;

  case GLUT_KEY_UP:
    grid_threshold += threshold_step;
    if (grid_threshold > threshold_range.Max()) grid_threshold = threshold_range.Max();
    break;

  case GLUT_KEY_LEFT:
    threshold_step /= 2;
    break;

  case GLUT_KEY_RIGHT:
    threshold_step *= 2;
    break;
  }

  // Remember mouse position 
  GLUTmouse[0] = x;
  GLUTmouse[1] = y;

  // Remember modifiers 
  GLUTmodifiers = glutGetModifiers();

  // Redraw
  glutPostRedisplay();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movl %esi, %ebx
movl %edi, %r14d
movl 0xf4022(%rip), %r12d    # 0x116890
movb 0xf8ffc(%rip), %al      # 0x11b870
testb %al, %al
je 0x229a2
cmpb $0x0, 0xf8fd9(%rip)     # 0x11b85c
jne 0x228cf
movq 0xf8f24(%rip), %rsi     # 0x11b7b0
movq %rsp, %r15
movq %r15, %rdi
callq 0x31ec6
movq 0xf8f12(%rip), %rdi     # 0x11b7b0
callq 0x2379c
divsd 0x927bd(%rip), %xmm0    # 0xb5068
movsd %xmm0, 0xf3fe5(%rip)    # 0x116898
movapd (%r15), %xmm0
addpd 0x92770(%rip), %xmm0    # 0xb5030
movapd %xmm0, 0xf8f98(%rip)    # 0x11b860
movb $0x1, 0xf8f8d(%rip)     # 0x11b85c
addl $-0x64, %r14d
cmpl $0x3, %r14d
ja 0x2294b
leaq 0x927d8(%rip), %rax     # 0xb50b8
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movsd 0xf3fa7(%rip), %xmm0    # 0x116898
mulsd 0x9275f(%rip), %xmm0    # 0xb5058
jmp 0x22907
movsd 0xf3f95(%rip), %xmm0    # 0x116898
addsd %xmm0, %xmm0
movsd %xmm0, 0xf3f89(%rip)    # 0x116898
jmp 0x2294b
cvtss2sd 0xf3f67(%rip), %xmm0    # 0x116880
subsd 0xf3f77(%rip), %xmm0    # 0x116898
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xf3f53(%rip)    # 0x116880
cvtss2sd %xmm0, %xmm1
movsd 0xf8f27(%rip), %xmm0    # 0x11b860
ucomisd %xmm1, %xmm0
jbe 0x2294b
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xf3f35(%rip)    # 0x116880
subl %ebp, %r12d
movl %ebx, 0xf8ef4(%rip)     # 0x11b848
movl %r12d, 0xf8ef1(%rip)    # 0x11b84c
callq 0x8271e
callq 0x7dc80
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cvtss2sd 0xf3f06(%rip), %xmm0    # 0x116880
addsd 0xf3f16(%rip), %xmm0    # 0x116898
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xf3ef2(%rip)    # 0x116880
cvtss2sd %xmm0, %xmm1
movsd 0xf8ece(%rip), %xmm0    # 0x11b868
ucomisd %xmm0, %xmm1
ja 0x2293f
jmp 0x2294b
leaq 0xf8ec7(%rip), %rdi     # 0x11b870
callq 0x1feb0
testl %eax, %eax
je 0x2287c
leaq 0xf8ea3(%rip), %rdi     # 0x11b860
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x7cd7c
leaq 0xf8ea0(%rip), %rdi     # 0x11b870
callq 0x1f4e0
jmp 0x2287c
movq %rax, %rbx
leaq 0xf8e8c(%rip), %rdi     # 0x11b870
callq 0x1f4c0
movq %rbx, %rdi
callq 0x1fe60