// File: /workspace/github_cpp_makefile_star2_O2/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 $0x6c8, %rsp            # imm = 0x6C8
movq %rsi, %rbx
movq %rdi, %r15
andl $0x0, 0xc(%rsp)
callq 0x30e28
leaq 0x308(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0xac9a2
movsd 0x8(%r14), %xmm0
ucomisd 0xf64bc(%rip), %xmm0    # 0x12b028
jne 0x34b7c
jp 0x34b7c
leaq 0xf710c(%rip), %rdi     # 0x12bc83
callq 0x27f50
movups 0xf7116(%rip), %xmm0    # 0x12bc99
leaq 0x180(%rsp), %rdi
movaps %xmm0, (%rdi)
pushq $0x1
popq %rsi
pushq $0x10
popq %rdx
movq %rbx, %rcx
callq 0x28350
cmpq $0x10, %rax
jne 0x34c6d
movq %r15, 0x70(%rsp)
leaq 0x8c(%rsp), %r13
movl $0x1, (%r13)
leaq 0x64(%rsp), %rax
movl $0x2, (%rax)
leaq 0x60(%rsp), %rax
andl $0x0, (%rax)
leaq 0x90(%rsp), %rbp
andq $0x0, (%rbp)
leaq 0xc(%rsp), %r14
pushq $0x4
popq %r15
pushq $0x1
popq %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x28350
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x8
popq %rsi
movq %rbp, %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x28350
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x64(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x35
popq %rbp
subl $0x1, %ebp
jb 0x34c9e
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x34c55
xorl %ebx, %ebx
leaq 0xf6fed(%rip), %rdi     # 0x12bc63
xorl %eax, %eax
callq 0xe434a
leaq 0x308(%rsp), %rdi
callq 0xad65a
movl %ebx, %eax
addq $0x6c8, %rsp            # imm = 0x6C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
movq 0x70(%rsp), %r14
movslq 0x14(%r14), %rax
cmpq %rax, %rcx
jge 0x34d74
movq 0x8(%r14), %rax
movq %rcx, 0x30(%rsp)
movq (%rax,%rcx,8), %rcx
xorl %edx, %edx
movq %rcx, 0x10(%rsp)
movslq 0x24(%rcx), %rax
cmpq %rax, %rdx
jge 0x34d67
movq 0x18(%rcx), %rax
movq %rdx, 0x38(%rsp)
movq (%rax,%rdx,8), %rcx
xorl %r15d, %r15d
movq %rcx, 0x40(%rsp)
movslq 0x2c(%rcx), %rax
cmpq %rax, %r15
jge 0x34d50
movq 0x20(%rcx), %rax
movq (%rax,%r15,8), %r12
xorl %r13d, %r13d
movslq 0x34(%r12), %rax
cmpq %rax, %r13
jge 0x34d46
movq 0x28(%r12), %rax
movq (%rax,%r13,8), %r14
movq %r14, %rdi
callq 0x3d614
xorl %ebp, %ebp
movslq 0x34(%r14), %rax
cmpq %rax, %rbp
jge 0x34d39
movq 0x28(%r14), %rax
movq (%rax,%rbp,8), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3f91e
incq %rbp
jmp 0x34d19
movq %r14, %rdi
callq 0x3d6e4
incq %r13
jmp 0x34cfc
incq %r15
movq 0x40(%rsp), %rcx
jmp 0x34ce8
movq 0x38(%rsp), %rdx
incq %rdx
movq 0x70(%rsp), %r14
movq 0x10(%rsp), %rcx
jmp 0x34cc6
movq 0x30(%rsp), %rcx
incq %rcx
jmp 0x34ca5
movq %rbx, %rdi
callq 0xe3997
movq %rax, 0x90(%rsp)
movl 0x14(%r14), %eax
movl %eax, 0x88(%rsp)
movq %r14, %rdi
callq 0x30e28
leaq 0x2d0(%rsp), %rdi
movq %rax, %rsi
callq 0xac9a2
leaq 0x70(%r14), %rsi
leaq 0x648(%rsp), %rdi
callq 0xb1438
leaq 0x88(%rsp), %rdi
pushq $0x4
popq %r14
pushq $0x1
popq %r15
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x2d8(%rsp), %rdi
pushq $0x8
popq %r12
pushq $0x6
popq %rdx
movq %r12, %rsi
movq %rbx, %rcx
callq 0x28350
leaq 0x648(%rsp), %rdi
pushq $0x10
popq %rdx
movq %r12, %rsi
movq %rbx, %rcx
callq 0x28350
pushq $0x59
popq %rbp
leaq 0xc(%rsp), %r12
subl $0x1, %ebp
jb 0x34e26
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x34e0e
xorl %edx, %edx
leaq 0x540(%rsp), %rbp
pushq $0x1
popq %r15
pushq $0x4
popq %r13
movq 0x70(%rsp), %rcx
movslq 0x14(%rcx), %rax
cmpq %rax, %rdx
jge 0x35ae7
movq 0x8(%rcx), %rax
movq %rdx, 0x98(%rsp)
movq (%rax,%rdx,8), %rdi
movl 0x34(%rdi), %eax
movl %eax, 0x84(%rsp)
movl 0x44(%rdi), %eax
movl %eax, 0x80(%rsp)
movl 0x24(%rdi), %eax
movl %eax, 0x7c(%rsp)
movq %rdi, 0x68(%rsp)
callq 0x35d9c
leaq 0x298(%rsp), %rdi
movq %rax, %rsi
callq 0xac9a2
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
xorl %esi, %esi
callq 0x274b0
movq 0x68(%rsp), %rax
movq 0x48(%rax), %rsi
testq %rsi, %rsi
je 0x34eb9
movl $0xff, %edx
movq %rbp, %rdi
callq 0x27460
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq 0x28350
leaq 0x84(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x7c(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x2a0(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x17
popq %rbp
subl $0x1, %ebp
jb 0x34f3e
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x34f24
xorl %r14d, %r14d
movq 0x68(%rsp), %rcx
movslq 0x34(%rcx), %rax
cmpq %rax, %r14
jge 0x35199
movq 0x28(%rcx), %rax
movq (%rax,%r14,8), %rbp
movl 0x24(%rbp), %eax
movl %eax, 0x48(%rsp)
movl 0x28(%rbp), %eax
movl %eax, 0x2c(%rsp)
movsd 0x38(%rbp), %xmm0
movsd %xmm0, 0x340(%rsp)
movsd 0x40(%rbp), %xmm0
movsd %xmm0, 0x190(%rsp)
movsd 0x48(%rbp), %xmm0
movsd %xmm0, 0x148(%rsp)
movsd 0x50(%rbp), %xmm0
movsd %xmm0, 0xf0(%rsp)
movsd 0x58(%rbp), %xmm0
movsd %xmm0, 0x128(%rsp)
movsd 0x60(%rbp), %xmm0
movsd %xmm0, 0xd8(%rsp)
movsd 0x68(%rbp), %xmm0
movsd %xmm0, 0xc0(%rsp)
movsd 0x70(%rbp), %xmm0
movsd %xmm0, 0xa8(%rsp)
movsd 0x78(%rbp), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x80(%rbp), %xmm0
movsd %xmm0, 0x50(%rsp)
movq %rbp, %rdi
callq 0x35dd4
leaq 0x440(%rsp), %rdi
movq %rax, %rsi
callq 0xac9a2
movl 0x2c(%rbp), %eax
testl %eax, %eax
movl $0x790, %ecx            # imm = 0x790
cmovsl %ecx, %eax
movl %eax, 0x28(%rsp)
movl 0x30(%rbp), %eax
testl %eax, %eax
movl $0xa20, %ecx            # imm = 0xA20
cmovsl %ecx, %eax
movl %eax, 0x24(%rsp)
leaq 0x48(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x2c(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x340(%rsp), %rdi
pushq $0x8
popq %rbp
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x190(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x148(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xf0(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x128(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xd8(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xc0(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xa8(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x58(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x50(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x448(%rsp), %rdi
movq %rbp, %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x24(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0xd
popq %rbp
subl $0x1, %ebp
jb 0x35184
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x3516a
leaq 0x440(%rsp), %rdi
callq 0xad65a
incq %r14
jmp 0x34f41
xorl %r14d, %r14d
movslq 0x44(%rcx), %rax
cmpq %rax, %r14
leaq 0x540(%rsp), %rbp
jge 0x3529b
movq 0x38(%rcx), %rax
movq (%rax,%r14,8), %rdi
movl 0x28(%rdi), %eax
movl %eax, 0x340(%rsp)
movl 0x2c(%rdi), %eax
movl %eax, 0x190(%rsp)
movl 0x30(%rdi), %eax
movl %eax, 0x148(%rsp)
movl 0x24(%rdi), %eax
movl %eax, 0xf0(%rsp)
callq 0x35e00
leaq 0x440(%rsp), %rdi
movq %rax, %rsi
callq 0xac9a2
leaq 0x340(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xf0(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x448(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x190(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x148(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x16
popq %rbp
subl $0x1, %ebp
jb 0x35281
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x35267
leaq 0x440(%rsp), %rdi
callq 0xad65a
incq %r14
movq 0x68(%rsp), %rcx
jmp 0x3519c
xorl %edx, %edx
movslq 0x24(%rcx), %rax
cmpq %rax, %rdx
jge 0x35aca
movq 0x18(%rcx), %rax
movq %rdx, 0xa0(%rsp)
movq (%rax,%rdx,8), %rdi
movl 0x2c(%rdi), %eax
movl %eax, 0x2c(%rsp)
movl 0x3c(%rdi), %eax
movl %eax, 0x28(%rsp)
movl 0x4c(%rdi), %eax
movl %eax, 0x24(%rsp)
movq %rdi, 0x10(%rsp)
callq 0x35e26
leaq 0x148(%rsp), %rdi
movq %rax, %rsi
callq 0xac9a2
movl $0x100, %edx            # imm = 0x100
leaq 0x440(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x274b0
movq 0x10(%rsp), %rax
movq 0x88(%rax), %rsi
testq %rsi, %rsi
je 0x3531e
movl $0xff, %edx
movq %r14, %rdi
callq 0x27460
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq 0x28350
leaq 0x2c(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x24(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x150(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x17
popq %rbp
subl $0x1, %ebp
jb 0x3539d
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x35383
xorl %edx, %edx
leaq 0x540(%rsp), %rbp
movq 0x10(%rsp), %rcx
movslq 0x2c(%rcx), %rax
cmpq %rax, %rdx
jge 0x3566c
movq 0x20(%rcx), %rax
movq %rdx, 0x30(%rsp)
movq (%rax,%rdx,8), %rdx
movq 0x18(%rdx), %rcx
pushq $-0x1
popq %rax
testq %rcx, %rcx
je 0x353d5
movl 0x10(%rcx), %eax
movl %eax, 0x58(%rsp)
movq %rdx, 0x38(%rsp)
movl 0x34(%rdx), %eax
movl %eax, 0x50(%rsp)
movq 0x10(%rsp), %rdi
callq 0x35e26
leaq 0x340(%rsp), %rdi
movq %rax, %rsi
callq 0xac9a2
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x348(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x18
popq %rbp
subl $0x1, %ebp
jb 0x35458
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x3543e
xorl %edx, %edx
movq 0x38(%rsp), %rcx
movslq 0x34(%rcx), %rax
cmpq %rax, %rdx
leaq 0x540(%rsp), %rbp
jge 0x35652
movq 0x28(%rcx), %rax
movq %rdx, 0x40(%rsp)
movq (%rax,%rdx,8), %r14
movl 0x34(%r14), %eax
movl %eax, 0x48(%rsp)
movq %r14, %rdi
callq 0x35e4c
leaq 0x190(%rsp), %rdi
movq %rax, %rsi
callq 0xac9a2
leaq 0x48(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x198(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x18
popq %rbp
subl $0x1, %ebp
jb 0x354e7
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x354cd
xorl %ebp, %ebp
movslq 0x34(%r14), %rax
cmpq %rax, %rbp
jge 0x35638
movq %r14, %r12
movq 0x28(%r14), %rax
movq (%rax,%rbp,8), %r14
movl 0x30(%r14), %eax
movl %eax, 0x20(%rsp)
leaq 0x40(%r14), %rsi
leaq 0xd8(%rsp), %rdi
callq 0xc0e0c
leaq 0x58(%r14), %rsi
leaq 0x128(%rsp), %rdi
callq 0xb05c0
movsd 0x78(%r14), %xmm0
movsd %xmm0, 0xc0(%rsp)
movl 0x80(%r14), %eax
movl %eax, 0x1c(%rsp)
movq %r14, %rdi
callq 0x35e72
leaq 0xf0(%rsp), %rdi
movq %rax, %rsi
callq 0xac9a2
movq 0x18(%r14), %rax
movq %rax, 0xa8(%rsp)
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xd8(%rsp), %rdi
pushq $0x8
popq %r14
movq %r14, %rsi
pushq $0x3
popq %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x128(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xa8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x1c(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0xe
popq %r14
subl $0x1, %r14d
jb 0x35620
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x35605
leaq 0xf0(%rsp), %rdi
callq 0xad65a
incq %rbp
movq %r12, %r14
jmp 0x354e9
leaq 0x190(%rsp), %rdi
callq 0xad65a
movq 0x40(%rsp), %rdx
incq %rdx
jmp 0x3545a
leaq 0x340(%rsp), %rdi
callq 0xad65a
movq 0x30(%rsp), %rdx
incq %rdx
jmp 0x353a7
xorl %r14d, %r14d
movslq 0x3c(%rcx), %rax
cmpq %rax, %r14
jge 0x35742
movq 0x30(%rcx), %rax
movq (%rax,%r14,8), %rax
movq 0x18(%rax), %rdx
pushq $-0x1
popq %rcx
testq %rdx, %rdx
je 0x35693
movl 0x10(%rdx), %ecx
movl %ecx, 0x190(%rsp)
movl 0x34(%rax), %eax
movl %eax, 0xf0(%rsp)
movq 0x10(%rsp), %rdi
callq 0x35e26
leaq 0x340(%rsp), %rdi
leaq 0x190(%rsp), %rbp
movq %rax, %rsi
callq 0xac9a2
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xf0(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x348(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x6
popq %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x18
popq %rbp
subl $0x1, %ebp
jb 0x35720
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x35706
leaq 0x340(%rsp), %rdi
callq 0xad65a
incq %r14
leaq 0x540(%rsp), %rbp
movq 0x10(%rsp), %rcx
jmp 0x3566f
xorl %edx, %edx
movslq 0x4c(%rcx), %rax
cmpq %rax, %rdx
jge 0x35aa8
movq 0x40(%rcx), %rax
movq %rdx, 0x30(%rsp)
movq (%rax,%rdx,8), %rbp
movl 0x24(%rbp), %eax
movl %eax, 0x20(%rsp)
movq %rbp, %rdi
callq 0x35e94
leaq 0xd8(%rsp), %rdi
movq %rax, %rsi
callq 0xc0e0c
movq %rbp, %rdi
callq 0x35eb4
leaq 0x340(%rsp), %r14
movsd %xmm0, 0x58(%rsp)
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x274b0
movq %rbp, 0x38(%rsp)
movq 0x78(%rbp), %rsi
testq %rsi, %rsi
je 0x357bd
movl $0xff, %edx
movq %r14, %rdi
callq 0x27460
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq 0x28350
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xd8(%rsp), %rdi
pushq $0x8
popq %r14
movq %r14, %rsi
pushq $0x3
popq %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0x16
popq %rbp
subl $0x1, %ebp
jb 0x3582d
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x35813
xorl %r14d, %r14d
movq 0x38(%rsp), %rcx
movslq 0x24(%rcx), %rax
cmpq %rax, %r14
jge 0x35a8e
movq 0x18(%rcx), %rax
movq (%rax,%r14,8), %rbp
movq 0x8(%rbp), %rcx
pushq $-0x1
popq %rax
testq %rcx, %rcx
je 0x35859
movl 0x10(%rcx), %eax
movl %eax, 0x1c(%rsp)
movq %rbp, %rdi
callq 0x3ac8e
movl %eax, 0x78(%rsp)
leaq 0x190(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3acd2
leaq 0xc0(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0xc0e0c
movq %r14, 0x40(%rsp)
leaq 0x190(%rsp), %r14
movq %r14, %rdi
callq 0x41e6a
movq %rbp, %rdi
callq 0x3ac8e
decl %eax
movq %r14, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x3acd2
leaq 0xa8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0xc0e0c
leaq 0x190(%rsp), %r14
movq %r14, %rdi
callq 0x41e6a
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3acd2
leaq 0xf0(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0xb05c0
leaq 0x190(%rsp), %r14
movq %r14, %rdi
callq 0x41e6a
movq %rbp, %rdi
callq 0x3ac8e
decl %eax
movq %r14, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x3acd2
leaq 0x128(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0xb05c0
leaq 0x190(%rsp), %rdi
callq 0x41e6a
movq %rbp, %rdi
xorl %esi, %esi
callq 0x3adba
movsd %xmm0, 0x50(%rsp)
movq %rbp, %rdi
callq 0x3ac8e
decl %eax
movq %rbp, %rdi
movl %eax, %esi
callq 0x3adba
movsd %xmm0, 0x48(%rsp)
movl $0x100, %edx            # imm = 0x100
leaq 0x190(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x274b0
movq 0xb8(%rbp), %rsi
testq %rsi, %rsi
je 0x359a6
movl $0xff, %edx
movq %r14, %rdi
callq 0x27460
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq 0x28350
leaq 0x1c(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x78(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xc0(%rsp), %rdi
pushq $0x8
popq %rbp
movq %rbp, %rsi
pushq $0x3
popq %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xa8(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0xf0(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x128(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x50(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x48(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
pushq $0xe
popq %rbp
movq 0x40(%rsp), %r14
subl $0x1, %ebp
jb 0x35a86
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
jmp 0x35a6c
incq %r14
jmp 0x35830
movq 0x30(%rsp), %rdx
incq %rdx
leaq 0x540(%rsp), %rbp
movq 0x10(%rsp), %rcx
jmp 0x35744
leaq 0x148(%rsp), %rdi
callq 0xad65a
movq 0xa0(%rsp), %rdx
incq %rdx
movq 0x68(%rsp), %rcx
jmp 0x3529d
leaq 0x298(%rsp), %rdi
callq 0xad65a
movq 0x98(%rsp), %rdx
incq %rdx
jmp 0x34e38
movq %rbx, %rdi
callq 0xe3997
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xe3986
leaq 0x180(%rsp), %rdi
pushq $0x1
popq %r15
pushq $0x10
popq %rdx
movq %r15, %rsi
movq %rbx, %rcx
callq 0x28350
leaq 0xc(%rsp), %r13
pushq $0x4
popq %r12
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x90(%rsp), %rdi
pushq $0x8
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x8c(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x64(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x28350
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xe3986
leaq 0x2d0(%rsp), %rdi
callq 0xad65a
pushq $0x1
popq %rbx
jmp 0x34c7d
jmp 0x35bc5
jmp 0x35bc5
jmp 0x35c5a
jmp 0x35c5a
movq %rax, %rbx
jmp 0x35c49
jmp 0x35c5a
jmp 0x35bd3
jmp 0x35bd3
movq %rax, %rbx
jmp 0x35c3c
jmp 0x35c04
jmp 0x35c04
jmp 0x35c04
jmp 0x35c04
jmp 0x35c04
jmp 0x35c04
jmp 0x35bee
jmp 0x35c04
jmp 0x35c04
jmp 0x35bee
jmp 0x35bee
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x41e6a
jmp 0x35c2f
jmp 0x35c04
jmp 0x35c04
movq %rax, %rbx
jmp 0x35c2f
movq %rax, %rbx
jmp 0x35c22
jmp 0x35c12
jmp 0x35c12
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0xad65a
leaq 0x340(%rsp), %rdi
callq 0xad65a
leaq 0x148(%rsp), %rdi
callq 0xad65a
leaq 0x298(%rsp), %rdi
callq 0xad65a
leaq 0x2d0(%rsp), %rdi
callq 0xad65a
jmp 0x35c5d
jmp 0x35c5a
movq %rax, %rbx
leaq 0x308(%rsp), %rdi
callq 0xad65a
movq %rbx, %rdi
callq 0x28170