// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::WriteGSVStream(_IO_FILE*) const
int GSVScene::
WriteGSVStream(FILE *fp) const
{
  // Convenient variables
  int dummy = 0;

  // Make sure everything is uptodate
  R3Box foobar = BBox();
  if (foobar[0][0] == FLT_MAX) printf("Ouch\n");

  // Write magic keyword
  char magic[16] = { '\0' };
  strncpy(magic, "GSV", 16);
  if (fwrite(magic, sizeof(char), 16, fp) != (unsigned int) 16) {
    RNFail("Unable to write GSV scene file\n");
    return 0;
  }

  // Write header
  int endian_test = 1;
  int major_version = 2;
  int minor_version = 0;
  unsigned long long scene_file_offset = 0;
  fwrite(&dummy, sizeof(int), 1, fp);
  fwrite(&dummy, sizeof(int), 1, fp);
  fwrite(&scene_file_offset, sizeof(unsigned long long), 1, fp);
  fwrite(&endian_test, sizeof(int), 1, fp);
  fwrite(&major_version, sizeof(int), 1, fp);
  fwrite(&minor_version, sizeof(int), 1, fp);
  for (int j = 0; j < 53; j++) {
    fwrite(&dummy, sizeof(int), 1, fp);
  }

  // Write points
  for (int ir = 0; ir < NRuns(); ir++) {
    GSVRun *run = 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);
          scan->ReadPoints();
          for (int ie = 0; ie < scan->NScanlines(); ie++) {
            GSVScanline *scanline = scan->Scanline(ie);
            scanline->WritePoints(fp, FALSE);
          }
          scan->ReleasePoints();
        }
      }
    }
  }

  // Get scene file offset
  scene_file_offset = RNFileTell(fp);

  // Write scene 
  int scene_nruns = NRuns();
  R3Box scene_bbox = BBox();
  R4Matrix scene_matrix = Transformation().Matrix();
  fwrite(&scene_nruns, sizeof(int), 1, fp);
  fwrite(&(scene_bbox[0][0]), sizeof(RNCoord), 6, fp);
  fwrite(&(scene_matrix[0][0]), sizeof(RNScalar), 16, fp);
  for (int j = 0; j < 89; j++) {
    fwrite(&dummy, sizeof(int), 1, fp);
  }

  // Write runs
  for (int ir = 0; ir < NRuns(); ir++) {
    GSVRun *run = Run(ir);
    int run_ncameras = run->NCameras();
    int run_nlasers = run->NLasers();
    int run_nsegments = run->NSegments();
    R3Box run_bbox = run->BBox();
    char run_name[256] = { '\0' };
    if (run->Name()) strncpy(run_name, run->Name(), 255);
    fwrite(run_name, sizeof(char), 256, fp);
    fwrite(&run_ncameras, sizeof(int), 1, fp);
    fwrite(&run_nlasers, sizeof(int), 1, fp);
    fwrite(&run_nsegments, sizeof(int), 1, fp);
    fwrite(&(run_bbox[0][0]), sizeof(RNCoord), 6, fp);
    for (int j = 0; j < 23; j++) {
      fwrite(&dummy, sizeof(int), 1, fp);
    }

    // Write cameras
    for (int ic = 0; ic < run->NCameras(); ic++) {
      GSVCamera *camera = run->Camera(ic);
      int camera_ntapestries = camera->NTapestries();
      int camera_distortion_type = camera->DistortionType();
      RNLength camera_focal_x = camera->XFocal();
      RNLength camera_focal_y = camera->YFocal();
      RNCoord camera_center_x = camera->XCenter();
      RNCoord camera_center_y = camera->YCenter();
      RNScalar camera_k1 = camera->K1();
      RNScalar camera_k2 = camera->K2();
      RNScalar camera_k3 = camera->K3();
      RNScalar camera_p1 = camera->P1();
      RNScalar camera_p2 = camera->P2();
      RNAngle camera_fov_max = camera->MaxFov();
      R3Box camera_bbox = camera->BBox();
      int camera_width = camera->ImageWidth();
      int camera_height = camera->ImageHeight();
      fwrite(&camera_ntapestries, sizeof(int), 1, fp);
      fwrite(&camera_distortion_type, sizeof(int), 1, fp);
      fwrite(&camera_focal_x, sizeof(RNLength), 1, fp);
      fwrite(&camera_focal_y, sizeof(RNLength), 1, fp);
      fwrite(&camera_center_x, sizeof(RNCoord), 1, fp);
      fwrite(&camera_center_y, sizeof(RNCoord), 1, fp);
      fwrite(&camera_k1, sizeof(RNScalar), 1, fp);
      fwrite(&camera_k2, sizeof(RNScalar), 1, fp);
      fwrite(&camera_k3, sizeof(RNScalar), 1, fp);
      fwrite(&camera_p1, sizeof(RNScalar), 1, fp);
      fwrite(&camera_p2, sizeof(RNScalar), 1, fp);
      fwrite(&camera_fov_max, sizeof(RNAngle), 1, fp);
      fwrite(&(camera_bbox[0][0]), sizeof(RNCoord), 6, fp);
      fwrite(&camera_width, sizeof(int), 1, fp);
      fwrite(&camera_height, sizeof(int), 1, fp);
      for (int j = 0; j < 13; j++) {
        fwrite(&dummy, sizeof(int), 1, fp);
      }
    }

    // Write lasers
    for (int il = 0; il < run->NLasers(); il++) {
      GSVLaser *laser = run->Laser(il);
      int device_type = laser->DeviceType();
      int max_sweep_index = laser->MaxSweepIndex();
      int max_beam_index = laser->MaxBeamIndex();
      int laser_nsurveys = laser->NSurveys();
      R3Box laser_bbox = laser->BBox();
      fwrite(&device_type, sizeof(int), 1, fp);
      fwrite(&laser_nsurveys, sizeof(int), 1, fp);
      fwrite(&(laser_bbox[0][0]), sizeof(RNCoord), 6, fp);
      fwrite(&max_sweep_index, sizeof(int), 1, fp);
      fwrite(&max_beam_index, sizeof(int), 1, fp);
      for (int j = 0; j < 22; j++) {
        fwrite(&dummy, sizeof(int), 1, fp);
      }
    }

    // Write segments
    for (int is = 0; is < run->NSegments(); is++) {
      GSVSegment *segment = run->Segment(is);
      int segment_nsurveys = segment->NSurveys();
      int segment_ntapestries = segment->NTapestries();
      int segment_npanoramas = segment->NPanoramas();
      R3Box segment_bbox = segment->BBox();
      char segment_name[256] = { '\0' };
      if (segment->Name()) strncpy(segment_name, segment->Name(), 255);
      fwrite(segment_name, sizeof(char), 256, fp);
      fwrite(&segment_nsurveys, sizeof(int), 1, fp);
      fwrite(&segment_ntapestries, sizeof(int), 1, fp);
      fwrite(&segment_npanoramas, sizeof(int), 1, fp);
      fwrite(&(segment_bbox[0][0]), sizeof(RNCoord), 6, fp);
      for (int j = 0; j < 23; j++) {
        fwrite(&dummy, sizeof(int), 1, fp);
      }

      // Write surveys
      for (int iu = 0; iu < segment->NSurveys(); iu++) {
        GSVSurvey *survey = segment->Survey(iu);
        int survey_laser_index = (survey->Laser()) ? survey->Laser()->RunIndex() : -1;
        int survey_nscans = survey->NScans();
        R3Box survey_bbox = segment->BBox();
        fwrite(&survey_laser_index, sizeof(int), 1, fp);
        fwrite(&survey_nscans, sizeof(int), 1, fp);
        fwrite(&(survey_bbox[0][0]), sizeof(RNCoord), 6, fp);
        for (int j = 0; j < 24; j++) {
          fwrite(&dummy, sizeof(int), 1, fp);
        }

        // Write scans
        for (int ia = 0; ia < survey->NScans(); ia++) {
          GSVScan *scan = survey->Scan(ia);
          int scan_nscanlines = scan->NScanlines();
          R3Box scan_bbox = scan->BBox();
          fwrite(&scan_nscanlines, sizeof(int), 1, fp);
          fwrite(&(scan_bbox[0][0]), sizeof(RNCoord), 6, fp);
          for (int j = 0; j < 24; j++) {
            fwrite(&dummy, sizeof(int), 1, fp);
          }

          // Write scanlines
          for (int ie = 0; ie < scan->NScanlines(); ie++) {
            GSVScanline *scanline = scan->Scanline(ie);
            int scanline_npoints = scanline->NPoints();
            R3Point scanline_viewpoint = scanline->Pose().Viewpoint();
            R3Quaternion scanline_orientation = scanline->Pose().Orientation();
            RNScalar scanline_timestamp = scanline->Timestamp();
            int scanline_sweep_index = scanline->SweepIndex();
            R3Box scanline_bbox = scanline->BBox();
            unsigned long long scanline_file_offset = scanline->FileOffset();
            fwrite(&(scanline_npoints), sizeof(int), 1, fp);
            fwrite(&(scanline_viewpoint[0]), sizeof(RNCoord), 3, fp);
            fwrite(&(scanline_orientation[0]), sizeof(RNCoord), 4, fp);
            fwrite(&scanline_timestamp, sizeof(RNScalar), 1, fp);
            fwrite(&(scanline_bbox[0][0]), sizeof(RNCoord), 6, fp);
            fwrite(&(scanline_file_offset), sizeof(unsigned long long), 1, fp);
            fwrite(&(scanline_sweep_index), sizeof(int), 1, fp);
            for (int j = 0; j < 14; j++) {
              fwrite(&dummy, sizeof(int), 1, fp);
            }
          }
        }
      }
      
      // Write tapestries
      for (int it = 0; it < segment->NTapestries(); it++) {
        GSVTapestry *tapestry = segment->Tapestry(it);
        int tapestry_camera_index = (tapestry->Camera()) ? tapestry->Camera()->RunIndex() : -1;
        int tapestry_nimages = tapestry->NImages();
        R3Box tapestry_bbox = segment->BBox();
        fwrite(&tapestry_camera_index, sizeof(int), 1, fp);
        fwrite(&tapestry_nimages, sizeof(int), 1, fp);
        fwrite(&(tapestry_bbox[0][0]), sizeof(RNCoord), 6, fp);
        for (int j = 0; j < 24; j++) {
          fwrite(&dummy, sizeof(int), 1, fp);
        }
      }

      // Write panoramas
      for (int ip = 0; ip < segment->NPanoramas(); ip++) {
        GSVPanorama *panorama = segment->Panorama(ip);
        int panorama_nimages = panorama->NImages();
        R3Point panorama_viewpoint = panorama->Viewpoint();
        RNScalar panorama_timestamp = panorama->Timestamp();
        char panorama_name[256] = { '\0' };
        if (panorama->Name()) strncpy(panorama_name, panorama->Name(), 255);
        fwrite(panorama_name, sizeof(char), 256, fp);
        fwrite(&panorama_nimages, sizeof(int), 1, fp);
        fwrite(&(panorama_viewpoint[0]), sizeof(RNCoord), 3, fp);
        fwrite(&panorama_timestamp, sizeof(RNScalar), 1, fp);
        for (int j = 0; j < 22; j++) {
          fwrite(&dummy, sizeof(int), 1, fp);
        }

        // Write images
        for (int ii = 0; ii < panorama->NImages(); ii++) {
          GSVImage *image = panorama->Image(ii);
          int image_tapestry_index = (image->Tapestry()) ? image->Tapestry()->SegmentIndex() : -1;
          int image_ncolumns = image->Width();
          R3Point image_viewpoint0 = image->Pose(0).Viewpoint();
          R3Point image_viewpoint1 = image->Pose(image->Width()-1).Viewpoint();
          R3Quaternion image_orientation0 = image->Pose(0).Orientation();
          R3Quaternion image_orientation1 = image->Pose(image->Width()-1).Orientation();
          RNScalar image_timestamp0 = image->Timestamp(0);
          RNScalar image_timestamp1 = image->Timestamp(image->Width()-1);
          char image_name[256] = { '\0' };
          if (image->Name()) strncpy(image_name, image->Name(), 255);
          fwrite(image_name, sizeof(char), 256, fp);
          fwrite(&image_tapestry_index, sizeof(int), 1, fp);
          fwrite(&image_ncolumns, sizeof(int), 1, fp);
          fwrite(&(image_viewpoint0[0]), sizeof(RNCoord), 3, fp);
          fwrite(&(image_viewpoint1[0]), sizeof(RNCoord), 3, fp);
          fwrite(&(image_orientation0[0]), sizeof(RNCoord), 4, fp);
          fwrite(&(image_orientation1[0]), sizeof(RNCoord), 4, fp);
          fwrite(&image_timestamp0, sizeof(RNScalar), 1, fp);
          fwrite(&image_timestamp1, sizeof(RNScalar), 1, fp);
          for (int j = 0; j < 14; j++) {
            fwrite(&dummy, sizeof(int), 1, fp);
          }
        }
      }
    }
  }

  // Get end of file offset
  unsigned long long end_of_file_offset = RNFileTell(fp);

  // Re-write header with updated scene file offset
  RNFileSeek(fp, 0, RN_FILE_SEEK_SET);
  fwrite(magic, sizeof(char), 16, fp);
  fwrite(&dummy, sizeof(int), 1, fp);
  fwrite(&dummy, sizeof(int), 1, fp);
  fwrite(&scene_file_offset, sizeof(unsigned long long), 1, fp);
  fwrite(&endian_test, sizeof(int), 1, fp);
  fwrite(&major_version, sizeof(int), 1, fp);
  fwrite(&minor_version, sizeof(int), 1, fp);

  // Seek to end of file
  RNFileSeek(fp, end_of_file_offset, RN_FILE_SEEK_SET);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6b8, %rsp            # imm = 0x6B8
movq %rsi, %rbx
movq %rdi, %r14
movl $0x0, (%rsp)
movsd 0x38(%rdi), %xmm0
ucomisd 0x115939(%rip), %xmm0   # 0x14c008
jne 0x366db
jp 0x366db
movq %r14, %rdi
callq 0x3302a
leaq 0x30(%r14), %rsi
leaq 0x2f8(%rsp), %r15
movq %r15, %rdi
movq %rsi, 0x18(%rsp)
callq 0xbd970
movsd 0x8(%r15), %xmm0
ucomisd 0x115906(%rip), %xmm0   # 0x14c008
jne 0x36712
jp 0x36712
leaq 0x116576(%rip), %rdi    # 0x14cc83
callq 0x27f30
movupd 0x11657f(%rip), %xmm0   # 0x14cc99
leaq 0x170(%rsp), %rdi
movapd %xmm0, (%rdi)
movl $0x1, %esi
movl $0x10, %edx
movq %rbx, %rcx
callq 0x28320
cmpq $0x10, %rax
jne 0x37979
movq %r14, 0x48(%rsp)
leaq 0x7c(%rsp), %rbp
movl $0x1, (%rbp)
leaq 0x78(%rsp), %r13
movl $0x2, (%r13)
leaq 0x74(%rsp), %r12
movl $0x0, (%r12)
leaq 0x80(%rsp), %r14
movq $0x0, (%r14)
movq %rsp, %r15
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
movq %rbp, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x35, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x36802
movq 0x48(%rsp), %r14
movl 0x14(%r14), %eax
testl %eax, %eax
jle 0x3691f
xorl %ecx, %ecx
movq %rcx, %rdx
movq 0x8(%r14), %rcx
movq %rdx, 0x58(%rsp)
movq (%rcx,%rdx,8), %rdx
movl 0x24(%rdx), %ecx
testl %ecx, %ecx
jle 0x36908
xorl %esi, %esi
movq %rdx, 0x50(%rsp)
movq 0x18(%rdx), %rax
movq (%rax,%rsi,8), %rdi
movl 0x2c(%rdi), %eax
testl %eax, %eax
jle 0x368f5
movq %rsi, 0x20(%rsp)
xorl %r14d, %r14d
movq %rdi, 0x28(%rsp)
movq 0x20(%rdi), %rcx
movq (%rcx,%r14,8), %r12
cmpl $0x0, 0x34(%r12)
jle 0x368d8
xorl %r13d, %r13d
movq 0x28(%r12), %rax
movq (%rax,%r13,8), %r15
movq %r15, %rdi
callq 0x40188
cmpl $0x0, 0x34(%r15)
jle 0x368bb
xorl %ebp, %ebp
movq 0x28(%r15), %rax
movq (%rax,%rbp,8), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x42a12
incq %rbp
movslq 0x34(%r15), %rax
cmpq %rax, %rbp
jl 0x3689d
movq %r15, %rdi
callq 0x40262
incq %r13
movslq 0x34(%r12), %rax
cmpq %rax, %r13
jl 0x36883
movq 0x28(%rsp), %rdi
movl 0x2c(%rdi), %eax
incq %r14
movslq %eax, %rcx
cmpq %rcx, %r14
jl 0x36870
movq 0x50(%rsp), %rdx
movl 0x24(%rdx), %ecx
movq 0x48(%rsp), %r14
movq 0x20(%rsp), %rsi
incq %rsi
movslq %ecx, %rax
cmpq %rax, %rsi
jl 0x36850
movl 0x14(%r14), %eax
movq 0x58(%rsp), %rdx
incq %rdx
movslq %eax, %rcx
cmpq %rcx, %rdx
movq %rdx, %rcx
jl 0x3682e
movq %rbx, %rdi
callq 0xfab43
movq %rax, 0x80(%rsp)
movl 0x14(%r14), %eax
movl %eax, 0x70(%rsp)
movsd 0x38(%r14), %xmm0
ucomisd 0x1156c3(%rip), %xmm0   # 0x14c008
jne 0x36951
jp 0x36951
movq %r14, %rdi
callq 0x3302a
leaq 0x2c0(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xbd970
leaq 0x70(%r14), %rsi
leaq 0x530(%rsp), %rdi
callq 0xc295a
leaq 0x70(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x28320
leaq 0x2c8(%rsp), %rdi
movl $0x8, %esi
movl $0x6, %edx
movq %rbx, %rcx
callq 0x28320
leaq 0x530(%rsp), %rdi
movl $0x8, %esi
movl $0x10, %edx
movq %rbx, %rcx
callq 0x28320
movl $0x59, %ebp
movq %rsp, %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x369c7
movq 0x48(%rsp), %rcx
cmpl $0x0, 0x14(%rcx)
jle 0x3789b
xorl %eax, %eax
movsd 0x11560f(%rip), %xmm1   # 0x14c008
leaq 0x5b0(%rsp), %r15
movq %rsp, %r14
movq %rax, %rdx
movq 0x8(%rcx), %rax
movq %rdx, 0x88(%rsp)
movq (%rax,%rdx,8), %r12
movl 0x34(%r12), %eax
movl %eax, 0x6c(%rsp)
movl 0x44(%r12), %eax
movl %eax, 0x68(%rsp)
movl 0x24(%r12), %eax
movl %eax, 0x64(%rsp)
movsd 0x58(%r12), %xmm0
ucomisd %xmm1, %xmm0
jne 0x36a49
jp 0x36a49
movq %r12, %rdi
callq 0x381ac
leaq 0x50(%r12), %rsi
leaq 0x288(%rsp), %rdi
callq 0xbd970
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x274b0
movq %r12, 0x18(%rsp)
movq 0x48(%r12), %rsi
testq %rsi, %rsi
je 0x36a86
movl $0xff, %edx
movq %r15, %rdi
callq 0x27450
movl $0x1, %esi
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x6c(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x68(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x64(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x6, %edx
leaq 0x290(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x17, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x36aff
movq 0x18(%rsp), %rcx
cmpl $0x0, 0x34(%rcx)
jle 0x36df1
xorl %r15d, %r15d
movq 0x28(%rcx), %rax
movq (%rax,%r15,8), %r12
movl 0x24(%r12), %eax
movl %eax, 0x30(%rsp)
movl 0x28(%r12), %eax
movl %eax, 0x14(%rsp)
movsd 0x38(%r12), %xmm0
movsd %xmm0, 0x330(%rsp)
movsd 0x40(%r12), %xmm0
movsd %xmm0, 0x180(%rsp)
movsd 0x48(%r12), %xmm0
movsd %xmm0, 0x138(%rsp)
movsd 0x50(%r12), %xmm0
movsd %xmm0, 0xe0(%rsp)
movsd 0x58(%r12), %xmm0
movsd %xmm0, 0x118(%rsp)
movsd 0x60(%r12), %xmm0
movsd %xmm0, 0xc8(%rsp)
movsd 0x68(%r12), %xmm0
movsd %xmm0, 0xb0(%rsp)
movsd 0x70(%r12), %xmm0
movsd %xmm0, 0x98(%rsp)
movsd 0x78(%r12), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x80(%r12), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x90(%r12), %xmm0
ucomisd 0x115415(%rip), %xmm0   # 0x14c008
leaq 0x180(%rsp), %r13
jne 0x36c07
jp 0x36c07
movq %r12, %rdi
callq 0x3bb5c
leaq 0x88(%r12), %rsi
leaq 0x430(%rsp), %rdi
callq 0xbd970
movl 0x2c(%r12), %eax
testl %eax, %eax
movl $0x790, %ecx            # imm = 0x790
cmovsl %ecx, %eax
movl %eax, 0x10(%rsp)
movl 0x30(%r12), %eax
testl %eax, %eax
movl $0xa20, %ecx            # imm = 0xA20
cmovsl %ecx, %eax
movl %eax, 0xc(%rsp)
movl $0x4, %esi
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x14(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x330(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x138(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0xe0(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x118(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0xc8(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0xb0(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x98(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x40(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x38(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x6, %edx
leaq 0x438(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x10(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0xc(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0xd, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x36db6
leaq 0x430(%rsp), %rdi
callq 0xbe790
incq %r15
movq 0x18(%rsp), %rcx
movslq 0x34(%rcx), %rax
cmpq %rax, %r15
jl 0x36b2a
cmpl $0x0, 0x44(%rcx)
leaq 0x180(%rsp), %r13
jle 0x36f32
xorl %r15d, %r15d
movq 0x38(%rcx), %rax
movq (%rax,%r15,8), %r12
movl 0x28(%r12), %eax
movl %eax, 0x330(%rsp)
movl 0x2c(%r12), %eax
movl %eax, 0x180(%rsp)
movl 0x30(%r12), %eax
movl %eax, 0x138(%rsp)
movl 0x24(%r12), %eax
movl %eax, 0xe0(%rsp)
movsd 0x40(%r12), %xmm0
ucomisd 0x1151bb(%rip), %xmm0   # 0x14c008
jne 0x36e59
jp 0x36e59
movq %r12, %rdi
callq 0x3ed54
addq $0x38, %r12
leaq 0x430(%rsp), %rdi
movq %r12, %rsi
callq 0xbd970
movl $0x4, %esi
movl $0x1, %edx
leaq 0x330(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0xe0(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x6, %edx
leaq 0x438(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x138(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x16, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x36eef
leaq 0x430(%rsp), %rdi
callq 0xbe790
incq %r15
movq 0x18(%rsp), %rcx
movslq 0x44(%rcx), %rax
cmpq %rax, %r15
leaq 0x180(%rsp), %r13
jl 0x36e06
cmpl $0x0, 0x24(%rcx)
jle 0x3785e
xorl %edx, %edx
movq 0x18(%rcx), %rax
movq %rdx, 0x90(%rsp)
movq (%rax,%rdx,8), %r12
movl 0x2c(%r12), %eax
movl %eax, 0x14(%rsp)
movl 0x3c(%r12), %eax
movl %eax, 0x10(%rsp)
movl 0x4c(%r12), %eax
movl %eax, 0xc(%rsp)
movsd 0x58(%r12), %xmm0
ucomisd 0x115090(%rip), %xmm0   # 0x14c008
jne 0x36f84
jp 0x36f84
movq %r12, %rdi
callq 0x3a30e
leaq 0x50(%r12), %rsi
leaq 0x138(%rsp), %rdi
movq %rsi, 0x50(%rsp)
callq 0xbd970
movl $0x100, %edx            # imm = 0x100
leaq 0x430(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x274b0
movq %r12, 0x20(%rsp)
movq 0x88(%r12), %rsi
testq %rsi, %rsi
je 0x36fd1
movl $0xff, %edx
movq %r15, %rdi
callq 0x27450
movl $0x1, %esi
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x14(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x10(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0xc(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x6, %edx
leaq 0x140(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x17, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x3704a
movq 0x20(%rsp), %rdi
cmpl $0x0, 0x2c(%rdi)
leaq 0x330(%rsp), %r15
leaq 0x180(%rsp), %r13
jle 0x373ac
xorl %r12d, %r12d
movq 0x20(%rdi), %rax
movq (%rax,%r12,8), %rcx
movq 0x18(%rcx), %rax
testq %rax, %rax
je 0x3709b
movl 0x10(%rax), %eax
jmp 0x370a0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x40(%rsp)
movq %rcx, 0x28(%rsp)
movl 0x34(%rcx), %eax
movl %eax, 0x38(%rsp)
movsd 0x58(%rdi), %xmm0
ucomisd 0x114f4b(%rip), %xmm0   # 0x14c008
jne 0x370c6
jp 0x370c6
callq 0x3a30e
movq %r15, %rdi
movq 0x50(%rsp), %rsi
callq 0xbd970
movq %r12, 0x58(%rsp)
movl $0x4, %esi
movl $0x1, %edx
leaq 0x40(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x38(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x6, %edx
leaq 0x338(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x18, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x37125
movq 0x28(%rsp), %rcx
cmpl $0x0, 0x34(%rcx)
leaq 0x180(%rsp), %r13
jle 0x37382
xorl %r15d, %r15d
movq 0x28(%rcx), %rax
movq (%rax,%r15,8), %r12
movl 0x34(%r12), %eax
movl %eax, 0x30(%rsp)
movsd 0x40(%r12), %xmm0
ucomisd 0x114e90(%rip), %xmm0   # 0x14c008
jne 0x37184
jp 0x37184
movq %r12, %rdi
callq 0x405ae
leaq 0x38(%r12), %rsi
movq %r13, %rdi
callq 0xbd970
movl $0x4, %esi
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x6, %edx
leaq 0x188(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x18, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x371c7
cmpl $0x0, 0x34(%r12)
jle 0x3735d
xorl %ebp, %ebp
movq 0x28(%r12), %rax
movq (%rax,%rbp,8), %r13
movl 0x30(%r13), %eax
movl %eax, 0x8(%rsp)
leaq 0x40(%r13), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xd43ee
leaq 0x58(%r13), %rsi
leaq 0x118(%rsp), %rdi
callq 0xc1866
movsd 0x78(%r13), %xmm0
movsd %xmm0, 0xb0(%rsp)
movl 0x80(%r13), %eax
movl %eax, 0x4(%rsp)
movq %r13, %rdi
callq 0x4277e
testl %eax, %eax
je 0x3724f
movq %r13, %rdi
callq 0x42798
leaq 0x88(%r13), %rsi
leaq 0xe0(%rsp), %rdi
callq 0xbd970
movq 0x18(%r13), %rax
movq %rax, 0x98(%rsp)
movl $0x4, %esi
movl $0x1, %edx
leaq 0x8(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x3, %edx
leaq 0xc8(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x4, %edx
leaq 0x118(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0xb0(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x6, %edx
leaq 0xe8(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x98(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x4(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0xe, %r13d
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %r13d
jne 0x37325
leaq 0xe0(%rsp), %rdi
callq 0xbe790
incq %rbp
movslq 0x34(%r12), %rax
cmpq %rax, %rbp
jl 0x371ee
leaq 0x180(%rsp), %r13
movq %r13, %rdi
callq 0xbe790
incq %r15
movq 0x28(%rsp), %rcx
movslq 0x34(%rcx), %rax
cmpq %rax, %r15
jl 0x37158
leaq 0x330(%rsp), %r15
movq %r15, %rdi
callq 0xbe790
movq 0x58(%rsp), %r12
incq %r12
movq 0x20(%rsp), %rdi
movslq 0x2c(%rdi), %rax
cmpq %rax, %r12
jl 0x37085
cmpl $0x0, 0x3c(%rdi)
jle 0x3749e
xorl %r15d, %r15d
movq 0x30(%rdi), %rax
movq (%rax,%r15,8), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x373cf
movl 0x10(%rcx), %ecx
jmp 0x373d4
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x180(%rsp)
movl 0x34(%rax), %eax
movl %eax, 0xe0(%rsp)
movsd 0x58(%rdi), %xmm0
ucomisd 0x114c16(%rip), %xmm0   # 0x14c008
jne 0x373fb
jp 0x373fb
callq 0x3a30e
leaq 0x330(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xbd970
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0xe0(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x6, %edx
leaq 0x338(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x18, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x3745b
leaq 0x330(%rsp), %rdi
callq 0xbe790
incq %r15
movq 0x20(%rsp), %rdi
movslq 0x3c(%rdi), %rax
cmpq %rax, %r15
leaq 0x180(%rsp), %r13
jl 0x373b9
cmpl $0x0, 0x4c(%rdi)
jle 0x37834
xorl %r12d, %r12d
movq 0x40(%rdi), %rax
movq (%rax,%r12,8), %r13
movl 0x24(%r13), %eax
movl %eax, 0x8(%rsp)
movsd 0x28(%r13), %xmm0
ucomisd 0x114b3f(%rip), %xmm0   # 0x14c008
jne 0x374d5
jp 0x374d5
movq %r13, %rdi
callq 0x3cc14
leaq 0x28(%r13), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xd43ee
movsd 0x70(%r13), %xmm0
ucomisd 0x114b7c(%rip), %xmm0   # 0x14c070
jne 0x37506
jp 0x37506
movq %r13, %rdi
callq 0x3cebc
movsd 0x70(%r13), %xmm0
movq %r12, 0x28(%rsp)
movsd %xmm0, 0x40(%rsp)
movl $0x100, %edx            # imm = 0x100
leaq 0x330(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x274b0
movq %r13, %r15
movq 0x78(%r13), %rsi
testq %rsi, %rsi
je 0x37541
movl $0xff, %edx
movq %r12, %rdi
callq 0x27450
movl $0x1, %esi
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x8(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x3, %edx
leaq 0xc8(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x40(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x16, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x375a3
cmpl $0x0, 0x24(%r15)
jle 0x3781a
movq %r15, %rcx
xorl %r13d, %r13d
movq 0x18(%rcx), %rax
movq (%rax,%r13,8), %r12
movq 0x8(%r12), %rax
testq %rax, %rax
leaq 0x180(%rsp), %rbp
je 0x375ec
movl 0x10(%rax), %eax
jmp 0x375f1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x4(%rsp)
movq %r12, %rdi
callq 0x3d2ba
movl %eax, 0x60(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3d2fe
leaq 0xb0(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0xd43ee
movq %rbp, %rdi
callq 0x450ee
movq %r12, %rdi
callq 0x3d2ba
decl %eax
movq %rbp, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x3d2fe
leaq 0x98(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0xd43ee
movq %rbp, %rdi
callq 0x450ee
movq %rbp, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3d2fe
leaq 0xe0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0xc1866
movq %rbp, %rdi
callq 0x450ee
movq %r12, %rdi
callq 0x3d2ba
decl %eax
movq %rbp, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x3d2fe
leaq 0x118(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0xc1866
movq %rbp, %rdi
callq 0x450ee
movq %r12, %rdi
xorl %esi, %esi
callq 0x3d3f8
movsd %xmm0, 0x38(%rsp)
movq %r12, %rdi
callq 0x3d2ba
decl %eax
movq %r12, %rdi
movl %eax, %esi
callq 0x3d3f8
movsd %xmm0, 0x30(%rsp)
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
xorl %esi, %esi
callq 0x274b0
movq 0xb8(%r12), %rsi
testq %rsi, %rsi
je 0x37710
movl $0xff, %edx
movq %rbp, %rdi
callq 0x27450
movl $0x1, %esi
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x4(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
leaq 0x60(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x3, %edx
leaq 0xb0(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x3, %edx
leaq 0x98(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x4, %edx
leaq 0xe0(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x4, %edx
leaq 0x118(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x38(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x8, %esi
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %rbx, %rcx
callq 0x28320
movl $0xe, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x28320
decl %ebp
jne 0x377ee
incq %r13
movq %r15, %rcx
movslq 0x24(%r15), %rax
cmpq %rax, %r13
jl 0x375cd
movq 0x28(%rsp), %r12
incq %r12
movq 0x20(%rsp), %rdi
movslq 0x4c(%rdi), %rax
cmpq %rax, %r12
jl 0x374ab
leaq 0x138(%rsp), %rdi
callq 0xbe790
movq 0x90(%rsp), %rdx
incq %rdx
movq 0x18(%rsp), %rcx
movslq 0x24(%rcx), %rax
cmpq %rax, %rdx
jl 0x36f3e
leaq 0x288(%rsp), %rdi
callq 0xbe790
movq 0x88(%rsp), %rdx
incq %rdx
movq 0x48(%rsp), %rcx
movslq 0x14(%rcx), %rax
cmpq %rax, %rdx
movq %rdx, %rax
movsd 0x11477b(%rip), %xmm1   # 0x14c008
leaq 0x5b0(%rsp), %r15
jl 0x36a04
movq %rbx, %rdi
callq 0xfab43
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xfab32
leaq 0x170(%rsp), %rdi
movl $0x1, %esi
movl $0x10, %edx
movq %rbx, %rcx
callq 0x28320
movq %rsp, %r15
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x28320
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x28320
leaq 0x80(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x28320
leaq 0x7c(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x28320
leaq 0x78(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x28320
leaq 0x74(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x28320
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xfab32
leaq 0x2c0(%rsp), %rdi
callq 0xbe790
movl $0x1, %ebx
jmp 0x37989
xorl %ebx, %ebx
leaq 0x1152e1(%rip), %rdi    # 0x14cc63
xorl %eax, %eax
callq 0xfb6f2
leaq 0x2f8(%rsp), %rdi
callq 0xbe790
movl %ebx, %eax
addq $0x6b8, %rsp            # imm = 0x6B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x379bd
jmp 0x37a4d
jmp 0x379bd
jmp 0x37a4d
jmp 0x37a4d
movq %rax, %rbx
jmp 0x37a3e
jmp 0x379c6
jmp 0x379c6
movq %rax, %rbx
jmp 0x37a31
jmp 0x379fc
jmp 0x379fc
jmp 0x379fc
jmp 0x379fc
jmp 0x379d9
jmp 0x379d9
jmp 0x379d9
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0x450ee
jmp 0x37a24
jmp 0x379fc
jmp 0x379fc
jmp 0x379fc
jmp 0x379fc
movq %rax, %rbx
jmp 0x37a17
jmp 0x379fc
jmp 0x379fc
movq %rax, %rbx
jmp 0x37a24
jmp 0x37a4d
jmp 0x37a07
jmp 0x37a07
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0xbe790
leaq 0x330(%rsp), %rdi
callq 0xbe790
leaq 0x138(%rsp), %rdi
callq 0xbe790
leaq 0x288(%rsp), %rdi
callq 0xbe790
leaq 0x2c0(%rsp), %rdi
callq 0xbe790
jmp 0x37a50
movq %rax, %rbx
leaq 0x2f8(%rsp), %rdi
callq 0xbe790
movq %rbx, %rdi
callq 0x28150
nop