// File: /workspace/github_cpp_makefile_star2_O1/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 $0x398, %rsp            # imm = 0x398
movl %edx, 0x70(%rsp)
movq %rsi, %rbx
movq %rdi, 0x38(%rsp)
movl $0x0, 0x14(%rsp)
xorps %xmm0, %xmm0
leaq 0x210(%rsp), %rdi
movaps %xmm0, (%rdi)
movl $0x1, %esi
movl $0x10, %edx
movq %rbx, %rcx
callq 0x27ed0
cmpq $0x10, %rax
jne 0x350cb
cmpl $0x565347, 0x210(%rsp) # imm = 0x565347
jne 0x350d4
leaq 0x130(%rsp), %r14
movq $0x0, (%r14)
leaq 0x14(%rsp), %r15
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ed0
leaq 0x13c(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x27ed0
leaq 0x6c(%rsp), %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ed0
leaq 0x34(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x27ed0
cmpl $0x0, (%r14)
jne 0x3421f
cmpl $0x1, 0x34(%rsp)
je 0x34242
movl $0x35, %ebp
leaq 0x14(%rsp), %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %ebp
jne 0x34229
movq %rbx, %rdi
callq 0xfc9f7
movq %rax, 0x118(%rsp)
movq 0x130(%rsp), %rsi
testq %rsi, %rsi
je 0x34273
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %edx, %edx
callq 0xfc9e6
testl %eax, %eax
je 0x35100
leaq 0x258(%rsp), %rdi
callq 0xbeff4
leaq 0x68(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x27ed0
leaq 0x260(%rsp), %rdi
movl $0x8, %esi
movl $0x6, %edx
movq %rbx, %rcx
callq 0x27ed0
movl $0x79, %ebp
leaq 0x14(%rsp), %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %ebp
jne 0x342bb
cmpl $0x0, 0x68(%rsp)
jle 0x34fa9
movq 0x38(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x120(%rsp)
xorl %r14d, %r14d
leaq 0x14(%rsp), %r13
movq %r14, 0x128(%rsp)
movl $0x90, %edi
callq 0x27930
movq %rax, 0x20(%rsp)
movq %rax, %rdi
xorl %esi, %esi
callq 0x37d24
leaq 0x220(%rsp), %rdi
callq 0xbeff4
movl $0x1, %esi
movl $0x100, %edx            # imm = 0x100
leaq 0x290(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x8c(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x88(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x64(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x228(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x17, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %ebp
jne 0x343aa
movl 0x8c(%rsp), %ebp
testl %ebp, %ebp
jle 0x34659
xorl %r14d, %r14d
movl $0xc8, %edi
callq 0x27930
movq %rax, %r12
movq %rax, %rdi
callq 0x3bae8
leaq 0x90(%rsp), %rdi
callq 0xbeff4
movl $0x4, %esi
movl $0x1, %edx
leaq 0x60(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x140(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x1d8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x1a0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x180(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x100(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0xe8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0xd0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x58(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x50(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x48(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x98(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0xf, %r15d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %r15d
jne 0x34540
movl 0x30(%rsp), %esi
movq %r12, %rdi
callq 0x3bd4e
movsd 0x140(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd5a
movsd 0x1d8(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd60
movsd 0x1a0(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd66
movsd 0x180(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd6c
movsd 0x100(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd72
movsd 0xe8(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd78
movsd 0xd0(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd7e
movsd 0x58(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd84
movsd 0x50(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd8a
movsd 0x48(%rsp), %xmm0
movq %r12, %rdi
callq 0x3bd90
leaq 0x90(%r12), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd619c
movq %r12, %rdi
addq $0xa8, %rdi
leaq 0xb0(%rsp), %rsi
callq 0xd619c
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x38164
leaq 0x90(%rsp), %rdi
callq 0xbfe90
incl %r14d
cmpl %ebp, %r14d
jne 0x343d5
movl 0x88(%rsp), %ebp
testl %ebp, %ebp
jle 0x3472e
xorl %r15d, %r15d
movl $0x78, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x3ee38
leaq 0x90(%rsp), %rdi
callq 0xbeff4
movl $0x4, %esi
movl $0x1, %edx
leaq 0x140(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x98(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x19, %r12d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %r12d
jne 0x346c9
leaq 0x40(%r14), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd619c
movq %r14, %rdi
addq $0x58, %rdi
leaq 0xb0(%rsp), %rsi
callq 0xd619c
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x381d0
leaq 0x90(%rsp), %rdi
callq 0xbfe90
incl %r15d
cmpl %ebp, %r15d
jne 0x3466b
cmpl $0x0, 0x64(%rsp)
jle 0x34f2c
xorl %ebp, %ebp
movl %ebp, 0x74(%rsp)
movl $0x98, %edi
callq 0x27930
movq %rax, 0x18(%rsp)
movq %rax, %rdi
xorl %esi, %esi
callq 0x39944
leaq 0x1d8(%rsp), %rdi
callq 0xbeff4
movl $0x4, %esi
movl $0x1, %edx
leaq 0x60(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x84(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x1e0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x17, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %ebp
jne 0x347cc
movl 0x60(%rsp), %eax
movl %eax, 0x78(%rsp)
testl %eax, %eax
jle 0x34aec
movl 0x34(%rsp), %eax
xorl $0x1, %eax
orl 0x6c(%rsp), %eax
sete 0x40(%rsp)
xorl %ebp, %ebp
movl %ebp, 0x2c(%rsp)
movl $0x78, %edi
callq 0x27930
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0x3f9e0
leaq 0x140(%rsp), %rdi
callq 0xbeff4
movl $0x4, %esi
movl $0x1, %edx
leaq 0x58(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x50(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x148(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x18, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %ebp
jne 0x3487c
movl 0x50(%rsp), %r15d
testl %r15d, %r15d
jle 0x34a57
xorl %ebp, %ebp
movl $0xc8, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
callq 0x40e50
leaq 0x100(%rsp), %rdi
callq 0xd5e2c
leaq 0x180(%rsp), %rdi
callq 0xc2ebc
leaq 0x1a0(%rsp), %rdi
callq 0xbeff4
movl $0x4, %esi
movl $0x1, %edx
leaq 0x48(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x3, %edx
leaq 0x100(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x4, %edx
leaq 0x180(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0xe8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x1a8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0xd0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0xf, %r12d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %r12d
jne 0x34980
cmpb $0x0, 0x40(%rsp)
je 0x349ac
movq %rbx, %rsi
movq %r14, %rdx
callq 0x37c10
leaq 0x90(%rsp), %r12
movq %r12, %rdi
leaq 0x100(%rsp), %rsi
leaq 0x180(%rsp), %rdx
callq 0x4546e
movq %r14, %rdi
movq %r12, %rsi
callq 0x41686
movsd 0xe8(%rsp), %xmm0
movsd %xmm0, 0x78(%r14)
leaq 0x90(%r14), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0xd619c
movq %r14, %rdi
addq $0xa8, %rdi
leaq 0x1c0(%rsp), %rsi
callq 0xd619c
movl 0x48(%rsp), %eax
movl %eax, 0x30(%r14)
movq 0xd0(%rsp), %rax
movq %rax, 0x18(%r14)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x4071c
leaq 0x90(%rsp), %rdi
callq 0x455ba
leaq 0x1a0(%rsp), %rdi
callq 0xbfe90
incl %ebp
cmpl %r15d, %ebp
jne 0x348a5
movq 0x8(%rsp), %r14
leaq 0x40(%r14), %rdi
leaq 0x148(%rsp), %rsi
callq 0xd619c
movq %r14, %rdi
addq $0x58, %rdi
leaq 0x160(%rsp), %rsi
callq 0xd619c
movl $0x80, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
callq 0x3f218
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x3f62a
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x3a29c
movslq 0x58(%rsp), %rax
testq %rax, %rax
movl 0x2c(%rsp), %ebp
js 0x34ad3
movq 0x20(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq (%rcx,%rax,8), %rdi
movq %r14, %rsi
callq 0x3efe4
leaq 0x140(%rsp), %rdi
callq 0xbfe90
incl %ebp
cmpl 0x78(%rsp), %ebp
jne 0x34807
movl 0x30(%rsp), %ebp
testl %ebp, %ebp
jle 0x34bf8
xorl %r15d, %r15d
movl $0x78, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
callq 0x3e708
leaq 0x90(%rsp), %rdi
callq 0xbeff4
movl $0x4, %esi
movl $0x1, %edx
leaq 0x140(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x1a0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x6, %edx
leaq 0x98(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x18, %r12d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %r12d
jne 0x34b71
leaq 0x40(%r14), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd619c
movq %r14, %rdi
addq $0x58, %rdi
leaq 0xb0(%rsp), %rsi
callq 0xd619c
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x3a39a
movslq 0x140(%rsp), %rax
testq %rax, %rax
js 0x34bdf
movq 0x20(%rsp), %rcx
movq 0x28(%rcx), %rcx
movq (%rcx,%rax,8), %rdi
movq %r14, %rsi
callq 0x3bc94
leaq 0x90(%rsp), %rdi
callq 0xbfe90
incl %r15d
cmpl %ebp, %r15d
jne 0x34afb
movl 0x84(%rsp), %eax
movl %eax, 0x2c(%rsp)
testl %eax, %eax
jle 0x34ed8
xorl %ebp, %ebp
movl %ebp, 0x40(%rsp)
movl $0x88, %edi
callq 0x27930
movq %rax, 0x8(%rsp)
movq %rax, %rdi
xorl %esi, %esi
callq 0x3cb38
leaq 0x100(%rsp), %r14
movq %r14, %rdi
callq 0xd5e2c
movl $0x4, %esi
movl $0x1, %edx
leaq 0x80(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x3, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x58(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x16, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %ebp
jne 0x34c85
movl 0x80(%rsp), %ebp
testl %ebp, %ebp
jle 0x34e96
xorl %r15d, %r15d
movl $0xc8, %edi
callq 0x27930
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x3d2b4
leaq 0xe8(%rsp), %rdi
callq 0xd5e2c
leaq 0xd0(%rsp), %rdi
callq 0xd5e2c
leaq 0x1a0(%rsp), %rdi
callq 0xc2ebc
leaq 0x180(%rsp), %r12
movq %r12, %rdi
callq 0xc2ebc
movl $0x4, %esi
movl $0x1, %edx
leaq 0x7c(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x4, %esi
movl $0x1, %edx
leaq 0x138(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x3, %edx
leaq 0xe8(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x3, %edx
leaq 0xd0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x4, %edx
leaq 0x1a0(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x4, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x50(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0x8, %esi
movl $0x1, %edx
leaq 0x48(%rsp), %rdi
movq %rbx, %rcx
callq 0x27ed0
movl $0xe, %r12d
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x27ed0
decl %r12d
jne 0x34dc6
leaq 0x90(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0x1a0(%rsp), %rdx
callq 0x4546e
leaq 0x140(%rsp), %r12
movq %r12, %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x180(%rsp), %rdx
callq 0x4546e
movq %r14, %rdi
leaq 0x90(%rsp), %rsi
movq %r12, %rdx
callq 0x3dbfc
movsd 0x50(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movq %r14, %rdi
callq 0x3dc60
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x3cdc6
movslq 0x7c(%rsp), %rax
testq %rax, %rax
js 0x34e70
movq 0x18(%rsp), %rcx
movq 0x30(%rcx), %rcx
movq (%rcx,%rax,8), %rdi
movq %r14, %rsi
callq 0x3eb92
leaq 0x140(%rsp), %rdi
callq 0x455ba
leaq 0x90(%rsp), %rdi
callq 0x455ba
incl %r15d
cmpl %ebp, %r15d
jne 0x34cb0
movq 0x8(%rsp), %r14
movq %r14, %rdi
addq $0x28, %rdi
leaq 0x100(%rsp), %rsi
callq 0xd619c
movl 0x40(%rsp), %ebp
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x70(%r14)
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x3a406
incl %ebp
cmpl 0x2c(%rsp), %ebp
jne 0x34c0d
movq 0x18(%rsp), %r14
leaq 0x58(%r14), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0xd619c
movl 0x74(%rsp), %ebp
movq %r14, %rdi
addq $0x70, %rdi
leaq 0x1f8(%rsp), %rsi
callq 0xd619c
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x38066
leaq 0x1d8(%rsp), %rdi
callq 0xbfe90
incl %ebp
cmpl 0x64(%rsp), %ebp
jl 0x3473b
movq 0x20(%rsp), %r15
movq %r15, %rdi
leaq 0x290(%rsp), %rsi
callq 0x3823c
movq 0x128(%rsp), %r14
leaq 0x58(%r15), %rdi
leaq 0x228(%rsp), %rsi
callq 0xd619c
movq %r15, %rdi
addq $0x70, %rdi
leaq 0x240(%rsp), %rsi
callq 0xd619c
movq 0x38(%rsp), %rax
movq %rax, 0x8(%r15)
movl 0x14(%rax), %edx
movl %edx, 0x10(%r15)
movq 0x120(%rsp), %rdi
movq %r15, %rsi
callq 0xfa862
leaq 0x220(%rsp), %rdi
callq 0xbfe90
incl %r14d
cmpl 0x68(%rsp), %r14d
jl 0x342f8
movq %rbx, %rdi
callq 0xfc9f7
movq %rax, 0x18(%rsp)
cmpl $0x0, 0x70(%rsp)
je 0x350a8
cmpl $0x0, 0x6c(%rsp)
jne 0x350a8
cmpl $0x2, 0x34(%rsp)
jne 0x350a8
movq %rbx, %rdi
movq 0x118(%rsp), %rsi
xorl %edx, %edx
callq 0xfc9e6
testl %eax, %eax
je 0x35109
movq 0x38(%rsp), %rax
cmpl $0x0, 0x14(%rax)
jle 0x350a8
xorl %ecx, %ecx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x40(%rsp)
movq (%rax,%rcx,8), %r14
cmpl $0x0, 0x24(%r14)
jle 0x3508e
xorl %r13d, %r13d
movq 0x18(%r14), %rax
movq (%rax,%r13,8), %r15
xorl %ebp, %ebp
movq %r15, 0x8(%rsp)
movq %r15, %rdi
callq 0x39ba4
cmpl %eax, %ebp
jge 0x35082
movq %r15, %rdi
movl %ebp, %esi
callq 0x39bc8
movq %rax, %r12
movq %r13, %r15
movq %r14, %r13
cmpl $0x0, 0x34(%rax)
jle 0x35073
xorl %r14d, %r14d
movq 0x28(%r12), %rax
movq (%rax,%r14,8), %rdx
movq %rbx, %rsi
callq 0x37c10
incq %r14
movslq 0x34(%r12), %rax
cmpq %rax, %r14
jl 0x35055
incl %ebp
movq %r13, %r14
movq %r15, %r13
movq 0x8(%rsp), %r15
jmp 0x3502d
incq %r13
movslq 0x24(%r14), %rax
cmpq %rax, %r13
jl 0x3501e
movq 0x40(%rsp), %rcx
incq %rcx
movq 0x38(%rsp), %rax
movslq 0x14(%rax), %rax
cmpq %rax, %rcx
jl 0x35002
movl $0x1, %ebp
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0xfc9e6
leaq 0x258(%rsp), %rdi
callq 0xbfe90
jmp 0x350ec
leaq 0x119adf(%rip), %rdi    # 0x14ebb1
jmp 0x350db
leaq 0x119b06(%rip), %rdi    # 0x14ebe1
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xfd64a
movq %rbx, %rdi
callq 0x27920
movl %ebp, %eax
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x119b02(%rip), %rdi    # 0x14ec09
jmp 0x350dd
leaq 0x119b1e(%rip), %rdi    # 0x14ec2e
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xfd64a
movq %rbx, %rdi
callq 0x27920
jmp 0x350bc
jmp 0x35203
jmp 0x35203
movq %rax, %rbx
movl $0x90, %esi
movq 0x20(%rsp), %rdi
callq 0x27950
jmp 0x352b6
jmp 0x35203
jmp 0x35171
jmp 0x35171
jmp 0x35171
movq %rax, %rbx
movl $0x98, %esi
movq 0x18(%rsp), %rdi
jmp 0x35184
movq %rax, %rbx
movl $0x78, %esi
movq %r14, %rdi
jmp 0x35184
jmp 0x35171
jmp 0x35171
jmp 0x35171
movq %rax, %rbx
jmp 0x352a9
movq %rax, %rbx
movl $0xc8, %esi
movq %r12, %rdi
callq 0x27950
jmp 0x352a9
jmp 0x35227
jmp 0x351a0
jmp 0x3524e
jmp 0x351ef
jmp 0x35203
jmp 0x35203
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x352a4
movq %rax, %rbx
movl $0x88, %esi
jmp 0x351d0
jmp 0x35227
jmp 0x35227
movq %rax, %rbx
movl $0x80, %esi
jmp 0x35244
movq %rax, %rbx
movl $0x78, %esi
movq 0x8(%rsp), %rdi
jmp 0x35220
jmp 0x35227
jmp 0x35227
movq %rax, %rbx
movl $0x78, %esi
jmp 0x3521d
jmp 0x35227
jmp 0x35227
jmp 0x35227
jmp 0x3524e
jmp 0x3524e
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x35297
jmp 0x35235
jmp 0x35253
movq %rax, %rbx
jmp 0x352b6
jmp 0x35227
jmp 0x35227
jmp 0x35227
jmp 0x35227
jmp 0x35227
movq %rax, %rbx
movl $0xc8, %esi
movq %r14, %rdi
callq 0x27950
jmp 0x3529c
movq %rax, %rbx
jmp 0x3529c
movq %rax, %rbx
jmp 0x35263
jmp 0x3524e
jmp 0x3524e
movq %rax, %rbx
jmp 0x35282
jmp 0x3524e
movq %rax, %rbx
movl $0xc8, %esi
movq %r14, %rdi
callq 0x27950
jmp 0x3528f
movq %rax, %rbx
jmp 0x3528f
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x455ba
leaq 0x90(%rsp), %rdi
callq 0x455ba
jmp 0x3529c
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x455ba
leaq 0x1a0(%rsp), %rdi
callq 0xbfe90
leaq 0x140(%rsp), %rdi
callq 0xbfe90
leaq 0x1d8(%rsp), %rdi
callq 0xbfe90
leaq 0x220(%rsp), %rdi
callq 0xbfe90
leaq 0x258(%rsp), %rdi
callq 0xbfe90
movq %rbx, %rdi
callq 0x28160
nop