// File: tomfunkhouser[P]gaps/apps/gapsview/gapsview.cpp
// Function: DrawGSV(gaps::GSVScene*, int, int)
static void
DrawGSV(GSVScene *scene,
  int model_index, int color_scheme)
{
  // Check if should draw gsv scene
  if (!show_gsvs) return;

  // Draw points
  if (show_points) {
    glDisable(GL_LIGHTING);
    RNGrfxBegin(RN_GRFX_POINTS);
    int point_count = 0;
    for (int ir = 0; ir < scene->NRuns(); ir++) {
      GSVRun *run = scene->Run(ir);
      for (int is = 0; is < run->NSegments(); is++) {
        GSVSegment *segment = run->Segment(is);
        for (int iu = 0; iu < segment->NSurveys(); iu++) {
          GSVSurvey *survey = segment->Survey(iu);
          for (int ia = 0; ia < survey->NScans(); ia++) {
            GSVScan *scan = survey->Scan(ia);
            for (int ie = 0; ie < scan->NScanlines(); ie++) {
              GSVScanline *scanline = scan->Scanline(ie);
              for (int ik = 0; ik < scanline->NPoints(); ik++) {
                const GSVPoint& point = scanline->Point(ik);
                if (color_scheme == PICK_COLOR_SCHEME)
                  LoadColorIndex(model_index, GSV_POINT_ELEMENT_TYPE, point_count);
                else if (color_scheme == RGB_COLOR_SCHEME)
                  RNLoadRgb(point.Color());
                else if (color_scheme == CATEGORY_COLOR_SCHEME)
                  LoadColorIdentifier(point.CategoryIdentifier());
                else if (color_scheme == INSTANCE_COLOR_SCHEME)
                  LoadColorIdentifier(point.ClusterIdentifier());
                else
                  LoadColorValue(point.Elevation() / 2.0);
                R3LoadPoint(point.Position());
                point_count++;
              }
            }
          }
        }
      }
    }
    RNGrfxEnd();
  }

  // Draw normals
  if (show_normals && (color_scheme != PICK_COLOR_SCHEME)) {
    glDisable(GL_LIGHTING);
    RNLoadRgb(0.0, 1.0, 0.0); 
    RNGrfxBegin(RN_GRFX_LINES);
    RNScalar d = 0.0025 * world_bbox.DiagonalRadius();
    for (int ir = 0; ir < scene->NRuns(); ir++) {
      GSVRun *run = scene->Run(ir);
      for (int is = 0; is < run->NSegments(); is++) {
        GSVSegment *segment = run->Segment(is);
        for (int iu = 0; iu < segment->NSurveys(); iu++) {
          GSVSurvey *survey = segment->Survey(iu);
          for (int ia = 0; ia < survey->NScans(); ia++) {
            GSVScan *scan = survey->Scan(ia);
            for (int ie = 0; ie < scan->NScanlines(); ie++) {
              GSVScanline *scanline = scan->Scanline(ie);
              for (int ik = 0; ik < scanline->NPoints(); ik++) {
                const GSVPoint& point = scanline->Point(ik);
                R3Point position = point.Position();
                R3Vector normal = point.Normal();
                R3LoadPoint(position);
                R3LoadPoint(position + d * normal);
              }
            }
          }
        }
      }
    }
    RNGrfxEnd();
  }

  // Draw cameras
  if (show_cameras) {
    glDisable(GL_LIGHTING);
    RNLoadRgb(0, 1, 0);
    int image_count = 0;
    for (int ir = 0; ir < scene->NRuns(); ir++) {
      GSVRun *run = scene->Run(ir);
      for (int is = 0; is < run->NSegments(); is++) {
        GSVSegment *segment = run->Segment(is);
        for (int ip = 0; ip < segment->NPanoramas(); ip++) {
          GSVPanorama *panorama = segment->Panorama(ip);
          for (int ii = 0; ii < panorama->NImages(); ii++) {
            GSVImage *image = panorama->Image(ii);
            GSVPose pose = image->Pose();
            if (color_scheme == PICK_COLOR_SCHEME)
              LoadColorIndex(model_index, GSV_CAMERA_ELEMENT_TYPE, image_count);
            R3Sphere(pose.Viewpoint(), 0.1).Draw();
            R3Span(pose.Viewpoint(), pose.Viewpoint() + pose.Towards()).Draw();
            R3Span(pose.Viewpoint(), pose.Viewpoint() + 0.5 * pose.Up()).Draw();
            R3Span(pose.Viewpoint(), pose.Viewpoint() + 0.25 * pose.Right()).Draw();
            image_count++;
          }
        }
      }
    }
  }

  // Draw images
  if (show_image_insets || show_image_billboards || show_image_depths || show_image_rays) {
    glDisable(GL_LIGHTING);
    int image_count = 0;
    for (int ir = 0; ir < scene->NRuns(); ir++) {
      GSVRun *run = scene->Run(ir);
      for (int is = 0; is < run->NSegments(); is++) {
        GSVSegment *segment = run->Segment(is);
        for (int ip = 0; ip < segment->NPanoramas(); ip++) {
          GSVPanorama *panorama = segment->Panorama(ip);
          for (int ii = 0; ii < panorama->NImages(); ii++) {
            GSVImage *image = panorama->Image(ii);
            ImageData *data = (ImageData *) image->Data();
            if (!data) continue;

            // Compute projection of selected 3D position
            R2Point image_position = image->DistortedPosition(selected_position);
            if (image_position.X() < 0) continue;
            if (image_position.Y() < 0) continue;
            if (image_position.X() >= image->Width()) continue;
            if (image_position.Y() >= image->Height()) continue;

            // Get pose info
            GSVPose pose = image->Pose();
            R3Point viewpoint = pose.Viewpoint();
            R3Vector towards = pose.Towards();
            R3Vector right = pose.Right();
            R3Vector up = pose.Up();

            // Draw image inset
            if (show_image_insets) {
              double x = image_count * image_inset_scale * data->image_width;
              DrawImageInset(data, x, 0, image_inset_scale);
              DrawDotOnImageInset(data, x, 0, image_inset_scale, image_position);
            }
      
            // Draw image billboard
            if (show_image_billboards) {
              DrawImageBillboard(data, pose.Viewpoint(),
                pose.Towards(), pose.Right(), pose.Up(),
                0.5 * image->XFov(), 0.5 * image->YFov(),
                image_billboard_depth);
              DrawDotOnImageBillboard(data, viewpoint, towards, right, up,
                0.5 * image->XFov(), 0.5 * image->YFov(), image_billboard_depth,
                image_position, 0.025);
            }

            // Draw image depths
            if (show_image_depths) {
              DrawImageDepths(data, pose.Viewpoint(),
                pose.Towards(), pose.Right(), pose.Up(),
                0.5 * image->XFov(), 0.5 * image->YFov(),
                image_billboard_depth);
            }

            // Draw image ray
            if (show_image_rays) {
              DrawImageRay(data, image_position);
            }

            // Increment image counter
            image_count++;
          }
        }
      }
    }
  }
}

// Assembly:
subq $0x688, %rsp            # imm = 0x688
movq %rdi, 0x680(%rsp)
movl %esi, 0x67c(%rsp)
movl %edx, 0x678(%rsp)
cmpl $0x0, 0x2bce0c(%rip)    # 0x2efba0
jne 0x32d9b
jmp 0x34092
cmpl $0x0, 0x2bcdd6(%rip)    # 0x2efb78
je 0x33135
movl $0xb50, %edi            # imm = 0xB50
callq 0x2a130
xorl %edi, %edi
callq 0x38d90
movl $0x0, 0x674(%rsp)
movl $0x0, 0x670(%rsp)
movl 0x670(%rsp), %eax
movl %eax, 0x11c(%rsp)
movq 0x680(%rsp), %rdi
callq 0x39f90
movl %eax, %ecx
movl 0x11c(%rsp), %eax
cmpl %ecx, %eax
jge 0x33130
movq 0x680(%rsp), %rdi
movl 0x670(%rsp), %esi
callq 0x39fb0
movq %rax, 0x668(%rsp)
movl $0x0, 0x664(%rsp)
movl 0x664(%rsp), %eax
movl %eax, 0x118(%rsp)
movq 0x668(%rsp), %rdi
callq 0x39fe0
movl %eax, %ecx
movl 0x118(%rsp), %eax
cmpl %ecx, %eax
jge 0x33118
movq 0x668(%rsp), %rdi
movl 0x664(%rsp), %esi
callq 0x3a000
movq %rax, 0x658(%rsp)
movl $0x0, 0x654(%rsp)
movl 0x654(%rsp), %eax
movl %eax, 0x114(%rsp)
movq 0x658(%rsp), %rdi
callq 0x3a030
movl %eax, %ecx
movl 0x114(%rsp), %eax
cmpl %ecx, %eax
jge 0x33100
movq 0x658(%rsp), %rdi
movl 0x654(%rsp), %esi
callq 0x3a050
movq %rax, 0x648(%rsp)
movl $0x0, 0x644(%rsp)
movl 0x644(%rsp), %eax
movl %eax, 0x110(%rsp)
movq 0x648(%rsp), %rdi
callq 0x3a080
movl %eax, %ecx
movl 0x110(%rsp), %eax
cmpl %ecx, %eax
jge 0x330e8
movq 0x648(%rsp), %rdi
movl 0x644(%rsp), %esi
callq 0x3a0a0
movq %rax, 0x638(%rsp)
movl $0x0, 0x634(%rsp)
movl 0x634(%rsp), %eax
movl %eax, 0x10c(%rsp)
movq 0x638(%rsp), %rdi
callq 0x3a0d0
movl %eax, %ecx
movl 0x10c(%rsp), %eax
cmpl %ecx, %eax
jge 0x330d0
movq 0x638(%rsp), %rdi
movl 0x634(%rsp), %esi
callq 0x3a0f0
movq %rax, 0x628(%rsp)
movl $0x0, 0x624(%rsp)
movl 0x624(%rsp), %eax
movl %eax, 0x108(%rsp)
movq 0x628(%rsp), %rdi
callq 0x3a120
movl %eax, %ecx
movl 0x108(%rsp), %eax
cmpl %ecx, %eax
jge 0x330b8
movq 0x628(%rsp), %rdi
movl 0x624(%rsp), %esi
callq 0x3a130
movq %rax, 0x618(%rsp)
cmpl $0x5, 0x678(%rsp)
jne 0x32fdd
movl 0x67c(%rsp), %edi
movl 0x674(%rsp), %edx
movl $0x9, %esi
callq 0x340b0
jmp 0x3306f
cmpl $0x1, 0x678(%rsp)
jne 0x3300b
movq 0x618(%rsp), %rsi
leaq 0x600(%rsp), %rdi
callq 0x3a150
leaq 0x600(%rsp), %rdi
callq 0x39130
jmp 0x3306d
cmpl $0x3, 0x678(%rsp)
jne 0x3302b
movq 0x618(%rsp), %rdi
callq 0x3a1c0
movl %eax, %edi
callq 0x34130
jmp 0x3306b
cmpl $0x4, 0x678(%rsp)
jne 0x3304b
movq 0x618(%rsp), %rdi
callq 0x3a1d0
movl %eax, %edi
callq 0x34130
jmp 0x33069
movq 0x618(%rsp), %rdi
callq 0x3a1e0
movsd 0x233050(%rip), %xmm1   # 0x2660b0
divsd %xmm1, %xmm0
callq 0x34af0
jmp 0x3306b
jmp 0x3306d
jmp 0x3306f
movq 0x618(%rsp), %rsi
leaq 0x5e8(%rsp), %rdi
callq 0x3a200
leaq 0x5e8(%rsp), %rdi
callq 0x38e20
movl 0x674(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x674(%rsp)
movl 0x624(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x624(%rsp)
jmp 0x32f6e
jmp 0x330ba
movl 0x634(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x634(%rsp)
jmp 0x32f1b
jmp 0x330d2
movl 0x644(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x644(%rsp)
jmp 0x32ec8
jmp 0x330ea
movl 0x654(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x654(%rsp)
jmp 0x32e75
jmp 0x33102
movl 0x664(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x664(%rsp)
jmp 0x32e22
jmp 0x3311a
movl 0x670(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x670(%rsp)
jmp 0x32dcf
callq 0x38e40
cmpl $0x0, 0x2cbb8c(%rip)    # 0x2fecc8
je 0x3349f
cmpl $0x5, 0x678(%rsp)
je 0x3349f
movl $0xb50, %edi            # imm = 0xB50
callq 0x2a130
xorps %xmm2, %xmm2
movsd 0x232eab(%rip), %xmm1   # 0x266010
movaps %xmm2, %xmm0
callq 0x38d60
movl $0x1, %edi
callq 0x38d90
leaq 0x2cb6ba(%rip), %rdi    # 0x2fe838
callq 0x38be0
movaps %xmm0, %xmm1
movsd 0x232efa(%rip), %xmm0   # 0x266088
mulsd %xmm1, %xmm0
movsd %xmm0, 0x5e0(%rsp)
movl $0x0, 0x5dc(%rsp)
movl 0x5dc(%rsp), %eax
movl %eax, 0x104(%rsp)
movq 0x680(%rsp), %rdi
callq 0x39f90
movl %eax, %ecx
movl 0x104(%rsp), %eax
cmpl %ecx, %eax
jge 0x3349a
movq 0x680(%rsp), %rdi
movl 0x5dc(%rsp), %esi
callq 0x39fb0
movq %rax, 0x5d0(%rsp)
movl $0x0, 0x5cc(%rsp)
movl 0x5cc(%rsp), %eax
movl %eax, 0x100(%rsp)
movq 0x5d0(%rsp), %rdi
callq 0x39fe0
movl %eax, %ecx
movl 0x100(%rsp), %eax
cmpl %ecx, %eax
jge 0x33482
movq 0x5d0(%rsp), %rdi
movl 0x5cc(%rsp), %esi
callq 0x3a000
movq %rax, 0x5c0(%rsp)
movl $0x0, 0x5bc(%rsp)
movl 0x5bc(%rsp), %eax
movl %eax, 0xfc(%rsp)
movq 0x5c0(%rsp), %rdi
callq 0x3a030
movl %eax, %ecx
movl 0xfc(%rsp), %eax
cmpl %ecx, %eax
jge 0x3346a
movq 0x5c0(%rsp), %rdi
movl 0x5bc(%rsp), %esi
callq 0x3a050
movq %rax, 0x5b0(%rsp)
movl $0x0, 0x5ac(%rsp)
movl 0x5ac(%rsp), %eax
movl %eax, 0xf8(%rsp)
movq 0x5b0(%rsp), %rdi
callq 0x3a080
movl %eax, %ecx
movl 0xf8(%rsp), %eax
cmpl %ecx, %eax
jge 0x33452
movq 0x5b0(%rsp), %rdi
movl 0x5ac(%rsp), %esi
callq 0x3a0a0
movq %rax, 0x5a0(%rsp)
movl $0x0, 0x59c(%rsp)
movl 0x59c(%rsp), %eax
movl %eax, 0xf4(%rsp)
movq 0x5a0(%rsp), %rdi
callq 0x3a0d0
movl %eax, %ecx
movl 0xf4(%rsp), %eax
cmpl %ecx, %eax
jge 0x3343a
movq 0x5a0(%rsp), %rdi
movl 0x59c(%rsp), %esi
callq 0x3a0f0
movq %rax, 0x590(%rsp)
movl $0x0, 0x58c(%rsp)
movl 0x58c(%rsp), %eax
movl %eax, 0xf0(%rsp)
movq 0x590(%rsp), %rdi
callq 0x3a120
movl %eax, %ecx
movl 0xf0(%rsp), %eax
cmpl %ecx, %eax
jge 0x33422
movq 0x590(%rsp), %rdi
movl 0x58c(%rsp), %esi
callq 0x3a130
movq %rax, 0x580(%rsp)
movq 0x580(%rsp), %rsi
leaq 0x568(%rsp), %rdi
callq 0x3a200
movq 0x580(%rsp), %rsi
leaq 0x550(%rsp), %rdi
callq 0x3a240
leaq 0x568(%rsp), %rdi
callq 0x38e20
movsd 0x5e0(%rsp), %xmm0
leaq 0x520(%rsp), %rdi
leaq 0x550(%rsp), %rsi
callq 0x38f20
leaq 0x538(%rsp), %rdi
leaq 0x568(%rsp), %rsi
leaq 0x520(%rsp), %rdx
callq 0x180350
leaq 0x538(%rsp), %rdi
callq 0x38e20
movl 0x58c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58c(%rsp)
jmp 0x33345
jmp 0x33424
movl 0x59c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x59c(%rsp)
jmp 0x332f2
jmp 0x3343c
movl 0x5ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5ac(%rsp)
jmp 0x3329f
jmp 0x33454
movl 0x5bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5bc(%rsp)
jmp 0x3324c
jmp 0x3346c
movl 0x5cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5cc(%rsp)
jmp 0x331f9
jmp 0x33484
movl 0x5dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5dc(%rsp)
jmp 0x331a6
callq 0x38e40
cmpl $0x0, 0x2bc6e6(%rip)    # 0x2efb8c
je 0x33987
movl $0xb50, %edi            # imm = 0xB50
callq 0x2a130
xorl %edx, %edx
movl $0x1, %esi
movl %edx, %edi
callq 0x39820
movl $0x0, 0x51c(%rsp)
movl $0x0, 0x518(%rsp)
movl 0x518(%rsp), %eax
movl %eax, 0xec(%rsp)
movq 0x680(%rsp), %rdi
callq 0x39f90
movl %eax, %ecx
movl 0xec(%rsp), %eax
cmpl %ecx, %eax
jge 0x33985
movq 0x680(%rsp), %rdi
movl 0x518(%rsp), %esi
callq 0x39fb0
movq %rax, 0x510(%rsp)
movl $0x0, 0x50c(%rsp)
movl 0x50c(%rsp), %eax
movl %eax, 0xe8(%rsp)
movq 0x510(%rsp), %rdi
callq 0x39fe0
movl %eax, %ecx
movl 0xe8(%rsp), %eax
cmpl %ecx, %eax
jge 0x3396d
movq 0x510(%rsp), %rdi
movl 0x50c(%rsp), %esi
callq 0x3a000
movq %rax, 0x500(%rsp)
movl $0x0, 0x4fc(%rsp)
movl 0x4fc(%rsp), %eax
movl %eax, 0xe4(%rsp)
movq 0x500(%rsp), %rdi
callq 0x3a290
movl %eax, %ecx
movl 0xe4(%rsp), %eax
cmpl %ecx, %eax
jge 0x33955
movq 0x500(%rsp), %rdi
movl 0x4fc(%rsp), %esi
callq 0x3a2b0
movq %rax, 0x4f0(%rsp)
movl $0x0, 0x4ec(%rsp)
movl 0x4ec(%rsp), %eax
movl %eax, 0xe0(%rsp)
movq 0x4f0(%rsp), %rdi
callq 0x3a2e0
movl %eax, %ecx
movl 0xe0(%rsp), %eax
cmpl %ecx, %eax
jge 0x3393d
movq 0x4f0(%rsp), %rdi
movl 0x4ec(%rsp), %esi
callq 0x3a300
movq %rax, 0x4e0(%rsp)
movq 0x4e0(%rsp), %rsi
leaq 0x4a0(%rsp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4faf0
cmpl $0x5, 0x678(%rsp)
jne 0x33674
movl 0x67c(%rsp), %edi
movl 0x51c(%rsp), %edx
movl $0xa, %esi
callq 0x340b0
jmp 0x33659
jmp 0x33674
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x498(%rsp)
movl %eax, 0x494(%rsp)
jmp 0x3392b
leaq 0x4a0(%rsp), %rdi
callq 0x3a330
movq %rax, 0xd8(%rsp)
jmp 0x3368b
movq 0xd8(%rsp), %rsi
leaq 0x468(%rsp), %rdi
movsd 0x2329fd(%rip), %xmm0   # 0x2660a0
callq 0x14d530
jmp 0x336aa
leaq 0x460(%rsp), %rdi
movl $0x772, %esi            # imm = 0x772
callq 0x38e50
jmp 0x336be
movq 0x460(%rsp), %rsi
leaq 0x468(%rsp), %rdi
callq 0xf8e00
jmp 0x336d5
leaq 0x468(%rsp), %rdi
callq 0x398c0
leaq 0x4a0(%rsp), %rdi
callq 0x3a330
movq %rax, 0xd0(%rsp)
jmp 0x336f9
leaq 0x4a0(%rsp), %rdi
callq 0x3a330
movq %rax, 0xc8(%rsp)
jmp 0x33710
leaq 0x3e0(%rsp), %rdi
leaq 0x4a0(%rsp), %rsi
callq 0x5e6c0
jmp 0x33727
movq 0xc8(%rsp), %rsi
leaq 0x3f8(%rsp), %rdi
leaq 0x3e0(%rsp), %rdx
callq 0x180350
jmp 0x33746
movq 0xd0(%rsp), %rsi
leaq 0x410(%rsp), %rdi
leaq 0x3f8(%rsp), %rdx
callq 0x17e7c0
jmp 0x33765
leaq 0x410(%rsp), %rdi
callq 0xf6860
jmp 0x33774
leaq 0x4a0(%rsp), %rdi
callq 0x3a330
movq %rax, 0xc0(%rsp)
jmp 0x3378b
leaq 0x4a0(%rsp), %rdi
callq 0x3a330
movq %rax, 0xb8(%rsp)
jmp 0x337a2
leaq 0x348(%rsp), %rdi
leaq 0x4a0(%rsp), %rsi
callq 0x5e730
jmp 0x337b9
leaq 0x360(%rsp), %rdi
movsd 0x232887(%rip), %xmm0   # 0x266050
leaq 0x348(%rsp), %rsi
callq 0x38f20
jmp 0x337d8
movq 0xb8(%rsp), %rsi
leaq 0x378(%rsp), %rdi
leaq 0x360(%rsp), %rdx
callq 0x180350
jmp 0x337f7
movq 0xc0(%rsp), %rsi
leaq 0x390(%rsp), %rdi
leaq 0x378(%rsp), %rdx
callq 0x17e7c0
jmp 0x33816
leaq 0x390(%rsp), %rdi
callq 0xf6860
jmp 0x33825
leaq 0x4a0(%rsp), %rdi
callq 0x3a330
movq %rax, 0xb0(%rsp)
jmp 0x3383c
leaq 0x4a0(%rsp), %rdi
callq 0x3a330
movq %rax, 0xa8(%rsp)
jmp 0x33853
leaq 0x2b0(%rsp), %rdi
leaq 0x4a0(%rsp), %rsi
callq 0x5e7a0
jmp 0x3386a
leaq 0x2c8(%rsp), %rdi
movsd 0x23282e(%rip), %xmm0   # 0x2660a8
leaq 0x2b0(%rsp), %rsi
callq 0x38f20
jmp 0x33889
movq 0xa8(%rsp), %rsi
leaq 0x2e0(%rsp), %rdi
leaq 0x2c8(%rsp), %rdx
callq 0x180350
jmp 0x338a8
movq 0xb0(%rsp), %rsi
leaq 0x2f8(%rsp), %rdi
leaq 0x2e0(%rsp), %rdx
callq 0x17e7c0
jmp 0x338c7
leaq 0x2f8(%rsp), %rdi
callq 0xf6860
jmp 0x338d6
movl 0x51c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x51c(%rsp)
leaq 0x4a0(%rsp), %rdi
callq 0x5e680
movl 0x4ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4ec(%rsp)
jmp 0x335d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x498(%rsp)
movl %eax, 0x494(%rsp)
leaq 0x468(%rsp), %rdi
callq 0x398c0
leaq 0x4a0(%rsp), %rdi
callq 0x5e680
jmp 0x3409a
jmp 0x3393f
movl 0x4fc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4fc(%rsp)
jmp 0x33580
jmp 0x33957
movl 0x50c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x50c(%rsp)
jmp 0x3352d
jmp 0x3396f
movl 0x518(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x518(%rsp)
jmp 0x334da
jmp 0x33987
cmpl $0x0, 0x2cb55e(%rip)    # 0x2feeec
jne 0x339af
cmpl $0x0, 0x2cb559(%rip)    # 0x2feef0
jne 0x339af
cmpl $0x0, 0x2cb554(%rip)    # 0x2feef4
jne 0x339af
cmpl $0x0, 0x2cb54f(%rip)    # 0x2feef8
je 0x34092
movl $0xb50, %edi            # imm = 0xB50
callq 0x2a130
movl $0x0, 0x2ac(%rsp)
movl $0x0, 0x2a8(%rsp)
movl 0x2a8(%rsp), %eax
movl %eax, 0xa4(%rsp)
movq 0x680(%rsp), %rdi
callq 0x39f90
movl %eax, %ecx
movl 0xa4(%rsp), %eax
cmpl %ecx, %eax
jge 0x34090
movq 0x680(%rsp), %rdi
movl 0x2a8(%rsp), %esi
callq 0x39fb0
movq %rax, 0x2a0(%rsp)
movl $0x0, 0x29c(%rsp)
movl 0x29c(%rsp), %eax
movl %eax, 0xa0(%rsp)
movq 0x2a0(%rsp), %rdi
callq 0x39fe0
movl %eax, %ecx
movl 0xa0(%rsp), %eax
cmpl %ecx, %eax
jge 0x34078
movq 0x2a0(%rsp), %rdi
movl 0x29c(%rsp), %esi
callq 0x3a000
movq %rax, 0x290(%rsp)
movl $0x0, 0x28c(%rsp)
movl 0x28c(%rsp), %eax
movl %eax, 0x9c(%rsp)
movq 0x290(%rsp), %rdi
callq 0x3a290
movl %eax, %ecx
movl 0x9c(%rsp), %eax
cmpl %ecx, %eax
jge 0x34060
movq 0x290(%rsp), %rdi
movl 0x28c(%rsp), %esi
callq 0x3a2b0
movq %rax, 0x280(%rsp)
movl $0x0, 0x27c(%rsp)
movl 0x27c(%rsp), %eax
movl %eax, 0x98(%rsp)
movq 0x280(%rsp), %rdi
callq 0x3a2e0
movl %eax, %ecx
movl 0x98(%rsp), %eax
cmpl %ecx, %eax
jge 0x34048
movq 0x280(%rsp), %rdi
movl 0x27c(%rsp), %esi
callq 0x3a300
movq %rax, 0x270(%rsp)
movq 0x270(%rsp), %rdi
callq 0x3a340
movq %rax, 0x268(%rsp)
cmpq $0x0, 0x268(%rsp)
jne 0x33b35
jmp 0x34032
movq 0x270(%rsp), %rsi
leaq 0x258(%rsp), %rdi
leaq 0x2cad3c(%rip), %rdx    # 0x2fe888
callq 0x51090
leaq 0x258(%rsp), %rdi
callq 0x39990
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x33b6f
jmp 0x34032
leaq 0x258(%rsp), %rdi
callq 0x399a0
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x33b8d
jmp 0x34032
leaq 0x258(%rsp), %rdi
callq 0x39990
movsd %xmm0, 0x90(%rsp)
movq 0x270(%rsp), %rdi
callq 0x4fa70
movsd 0x90(%rsp), %xmm0
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jb 0x33bc8
jmp 0x34032
leaq 0x258(%rsp), %rdi
callq 0x399a0
movsd %xmm0, 0x88(%rsp)
movq 0x270(%rsp), %rdi
callq 0x4fab0
movsd 0x88(%rsp), %xmm0
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jb 0x33c03
jmp 0x34032
movq 0x270(%rsp), %rsi
leaq 0x218(%rsp), %rdi
movq %rdi, 0x78(%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4faf0
movq 0x78(%rsp), %rdi
callq 0x3a330
movq %rax, 0x80(%rsp)
jmp 0x33c36
movq 0x80(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x17fdd0
jmp 0x33c4d
leaq 0x1e8(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e6c0
jmp 0x33c64
leaq 0x1d0(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e7a0
jmp 0x33c7b
leaq 0x1b8(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e730
jmp 0x33c92
cmpl $0x0, 0x2cb253(%rip)    # 0x2feeec
je 0x33d47
cvtsi2sdl 0x2ac(%rsp), %xmm0
movsd 0x2bbee0(%rip), %xmm1   # 0x2efb90
mulsd %xmm1, %xmm0
movq 0x268(%rsp), %rax
cvtsi2sdl 0x768(%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x1b0(%rsp)
movq 0x268(%rsp), %rdi
movsd 0x1b0(%rsp), %xmm0
movsd 0x2bbea6(%rip), %xmm2   # 0x2efb90
xorps %xmm1, %xmm1
callq 0x34ca0
jmp 0x33cf4
movq 0x268(%rsp), %rdi
movsd 0x1b0(%rsp), %xmm0
movsd 0x2bbe83(%rip), %xmm2   # 0x2efb90
xorps %xmm1, %xmm1
leaq 0x258(%rsp), %rsi
callq 0x34eb0
jmp 0x33d1f
jmp 0x33d47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x498(%rsp)
movl %eax, 0x494(%rsp)
leaq 0x218(%rsp), %rdi
callq 0x5e680
jmp 0x3409a
cmpl $0x0, 0x2cb1a2(%rip)    # 0x2feef0
je 0x33ef2
movq 0x268(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x218(%rsp), %rdi
callq 0x3a330
movq %rax, 0x70(%rsp)
jmp 0x33d75
leaq 0x198(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e6c0
jmp 0x33d8c
leaq 0x180(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e7a0
jmp 0x33da3
leaq 0x168(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e730
jmp 0x33dba
movq 0x270(%rsp), %rdi
callq 0x4f9d0
movsd %xmm0, 0x60(%rsp)
jmp 0x33dcf
movsd 0x60(%rsp), %xmm0
movsd 0x232273(%rip), %xmm1   # 0x266050
mulsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x270(%rsp), %rdi
callq 0x4fa20
movsd %xmm0, 0x58(%rsp)
jmp 0x33dfc
movsd 0x50(%rsp), %xmm0
movq 0x70(%rsp), %rsi
movq 0x68(%rsp), %rdi
movsd 0x58(%rsp), %xmm1
movsd 0x232236(%rip), %xmm2   # 0x266050
mulsd %xmm2, %xmm1
movsd 0x2bbd72(%rip), %xmm2   # 0x2efb98
leaq 0x198(%rsp), %rdx
leaq 0x180(%rsp), %rcx
leaq 0x168(%rsp), %r8
callq 0x35060
jmp 0x33e45
movq 0x268(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x270(%rsp), %rdi
callq 0x4f9d0
movsd %xmm0, 0x48(%rsp)
jmp 0x33e67
movsd 0x48(%rsp), %xmm0
movsd 0x2321db(%rip), %xmm1   # 0x266050
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x270(%rsp), %rdi
callq 0x4fa20
movsd %xmm0, 0x38(%rsp)
jmp 0x33e94
movsd 0x30(%rsp), %xmm0
movq 0x40(%rsp), %rdi
movsd 0x38(%rsp), %xmm1
movsd 0x2321a3(%rip), %xmm2   # 0x266050
mulsd %xmm2, %xmm1
movsd 0x2bbcdf(%rip), %xmm2   # 0x2efb98
leaq 0x200(%rsp), %rsi
leaq 0x1e8(%rsp), %rdx
leaq 0x1d0(%rsp), %rcx
leaq 0x1b8(%rsp), %r8
leaq 0x258(%rsp), %r9
movsd 0x232177(%rip), %xmm3   # 0x266060
callq 0x35320
jmp 0x33ef0
jmp 0x33ef2
cmpl $0x0, 0x2caffb(%rip)    # 0x2feef4
je 0x33ff2
movq 0x268(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x218(%rsp), %rdi
callq 0x3a330
movq %rax, 0x28(%rsp)
jmp 0x33f20
leaq 0x150(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e6c0
jmp 0x33f37
leaq 0x138(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e7a0
jmp 0x33f4e
leaq 0x120(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x5e730
jmp 0x33f65
movq 0x270(%rsp), %rdi
callq 0x4f9d0
movsd %xmm0, 0x18(%rsp)
jmp 0x33f7a
movsd 0x18(%rsp), %xmm0
movsd 0x2320c8(%rip), %xmm1   # 0x266050
mulsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x270(%rsp), %rdi
callq 0x4fa20
movsd %xmm0, 0x10(%rsp)
jmp 0x33fa7
movsd 0x8(%rsp), %xmm0
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdi
movsd 0x10(%rsp), %xmm1
movsd 0x23208b(%rip), %xmm2   # 0x266050
mulsd %xmm2, %xmm1
movsd 0x2bbbc7(%rip), %xmm2   # 0x2efb98
leaq 0x150(%rsp), %rdx
leaq 0x138(%rsp), %rcx
leaq 0x120(%rsp), %r8
callq 0x35660
jmp 0x33ff0
jmp 0x33ff2
cmpl $0x0, 0x2caeff(%rip)    # 0x2feef8
je 0x34014
movq 0x268(%rsp), %rdi
leaq 0x258(%rsp), %rsi
callq 0x36050
jmp 0x34012
jmp 0x34014
movl 0x2ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2ac(%rsp)
leaq 0x218(%rsp), %rdi
callq 0x5e680
movl 0x27c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x27c(%rsp)
jmp 0x33ac8
jmp 0x3404a
movl 0x28c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28c(%rsp)
jmp 0x33a75
jmp 0x34062
movl 0x29c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x29c(%rsp)
jmp 0x33a22
jmp 0x3407a
movl 0x2a8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2a8(%rsp)
jmp 0x339cf
jmp 0x34092
addq $0x688, %rsp            # imm = 0x688
retq
movq 0x498(%rsp), %rdi
callq 0x29c10
nopw (%rax,%rax)