// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::Keyboard(int, int, int, int, int, int)
int R3SurfelViewer::
Keyboard(int x, int y, int key, int shift, int ctrl, int alt)
{
  // Initialize redraw status
  int redraw = 1;

  // Process debugging commands
  if (alt) {
    // Process debugging commands
    switch (key) {
    case 'A':
    case 'a':
      SetAxesVisibility(-1);
      break;
      
    case 'B':
      SetNodeBBoxVisibility(-1);
      break;

    case 'b':
      SetObjectOrientedBBoxVisibility(-1);
      break;

    case 'C':
      SetSurfelColorScheme((surfel_color_scheme + 1) % R3_SURFEL_VIEWER_NUM_COLOR_SCHEMES);
      break;

    case 'c':
      if (SurfelColorScheme() == R3_SURFEL_VIEWER_COLOR_BY_RGB)
        SetSurfelColorScheme(R3_SURFEL_VIEWER_COLOR_BY_ELEVATION);
      else if (SurfelColorScheme() == R3_SURFEL_VIEWER_COLOR_BY_ELEVATION)
        SetSurfelColorScheme(R3_SURFEL_VIEWER_COLOR_BY_OBJECT);
      else if (SurfelColorScheme() == R3_SURFEL_VIEWER_COLOR_BY_OBJECT)
        SetSurfelColorScheme(R3_SURFEL_VIEWER_COLOR_BY_CURRENT_LABEL);
      else SetSurfelColorScheme(R3_SURFEL_VIEWER_COLOR_BY_RGB);
      break;
      
    case 'D':
    case 'd':
      SetImagePointsVisibility(-1);
      SelectImage(selected_image, FALSE, FALSE);
      break;
      
    case 'E':
    case 'e':
      if (shape_draw_flags != 0) shape_draw_flags = 0;
      else shape_draw_flags = R3_SURFEL_DISC_DRAW_FLAG | R3_SURFEL_NORMAL_DRAW_FLAG;
      break;
      
    case 'F':
    case 'f':
      SetBackfacingVisibility(-1);
      break;

    case 'G':
    case 'g':
      if (ElevationRange().IsEmpty()) SetElevationRange(RNInterval(-FLT_MAX, 0.25));
      else SetElevationRange(RNnull_interval);
      break;
      
    case 'I':
      SetImagePlaneVisibility(-1);
      SelectImage(selected_image, FALSE, FALSE);
      break;

    case 'i':
      SetImageInsetVisibility(-1);
      SelectImage(selected_image, FALSE, FALSE);
      break;

    case 'L': 
    case 'l':
      SetHumanLabeledObjectVisibility(-1);
      break;
      
    case 'M':
    case 'm':
      subsampling_multiplier_when_mouse_down = (subsampling_multiplier_when_mouse_down <= 1) ? 8 : 1;
      break;
      
    case 'N':
    case 'n':
      SetNormalVisibility(-1);
      break;
      
    case 'O':
    case 'o':
      SetCenterPointVisibility(-1);
      break;
      
    case 'P':
    case 'p':
      SetSurfelVisibility(-1);
      break;

    case 'R':
    case 'r':
      SetObjectRelationshipVisibility(-1);
      break;

    // case 'S': // Save for toggling "selection" in sfllabel
    // case 's':
    //   break;

    // case 'T': // Reserve for toggling object label text in sfllabel
    // case 't':
    //  break;
      
    case 'V':
    case 'v':
      SetImageViewpointVisibility(-1);
      break;
      
    case 'W':
      UpdateWorkingSet(viewer);
      break;

    case 'w': {
      R3Point pick_position;
      R3SurfelNode *node = PickNode(x, y, &pick_position);
      if (node) SetCenterPoint(pick_position);
      break; }

    case 'X':
    case 'x':
      SetObjectPrincipalAxesVisibility(-1);
      break;
      
    case 'Y':
    case 'y':
      SetScanViewpointVisibility(-1);
      break;
      
    case 'Z':
    case 'z':
      SetViewingExtentVisibility(-1);
      break;
      
    case 'Q':
      // Print info about the currently selected image
      if (selected_image) {
        printf("%s\n", selected_image->Name());
        fflush(stdout);
      }
      break;
        
    case 'q': {
      // Print info about the node clicked
      R3Point pick_position(0,0,0);
      R3SurfelNode *node = PickNode(x, y, &pick_position);
      if (node) {
        SetCenterPoint(pick_position);
        printf("%g %g %g\n", pick_position[0], pick_position[1], pick_position[2]);
        while (node) {
          const char *node_name = (node->Name()) ? node->Name() : "-";
          R3SurfelObject *object = node->Object();
          const char *object_name = (object && (object->Name())) ? object->Name() : "-";
          char object_index[128];
          if (object) sprintf(object_index, "%d", object->SceneIndex());
          else sprintf(object_index, "%s", "-");
          R3SurfelLabel *ground_truth_label = (object) ? object->GroundTruthLabel() : NULL;
          const char *ground_truth_label_name = (ground_truth_label && (ground_truth_label->Name())) ? ground_truth_label->Name() : "-";
          R3SurfelLabel *current_label = (object) ? object->CurrentLabel() : NULL;
          const char *current_label_name = (current_label && (current_label->Name())) ? current_label->Name() : "-";
          printf("  %4d %4d %-30s  :  %-6s %-30s  :  %-30s %-30s\n",  
                 node->TreeLevel(), node->NParts(), node_name, 
                 object_index, object_name, 
                 current_label_name, ground_truth_label_name);
          node = node->Parent();        
        }
      }
      break; }

    case ';':
      SetFocusRadius(0.9 * FocusRadius());
      break;
      
    case '\'':
      SetFocusRadius(1.1 * FocusRadius());
      break;

    case ':':
      SetTargetResolution(0.9 * TargetResolution());
      break;

    case '"':
      SetTargetResolution(1.1 * TargetResolution());
      break;

    case ',': 
    case '.':
      if (!ElevationRange().IsEmpty()) {
        RNInterval range = ElevationRange();
        if (key == ',') range.SetMax(0.9 * range.Max());
        else if (key == '.') range.SetMax(1.1 * range.Max());
        SetElevationRange(range);
      }
      break;
      
    case '{':
    case '}': {
      // Set billboard depth
      RNScalar factor = (key == '{') ? 0.8 : 1.2;
      SetImagePlaneDepth(factor * ImagePlaneDepth());
      break; }

    case '<':
    case '>': {
      // Select next/prev image
      int image_index = (selected_image) ? selected_image->SceneIndex() : 0;
      if (key == '>') image_index++;
      else if (key == '<') image_index--;
      if (image_index < 0) image_index = 0;
      if (image_index > scene->NImages()-1) image_index = scene->NImages()-1;
      SelectImage(scene->Image(image_index), FALSE, FALSE);
      break; }

    case '_': 
      SetSubsamplingFactor(SubsamplingFactor() / 2);
      break;

    case '+': 
      SetSubsamplingFactor(SubsamplingFactor() * 2);
      break;

    case '-': 
      SetSurfelSize(0.8 * SurfelSize());
      break;

    case '=': 
      SetSurfelSize(1.25 * SurfelSize());
      break;

    default:
      redraw = 0;
      break;
    }
  }
  else if (ctrl) {
    switch(key) {
    case 'M':
    case 'm': // Enter
      if (image_inset_size < 0.5) SetImageInsetSize(0.8);
      else SetImageInsetSize(0.2);
      break;

    case 'R':
    case 'r':
      // Reset camera
      ResetCamera();
      break;

    default:
      redraw = 0;
      break;
    }
  }
  else {
    // Process other commands
    switch (key) {
    case R3_SURFEL_VIEWER_F1_KEY:
    case R3_SURFEL_VIEWER_F2_KEY:
    case R3_SURFEL_VIEWER_F3_KEY:
    case R3_SURFEL_VIEWER_F4_KEY: {
      int scale = key - R3_SURFEL_VIEWER_F1_KEY + 1;
      ZoomCamera(0.05 + 0.25*scale*scale);
      break; }

    case R3_SURFEL_VIEWER_F7_KEY:
      if (selected_image) SelectImage(selected_image, TRUE, TRUE);
      break;

    case R3_SURFEL_VIEWER_F8_KEY:
      ResetCamera();
      break;
      
    case R3_SURFEL_VIEWER_DOWN_KEY:
      SetImageInsetSize(0.8 * ImageInsetSize());
      break;

    case R3_SURFEL_VIEWER_UP_KEY:
      SetImageInsetSize(1.25 * ImageInsetSize());
      break;

    case R3_SURFEL_VIEWER_PAGE_UP_KEY: 
      if (viewing_extent.IsEmpty()) viewing_extent = scene->BBox();
      if (shift) viewing_extent[RN_LO][RN_Z] += 0.01 * scene->BBox().ZLength();
      else viewing_extent[RN_HI][RN_Z] += 0.01 * scene->BBox().ZLength();
      if (R3Contains(viewing_extent, scene->BBox())) viewing_extent = R3null_box;
      break;

    case R3_SURFEL_VIEWER_PAGE_DOWN_KEY: 
      if (viewing_extent.IsEmpty()) viewing_extent = scene->BBox();
      if (shift) viewing_extent[RN_LO][RN_Z] -= 0.01 * scene->BBox().ZLength();
      else viewing_extent[RN_HI][RN_Z] -= 0.01 * scene->BBox().ZLength();
      if (R3Contains(viewing_extent, scene->BBox())) viewing_extent = R3null_box;
      break;

    default:
      redraw = 0;
      break;
    }
  }

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

  // Remember modifiers 
  shift_down = shift;
  ctrl_down = ctrl;
  alt_down = alt;

  // Return whether need redraw
  return redraw;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %r9d, %ebx
movl %r8d, %r15d
movl %ecx, %ebp
movl %edx, %r12d
movl %esi, %edx
movq %rdi, %r14
movl 0x100(%rsp), %esi
testl %esi, %esi
je 0x2f63b
xorl %r13d, %r13d
leal -0x22(%rbp), %eax
cmpl $0x5b, %eax
ja 0x2ff98
leaq 0xeaf8a(%rip), %rcx     # 0x11a56c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsd 0x158(%r14), %xmm0
pushq $0x1
popq %r13
ucomisd 0x160(%r14), %xmm0
ja 0x2ff98
movl %edx, 0x18(%rsp)
leaq 0x158(%r14), %rsi
leaq 0x40(%rsp), %rdi
callq 0xd27d6
cmpl $0x2c, %ebp
je 0x2ff4d
cmpl $0x2e, %ebp
jne 0x2ff61
movsd 0xead92(%rip), %xmm0    # 0x11a3c8
jmp 0x2ff55
testl %ebx, %ebx
je 0x2f692
cmpl $0x4d, %ebp
je 0x2f662
cmpl $0x52, %ebp
je 0x2f6eb
cmpl $0x72, %ebp
je 0x2f6eb
xorl %r13d, %r13d
cmpl $0x6d, %ebp
jne 0x2ff98
movl %edx, %ebp
movsd 0xea9a4(%rip), %xmm0    # 0x11a010
ucomisd 0x2d8(%r14), %xmm0
movq (%r14), %rax
movq 0x88(%rax), %rax
jbe 0x2f724
movsd 0xead4b(%rip), %xmm0    # 0x11a3d8
jmp 0x2f72c
xorl %r13d, %r13d
leal -0x402(%rbp), %eax
cmpl $0x6, %eax
jbe 0x2f6fe
movl %edx, 0x18(%rsp)
leal -0x428(%rbp), %eax
cmpl $0x4, %eax
jae 0x2f743
addl $0xfffffbd9, %ebp       # imm = 0xFFFFFBD9
cvtsi2sd %ebp, %xmm1
movsd 0xead2b(%rip), %xmm0    # 0x11a3f0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
addsd 0xeaceb(%rip), %xmm0    # 0x11a3c0
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
callq *0x60(%rax)
movl %ebp, %esi
pushq $0x1
popq %r13
jmp 0x2ff76
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
movl %edx, %r13d
callq *0x50(%rax)
jmp 0x2ff8f
leaq 0xeafd7(%rip), %rcx     # 0x11a6dc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsd 0x2d8(%r14), %xmm0
mulsd 0xeacb9(%rip), %xmm0    # 0x11a3d8
jmp 0x2f9c3
movsd 0xeacf4(%rip), %xmm0    # 0x11a420
movq %r14, %rdi
callq *%rax
pushq $0x1
popq %r13
movl 0x100(%rsp), %esi
movl %ebp, %edx
jmp 0x2ff98
cmpl $0x42e, %ebp            # imm = 0x42E
je 0x2fa71
cmpl $0x42f, %ebp            # imm = 0x42F
movl 0x18(%rsp), %edx
jne 0x2ff98
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
callq *0x50(%rax)
movl 0x18(%rsp), %edx
jmp 0x2ff92
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0x100(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0xd0(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0x130(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0xe0(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0xc8(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0xb0(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0x108(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0x138(%rax)
jmp 0x2ff8f
movl %edx, %ebp
movsd 0x158(%r14), %xmm0
ucomisd 0x160(%r14), %xmm0
ja 0x2feac
movq (%r14), %rax
leaq 0x5813d1(%rip), %rsi    # 0x5b0c30
movq %r14, %rdi
jmp 0x2fed8
cmpq $0x0, 0x458(%r14)
je 0x2fee0
andq $0x0, 0x458(%r14)
jmp 0x2ff94
movq 0x2d0(%r14), %rax
testq %rax, %rax
je 0x2fef0
movl 0x10(%rax), %eax
jmp 0x2fef2
xorl %eax, %eax
cmpl $0x7b, %ebp
sete %al
leaq 0xeac07(%rip), %rcx     # 0x11a4b0
movsd (%rcx,%rax,8), %xmm0
mulsd 0x2e0(%r14), %xmm0
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
movl %edx, %r13d
callq *0x90(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0x120(%rax)
jmp 0x2fe19
cmpl $0x2, 0x490(%r14)
pushq $0x1
popq %r13
pushq $0x8
popq %rax
cmovgel %r13d, %eax
movl %eax, 0x490(%r14)
jmp 0x2ff98
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0xa8(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0xa0(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0x128(%rax)
jmp 0x2ff8f
movl %edx, 0x18(%rsp)
movl %r15d, %ebp
leaq 0x120(%r14), %r15
movq %r15, %rdi
callq 0x2bb24
testl %eax, %eax
je 0x2f97e
movq 0x8(%r14), %rdi
callq 0x32960
movq %r15, %rdi
movq %rax, %rsi
callq 0x32c06
movq 0x8(%r14), %rdi
callq 0x32960
leaq 0x138(%r14), %rcx
leaq 0x150(%r14), %rdx
testl %ebp, %ebp
movsd 0x30(%rax), %xmm0
subsd 0x18(%rax), %xmm0
cmoveq %rdx, %rcx
mulsd 0xea67b(%rip), %xmm0    # 0x11a028
jmp 0x2fa36
movsd 0x2d8(%r14), %xmm0
mulsd 0xeaa55(%rip), %xmm0    # 0x11a418
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
movl %edx, %r13d
callq *0x88(%rax)
jmp 0x2ff8f
movl %edx, 0x18(%rsp)
movl %r15d, %ebp
leaq 0x120(%r14), %r15
movq %r15, %rdi
callq 0x2bb24
testl %eax, %eax
je 0x2fa07
movq 0x8(%r14), %rdi
callq 0x32960
movq %r15, %rdi
movq %rax, %rsi
callq 0x32c06
movq 0x8(%r14), %rdi
callq 0x32960
leaq 0x138(%r14), %rcx
leaq 0x150(%r14), %rdx
testl %ebp, %ebp
movsd 0x30(%rax), %xmm0
subsd 0x18(%rax), %xmm0
cmoveq %rdx, %rcx
mulsd 0xea9f2(%rip), %xmm0    # 0x11a428
addsd (%rcx), %xmm0
movsd %xmm0, (%rcx)
movq 0x8(%r14), %rdi
callq 0x32960
movq %r15, %rdi
movq %rax, %rsi
callq 0x7ee2e
pushq $0x1
popq %r13
testl %eax, %eax
je 0x2fa69
leaq 0x17fb17(%rip), %rsi    # 0x1af578
movq %r15, %rdi
callq 0x32c06
movl %ebp, %r15d
jmp 0x2ff6f
movl %esi, %ebp
movq 0x2d0(%r14), %rsi
testq %rsi, %rsi
je 0x2ff45
movq (%r14), %rax
pushq $0x1
popq %r13
movq %r14, %rdi
movl %r13d, %edx
movl %r13d, %ecx
callq *0x1c0(%rax)
jmp 0x2ff49
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0x110(%rax)
jmp 0x2fe19
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0xd8(%rax)
jmp 0x2ff8f
movl %r15d, 0x1c(%rsp)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movl %edx, %r13d
callq 0xb231e
movq (%r14), %rax
andl $0x0, (%rsp)
movq %r14, %rdi
movl %r13d, %ebp
movl %r13d, %esi
movl %r12d, %edx
movq %r15, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq *0x1f8(%rax)
testq %rax, %rax
je 0x2fb1d
movq (%r14), %rax
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq *0x80(%rax)
pushq $0x1
popq %r13
movl 0x1c(%rsp), %r15d
jmp 0x2f735
movq 0x2d0(%r14), %rax
pushq $0x1
popq %r13
testq %rax, %rax
je 0x2ff98
movq 0x1c0(%rax), %rdi
movl %edx, %ebp
callq 0x27f30
movq 0x17736c(%rip), %rax    # 0x1a6ec0
movq (%rax), %rdi
callq 0x27af0
movl %ebp, %edx
movl 0x100(%rsp), %esi
jmp 0x2ff98
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0xf0(%rax)
jmp 0x2ff8f
movsd 0x478(%r14), %xmm0
mulsd 0xea7c4(%rip), %xmm0    # 0x11a358
jmp 0x2fd5b
movsd 0x2e8(%r14), %xmm0
mulsd 0xea86e(%rip), %xmm0    # 0x11a418
jmp 0x2fdef
movl %r15d, 0x1c(%rsp)
movl %ebx, 0x20(%rsp)
leaq 0x28(%rsp), %r15
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r15, %rdi
movl %edx, %ebx
callq 0xb2320
movq (%r14), %rax
andl $0x0, (%rsp)
movq %r14, %rdi
movl %ebx, 0x18(%rsp)
movl %ebx, %esi
movl %r12d, %edx
movq %r15, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq *0x1f8(%rax)
testq %rax, %rax
je 0x2fd25
movq %rax, %r13
movq (%r14), %rax
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq *0x80(%rax)
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movsd 0x10(%r15), %xmm2
leaq 0xed976(%rip), %rdi     # 0x11d5a2
movb $0x3, %al
callq 0x27080
leaq 0xeac90(%rip), %rbx     # 0x11a8ca
movl %r12d, 0x24(%rsp)
testq %r13, %r13
je 0x2fd25
movq 0xb8(%r13), %rbp
testq %rbp, %rbp
cmoveq %rbx, %rbp
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3d228
testq %rax, %rax
je 0x2fcca
movq %rax, %r12
movq 0x88(%rax), %r15
testq %r15, %r15
cmoveq %rbx, %r15
movl 0x10(%rax), %edx
leaq 0x40(%rsp), %rdi
leaq 0xf8653(%rip), %rsi     # 0x1282da
xorl %eax, %eax
callq 0x27140
movq %r12, %rdi
callq 0x432fe
testq %rax, %rax
je 0x2fca9
movq %rbx, %rcx
movq 0x60(%rax), %rbx
testq %rbx, %rbx
cmoveq %rcx, %rbx
movq %r12, %rdi
callq 0x43340
testq %rax, %rax
je 0x2fcd9
movq 0x60(%rax), %r12
testq %r12, %r12
leaq 0xeac06(%rip), %rax     # 0x11a8ca
cmoveq %rax, %r12
jmp 0x2fce0
movw $0x2d, 0x40(%rsp)
movq %rbx, %r15
movq %rbx, %r12
jmp 0x2fce0
leaq 0xeabea(%rip), %r12     # 0x11a8ca
movq %r13, %rdi
callq 0x3d218
movl 0x3c(%r13), %edx
movq %rbx, 0x8(%rsp)
movq %r12, (%rsp)
leaq 0xeabd0(%rip), %rdi     # 0x11a8cc
movl %eax, %esi
movq %rbp, %rcx
leaq 0x40(%rsp), %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x27080
movq 0x28(%r13), %r13
movl 0x24(%rsp), %r12d
leaq 0xeabaa(%rip), %rbx     # 0x11a8ca
jmp 0x2fc3f
pushq $0x1
popq %r13
movl 0x20(%rsp), %ebx
movl 0x1c(%rsp), %r15d
jmp 0x2ff6f
movsd 0x468(%r14), %xmm0
mulsd 0xea680(%rip), %xmm0    # 0x11a3c8
jmp 0x2fdc8
movsd 0x478(%r14), %xmm0
mulsd 0xea66d(%rip), %xmm0    # 0x11a3c8
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
movl %edx, %r13d
callq *0x1d0(%rax)
jmp 0x2ff8f
movl 0x360(%r14), %eax
incl %eax
pushq $0xf
popq %rcx
movl %edx, %r13d
cltd
idivl %ecx
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
movl %edx, %esi
callq *0x158(%rax)
jmp 0x2ff8f
movl %esi, %ebp
movl 0x48c(%r14), %esi
addl %esi, %esi
movq (%r14), %rax
movq %r14, %rdi
movl %edx, %r13d
callq *0x1d8(%rax)
jmp 0x2ff8f
movsd 0x468(%r14), %xmm0
mulsd 0xea590(%rip), %xmm0    # 0x11a358
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
movl %edx, %r13d
callq *0x1c8(%rax)
jmp 0x2ff8f
movsd 0x2e8(%r14), %xmm0
mulsd 0xea5e9(%rip), %xmm0    # 0x11a3d8
movq (%r14), %rax
movq %r14, %rdi
movl %esi, %ebp
movl %edx, %r13d
callq *0x98(%rax)
jmp 0x2ff8f
movq (%r14), %rax
movl %esi, %ebp
pushq $-0x1
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *0x118(%rax)
movq 0x2d0(%r14), %rsi
movq (%r14), %rax
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x1c0(%rax)
jmp 0x2ff8f
movl %esi, %ebp
leaq 0x78(%r14), %rsi
movq (%r14), %rax
movq %r14, %rdi
movl %edx, %r13d
callq *0x318(%rax)
jmp 0x2ff8f
movl 0x360(%r14), %ecx
movq (%r14), %rax
movq 0x158(%rax), %rax
cmpl $0xc, %ecx
je 0x2ff82
cmpl $0x5, %ecx
je 0x2ff7c
movl %edx, %ebp
testl %ecx, %ecx
jne 0x2ffd0
pushq $0xc
popq %rsi
movq %r14, %rdi
jmp 0x2ffd5
movl 0x48c(%r14), %eax
pushq $0x2
popq %rcx
movl %edx, %r13d
cltd
idivl %ecx
movq (%r14), %rcx
movq %r14, %rdi
movl %esi, %ebp
movl %eax, %esi
callq *0x1d8(%rcx)
jmp 0x2ff8f
movl %r15d, %r13d
leaq 0x40(%rsp), %r15
movsd 0xea484(%rip), %xmm0    # 0x11a340
movsd 0xea52c(%rip), %xmm1    # 0x11a3f0
movq %r15, %rdi
callq 0xd27cc
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movl %r13d, %r15d
callq *0x78(%rax)
jmp 0x2f731
movq $0x12, 0x458(%r14)
jmp 0x2ff94
xorl %eax, %eax
cmpl $0x3c, %ebp
movl %edx, 0x18(%rsp)
je 0x2ff06
cmpl $0x3e, %ebp
jne 0x2ff0c
movl %esi, %ebp
incl %eax
jmp 0x2ff0e
movl %esi, %ebp
decl %eax
jmp 0x2ff0e
movl %esi, %ebp
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movq 0x8(%r14), %rcx
movl 0x9c(%rcx), %edx
leal -0x1(%rdx), %esi
cmpl %edx, %eax
cmovll %eax, %esi
movq (%r14), %rax
movq 0x90(%rcx), %rcx
movslq %esi, %rdx
movq (%rcx,%rdx,8), %rsi
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x1c0(%rax)
pushq $0x1
popq %r13
movl %ebp, %esi
jmp 0x2ff76
movsd 0xea403(%rip), %xmm0    # 0x11a358
mulsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq (%r14), %rax
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq *0x78(%rax)
movl 0x100(%rsp), %esi
movl 0x18(%rsp), %edx
jmp 0x2ff98
movl %esi, %ebp
pushq $0x8
jmp 0x2ff86
movl %esi, %ebp
pushq $0x5
popq %rsi
movq %r14, %rdi
movl %edx, %r13d
callq *%rax
movl %r13d, %edx
movl %ebp, %esi
pushq $0x1
popq %r13
movl %edx, 0x4a8(%r14)
movl %r12d, 0x4ac(%r14)
movl %r15d, 0x4bc(%r14)
movl %ebx, 0x4c0(%r14)
movl %esi, 0x4c4(%r14)
movl %r13d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
xorl %esi, %esi
callq *%rax
jmp 0x2f731