// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDUtil.cpp
// Function: gaps::RGBDCreateTangentChannels(gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid const&, gaps::R2Grid&, gaps::R2Grid&, gaps::R2Grid&, gaps::R2Grid&, gaps::R2Grid&, gaps::R2Grid&, gaps::R2Grid&, gaps::R2Grid&, gaps::R3Point const&, gaps::R3Vector const&, gaps::R3Vector const&, double, int, int)
int RGBDCreateTangentChannels(const R2Grid& input_depth_image, 
  const R2Grid& input_px_image, const R2Grid& input_py_image, const R2Grid& input_pz_image,
  const R2Grid& input_boundary_image,
  R2Grid& output_nx_image, R2Grid& output_ny_image, R2Grid& output_nz_image,
  R2Grid& output_tx_image, R2Grid& output_ty_image, R2Grid& output_tz_image,
  R2Grid& output_r1_image, R2Grid& output_r2_image,
  const R3Point& viewpoint, const R3Vector& towards, const R3Vector& up,
  RNLength neighborhood_world_radius, int neighborhood_pixel_radius, RNBoolean neighborhood_search)
{
  // Initialize normal images
  output_nx_image = input_depth_image; 
  output_nx_image.Clear(R2_GRID_UNKNOWN_VALUE);
  output_ny_image = output_nx_image;
  output_nz_image = output_nx_image;
  output_tx_image = output_nx_image;
  output_ty_image = output_nx_image;
  output_tz_image = output_nx_image;
  output_r1_image = output_nx_image;
  output_r2_image = output_nx_image;

  // Allocate array of neighborhood points
  int pixel_radius = neighborhood_pixel_radius * input_depth_image.XResolution() / 640.0 + 0.5;
  if (pixel_radius == 0) pixel_radius = 1;
  int neighborhood_pixel_radius_squared = pixel_radius * pixel_radius;
  RNScalar neighborhood_world_radius_squared = neighborhood_world_radius * neighborhood_world_radius;
  R3Point *neighborhood_points = new R3Point [ input_depth_image.NEntries() ];

  // Allocate search grid
  R2Grid search_grid(input_depth_image.XResolution(), input_depth_image.YResolution());
  const RNScalar *search_valuesp = search_grid.GridValues();
  search_grid.Clear(-1);

  // Fill normal images
  for (int i = 0; i < input_depth_image.XResolution(); i++) {
    for (int j = 0; j < input_depth_image.YResolution(); j++) {
      int neighborhood_npoints = 0;

      // Check depth
      RNScalar depth = input_depth_image.GridValue(i, j);
      if (RNIsNegativeOrZero(depth)) continue;

      // Get image position
      R2Point image_position(i, j);

      // Get world position
      RNScalar x = input_px_image.GridValue(i, j);
      RNScalar y = input_py_image.GridValue(i, j);
      RNScalar z = input_pz_image.GridValue(i, j);
      R3Point world_position(x, y, z);

      // Create array of neighborhood points
      if (neighborhood_search) {
        // Initialize stack
        int seed_index;
        RNArray<const RNScalar *> stack;
        search_grid.IndicesToIndex(i, j, seed_index);
        const RNScalar *seed_valuep = &search_valuesp[seed_index];
        search_grid.SetGridValue(seed_index, seed_index);
        stack.Insert(seed_valuep);

        // Depth first search, not extending beyond boundaries
        while (!stack.IsEmpty()) {
          // Pop current point off stack
          int ix, iy;
          const RNScalar *current_valuep = stack.Tail(); stack.RemoveTail();
          int current_index = current_valuep - search_valuesp;
          search_grid.IndexToIndices(current_index, ix, iy);

          // Get current info
          RNScalar current_x = input_px_image.GridValue(ix, iy);
          RNScalar current_y = input_py_image.GridValue(ix, iy);
          RNScalar current_z = input_pz_image.GridValue(ix, iy);
          R3Point current_position(current_x, current_y, current_z);
          RNScalar current_boundary_value = input_boundary_image.GridValue(ix, iy);
          int current_boundary = (int) (current_boundary_value + 0.5);
        
          // Add point to array
          neighborhood_points[neighborhood_npoints++] = current_position;

          // Add adjacent points to stack
          for (int inx = ix-1; inx <= ix+1; inx++) {
            if ((inx < 0) || (inx >= search_grid.XResolution())) continue;
            for (int iny = iy-1; iny <= iy+1; iny++) {
              if ((iny < 0) || (iny >= search_grid.YResolution())) continue;

              // Check if neighbor has already been visited
              RNScalar neighbor_value = search_grid.GridValue(inx, iny);
              if (RNIsEqual(neighbor_value, seed_index)) continue;
              search_grid.SetGridValue(inx, iny, seed_index);

              // Check neighbor depth
              RNScalar neighbor_depth = input_depth_image.GridValue(inx, iny);
              if (RNIsNegativeOrZero(neighbor_depth)) continue;

              // Check neighbor image distance
              R2Point neighbor_image_position(inx, iny);
              if (R2SquaredDistance(image_position, neighbor_image_position) > neighborhood_pixel_radius_squared) continue;
            
              // Check neighbor world distance
              RNScalar neighbor_x = input_px_image.GridValue(inx, iny);
              RNScalar neighbor_y = input_py_image.GridValue(inx, iny);
              RNScalar neighbor_z = input_pz_image.GridValue(inx, iny);
              R3Point neighbor_world_position(neighbor_x, neighbor_y, neighbor_z);
              if (neighborhood_world_radius_squared > 0) {
                if (R3SquaredDistance(world_position, neighbor_world_position) > neighborhood_world_radius_squared) continue;
              }

              // Check if neighbor is across boundary
              int neighbor_boundary = (int) (input_boundary_image.GridValue(inx, iny) + 0.5);
              if ((current_boundary == RGBD_SHADOW_BOUNDARY) && (neighbor_boundary == RGBD_SILHOUETTE_BOUNDARY)) continue;
              if ((current_boundary == RGBD_SILHOUETTE_BOUNDARY) && (neighbor_boundary == RGBD_SHADOW_BOUNDARY)) continue;
        
              // Add neighbor to search
              int neighbor_index;
              search_grid.IndicesToIndex(inx, iny, neighbor_index);
              const RNScalar *neighbor_valuep = &search_valuesp[neighbor_index];
              stack.Insert(neighbor_valuep);
            }
          }
        }
      }
      else {
        // Add neighbor points to array
        for (int inx = i-neighborhood_pixel_radius; inx <= i+neighborhood_pixel_radius; inx++) {
          if ((inx < 0) || (inx >= input_depth_image.XResolution())) continue;
          for (int iny = j-neighborhood_pixel_radius; iny <= j+neighborhood_pixel_radius; iny++) {
            if ((iny < 0) || (iny >= input_depth_image.YResolution())) continue;
            
            // Check neighbor depth
            RNScalar neighbor_depth = input_depth_image.GridValue(inx, iny);
            if (RNIsNegativeOrZero(neighbor_depth)) continue;

            // Check neighbor world position
            RNScalar neighbor_x = input_px_image.GridValue(inx, iny);
            RNScalar neighbor_y = input_py_image.GridValue(inx, iny);
            RNScalar neighbor_z = input_pz_image.GridValue(inx, iny);
            R3Point neighbor_world_position(neighbor_x, neighbor_y, neighbor_z);
            if (neighborhood_world_radius_squared > 0) {
              if (R3SquaredDistance(world_position, neighbor_world_position) > neighborhood_world_radius_squared) continue;
            }

            // Add neighbor point to array
            neighborhood_points[neighborhood_npoints++] = neighbor_world_position;
          }
        }
      }

      // Check number of neighbor points
      if (neighborhood_npoints < 3) continue;

      // Solve for normal
      RNScalar variances[3];
      R3Point centroid = R3Centroid(neighborhood_npoints, neighborhood_points);
      R3Triad triad = R3PrincipleAxes(centroid, neighborhood_npoints, neighborhood_points, NULL, variances);
      R3Vector normal = triad[2];
      R3Vector tangent = triad[0];
      
      // Flip normal to point towards camera
      R3Plane plane(world_position, normal);
      if (R3SignedDistance(plane, viewpoint) < 0) normal.Flip(); 

      // Fill normal images
      output_nx_image.SetGridValue(i, j, normal.X());
      output_ny_image.SetGridValue(i, j, normal.Y());
      output_nz_image.SetGridValue(i, j, normal.Z());

      // Fill tangent images
      output_tx_image.SetGridValue(i, j, tangent.X());
      output_ty_image.SetGridValue(i, j, tangent.Y());
      output_tz_image.SetGridValue(i, j, tangent.Z());

      // Fill radius images
      RNScalar r1 = 3 * sqrt(variances[0]);
      RNScalar r2 = 3 * sqrt(variances[1]);
      if (neighborhood_pixel_radius > 1) r1 /= neighborhood_pixel_radius;
      if (neighborhood_pixel_radius > 1) r2 /= neighborhood_pixel_radius;
      output_r1_image.SetGridValue(i, j, r1);
      output_r2_image.SetGridValue(i, j, r2);
    }
  }

  // Delete array of neighborhood points
  delete [] neighborhood_points;

  // Return success 
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movsd %xmm0, 0x10(%rsp)
movq %r9, %rbx
movq %r8, 0x98(%rsp)
movq %rcx, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, %rbp
movq 0x2b8(%rsp), %r14
movq 0x2b0(%rsp), %r15
movq 0x2a8(%rsp), %r12
movq 0x2a0(%rsp), %r13
movq %r9, %rdi
movq %rbp, %rsi
callq 0x5ffa2
movsd 0x9904c(%rip), %xmm0    # 0xbb018
movq %rbx, %rdi
callq 0x617b0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x5ffa2
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5ffa2
movq %r15, %rdi
movq %rbx, %rsi
callq 0x5ffa2
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5ffa2
movq 0x2c0(%rsp), %rdi
movq %rbx, %rsi
callq 0x5ffa2
movq 0x2c8(%rsp), %rdi
movq %rbx, %rsi
callq 0x5ffa2
movq 0x2d0(%rsp), %rdi
movq %rbx, 0xa0(%rsp)
movq %rbx, %rsi
callq 0x5ffa2
movl 0xc0(%rbp), %ebx
movl %ebx, %eax
movl 0x2f0(%rsp), %ecx
imull %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x9a1b7(%rip), %xmm0    # 0xbc210
addsd 0x98fbf(%rip), %xmm0    # 0xbb020
cvttsd2si %xmm0, %r12d
cmpl $0x1, %r12d
adcl $0x0, %r12d
movslq 0xcc(%rbp), %r15
movl $0x18, %ecx
movq %r15, %rax
mulq %rcx
movq $-0x1, %r14
cmovnoq %rax, %r14
movq %r14, %rdi
callq 0x11040
testq %r15, %r15
je 0x220c1
shlq $0x3, %r15
leaq (%r15,%r15,2), %rbx
xorl %r15d, %r15d
movq %rax, %r13
leaq (%rax,%r15), %rdi
callq 0x4b600
addq $0x18, %r15
cmpq %r15, %rbx
movq %r13, %rax
jne 0x220a3
movl 0xc0(%rbp), %ebx
movq %rax, 0x28(%rsp)
movl 0xc4(%rbp), %edx
leaq 0x198(%rsp), %r14
movq %r14, %rdi
movl %ebx, %esi
callq 0x5f630
movq 0xb8(%r14), %rax
movq %rax, 0x70(%rsp)
movsd 0x98f46(%rip), %xmm0    # 0xbb038
movq %r14, %rdi
callq 0x617b0
movl 0xc0(%rbp), %ecx
testl %ecx, %ecx
jle 0x22a64
imull %r12d, %r12d
movsd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd %xmm0, 0xb8(%rsp)
movl 0x2f0(%rsp), %eax
movq %rax, %rdx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x90(%rsp)
incl %eax
movl %eax, 0x24(%rsp)
movl 0xc4(%rbp), %eax
leal 0x1(,%rdx,2), %edx
movl %edx, 0x84(%rsp)
xorl %ebx, %ebx
leaq 0x138(%rsp), %r15
testl %eax, %eax
jle 0x22a56
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0xb0(%rsp)
movl %ebx, %edx
movl 0x2f0(%rsp), %ecx
subl %ecx, %edx
movl %edx, 0x20(%rsp)
addl %ebx, %ecx
movl %ecx, 0x80(%rsp)
xorl %r14d, %r14d
movq %rbx, 0xa8(%rsp)
movq 0xb8(%rbp), %rcx
movl 0xc8(%rbp), %edx
imull %r14d, %edx
addl %ebx, %edx
movslq %edx, %rdx
leaq 0xe2b15(%rip), %rsi     # 0x104cd8
movsd (%rsi), %xmm0
ucomisd (%rcx,%rdx,8), %xmm0
jae 0x22a44
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
leaq 0x128(%rsp), %rdi
movsd 0xb0(%rsp), %xmm0
callq 0x6f0d6
movq 0x30(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r14d, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x38(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r14d, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x40(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
movq %r14, 0x18(%rsp)
imull %r14d, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
leaq 0xf0(%rsp), %rdi
callq 0x4b602
cmpl $0x0, 0x2f8(%rsp)
je 0x2261f
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x753d0
movl 0x260(%rsp), %eax
imull 0x18(%rsp), %eax
addl %ebx, %eax
cltq
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movq 0x70(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
movq 0x250(%rsp), %rcx
movsd %xmm0, 0x48(%rsp)
movsd %xmm0, (%rcx,%rax,8)
movl 0x5c(%rsp), %edx
movq %r14, %rdi
callq 0x75466
movq %r14, %rdi
movl 0x5c(%rsp), %eax
testl %eax, %eax
je 0x2279f
xorl %ebx, %ebx
movq 0x50(%rsp), %rcx
movslq %eax, %rsi
movq -0x8(%rcx,%rsi,8), %r14
decl %esi
callq 0x755f0
subq 0x70(%rsp), %r14
shrq $0x3, %r14
movl %r14d, %eax
cltd
idivl 0x260(%rsp)
movl %eax, %r14d
movl %edx, %r12d
movq 0x30(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r14d, %ecx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x38(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r14d, %ecx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x40(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r14d, %ecx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movq %r15, %rdi
callq 0x4b602
movq 0x98(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r14d, %ecx
addl %r12d, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x78(%rsp)
leaq (%rbx,%rbx,2), %rax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rax,8), %rdi
movq %r15, %rsi
callq 0x4b96a
incq %rbx
movq %rbx, 0x8(%rsp)
movsd 0x78(%rsp), %xmm0
addsd 0x98c68(%rip), %xmm0    # 0xbb020
cvttsd2si %xmm0, %eax
movl %eax, 0x8c(%rsp)
leal -0x1(%r12), %ebx
leal -0x2(%r14), %eax
movl %eax, 0x88(%rsp)
testl %ebx, %ebx
js 0x225ee
cmpl 0x258(%rsp), %ebx
jge 0x225ee
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x78(%rsp)
movl 0x88(%rsp), %r15d
incl %r15d
js 0x225e5
cmpl 0x25c(%rsp), %r15d
jge 0x225e5
movq 0x250(%rsp), %rax
movl 0x260(%rsp), %ecx
imull %r15d, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0xe28a0(%rip), %rdx     # 0x104cd8
movsd (%rdx), %xmm1
subsd 0x48(%rsp), %xmm0
movapd %xmm1, %xmm2
xorpd 0x98c02(%rip), %xmm2    # 0xbb050
ucomisd %xmm2, %xmm0
jb 0x2245e
ucomisd %xmm0, %xmm1
jae 0x225e5
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq 0xb8(%rbp), %rax
movl 0xc8(%rbp), %ecx
imull %r15d, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
leaq 0xe2852(%rip), %rdx     # 0x104cd8
movsd (%rdx), %xmm0
ucomisd (%rax,%rcx,8), %xmm0
jae 0x225e5
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
leaq 0x180(%rsp), %r13
movq %r13, %rdi
movsd 0x78(%rsp), %xmm0
callq 0x6f0d6
leaq 0x128(%rsp), %rdi
movq %r13, %rsi
callq 0x5ce84
ucomisd 0xb8(%rsp), %xmm0
ja 0x225e5
movq 0x30(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r15d, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x38(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r15d, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x40(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %r15d, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
leaq 0x108(%rsp), %rdi
callq 0x4b602
movsd 0x10(%rsp), %xmm0
ucomisd 0x98ac3(%rip), %xmm0    # 0xbb010
jbe 0x2256c
leaq 0xf0(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x26d53
ucomisd 0x10(%rsp), %xmm0
ja 0x225e5
movl 0x8c(%rsp), %ecx
movl %ecx, %eax
xorl $0x2, %eax
xorl $0x4, %ecx
movq 0x98(%rsp), %rsi
movq 0xb8(%rsi), %rdx
movl 0xc8(%rsi), %esi
imull %r15d, %esi
addl %ebx, %esi
movslq %esi, %rsi
movsd (%rdx,%rsi,8), %xmm0
addsd 0x98a7a(%rip), %xmm0    # 0xbb020
cvttsd2si %xmm0, %edx
movl %edx, %esi
xorl $0x2, %esi
xorl $0x4, %edx
orl %eax, %edx
sete %al
orl %ecx, %esi
je 0x225e5
testb %al, %al
jne 0x225e5
movl 0x260(%rsp), %eax
imull %r15d, %eax
addl %ebx, %eax
cltq
movq 0x70(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
movl 0x5c(%rsp), %edx
leaq 0x50(%rsp), %rdi
callq 0x75466
cmpl %r14d, %r15d
jle 0x223fd
leal 0x1(%rbx), %eax
cmpl %r12d, %ebx
movl %eax, %ebx
jle 0x223d3
movl 0x5c(%rsp), %eax
testl %eax, %eax
leaq 0x138(%rsp), %r15
leaq 0x50(%rsp), %rdi
movq 0x8(%rsp), %rbx
jne 0x222cd
jmp 0x227a8
movl 0x80(%rsp), %eax
cmpl %eax, 0x20(%rsp)
jg 0x22a39
movq 0x18(%rsp), %rcx
movl %ecx, %r14d
movl 0x2f0(%rsp), %eax
subl %eax, %r14d
leal (%rcx,%rax), %r12d
movq $0x0, 0x8(%rsp)
movl 0x20(%rsp), %r15d
cmpl %r12d, %r14d
setg %al
testl %r15d, %r15d
sets %cl
cmpl 0xc0(%rbp), %r15d
setge %dl
orb %al, %cl
orb %dl, %cl
jne 0x2278f
movl 0x84(%rsp), %r13d
movl %r14d, %ebx
testl %ebx, %ebx
js 0x22784
cmpl 0xc4(%rbp), %ebx
jge 0x22784
movq 0xb8(%rbp), %rax
movl 0xc8(%rbp), %ecx
imull %ebx, %ecx
addl %r15d, %ecx
movslq %ecx, %rcx
leaq 0xe2628(%rip), %rdx     # 0x104cd8
movsd (%rdx), %xmm0
ucomisd (%rax,%rcx,8), %xmm0
jae 0x22784
movq 0x30(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %ebx, %ecx
addl %r15d, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x38(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %ebx, %ecx
addl %r15d, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x40(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %ebx, %ecx
addl %r15d, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
leaq 0x138(%rsp), %rdi
callq 0x4b602
movsd 0x10(%rsp), %xmm0
ucomisd 0x988d6(%rip), %xmm0    # 0xbb010
jbe 0x22759
leaq 0xf0(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x26d53
ucomisd 0x10(%rsp), %xmm0
ja 0x22784
movslq 0x8(%rsp), %rax
leaq (%rax,%rax,2), %rax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rax,8), %rdi
leaq 0x138(%rsp), %rsi
callq 0x4b96a
movq 0x8(%rsp), %rax
incl %eax
movq %rax, 0x8(%rsp)
incl %ebx
decl %r13d
jne 0x2267f
incl %r15d
cmpl 0x24(%rsp), %r15d
jne 0x22654
jmp 0x227ad
movq $0x0, 0x8(%rsp)
callq 0x7543a
movq 0x8(%rsp), %r13
cmpl $0x3, %r13d
movq 0xa8(%rsp), %rbx
leaq 0x138(%rsp), %r15
leaq 0x180(%rsp), %r12
jl 0x22a39
movq %r12, %rdi
movl %r13d, %esi
movq 0x28(%rsp), %r14
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x2ae31
movq %r15, %rdi
movq %r12, %rsi
movl %r13d, %edx
movq %r14, %rcx
xorl %r8d, %r8d
leaq 0x50(%rsp), %r9
callq 0x2aebb
leaq 0xc0(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x4c0a6
leaq 0xd8(%rsp), %rdi
movq %r15, %rsi
callq 0x4c0a6
leaq 0x108(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x4a182
leaq 0x108(%rsp), %rdi
movq 0x2d8(%rsp), %rsi
callq 0x26f8f
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x22870
leaq 0xc0(%rsp), %rdi
callq 0x4c404
movsd 0xc0(%rsp), %xmm0
movq 0xa0(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
movq 0x18(%rsp), %rdx
imull %edx, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0xc8(%rsp), %xmm0
movq 0x2a0(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %edx, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0xd0(%rsp), %xmm0
movq 0x2a8(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %edx, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0xd8(%rsp), %xmm0
movq 0x2b0(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %edx, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0xe0(%rsp), %xmm0
movq 0x2b8(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %edx, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0xe8(%rsp), %xmm0
movq 0x2c0(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %edx, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x50(%rsp), %xmm0
ucomisd 0x9868b(%rip), %xmm0    # 0xbb010
jb 0x22990
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x22999
callq 0x11480
movapd %xmm0, %xmm1
mulsd 0x99877(%rip), %xmm1    # 0xbc218
movsd 0x58(%rsp), %xmm0
ucomisd 0x98661(%rip), %xmm0    # 0xbb010
jb 0x229b7
sqrtsd %xmm0, %xmm0
jmp 0x229c8
movsd %xmm1, 0x48(%rsp)
callq 0x11480
movsd 0x48(%rsp), %xmm1
mulsd 0x99848(%rip), %xmm0    # 0xbc218
movl 0x2f0(%rsp), %eax
cmpl $0x2, %eax
jl 0x229e5
divsd 0x90(%rsp), %xmm1
jl 0x229f0
divsd 0x90(%rsp), %xmm0
movq 0x2c8(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
movq 0x18(%rsp), %rdx
imull %edx, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd %xmm1, (%rax,%rcx,8)
movq 0x2d0(%rsp), %rcx
movq 0xb8(%rcx), %rax
movl 0xc8(%rcx), %ecx
imull %edx, %ecx
addl %ebx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0xc4(%rbp), %eax
movq 0x18(%rsp), %r14
incl %r14d
cmpl %eax, %r14d
jl 0x221a6
movl 0xc0(%rbp), %ecx
incl %ebx
incl 0x24(%rsp)
cmpl %ecx, %ebx
jl 0x2216b
movq 0x28(%rsp), %rdi
callq 0x117a0
leaq 0x198(%rsp), %rdi
callq 0x60264
movl $0x1, %eax
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x22abc
movq %rax, %rbx
movq %r13, %rdi
movq %r14, %rsi
callq 0x11b90
jmp 0x22adf
jmp 0x22abc
jmp 0x22abc
jmp 0x22abc
jmp 0x22abc
jmp 0x22abc
jmp 0x22ac5
jmp 0x22abc
jmp 0x22abc
jmp 0x22abc
jmp 0x22ac5
jmp 0x22ac5
jmp 0x22ac5
movq %rax, %rbx
jmp 0x22ad2
jmp 0x22ac5
jmp 0x22ac5
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x7543a
leaq 0x198(%rsp), %rdi
callq 0x60264
movq %rbx, %rdi
callq 0x11a60