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

  // Read magic keyword
  char magic[16] = { '\0' };
  if (fread(magic, sizeof(char), 16, fp) != (unsigned int) 16) {
    RNFail("Unable to read first bytes from GSV scene file\n");
    fclose(fp);
    return 0;
  }

  // Check magic keyword
  if (strcmp(magic, "GSV")) {
    RNFail("Invalid file format for GSV scene file\n");
    fclose(fp);
    return 0;
  }

  // Read header
  int endian_test;
  int major_version;
  int minor_version;
  unsigned long long scene_file_offset = 0;
  fread(&dummy, sizeof(int), 1, fp);
  fread(&dummy, sizeof(int), 1, fp);
  fread(&scene_file_offset, sizeof(unsigned long long), 1, fp);
  fread(&endian_test, sizeof(int), 1, fp);
  fread(&major_version, sizeof(int), 1, fp);
  fread(&minor_version, sizeof(int), 1, fp);
  if ((major_version != 0) || (minor_version != 1)) {
    for (int j = 0; j < 53; j++) {
      fread(&dummy, sizeof(int), 1, fp);
    }
  }

  // Seek to beginning of scene stuff
  assert(((major_version != 0) || (minor_version != 1)) || (scene_file_offset == 0));
  assert(((major_version == 0) && (minor_version == 1)) || (scene_file_offset > 0));
  unsigned long long point_file_offset = RNFileTell(fp);
  if (scene_file_offset > 0) {
    if (!RNFileSeek(fp, scene_file_offset, RN_FILE_SEEK_SET)) {
      RNFail("Unable to seek to scene file offset\n");
      fclose(fp);
      return 0;
    }
  }

  // Read scene stuff
  int scene_nruns;
  R3Box scene_bbox;
  fread(&scene_nruns, sizeof(int), 1, fp);
  fread(&(scene_bbox[0][0]), sizeof(RNCoord), 6, fp);
  for (int j = 0; j < 121; j++) {
    fread(&dummy, sizeof(int), 1, fp);
  }
  
  // Read runs
  for (int ir = 0; ir < scene_nruns; ir++) {
    // Create run
    GSVRun *run = new GSVRun();

    // Read run stuff
    int run_ncameras;
    int run_nlasers;
    int run_nsegments;
    R3Box run_bbox;
    char run_name[256];
    fread(run_name, sizeof(char), 256, fp);
    fread(&run_ncameras, sizeof(int), 1, fp);
    fread(&run_nlasers, sizeof(int), 1, fp);
    fread(&run_nsegments, sizeof(int), 1, fp);
    fread(&(run_bbox[0][0]), sizeof(RNCoord), 6, fp);
    for (int j = 0; j < 23; j++) {
      fread(&dummy, sizeof(int), 1, fp);
    }

    // Read cameras
    for (int ic = 0; ic < run_ncameras; ic++) {
      GSVCamera *camera = new GSVCamera();

      // Read camera stuff
      int camera_ntapestries;
      int camera_distortion_type;
      RNLength camera_focal_x;
      RNLength camera_focal_y;
      RNCoord camera_center_x;
      RNCoord camera_center_y;
      RNScalar camera_k1;
      RNScalar camera_k2;
      RNScalar camera_k3;
      RNScalar camera_p1;
      RNScalar camera_p2;
      RNAngle camera_fov_max;
      R3Box camera_bbox;
      fread(&camera_ntapestries, sizeof(int), 1, fp);
      fread(&camera_distortion_type, sizeof(int), 1, fp);
      fread(&camera_focal_x, sizeof(RNLength), 1, fp);
      fread(&camera_focal_y, sizeof(RNLength), 1, fp);
      fread(&camera_center_x, sizeof(RNCoord), 1, fp);
      fread(&camera_center_y, sizeof(RNCoord), 1, fp);
      fread(&camera_k1, sizeof(RNScalar), 1, fp);
      fread(&camera_k2, sizeof(RNScalar), 1, fp);
      fread(&camera_k3, sizeof(RNScalar), 1, fp);
      fread(&camera_p1, sizeof(RNScalar), 1, fp);
      fread(&camera_p2, sizeof(RNScalar), 1, fp);
      fread(&camera_fov_max, sizeof(RNAngle), 1, fp);
      fread(&(camera_bbox[0][0]), sizeof(RNCoord), 6, fp);
      for (int j = 0; j < 15; j++) {
        fread(&dummy, sizeof(int), 1, fp);
      }

      // Set camera stuff
      camera->SetDistortionType(camera_distortion_type);
      camera->SetXFocal(camera_focal_x);
      camera->SetYFocal(camera_focal_y);
      camera->SetXCenter(camera_center_x);
      camera->SetYCenter(camera_center_y);
      camera->SetK1(camera_k1);
      camera->SetK2(camera_k2);
      camera->SetK3(camera_k3);
      camera->SetP1(camera_p1);
      camera->SetP2(camera_p2);
      camera->SetMaxFov(camera_fov_max);
      camera->SetBBox(camera_bbox);
      run->InsertCamera(camera);
    }

    // Read lasers
    for (int il = 0; il < run_nlasers; il++) {
      GSVLaser *laser = new GSVLaser();

      // Read laser stuff
      int laser_nscans;
      R3Box laser_bbox;
      fread(&laser_nscans, sizeof(int), 1, fp);
      fread(&(laser_bbox[0][0]), sizeof(RNCoord), 6, fp);
      for (int j = 0; j < 25; j++) {
        fread(&dummy, sizeof(int), 1, fp);
      }

      // Set laser stuff
      laser->SetBBox(laser_bbox);
      run->InsertLaser(laser);
    }

    // Read segments
    for (int is = 0; is < run_nsegments; is++) {
      GSVSegment *segment = new GSVSegment();

      // Read segment stuff
      int segment_nscans;
      int segment_ntapestries;
      int segment_npanoramas;
      R3Box segment_bbox;
      fread(&segment_nscans, sizeof(int), 1, fp);
      fread(&segment_ntapestries, sizeof(int), 1, fp);
      fread(&segment_npanoramas, sizeof(int), 1, fp);
      fread(&(segment_bbox[0][0]), sizeof(RNCoord), 6, fp);
      for (int j = 0; j < 23; j++) {
        fread(&dummy, sizeof(int), 1, fp);
      }

      // Read scans
      for (int ia = 0; ia < segment_nscans; ia++) {
        GSVScan *scan = new GSVScan();

        // Read scan stuff
        int scan_laser_index;
        int scan_nscanlines;
        R3Box scan_bbox;
        fread(&scan_laser_index, sizeof(int), 1, fp);
        fread(&scan_nscanlines, sizeof(int), 1, fp);
        fread(&(scan_bbox[0][0]), sizeof(RNCoord), 6, fp);
        for (int j = 0; j < 24; j++) {
          fread(&dummy, sizeof(int), 1, fp);
        }

        // Read scanlines
        for (int ie = 0; ie < scan_nscanlines; ie++) {
          GSVScanline *scanline = new GSVScanline();

          // Read scanline stuff
          int scanline_npoints;
          R3Point scanline_viewpoint;
          R3Quaternion scanline_orientation;
          RNScalar scanline_timestamp;
          R3Box scanline_bbox;
          unsigned long long scanline_file_offset;
          fread(&(scanline_npoints), sizeof(int), 1, fp);
          fread(&(scanline_viewpoint[0]), sizeof(RNCoord), 3, fp);
          fread(&(scanline_orientation[0]), sizeof(RNCoord), 4, fp);
          fread(&scanline_timestamp, sizeof(RNScalar), 1, fp);
          fread(&(scanline_bbox[0][0]), sizeof(RNCoord), 6, fp);
          fread(&(scanline_file_offset), sizeof(unsigned long long), 1, fp);
          for (int j = 0; j < 15; j++) {
            fread(&dummy, sizeof(int), 1, fp);
          }

          // Read points
          if ((major_version == 0) && (minor_version == 1)) {
            ReadScanlinePointsFromOldVersion(fp, scanline);
          }

          // Set scanline stuff
          GSVPose scanline_pose(scanline_viewpoint, scanline_orientation);
          scanline->SetPose(scanline_pose);
          scanline->SetTimestamp(scanline_timestamp);
          scanline->SetBBox(scanline_bbox);
          scanline->SetNPoints(scanline_npoints);
          scanline->SetFileOffset(scanline_file_offset);
          scan->InsertScanline(scanline);
        }

        // Set scan stuff
        scan->SetBBox(scan_bbox);

        // Create survey
        GSVSurvey *survey = new GSVSurvey();
        survey->InsertScan(scan);
        segment->InsertSurvey(survey);
        
        // Insert survey into laser
        if (scan_laser_index >= 0) {
          GSVLaser *scan_laser = run->Laser(scan_laser_index);
          scan_laser->InsertSurvey(survey);
        }
      }

      // Read tapestries
      for (int it = 0; it < segment_ntapestries; it++) {
        GSVTapestry *tapestry = new GSVTapestry();

        // Read tapestry stuff
        int tapestry_camera_index;
        int tapestry_nimages;
        R3Box tapestry_bbox;
        fread(&tapestry_camera_index, sizeof(int), 1, fp);
        fread(&tapestry_nimages, sizeof(int), 1, fp);
        fread(&(tapestry_bbox[0][0]), sizeof(RNCoord), 6, fp);
        for (int j = 0; j < 24; j++) {
          fread(&dummy, sizeof(int), 1, fp);
        }

        // Set tapestry stuff
        tapestry->SetBBox(tapestry_bbox);
        segment->InsertTapestry(tapestry);
        if (tapestry_camera_index >= 0) {
          GSVCamera *camera = run->Camera(tapestry_camera_index);
          camera->InsertTapestry(tapestry);
        }
      }

      // Read panoramas
      for (int ip = 0; ip < segment_npanoramas; ip++) {
        GSVPanorama *panorama = new GSVPanorama();

        // Read panorama stuff
        int panorama_nimages;
        R3Point panorama_viewpoint;
        RNScalar panorama_timestamp;
        fread(&panorama_nimages, sizeof(int), 1, fp);
        fread(&(panorama_viewpoint[0]), sizeof(RNCoord), 3, fp);
        fread(&panorama_timestamp, sizeof(RNScalar), 1, fp);
        for (int j = 0; j < 22; j++) {
          fread(&dummy, sizeof(int), 1, fp);
        }

        // Read images
        for (int ii = 0; ii < panorama_nimages; ii++) {
          GSVImage *image = new GSVImage();

          // Read image stuff
          int image_tapestry_index, image_ncolumns;
          R3Point image_viewpoint0, image_viewpoint1;
          R3Quaternion image_orientation0, image_orientation1;
          RNScalar image_timestamp0, image_timestamp1;
          fread(&image_tapestry_index, sizeof(int), 1, fp);
          fread(&image_ncolumns, sizeof(int), 1, fp);
          fread(&(image_viewpoint0[0]), sizeof(RNCoord), 3, fp);
          fread(&(image_viewpoint1[0]), sizeof(RNCoord), 3, fp);
          fread(&(image_orientation0[0]), sizeof(RNCoord), 4, fp);
          fread(&(image_orientation1[0]), sizeof(RNCoord), 4, fp);
          fread(&image_timestamp0, sizeof(RNScalar), 1, fp);
          fread(&image_timestamp1, sizeof(RNScalar), 1, fp);
          for (int j = 0; j < 14; j++) {
            fread(&dummy, sizeof(int), 1, fp);
          }

          // Set image stuff
          GSVPose image_pose0(image_viewpoint0, image_orientation0);
          GSVPose image_pose1(image_viewpoint1, image_orientation1);
          image->SetPose(image_pose0, image_pose1);
          image->SetTimestamp(image_timestamp0, image_timestamp1);
          panorama->InsertImage(image);

          // Insert image into tapestry
          if (image_tapestry_index >= 0) {
            GSVTapestry *tapestry = segment->Tapestry(image_tapestry_index);
            tapestry->InsertImage(image);
          }
        }

        // Set panorama stuff
        panorama->SetViewpoint(panorama_viewpoint);
        panorama->SetTimestamp(panorama_timestamp);
        segment->InsertPanorama(panorama);
      }

      // Set segment stuff
      segment->SetBBox(segment_bbox);
      run->InsertSegment(segment);
    }

    // Set run stuff
    run->SetName(run_name);
    run->SetBBox(run_bbox);
    InsertRun(run);
  }

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

  // Read points
  if (read_points) {
    if ((major_version == 0) && (minor_version == 2)) {
      if (!RNFileSeek(fp, point_file_offset, RN_FILE_SEEK_SET)) {
        RNFail("Unable to seek to point file offset\n");
        fclose(fp);
        return 0;
      }
      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 ia = 0; ia < segment->NScans(); ia++) {
            GSVScan *scan = segment->Scan(ia);
            for (int ie = 0; ie < scan->NScanlines(); ie++) {
              GSVScanline *scanline = scan->Scanline(ie);
              ReadScanlinePointsFromOldVersion(fp, scanline);
            }
          }
        }
      }
    }
  }

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

  // Set scene stuff
  // SetBBox(scene_bbox);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3a8, %rsp            # imm = 0x3A8
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r12
movl $0x0, 0x14(%rsp)
xorps %xmm0, %xmm0
leaq 0x220(%rsp), %rdi
movaps %xmm0, (%rdi)
movl $0x1, %esi
movl $0x10, %edx
movq %rbx, %rcx
callq 0x27ec0
cmpq $0x10, %rax
jne 0x34f03
cmpl $0x565347, 0x220(%rsp) # imm = 0x565347
jne 0x34f0c
movl %ebp, 0x6c(%rsp)
leaq 0x138(%rsp), %r14
movq $0x0, (%r14)
leaq 0x14(%rsp), %r15
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ec0
leaq 0x14c(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x27ec0
leaq 0x148(%rsp), %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ec0
leaq 0x144(%rsp), %r15
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x27ec0
movl (%r14), %eax
movl (%r15), %r15d
movl %r15d, 0x68(%rsp)
xorl $0x1, %r15d
movl %eax, 0x50(%rsp)
orl %r15d, %eax
je 0x3406a
movl $0x35, %ebp
leaq 0x14(%rsp), %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %ebp
jne 0x34051
movq %rbx, %rdi
callq 0xfab43
movq %rax, %r14
movq 0x138(%rsp), %rsi
testq %rsi, %rsi
je 0x34096
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %edx, %edx
callq 0xfab32
testl %eax, %eax
je 0x34f38
movq %r14, 0x120(%rsp)
movq %r12, 0x58(%rsp)
leaq 0x268(%rsp), %rdi
callq 0xbd92c
leaq 0x94(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x27ec0
leaq 0x270(%rsp), %rdi
movl $0x8, %esi
movl $0x6, %edx
movq %rbx, %rcx
callq 0x27ec0
movl $0x79, %ebp
leaq 0x14(%rsp), %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %ebp
jne 0x340ee
movl 0x94(%rsp), %eax
movl %eax, 0x70(%rsp)
testl %eax, %eax
jle 0x34df3
orl 0x50(%rsp), %r15d
movq 0x58(%rsp), %rax
leaq 0x8(%rax), %rax
movq %rax, 0x128(%rsp)
sete 0x60(%rsp)
xorl %r14d, %r14d
leaq 0x14(%rsp), %r13
movq %r14, 0x130(%rsp)
movl $0x90, %edi
callq 0x27930
movq %rax, 0x20(%rsp)
movq %rax, %rdi
xorl %esi, %esi
callq 0x37b7c
leaq 0x230(%rsp), %rdi
callq 0xbd92c
movl $0x1, %esi
movl $0x100, %edx            # imm = 0x100
leaq 0x2a0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x90(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x8c(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x88(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x238(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x17, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %ebp
jne 0x341f2
movl 0x90(%rsp), %eax
movl %eax, 0x8(%rsp)
testl %eax, %eax
leaq 0x98(%rsp), %r15
jle 0x344ab
xorl %r14d, %r14d
movl $0xc8, %edi
callq 0x27930
movq %rax, %r12
movq %rax, %rdi
callq 0x3b7a8
movq %r15, %rdi
callq 0xbd92c
movl $0x4, %esi
movl $0x1, %edx
leaq 0x54(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x34(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x150(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x1e8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x1b0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x190(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x108(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0xf0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0xd8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x48(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x40(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x38(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x6, %edx
leaq 0xa0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0xf, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %ebp
jne 0x3438e
movl 0x34(%rsp), %esi
movq %r12, %rdi
callq 0x3ba16
movsd 0x150(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba22
movsd 0x1e8(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba28
movsd 0x1b0(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba2e
movsd 0x190(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba34
movsd 0x108(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba3a
movsd 0xf0(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba40
movsd 0xd8(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba46
movsd 0x48(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba4c
movsd 0x40(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba52
movsd 0x38(%rsp), %xmm0
movq %r12, %rdi
callq 0x3ba58
leaq 0x90(%r12), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xd4746
movq %r12, %rdi
addq $0xa8, %rdi
leaq 0xb8(%rsp), %rsi
callq 0xd4746
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x37fa4
leaq 0x98(%rsp), %r15
movq %r15, %rdi
callq 0xbe790
incl %r14d
cmpl 0x8(%rsp), %r14d
jne 0x34229
movl 0x8c(%rsp), %ebp
testl %ebp, %ebp
jle 0x34580
xorl %r15d, %r15d
movl $0x78, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x3e9f4
leaq 0x98(%rsp), %rdi
callq 0xbd92c
movl $0x4, %esi
movl $0x1, %edx
leaq 0x150(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x6, %edx
leaq 0xa0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x19, %r12d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %r12d
jne 0x3451b
leaq 0x40(%r14), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xd4746
movq %r14, %rdi
addq $0x58, %rdi
leaq 0xb8(%rsp), %rsi
callq 0xd4746
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x38010
leaq 0x98(%rsp), %rdi
callq 0xbe790
incl %r15d
cmpl %ebp, %r15d
jne 0x344bd
movl 0x88(%rsp), %eax
movl %eax, 0x74(%rsp)
testl %eax, %eax
jle 0x34d76
xorl %ebp, %ebp
movl %ebp, 0x78(%rsp)
movl $0x98, %edi
callq 0x27930
movq %rax, 0x18(%rsp)
movq %rax, %rdi
xorl %esi, %esi
callq 0x39658
leaq 0x1e8(%rsp), %rdi
callq 0xbd92c
movl $0x4, %esi
movl $0x1, %edx
leaq 0x54(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x34(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x84(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x1f0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x17, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %ebp
jne 0x34626
movl 0x54(%rsp), %eax
movl %eax, 0x2c(%rsp)
testl %eax, %eax
jle 0x34936
xorl %ebp, %ebp
movl %ebp, 0x30(%rsp)
movl $0x78, %edi
callq 0x27930
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0x3f594
leaq 0x150(%rsp), %rdi
callq 0xbd92c
movl $0x4, %esi
movl $0x1, %edx
leaq 0x48(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x40(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x158(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x18, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %ebp
jne 0x346c6
movl 0x40(%rsp), %ebp
testl %ebp, %ebp
jle 0x348a1
xorl %r15d, %r15d
movl $0xc8, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
callq 0x409a8
leaq 0x108(%rsp), %rdi
callq 0xd43dc
leaq 0x190(%rsp), %rdi
callq 0xc17c8
leaq 0x1b0(%rsp), %rdi
callq 0xbd92c
movl $0x4, %esi
movl $0x1, %edx
leaq 0x38(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x3, %edx
leaq 0x108(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x4, %edx
leaq 0x190(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0xf0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x1b8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0xd8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0xf, %r12d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %r12d
jne 0x347c9
cmpb $0x0, 0x60(%rsp)
je 0x347f5
movq %rbx, %rsi
movq %r14, %rdx
callq 0x37a66
leaq 0x98(%rsp), %r12
movq %r12, %rdi
leaq 0x108(%rsp), %rsi
leaq 0x190(%rsp), %rdx
callq 0x44fa2
movq %r14, %rdi
movq %r12, %rsi
callq 0x411ec
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x78(%r14)
leaq 0x90(%r14), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0xd4746
movq %r14, %rdi
addq $0xa8, %rdi
leaq 0x1d0(%rsp), %rsi
callq 0xd4746
movl 0x38(%rsp), %eax
movl %eax, 0x30(%r14)
movq 0xd8(%rsp), %rax
movq %rax, 0x18(%r14)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x402ac
leaq 0x98(%rsp), %rdi
callq 0x450ee
leaq 0x1b0(%rsp), %rdi
callq 0xbe790
incl %r15d
cmpl %ebp, %r15d
jne 0x346ee
movq 0x8(%rsp), %r14
leaq 0x40(%r14), %rdi
leaq 0x158(%rsp), %rsi
callq 0xd4746
movq %r14, %rdi
addq $0x58, %rdi
leaq 0x170(%rsp), %rsi
callq 0xd4746
movl $0x80, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
callq 0x3eddc
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x3f1de
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x39f7c
movslq 0x48(%rsp), %rax
testq %rax, %rax
movl 0x30(%rsp), %ebp
js 0x3491d
movq 0x20(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq (%rcx,%rax,8), %rdi
movq %r14, %rsi
callq 0x3eba8
leaq 0x150(%rsp), %rdi
callq 0xbe790
incl %ebp
cmpl 0x2c(%rsp), %ebp
jne 0x34651
movl 0x34(%rsp), %ebp
testl %ebp, %ebp
jle 0x34a42
xorl %r15d, %r15d
movl $0x78, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
callq 0x3e2c8
leaq 0x98(%rsp), %rdi
callq 0xbd92c
movl $0x4, %esi
movl $0x1, %edx
leaq 0x150(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x1b0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x6, %edx
leaq 0xa0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x18, %r12d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %r12d
jne 0x349bb
leaq 0x40(%r14), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xd4746
movq %r14, %rdi
addq $0x58, %rdi
leaq 0xb8(%rsp), %rsi
callq 0xd4746
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x3a07a
movslq 0x150(%rsp), %rax
testq %rax, %rax
js 0x34a29
movq 0x20(%rsp), %rcx
movq 0x28(%rcx), %rcx
movq (%rcx,%rax,8), %rdi
movq %r14, %rsi
callq 0x3b95c
leaq 0x98(%rsp), %rdi
callq 0xbe790
incl %r15d
cmpl %ebp, %r15d
jne 0x34945
movl 0x84(%rsp), %eax
movl %eax, 0x2c(%rsp)
testl %eax, %eax
jle 0x34d22
xorl %ebp, %ebp
movl %ebp, 0x30(%rsp)
movl $0x88, %edi
callq 0x27930
movq %rax, 0x8(%rsp)
movq %rax, %rdi
xorl %esi, %esi
callq 0x3c800
leaq 0x108(%rsp), %r14
movq %r14, %rdi
callq 0xd43dc
movl $0x4, %esi
movl $0x1, %edx
leaq 0x80(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x3, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x48(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x16, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %ebp
jne 0x34acf
movl 0x80(%rsp), %ebp
testl %ebp, %ebp
jle 0x34ce0
xorl %r15d, %r15d
movl $0xc8, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x3cf34
leaq 0xf0(%rsp), %rdi
callq 0xd43dc
leaq 0xd8(%rsp), %rdi
callq 0xd43dc
leaq 0x1b0(%rsp), %rdi
callq 0xc17c8
leaq 0x190(%rsp), %r12
movq %r12, %rdi
callq 0xc17c8
movl $0x4, %esi
movl $0x1, %edx
leaq 0x7c(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x140(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x3, %edx
leaq 0xf0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x3, %edx
leaq 0xd8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x4, %edx
leaq 0x1b0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x4, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x40(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x38(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ec0
movl $0xe, %r12d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ec0
decl %r12d
jne 0x34c10
leaq 0x98(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0x1b0(%rsp), %rdx
callq 0x44fa2
leaq 0x150(%rsp), %r12
movq %r12, %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x190(%rsp), %rdx
callq 0x44fa2
movq %r14, %rdi
leaq 0x98(%rsp), %rsi
movq %r12, %rdx
callq 0x3d822
movsd 0x40(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movq %r14, %rdi
callq 0x3d886
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x3ca6c
movslq 0x7c(%rsp), %rax
testq %rax, %rax
js 0x34cba
movq 0x18(%rsp), %rcx
movq 0x30(%rcx), %rcx
movq (%rcx,%rax,8), %rdi
movq %r14, %rsi
callq 0x3e74e
leaq 0x150(%rsp), %rdi
callq 0x450ee
leaq 0x98(%rsp), %rdi
callq 0x450ee
incl %r15d
cmpl %ebp, %r15d
jne 0x34afa
movq 0x8(%rsp), %r14
movq %r14, %rdi
addq $0x28, %rdi
leaq 0x108(%rsp), %rsi
callq 0xd4746
movl 0x30(%rsp), %ebp
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x70(%r14)
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x3a0e6
incl %ebp
cmpl 0x2c(%rsp), %ebp
jne 0x34a57
movq 0x18(%rsp), %r14
leaq 0x58(%r14), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0xd4746
movl 0x78(%rsp), %ebp
movq %r14, %rdi
addq $0x70, %rdi
leaq 0x208(%rsp), %rsi
callq 0xd4746
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x37ea6
leaq 0x1e8(%rsp), %rdi
callq 0xbe790
incl %ebp
cmpl 0x74(%rsp), %ebp
jl 0x34595
movq 0x20(%rsp), %r15
movq %r15, %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x3807c
movq 0x130(%rsp), %r14
leaq 0x58(%r15), %rdi
leaq 0x238(%rsp), %rsi
callq 0xd4746
movq %r15, %rdi
addq $0x70, %rdi
leaq 0x250(%rsp), %rsi
callq 0xd4746
movq 0x58(%rsp), %rax
movq %rax, 0x8(%r15)
movl 0x14(%rax), %edx
movl %edx, 0x10(%r15)
movq 0x128(%rsp), %rdi
movq %r15, %rsi
callq 0xf8c16
leaq 0x230(%rsp), %rdi
callq 0xbe790
incl %r14d
cmpl 0x70(%rsp), %r14d
jl 0x3413d
movq %rbx, %rdi
callq 0xfab43
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %r14
cmpl $0x0, 0x6c(%rsp)
je 0x34ee0
movl 0x68(%rsp), %eax
xorl $0x2, %eax
orl %eax, 0x50(%rsp)
jne 0x34ee0
movq %rbx, %rdi
movq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0xfab32
testl %eax, %eax
je 0x34f41
movl 0x14(%r14), %eax
testl %eax, %eax
jle 0x34ee0
xorl %edx, %edx
movq 0x8(%r14), %rcx
movq (%rcx,%rdx,8), %rcx
cmpl $0x0, 0x24(%rcx)
jle 0x34ed1
movq %rdx, 0x60(%rsp)
xorl %r13d, %r13d
movq %rcx, 0x8(%rsp)
movq 0x18(%rcx), %rax
movq (%rax,%r13,8), %r15
xorl %ebp, %ebp
movq %r15, %rdi
callq 0x398b2
cmpl %eax, %ebp
jge 0x34eb2
movq %r15, %rdi
movl %ebp, %esi
callq 0x398d6
movq %rax, %r12
cmpl $0x0, 0x34(%rax)
jle 0x34eae
xorl %r14d, %r14d
movq 0x28(%r12), %rax
movq (%rax,%r14,8), %rdx
movq %rbx, %rsi
callq 0x37a66
incq %r14
movslq 0x34(%r12), %rax
cmpq %rax, %r14
jl 0x34e90
incl %ebp
jmp 0x34e6e
incq %r13
movq 0x8(%rsp), %rcx
movslq 0x24(%rcx), %rax
cmpq %rax, %r13
jl 0x34e64
movq 0x58(%rsp), %r14
movl 0x14(%r14), %eax
movq 0x60(%rsp), %rdx
incq %rdx
movslq %eax, %rcx
cmpq %rcx, %rdx
jl 0x34e49
movl $0x1, %ebp
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0xfab32
leaq 0x268(%rsp), %rdi
callq 0xbe790
jmp 0x34f24
leaq 0x117cb7(%rip), %rdi    # 0x14cbc1
jmp 0x34f13
leaq 0x117cde(%rip), %rdi    # 0x14cbf1
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xfb6f2
movq %rbx, %rdi
callq 0x27920
movl %ebp, %eax
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x117cda(%rip), %rdi    # 0x14cc19
jmp 0x34f15
leaq 0x117cf6(%rip), %rdi    # 0x14cc3e
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xfb6f2
movq %rbx, %rdi
callq 0x27920
jmp 0x34ef4
jmp 0x3503b
jmp 0x3503b
movq %rax, %rbx
movl $0x90, %esi
movq 0x20(%rsp), %rdi
callq 0x27950
jmp 0x350ee
jmp 0x3503b
jmp 0x34fa9
jmp 0x34fa9
jmp 0x34fa9
movq %rax, %rbx
movl $0x98, %esi
movq 0x18(%rsp), %rdi
jmp 0x34fbc
movq %rax, %rbx
movl $0x78, %esi
movq %r14, %rdi
jmp 0x34fbc
jmp 0x34fa9
jmp 0x34fa9
jmp 0x34fa9
movq %rax, %rbx
jmp 0x350e1
movq %rax, %rbx
movl $0xc8, %esi
movq %r12, %rdi
callq 0x27950
jmp 0x350e1
jmp 0x3505f
jmp 0x34fd8
jmp 0x35086
jmp 0x35027
jmp 0x3503b
jmp 0x3503b
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x350dc
movq %rax, %rbx
movl $0x88, %esi
jmp 0x35008
jmp 0x3505f
jmp 0x3505f
movq %rax, %rbx
movl $0x80, %esi
jmp 0x3507c
movq %rax, %rbx
movl $0x78, %esi
movq 0x8(%rsp), %rdi
jmp 0x35058
jmp 0x3505f
jmp 0x3505f
movq %rax, %rbx
movl $0x78, %esi
jmp 0x35055
jmp 0x3505f
jmp 0x3505f
jmp 0x3505f
jmp 0x35086
jmp 0x35086
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x350cf
jmp 0x3506d
jmp 0x3508b
movq %rax, %rbx
jmp 0x350ee
jmp 0x3505f
jmp 0x3505f
jmp 0x3505f
jmp 0x3505f
jmp 0x3505f
movq %rax, %rbx
movl $0xc8, %esi
movq %r14, %rdi
callq 0x27950
jmp 0x350d4
movq %rax, %rbx
jmp 0x350d4
movq %rax, %rbx
jmp 0x3509b
jmp 0x35086
jmp 0x35086
movq %rax, %rbx
jmp 0x350ba
jmp 0x35086
movq %rax, %rbx
movl $0xc8, %esi
movq %r14, %rdi
callq 0x27950
jmp 0x350c7
movq %rax, %rbx
jmp 0x350c7
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x450ee
leaq 0x98(%rsp), %rdi
callq 0x450ee
jmp 0x350d4
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x450ee
leaq 0x1b0(%rsp), %rdi
callq 0xbe790
leaq 0x150(%rsp), %rdi
callq 0xbe790
leaq 0x1e8(%rsp), %rdi
callq 0xbe790
leaq 0x230(%rsp), %rdi
callq 0xbe790
leaq 0x268(%rsp), %rdi
callq 0xbe790
movq %rbx, %rdi
callq 0x28150
nop