// File: tomfunkhouser[P]gaps/apps/conf2sfl/conf2sfl.cpp
// Function: LoadSurfels(gaps::R3SurfelScene*, char const*, gaps::R3Segmentation*, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Image const&, gaps::R3Point const&, gaps::R3Vector const&, gaps::R3Vector const&, gaps::R3Matrix const&)
static int
LoadSurfels(R3SurfelScene *scene,
  const char *scan_name, R3Segmentation *segmentation, const R2Grid& depth_image, 
  const R2Grid& px_image, const R2Grid& py_image, const R2Grid& pz_image,
  const R2Grid& nx_image, const R2Grid& ny_image, const R2Grid& nz_image,
  const R2Grid& tx_image, const R2Grid& ty_image, const R2Grid& tz_image,
  const R2Grid& r1_image, const R2Grid& r2_image,
  const R2Grid& boundary_image, const R2Image& color_image,
  const R3Point& viewpoint, const R3Vector& towards, const R3Vector& up,
  const R3Matrix& intrinsics)
{
  // Get convenient variables
  R3SurfelTree *tree = scene->Tree();
  R3SurfelDatabase *database = tree->Database();
  R3SurfelNode *parent_node = tree->RootNode();
  int width = depth_image.XResolution();
  int height = depth_image.YResolution();
  R2Point center(intrinsics[0][2], intrinsics[1][2]);
  RNLength xfocal = intrinsics[0][0];
  RNLength yfocal = intrinsics[1][1];
  int cx = depth_image.XResolution()/2;
  int cy = depth_image.YResolution()/2;
  double rx = cx;
  double ry = cy;
  
  // Allocate array of surfels
  int max_surfels = depth_image.NEntries();
  R3Surfel *surfels = new R3Surfel [ max_surfels ];
  if (!surfels) {
    RNFail("Unable to allocate surfels for %s\n", scan_name);
    return 0;
  }

  // Load surfels into array
  int nsurfels = 0;
  for (int i = 0; i < depth_image.XResolution(); i += pixel_stride) {
    for (int j = 0; j < depth_image.YResolution(); j += pixel_stride) {
      // Check depth
      RNScalar depth = depth_image.GridValue(i, j);
      if (RNIsNegativeOrZero(depth)) continue;
      if ((max_depth > 0) && (depth > max_depth)) continue;

      // Check if outside elipse centered in image
      if (omit_corners) {
        int dx = (i - cx) / rx;
        int dy = (j - cy) / ry;
        if (dx*dx + dy*dy > 1) continue;
      }

      // Set position
      float px = (float) (px_image.GridValue(i, j) - viewpoint.X());
      float py = (float) (py_image.GridValue(i, j) - viewpoint.Y());
      float pz = (float) (pz_image.GridValue(i, j) - viewpoint.Z());
      surfels[nsurfels].SetPosition(px, py, pz);

      // Set normal
      float nx = (float) (nx_image.GridValue(i, j));
      float ny = (float) (ny_image.GridValue(i, j));
      float nz = (float) (nz_image.GridValue(i, j));
      surfels[nsurfels].SetNormal(nx, ny, nz);

      // Set tangent
      float tx = (float) (tx_image.GridValue(i, j));
      float ty = (float) (ty_image.GridValue(i, j));
      float tz = (float) (tz_image.GridValue(i, j));
      surfels[nsurfels].SetTangent(tx, ty, tz);

      // Set radius
      float r1 = (float) (r1_image.GridValue(i, j));
      float r2 = (float) (r2_image.GridValue(i, j));
      surfels[nsurfels].SetRadius(0, r1);
      surfels[nsurfels].SetRadius(1, r2);

      // Set depth
      surfels[nsurfels].SetDepth(depth);

      // Set color
      RNRgb color(0.0, 0.8, 0.0);
      if ((i < color_image.Width()) && (j < color_image.Height())) {
        color = color_image.PixelRGB(i, j);
        surfels[nsurfels].SetColor(color);
      }

      // Set identifier
      unsigned int identifier = database->NSurfels() + nsurfels + 1;    
      surfels[nsurfels].SetIdentifier(identifier);

      // Set boundary flags
      int boundary = (int) (boundary_image.GridValue(i, j) + 0.5);
      if (boundary == R3_SURFEL_BORDER_BOUNDARY_FLAG) surfels[nsurfels].SetBorderBoundary(TRUE);
      else if (boundary == R3_SURFEL_SILHOUETTE_BOUNDARY_FLAG) surfels[nsurfels].SetSilhouetteBoundary(TRUE);
      else if (boundary == R3_SURFEL_SHADOW_BOUNDARY_FLAG) surfels[nsurfels].SetShadowBoundary(TRUE);

      // Increment number of surfels
      nsurfels++;
    }
  }

  // Create block from array of surfels
  R3SurfelBlock *block = new R3SurfelBlock(surfels, nsurfels, viewpoint);
  if (!block) {
    RNFail("Unable to allocate block\n");
    delete [] surfels;
    return 0;
  }

  // Delete array of surfels
  delete [] surfels;

  // Update block properties
  block->UpdateProperties();
  
  // Insert block into database
  database->InsertBlock(block);

  // Create node name
  char node_name[1024];
  sprintf(node_name, "SCAN:%s", scan_name);
  
  // Create node
  R3SurfelNode *node = new R3SurfelNode(node_name);
  if (!node) {
    RNFail("Unable to allocate node\n");
    delete block;
    return 0;
  }
            
  // Insert node into tree
  tree->InsertNode(node, parent_node);

  // Insert block into node
  node->InsertBlock(block);
  
  // Update node properties
  node->UpdateProperties();

  // Release block
  database->ReleaseBlock(block);

  // Create scan
  R3SurfelScan *scan = new R3SurfelScan(node_name);
  if (!scan) {
    RNFail("Unable to allocate scan\n");
    return 0;
  }

  // Assign scan properties
  scan->SetViewpoint(viewpoint);
  scan->SetOrientation(towards, up);
  scan->SetImageDimensions(width, height);
  scan->SetImageCenter(center);
  scan->SetXFocal(xfocal);
  scan->SetYFocal(yfocal);
  scan->SetNode(node);
          
  // Insert scan
  scene->InsertScan(scan);

  // Create image
  R3SurfelImage *image = new R3SurfelImage(scan_name);
  if (!image) {
    RNFail("Unable to allocate image\n");
    return 0;
  }

  // Assign image properties
  image->SetViewpoint(viewpoint);
  image->SetOrientation(towards, up);
  image->SetImageDimensions(width, height);
  image->SetImageCenter(center);
  image->SetXFocal(xfocal);
  image->SetYFocal(yfocal);
  image->SetScan(scan);
          
  // Insert image
  scene->InsertImage(image);

  // Return success
  return 1;
}

// Assembly:
subq $0x5f8, %rsp            # imm = 0x5F8
movq 0x670(%rsp), %rax
movq 0x668(%rsp), %rax
movq 0x660(%rsp), %rax
movq 0x658(%rsp), %rax
movq 0x650(%rsp), %rax
movq 0x648(%rsp), %rax
movq 0x640(%rsp), %rax
movq 0x638(%rsp), %rax
movq 0x630(%rsp), %rax
movq 0x628(%rsp), %rax
movq 0x620(%rsp), %rax
movq 0x618(%rsp), %rax
movq 0x610(%rsp), %rax
movq 0x608(%rsp), %rax
movq 0x600(%rsp), %rax
movq %rdi, 0x5e8(%rsp)
movq %rsi, 0x5e0(%rsp)
movq %rdx, 0x5d8(%rsp)
movq %rcx, 0x5d0(%rsp)
movq %r8, 0x5c8(%rsp)
movq %r9, 0x5c0(%rsp)
movq 0x5e8(%rsp), %rdi
callq 0x1edc0
movq %rax, 0x5b8(%rsp)
movq 0x5b8(%rsp), %rdi
callq 0x1edf0
movq %rax, 0x5b0(%rsp)
movq 0x5b8(%rsp), %rdi
callq 0x20220
movq %rax, 0x5a8(%rsp)
movq 0x5d0(%rsp), %rdi
callq 0x1f1a0
movl %eax, 0x5a4(%rsp)
movq 0x5d0(%rsp), %rdi
callq 0x1f1c0
movl %eax, 0x5a0(%rsp)
movq 0x670(%rsp), %rdi
xorl %esi, %esi
callq 0x20240
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x670(%rsp), %rdi
movl $0x1, %esi
callq 0x20240
movsd 0x88(%rsp), %xmm0
movsd 0x10(%rax), %xmm1
leaq 0x590(%rsp), %rdi
callq 0x167da0
movq 0x670(%rsp), %rdi
xorl %esi, %esi
callq 0x20240
movsd (%rax), %xmm0
movsd %xmm0, 0x588(%rsp)
movq 0x670(%rsp), %rdi
movl $0x1, %esi
callq 0x20240
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x580(%rsp)
movq 0x5d0(%rsp), %rdi
callq 0x1f1a0
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x57c(%rsp)
movq 0x5d0(%rsp), %rdi
callq 0x1f1c0
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x578(%rsp)
cvtsi2sdl 0x57c(%rsp), %xmm0
movsd %xmm0, 0x570(%rsp)
cvtsi2sdl 0x578(%rsp), %xmm0
movsd %xmm0, 0x568(%rsp)
movq 0x5d0(%rsp), %rdi
callq 0x1f290
movl %eax, 0x564(%rsp)
movslq 0x564(%rsp), %rax
movq %rax, 0x98(%rsp)
movl $0x30, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, 0x90(%rsp)
callq 0x16040
movq %rax, %rcx
movq 0x98(%rsp), %rax
movq %rcx, 0xa0(%rsp)
cmpq $0x0, %rax
je 0x1c7c4
movq 0xa0(%rsp), %rax
movq 0x98(%rsp), %rcx
imulq $0x30, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x4a880
jmp 0x1c7a9
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %rax
addq $0x30, %rax
cmpq %rcx, %rax
movq %rax, 0x80(%rsp)
jne 0x1c795
movq 0xa0(%rsp), %rax
movq %rax, 0x558(%rsp)
cmpq $0x0, 0x558(%rsp)
jne 0x1c833
movq 0x5e0(%rsp), %rsi
leaq 0x1e0d32(%rip), %rdi    # 0x1fd520
movb $0x0, %al
callq 0x1779b0
movl $0x0, 0x5f4(%rsp)
jmp 0x1d396
movq 0x90(%rsp), %rsi
movq 0xa0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x550(%rsp)
movl %eax, 0x54c(%rsp)
callq 0x16e20
jmp 0x1d3a5
movl $0x0, 0x548(%rsp)
movl $0x0, 0x544(%rsp)
movl 0x544(%rsp), %eax
movl %eax, 0x6c(%rsp)
movq 0x5d0(%rsp), %rdi
callq 0x1f1a0
movl %eax, %ecx
movl 0x6c(%rsp), %eax
cmpl %ecx, %eax
jge 0x1cec9
movl $0x0, 0x540(%rsp)
movl 0x540(%rsp), %eax
movl %eax, 0x68(%rsp)
movq 0x5d0(%rsp), %rdi
callq 0x1f1c0
movl %eax, %ecx
movl 0x68(%rsp), %eax
cmpl %ecx, %eax
jge 0x1ceae
movq 0x5d0(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
movsd %xmm0, 0x538(%rsp)
movsd 0x538(%rsp), %xmm0
leaq 0x24be74(%rip), %rax    # 0x268748
movsd (%rax), %xmm1
callq 0x1f320
cmpl $0x0, %eax
je 0x1c8e7
jmp 0x1ce95
movsd 0x24bf41(%rip), %xmm0   # 0x268830
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1c910
movsd 0x538(%rsp), %xmm0
ucomisd 0x24bf27(%rip), %xmm0   # 0x268830
jbe 0x1c910
jmp 0x1ce95
cmpl $0x0, 0x24bf21(%rip)    # 0x268838
je 0x1c991
movl 0x544(%rsp), %eax
subl 0x57c(%rsp), %eax
cvtsi2sd %eax, %xmm0
divsd 0x570(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x534(%rsp)
movl 0x540(%rsp), %eax
subl 0x578(%rsp), %eax
cvtsi2sd %eax, %xmm0
divsd 0x568(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x530(%rsp)
movl 0x534(%rsp), %eax
imull 0x534(%rsp), %eax
movl 0x530(%rsp), %ecx
imull 0x530(%rsp), %ecx
addl %ecx, %eax
cmpl $0x1, %eax
jle 0x1c98f
jmp 0x1ce95
jmp 0x1c991
movq 0x5c8(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
movsd %xmm0, 0x48(%rsp)
movq 0x658(%rsp), %rdi
callq 0x1efb0
movaps %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
subsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x52c(%rsp)
movq 0x5c0(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
movsd %xmm0, 0x50(%rsp)
movq 0x658(%rsp), %rdi
callq 0x1efc0
movaps %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
subsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x528(%rsp)
movq 0x600(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
movsd %xmm0, 0x58(%rsp)
movq 0x658(%rsp), %rdi
callq 0x1efd0
movaps %xmm0, %xmm1
movsd 0x58(%rsp), %xmm0
subsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x524(%rsp)
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movss 0x52c(%rsp), %xmm0
movss 0x528(%rsp), %xmm1
movss 0x524(%rsp), %xmm2
callq 0x202d0
movq 0x608(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x520(%rsp)
movq 0x610(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x51c(%rsp)
movq 0x618(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x518(%rsp)
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movss 0x520(%rsp), %xmm0
movss 0x51c(%rsp), %xmm1
movss 0x518(%rsp), %xmm2
callq 0x20340
movq 0x620(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x514(%rsp)
movq 0x628(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x510(%rsp)
movq 0x630(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x50c(%rsp)
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movss 0x514(%rsp), %xmm0
movss 0x510(%rsp), %xmm1
movss 0x50c(%rsp), %xmm2
callq 0x20410
movq 0x638(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x508(%rsp)
movq 0x640(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x504(%rsp)
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movss 0x508(%rsp), %xmm0
xorl %esi, %esi
callq 0x204e0
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movss 0x504(%rsp), %xmm0
movl $0x1, %esi
callq 0x204e0
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movsd 0x538(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0x20560
leaq 0x4e8(%rsp), %rdi
xorps %xmm2, %xmm2
movsd 0x1e0365(%rip), %xmm1   # 0x1fd040
movaps %xmm2, %xmm0
callq 0x1731f0
movl 0x544(%rsp), %eax
movl %eax, 0x64(%rsp)
movq 0x650(%rsp), %rdi
callq 0x20930
movl %eax, %ecx
movl 0x64(%rsp), %eax
cmpl %ecx, %eax
jge 0x1cd83
movl 0x540(%rsp), %eax
movl %eax, 0x44(%rsp)
movq 0x650(%rsp), %rdi
callq 0x20940
movl %eax, %ecx
movl 0x44(%rsp), %eax
cmpl %ecx, %eax
jge 0x1cd83
movq 0x650(%rsp), %rsi
movl 0x544(%rsp), %edx
movl 0x540(%rsp), %ecx
leaq 0x4d0(%rsp), %rdi
callq 0x16a1c0
leaq 0x4e8(%rsp), %rdi
leaq 0x4d0(%rsp), %rsi
callq 0x173370
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq 0x4e8(%rsp), %rsi
callq 0x205e0
movq 0x5b0(%rsp), %rdi
callq 0x1ee20
movslq 0x548(%rsp), %rcx
addq %rcx, %rax
addq $0x1, %rax
movl %eax, 0x4cc(%rsp)
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movl 0x4cc(%rsp), %esi
callq 0x20670
movq 0x648(%rsp), %rdi
movl 0x544(%rsp), %esi
movl 0x540(%rsp), %edx
callq 0x208f0
movsd 0x1e0244(%rip), %xmm1   # 0x1fd030
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x4c8(%rsp)
cmpl $0x30, 0x4c8(%rsp)
jne 0x1ce28
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movl $0x1, %esi
callq 0x20690
jmp 0x1ce84
cmpl $0x10, 0x4c8(%rsp)
jne 0x1ce55
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movl $0x1, %esi
callq 0x206d0
jmp 0x1ce82
cmpl $0x20, 0x4c8(%rsp)
jne 0x1ce80
movq 0x558(%rsp), %rdi
movslq 0x548(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movl $0x1, %esi
callq 0x20710
jmp 0x1ce82
jmp 0x1ce84
movl 0x548(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x548(%rsp)
movl 0x2428c5(%rip), %eax    # 0x25f760
addl 0x540(%rsp), %eax
movl %eax, 0x540(%rsp)
jmp 0x1c87a
jmp 0x1ceb0
movl 0x2428aa(%rip), %eax    # 0x25f760
addl 0x544(%rsp), %eax
movl %eax, 0x544(%rsp)
jmp 0x1c849
movl $0xc8, %edi
callq 0x16740
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x38(%rsp)
movq 0x558(%rsp), %rsi
movl 0x548(%rsp), %edx
movq 0x658(%rsp), %rcx
xorps %xmm0, %xmm0
callq 0x4c620
jmp 0x1ceff
movq 0x38(%rsp), %rax
movq %rax, 0x4c0(%rsp)
cmpq $0x0, 0x4c0(%rsp)
jne 0x1cf7a
leaq 0x1e0625(%rip), %rdi    # 0x1fd543
movb $0x0, %al
callq 0x1779b0
movq 0x558(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x1cf42
movq 0x30(%rsp), %rdi
callq 0x169a0
movl $0x0, 0x5f4(%rsp)
jmp 0x1d396
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x550(%rsp)
movl %eax, 0x54c(%rsp)
movl $0xc8, %esi
callq 0x16750
jmp 0x1d3a5
movq 0x558(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, %rax
je 0x1cf97
movq 0x28(%rsp), %rdi
callq 0x169a0
movq 0x4c0(%rsp), %rdi
callq 0x4f690
movq 0x5b0(%rsp), %rdi
movq 0x4c0(%rsp), %rsi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq 0x5e0(%rsp), %rdx
leaq 0x1e04da(%rip), %rsi    # 0x1fd4a6
xorl %eax, %eax
leaq 0xc0(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x16130
movl $0xd0, %edi
callq 0x16740
movq 0x18(%rsp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x20(%rsp)
callq 0x5acf0
jmp 0x1d001
movq 0x20(%rsp), %rax
movq %rax, 0xb8(%rsp)
cmpq $0x0, 0xb8(%rsp)
jne 0x1d08b
leaq 0x1e055f(%rip), %rdi    # 0x1fd57f
movb $0x0, %al
callq 0x1779b0
movq 0x4c0(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x1d053
movq 0x10(%rsp), %rdi
callq 0x4d4d0
movq 0x10(%rsp), %rdi
movl $0xc8, %esi
callq 0x16750
movl $0x0, 0x5f4(%rsp)
jmp 0x1d396
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x550(%rsp)
movl %eax, 0x54c(%rsp)
movl $0xd0, %esi
callq 0x16750
jmp 0x1d3a5
movq 0x5b8(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movq 0x5a8(%rsp), %rdx
callq 0x5d9f0
movq 0xb8(%rsp), %rdi
movq 0x4c0(%rsp), %rsi
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
movq 0xb8(%rsp), %rdi
callq 0x5cc70
movq 0x5b0(%rsp), %rdi
movq 0x4c0(%rsp), %rsi
callq 0x20750
movl $0xd0, %edi
callq 0x16740
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x8(%rsp)
leaq 0xc0(%rsp), %rsi
callq 0x61d80
jmp 0x1d107
movq 0x8(%rsp), %rax
movq %rax, 0xb0(%rsp)
cmpq $0x0, 0xb0(%rsp)
jne 0x1d165
leaq 0x1e03c7(%rip), %rdi    # 0x1fd4ed
movb $0x0, %al
callq 0x1779b0
movl $0x0, 0x5f4(%rsp)
jmp 0x1d396
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x550(%rsp)
movl %eax, 0x54c(%rsp)
movl $0xd0, %esi
callq 0x16750
jmp 0x1d3a5
movq 0xb0(%rsp), %rdi
movq 0x658(%rsp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq 0xb0(%rsp), %rdi
movq 0x660(%rsp), %rsi
movq 0x668(%rsp), %rdx
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movq 0xb0(%rsp), %rdi
movl 0x5a4(%rsp), %esi
movl 0x5a0(%rsp), %edx
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
movq 0xb0(%rsp), %rdi
movq (%rdi), %rax
movq 0x40(%rax), %rax
leaq 0x590(%rsp), %rsi
callq *%rax
movq 0xb0(%rsp), %rdi
movsd 0x588(%rsp), %xmm0
movq (%rdi), %rax
movq 0x50(%rax), %rax
callq *%rax
movq 0xb0(%rsp), %rdi
movsd 0x580(%rsp), %xmm0
movq (%rdi), %rax
movq 0x58(%rax), %rax
callq *%rax
movq 0xb0(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movq (%rdi), %rax
movq 0x78(%rax), %rax
callq *%rax
movq 0x5e8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq (%rdi), %rax
movq 0x90(%rax), %rax
callq *%rax
movl $0x1d8, %edi            # imm = 0x1D8
callq 0x16740
movq %rax, %rdi
movq %rdi, %rax
movq %rax, (%rsp)
movq 0x5e0(%rsp), %rsi
callq 0x62b40
jmp 0x1d263
movq (%rsp), %rax
movq %rax, 0xa8(%rsp)
cmpq $0x0, 0xa8(%rsp)
jne 0x1d2bf
leaq 0x1e0285(%rip), %rdi    # 0x1fd506
movb $0x0, %al
callq 0x1779b0
movl $0x0, 0x5f4(%rsp)
jmp 0x1d396
movq (%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x550(%rsp)
movl %eax, 0x54c(%rsp)
movl $0x1d8, %esi            # imm = 0x1D8
callq 0x16750
jmp 0x1d3a5
movq 0xa8(%rsp), %rdi
movq 0x658(%rsp), %rsi
movq (%rdi), %rax
callq *0x60(%rax)
movq 0xa8(%rsp), %rdi
movq 0x660(%rsp), %rsi
movq 0x668(%rsp), %rdx
movq (%rdi), %rax
callq *0x68(%rax)
movq 0xa8(%rsp), %rdi
movl 0x5a4(%rsp), %esi
movl 0x5a0(%rsp), %edx
movq (%rdi), %rax
callq *0x70(%rax)
movq 0xa8(%rsp), %rdi
movq (%rdi), %rax
leaq 0x590(%rsp), %rsi
callq *0x78(%rax)
movq 0xa8(%rsp), %rdi
movsd 0x588(%rsp), %xmm0
movq (%rdi), %rax
callq *0x88(%rax)
movq 0xa8(%rsp), %rdi
movsd 0x580(%rsp), %xmm0
movq (%rdi), %rax
callq *0x90(%rax)
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq (%rdi), %rax
callq *0xd0(%rax)
movq 0x5e8(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq (%rdi), %rax
callq *0xa0(%rax)
movl $0x1, 0x5f4(%rsp)
movl 0x5f4(%rsp), %eax
addq $0x5f8, %rsp            # imm = 0x5F8
retq
movq 0x550(%rsp), %rdi
callq 0x16ca0
nopw %cs:(%rax,%rax)