// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreatePlanarGrids(gaps::R3SurfelPointGraph*, double, double, double, double, int, double, double)
RNArray<R3PlanarGrid *> *
CreatePlanarGrids(R3SurfelPointGraph *graph, 
  RNLength max_offplane_distance, RNAngle max_normal_angle,
  RNArea min_area, RNScalar min_density, int min_points,
  RNLength grid_spacing, RNScalar accuracy_factor)
{
  // Get convenient variables
  RNLength offplane_distance_sigma = 0.5 * max_offplane_distance;
  RNLength offplane_distance_sigma_squared = offplane_distance_sigma * offplane_distance_sigma;
  RNScalar offplane_distance_factor = (offplane_distance_sigma_squared != 0) ? 1.0 / (-2.0 * offplane_distance_sigma_squared) : 1;
  RNLength normal_angle_sigma = 0.5 * max_normal_angle;
  RNAngle normal_angle_sigma_squared = normal_angle_sigma * normal_angle_sigma;
  RNScalar normal_angle_factor = (normal_angle_sigma_squared != 0) ? 1.0 / (-2.0 * normal_angle_sigma_squared) : 1;

  // Determine number of samples
  if (min_points <= 1) min_points = 1;
  RNScalar max_grids = graph->NPoints();
  RNScalar bbox_volume = graph->BBox().Volume();
  if ((min_points > 0) && (graph->NPoints() / min_points < max_grids)) max_grids = graph->NPoints() / min_points;
  if ((min_area > 0) && (bbox_volume / min_area < max_grids)) max_grids = bbox_volume / min_area;
  int nsamples = (int) (accuracy_factor * 10.0 * max_grids) + 1;
  if (nsamples > graph->NPoints()) nsamples = graph->NPoints();

  // Create temporary data
  int *point_marks = new int [ graph->NPoints() ];
  R3Vector *point_normals = CreateNormals(graph, FALSE);
  R3Point *point_positions = new R3Point [ graph->NPoints() ];
  RNScalar *point_weights = new RNScalar [ graph->NPoints() ];
  R3PlanarGrid **point_grids = new R3PlanarGrid * [ graph->NPoints() ];
  SurfelPlanarGridData *grid_datas = new SurfelPlanarGridData [ nsamples ];
  for (int i = 0; i < graph->NPoints(); i++) point_marks[i] = 0;
  for (int i = 0; i < graph->NPoints(); i++) point_grids[i] = NULL;

  // Generate grid data
  int grid_data_count = 0;
  for (int iter = 0; iter < nsamples; iter++) {
    // Compute plane 
    int seed_index = (int) (RNRandomScalar() * graph->NPoints());
    if (point_marks[seed_index]) continue;
    if (graph->NNeighbors(seed_index) < 2) continue;
    R3SurfelPoint *seed = graph->Point(seed_index);
    R3Point seed_position = seed->Position();
    const R3Vector& seed_normal = point_normals[seed_index];
    if (R3Contains(seed_normal, R3zero_vector)) continue;
    R3Plane plane(seed_position, seed_normal);

    // Find positions of points near plane
    int point_count = 0;
    RNScalar total_weight = 0;
    for (int i = 0; i < graph->NPoints(); i++) {
      R3SurfelPoint *point = graph->Point(i);
      if (graph->NNeighbors(seed_index) < 2) continue;
      R3Point position = point->Position();
      RNScalar offplane_distance = R3Distance(plane, position);
      if (offplane_distance > max_offplane_distance) continue;
      const R3Vector& normal = point_normals[i];
      if (R3Contains(normal, R3zero_vector)) continue;
      RNScalar dot = fabs(normal.Dot(seed_normal));
      RNAngle normal_angle = (dot < 1) ? acos(dot) : 0;
      if (normal_angle > max_normal_angle) continue;
      RNScalar weight = 1;
      weight *= exp(offplane_distance_factor * offplane_distance * offplane_distance);
      weight *= exp(normal_angle_factor * normal_angle * normal_angle);
      total_weight += weight;
      point_positions[point_count] = position;
      point_weights[point_count] = weight;
      point_count++;
    }

    // Check number of points
    if (total_weight < min_points) continue;

    // Re-compute plane to fit points
    R3Point centroid = R3Centroid(point_count, point_positions, point_weights);
    R3Triad triad = R3PrincipleAxes(centroid, point_count, point_positions, point_weights);
    if (R3Contains(triad[2], R3zero_vector)) continue;
    plane.Reset(centroid, triad[2]);

    // Fill grid data
    SurfelPlanarGridData *grid_data = &grid_datas[grid_data_count];
    grid_data->points.Empty();
    grid_data->plane = plane;
    grid_data->bbox = R3null_box;
    grid_data->weight = 0;
    for (int i = 0; i < graph->NPoints(); i++) {
      R3SurfelPoint *point = graph->Point(i);
      int point_index = graph->PointIndex(point);
      if (graph->NNeighbors(point_index) < 2) continue;
      R3Point position = point->Position();
      RNScalar offplane_distance = R3Distance(plane, position);
      if (offplane_distance > max_offplane_distance) continue;
      const R3Vector& normal = point_normals[i];
      if (R3Contains(normal, R3zero_vector)) continue;
      RNScalar dot = fabs(normal.Dot(plane.Normal()));
      RNAngle normal_angle = (dot < 1) ? acos(dot) : 0;
      if (normal_angle > max_normal_angle) continue;
      RNScalar weight = 1;
      weight *= exp(offplane_distance_factor * offplane_distance * offplane_distance);
      weight *= exp(normal_angle_factor * normal_angle * normal_angle);
      grid_data->points.Insert(point);
      grid_data->bbox.Union(position);
      grid_data->weight += weight;
      point_marks[point_index]++;
    }

    // Check grid
    if (grid_data->weight < min_points) continue;

    // Add grid data
    grid_data_count++;
  }

  ////////////////////

  // Sort grid data
  if (grid_data_count > 0) {
    qsort(grid_datas, grid_data_count, sizeof(SurfelPlanarGridData), CompareSurfelPlanarGridDatas);
  }

  ////////////////////

  // Create array of grids
  RNArray<R3PlanarGrid *> *grids = new RNArray<R3PlanarGrid *>();
  if (!grids) {
    RNFail("Unable to allocate array of grids\n");
    return NULL;
  }

  // Create grids
  for (int i = 0; i < grid_data_count; i++) {
    int point_count = 0;
    SurfelPlanarGridData *grid_data = &grid_datas[i];
    R3PlanarGrid *grid = new R3PlanarGrid(grid_data->plane, grid_data->bbox, grid_spacing);
    for (int j = 0; j < grid_data->points.NEntries(); j++) {
      R3SurfelPoint *point = grid_data->points.Kth(j);
      int point_index = graph->PointIndex(point);
      if (graph->NNeighbors(point_index) < 2) continue;
      if (point_grids[point_index]) continue;
      point_grids[point_index] = grid;
      R3Point position = point->Position();
      RNScalar offplane_distance = R3Distance(grid_data->plane, position);
      if (offplane_distance > max_offplane_distance) continue;
      const R3Vector& normal = point_normals[point_index];
      if (R3Contains(normal, R3zero_vector)) continue;
      RNScalar dot = fabs(normal.Dot(grid_data->plane.Normal()));
      RNAngle normal_angle = (dot < 1) ? acos(dot) : 0;
      if (normal_angle > max_normal_angle) continue;
      RNScalar weight = 1;
      weight *= exp(offplane_distance_factor * offplane_distance * offplane_distance);
      weight *= exp(normal_angle_factor * normal_angle * normal_angle);
      grid->RasterizeWorldPoint(position, weight);
      point_count++;
    }

    // Check grid support
    if ((min_points > 0) && (point_count < min_points)) {
      delete grid;
      continue;
    }

    // Mask low-density areas and small-connected components
    if ((min_density > 0) || (min_area > 0)) {
      RNLength gridcell_per_meter = grid->WorldToGridScaleFactor();
      RNScalar min_grid_density = min_density / (gridcell_per_meter * gridcell_per_meter);
      RNScalar min_grid_area = min_area * gridcell_per_meter * gridcell_per_meter;
      grid->ConnectedComponentFilter(min_grid_density, min_grid_area, 0, 0, 0, R2_GRID_KEEP_VALUE);
      if (grid->Sum() == 0) { delete grid; continue; }
    }

    // Insert grid
    grids->Insert(grid);
  }

  ////////////////////

  // Delete temporary data
  delete [] point_marks;
  delete [] point_normals;
  delete [] point_positions;
  delete [] point_weights;
  delete [] point_grids;
  delete [] grid_datas;

  // Return grids
  return grids;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movsd %xmm5, 0x8(%rsp)
movsd %xmm4, 0xd8(%rsp)
movapd %xmm3, 0xe0(%rsp)
movaps %xmm2, 0xa0(%rsp)
movsd %xmm1, 0x70(%rsp)
movsd %xmm0, 0x88(%rsp)
movq %rdi, %rbx
cmpl $0x2, %esi
pushq $0x1
popq %rbp
cmovgel %esi, %ebp
addq $0x20, %rdi
movq 0x20(%rbx), %rax
cvtsi2sdl 0x18(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
callq *0x60(%rax)
movapd 0xa0(%rsp), %xmm2
movslq 0x18(%rbx), %rcx
movl %ecx, %eax
cltd
movl %ebp, 0x6c(%rsp)
idivl %ebp
cvtsi2sd %eax, %xmm1
minsd 0x28(%rsp), %xmm1
ucomisd 0xa2126(%rip), %xmm2    # 0xc8380
jbe 0x2626a
divsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x2626a
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd 0xa28a0(%rip), %xmm0    # 0xc8b18
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
leal 0x1(%rax), %edx
cmpl %eax, %ecx
cmovlel %ecx, %edx
movl %edx, 0x18(%rsp)
movq %rcx, %rdi
shlq $0x2, %rdi
testl %ecx, %ecx
pushq $-0x1
popq %r13
cmovsq %r13, %rdi
callq 0x13030
movq %rax, 0x78(%rsp)
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x251da
movq %rax, 0x80(%rsp)
movslq 0x18(%rbx), %r15
pushq $0x18
popq %rcx
movq %r15, %rax
mulq %rcx
movq %rax, %r14
cmovoq %r13, %r14
movq %r14, %rdi
callq 0x13030
movq %rax, 0x58(%rsp)
testq %r15, %r15
je 0x26315
imulq $0x18, %r15, %r15
xorl %r12d, %r12d
movq 0x58(%rsp), %rax
leaq (%rax,%r12), %rdi
callq 0x781ba
addq $0x18, %r12
cmpq %r12, %r15
jne 0x262e8
movl 0x18(%rbx), %ebp
movslq %ebp, %rax
leaq (,%rax,8), %r12
testl %eax, %eax
cmovsq %r13, %r12
jmp 0x26318
xorl %r12d, %r12d
movslq 0x18(%rsp), %r15
pushq $0x70
popq %rcx
movq %r15, %rax
mulq %rcx
movq %rax, %r14
seto %al
orq $0x8, %r14
testb %al, %al
cmovneq %r13, %r14
movq %r12, %rdi
callq 0x13030
movq %rax, 0x90(%rsp)
movq %r12, %rdi
callq 0x13030
movq %rax, 0x28(%rsp)
movq %r14, %rdi
callq 0x13030
movq %r15, (%rax)
movq %rax, 0x48(%rsp)
addq $0x8, %rax
movq %rax, 0x60(%rsp)
testl %r15d, %r15d
je 0x26395
imulq $-0x70, %r15, %r13
xorl %r12d, %r12d
movq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0x286b8
addq $-0x70, %r12
addq $0x70, %r15
cmpq %r12, %r13
jne 0x2637d
movl 0x18(%rbx), %ebp
movsd 0xa1d9b(%rip), %xmm3    # 0xc8138
movsd 0x88(%rsp), %xmm4
mulsd %xmm3, %xmm4
mulsd 0x70(%rsp), %xmm3
mulsd %xmm4, %xmm4
movsd 0xa2754(%rip), %xmm0    # 0xc8b10
mulsd %xmm3, %xmm3
movapd %xmm4, %xmm1
mulsd %xmm0, %xmm1
movsd 0xa1d78(%rip), %xmm5    # 0xc8148
mulsd %xmm3, %xmm0
movapd %xmm5, %xmm2
divsd %xmm1, %xmm2
xorpd %xmm6, %xmm6
cmpneqsd %xmm6, %xmm4
movapd %xmm5, %xmm1
divsd %xmm0, %xmm1
cmpneqsd %xmm6, %xmm3
andpd %xmm4, %xmm2
andnpd %xmm5, %xmm4
orpd %xmm2, %xmm4
movapd %xmm4, 0xb0(%rsp)
andpd %xmm3, %xmm1
andnpd %xmm5, %xmm3
orpd %xmm1, %xmm3
movapd %xmm3, 0xc0(%rsp)
xorl %eax, %eax
testl %ebp, %ebp
cmovlel %eax, %ebp
movq 0x28(%rsp), %rdx
movq 0x78(%rsp), %rcx
cmpq %rax, %rbp
je 0x2643b
andl $0x0, (%rcx,%rax,4)
incq %rax
jmp 0x2642d
xorl %eax, %eax
cmpq %rax, %rbp
je 0x2644c
andq $0x0, (%rdx,%rax,8)
incq %rax
jmp 0x2643d
cvtsi2sdl 0x6c(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
xorl %r15d, %r15d
movl 0x18(%rsp), %ebp
testl %ebp, %ebp
cmovlel %r15d, %ebp
xorl %r12d, %r12d
movl %ebp, 0x18(%rsp)
cmpl %ebp, %r15d
je 0x26910
callq 0x9c2ba
cvtsi2sdl 0x18(%rbx), %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movslq %eax, %r14
movq 0x78(%rsp), %rax
cmpl $0x0, (%rax,%r14,4)
jne 0x266ad
movq %r15, 0x8(%rsp)
movq 0x68(%rbx), %rax
movq %r14, %r15
shlq $0x4, %r15
cmpl $0x2, 0xc(%rax,%r15)
jl 0x266a8
movq 0x10(%rbx), %rsi
addq %r15, %rsi
leaq 0x190(%rsp), %r13
movq %r13, %rdi
callq 0x16310
imulq $0x18, %r14, %r14
movq 0x80(%rsp), %rbp
addq %rbp, %r14
movq %r14, %rdi
leaq 0xa9c6f(%rip), %rsi     # 0xd0158
callq 0x47124
testl %eax, %eax
jne 0x266a4
movq %r12, 0x40(%rsp)
leaq 0xf8(%rsp), %rdi
movq %r13, %rsi
movq %r14, 0x50(%rsp)
movq %r14, %rdx
callq 0x76e1c
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x38(%rsp)
movslq 0x18(%rbx), %rax
cmpq %rax, %r12
jge 0x2668e
movq 0x68(%rbx), %rax
cmpl $0x2, 0xc(%rax,%r15)
jl 0x2667e
movq 0x10(%rbx), %rsi
addq %r14, %rsi
leaq 0x130(%rsp), %r13
movq %r13, %rdi
callq 0x16310
movq %r13, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x49786
ucomisd 0x88(%rsp), %xmm0
ja 0x2667e
movsd %xmm0, 0x10(%rsp)
movq %rbp, %rdi
leaq 0xa9bca(%rip), %rsi     # 0xd0158
callq 0x47124
testl %eax, %eax
jne 0x2667e
movq %rbp, %rdi
movq 0x50(%rsp), %rsi
callq 0x78bf6
andpd 0xa1e20(%rip), %xmm0    # 0xc83d0
xorpd %xmm2, %xmm2
movsd 0xa1b8c(%rip), %xmm1    # 0xc8148
ucomisd %xmm0, %xmm1
jbe 0x265cb
callq 0x134a0
movapd %xmm0, %xmm2
ucomisd 0x70(%rsp), %xmm2
ja 0x2667e
movapd 0xb0(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm2, 0x30(%rsp)
callq 0x13900
movsd %xmm0, 0x10(%rsp)
movapd 0xc0(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
callq 0x13900
movapd %xmm0, %xmm1
mulsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movl 0x38(%rsp), %r13d
movslq %r13d, %rax
movq %rax, 0x30(%rsp)
imulq $0x18, %rax, %rdi
addq 0x58(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x784a6
movq 0x90(%rsp), %rax
movsd 0x10(%rsp), %xmm0
movq 0x30(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
incl %r13d
movl %r13d, 0x38(%rsp)
incq %r12
addq $0x10, %r14
addq $0x18, %rbp
jmp 0x2652b
movsd 0x98(%rsp), %xmm0
ucomisd 0x20(%rsp), %xmm0
jbe 0x266b5
movq 0x40(%rsp), %r12
movl 0x18(%rsp), %ebp
movq 0x8(%rsp), %r15
incl %r15d
jmp 0x2646f
leaq 0x178(%rsp), %r13
movq %r13, %rdi
movl 0x38(%rsp), %ebp
movl %ebp, %esi
movq 0x58(%rsp), %r14
movq %r14, %rdx
movq 0x90(%rsp), %r15
movq %r15, %rcx
callq 0x4d640
leaq 0x130(%rsp), %rdi
movq %r13, %rsi
movl %ebp, %edx
movq %r14, %rcx
movq %r15, %r8
xorl %r9d, %r9d
callq 0x4d6c9
leaq 0x160(%rsp), %r14
movq %r14, %rdi
leaq 0xa9a4d(%rip), %rsi     # 0xd0158
callq 0x47124
testl %eax, %eax
movq 0x40(%rsp), %r12
movl 0x18(%rsp), %ebp
jne 0x266a8
leaq 0xf8(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x7754a
movslq %r12d, %rax
imulq $0x70, %rax, %r15
movq 0x60(%rsp), %r12
leaq (%r12,%r15), %rdi
movq %rdi, 0x20(%rsp)
xorl %esi, %esi
callq 0x9a9cc
leaq (%r12,%r15), %rdi
addq $0x10, %rdi
movq %rbp, %rsi
callq 0x2865e
leaq (%r12,%r15), %r14
addq $0x30, %r14
movq %r14, %rdi
leaq 0xff277(%rip), %rsi     # 0x1259e8
callq 0x177ee
movq %r14, 0x50(%rsp)
andq $0x0, 0x38(%r14)
movq 0x80(%rsp), %rbp
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
movslq 0x18(%rbx), %rax
cmpq %rax, %r13
jge 0x268e7
movq 0x68(%rbx), %rax
cmpl $0x2, 0xc(%rax,%r12)
jl 0x268d7
movq 0x10(%rbx), %r15
addq %r12, %r15
leaq 0x118(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x16310
movq %r14, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x49786
movsd %xmm0, 0x10(%rsp)
ucomisd 0x88(%rsp), %xmm0
ja 0x268d2
movq %rbp, %rdi
leaq 0xa995f(%rip), %rsi     # 0xd0158
callq 0x47124
testl %eax, %eax
jne 0x268d2
movq %rbp, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x78bf6
andpd 0xa1bb2(%rip), %xmm0    # 0xc83d0
xorpd %xmm2, %xmm2
movsd 0xa191e(%rip), %xmm1    # 0xc8148
ucomisd %xmm0, %xmm1
jbe 0x26839
callq 0x134a0
movapd %xmm0, %xmm2
ucomisd 0x70(%rsp), %xmm2
ja 0x268d2
movapd 0xb0(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm2, 0x38(%rsp)
callq 0x13900
movsd %xmm0, 0x10(%rsp)
movapd 0xc0(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
callq 0x13900
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x1784c
movq 0x50(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x6464c
movsd 0x10(%rsp), %xmm0
addsd 0x68(%r14), %xmm0
movsd %xmm0, 0x68(%r14)
movq 0x78(%rsp), %rax
incl (%rax,%r13,4)
movq 0x8(%rsp), %r15
incq %r13
addq $0x10, %r12
addq $0x18, %rbp
jmp 0x26793
xorl %eax, %eax
movsd 0x98(%rsp), %xmm0
movq 0x20(%rsp), %rcx
ucomisd 0x68(%rcx), %xmm0
setbe %al
movq 0x40(%rsp), %r12
addl %eax, %r12d
movl 0x18(%rsp), %ebp
jmp 0x266ad
testl %r12d, %r12d
jle 0x2692c
movl %r12d, %esi
leaq 0x3c5(%rip), %rcx       # 0x26ce4
pushq $0x70
popq %rdx
movq 0x60(%rsp), %rdi
callq 0x139b0
pushq $0x10
popq %rdi
callq 0x134f0
movq %rax, 0x30(%rsp)
movq %rax, %rdi
callq 0x9a7ae
xorpd %xmm0, %xmm0
cmpltpd 0xe0(%rsp), %xmm0
xorpd %xmm1, %xmm1
cmpltpd 0xa0(%rsp), %xmm1
orpd %xmm0, %xmm1
xorl %eax, %eax
testl %r12d, %r12d
cmovlel %eax, %r12d
movss %xmm1, 0x50(%rsp)
movq %r12, 0x40(%rsp)
cmpq %r12, %rax
je 0x26bf3
movq %rax, 0x18(%rsp)
imulq $0x70, %rax, %r12
movl $0x240, %edi            # imm = 0x240
callq 0x134f0
movq %rax, %rdi
movq 0x60(%rsp), %rax
leaq (%rax,%r12), %rbp
addq $0x10, %rbp
leaq 0x30(%rax,%r12), %rdx
movq %rdi, 0x8(%rsp)
movq %rbp, %rsi
movsd 0xd8(%rsp), %xmm0
callq 0x6a47c
addq 0x60(%rsp), %r12
xorl %r13d, %r13d
movl $0x0, 0x20(%rsp)
movq 0x28(%rsp), %rdx
movslq 0xc(%r12), %rax
cmpq %rax, %r13
jge 0x26b17
movq (%r12), %rax
movq (%rax,%r13,8), %rsi
movq %rsi, %rax
subq 0x10(%rbx), %rax
movq 0x68(%rbx), %rcx
shrq $0x4, %rax
movslq %eax, %r15
movq %r15, %rax
shlq $0x4, %rax
cmpl $0x2, 0xc(%rcx,%rax)
jl 0x26b0f
cmpq $0x0, (%rdx,%r15,8)
jne 0x26b0f
movq 0x8(%rsp), %rax
movq %rax, (%rdx,%r15,8)
leaq 0x130(%rsp), %r14
movq %r14, %rdi
callq 0x16310
movq %r14, %rdi
movq %rbp, %rsi
callq 0x49786
ucomisd 0x88(%rsp), %xmm0
ja 0x26b0a
movsd %xmm0, 0x10(%rsp)
imulq $0x18, %r15, %r15
addq 0x80(%rsp), %r15
movq %r15, %rdi
leaq 0xa96f3(%rip), %rsi     # 0xd0158
callq 0x47124
testl %eax, %eax
jne 0x26b0a
movq %r15, %rdi
movq %rbp, %rsi
callq 0x78bf6
andpd 0xa194b(%rip), %xmm0    # 0xc83d0
xorpd %xmm2, %xmm2
movsd 0xa16b7(%rip), %xmm1    # 0xc8148
ucomisd %xmm0, %xmm1
jbe 0x26aa0
callq 0x134a0
movapd %xmm0, %xmm2
ucomisd 0x70(%rsp), %xmm2
ja 0x26b0a
movapd 0xb0(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm2, 0x38(%rsp)
callq 0x13900
movsd %xmm0, 0x10(%rsp)
movapd 0xc0(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
callq 0x13900
mulsd 0x10(%rsp), %xmm0
movq 0x8(%rsp), %rdi
leaq 0x130(%rsp), %rsi
xorl %edx, %edx
callq 0x28708
incl 0x20(%rsp)
movq 0x28(%rsp), %rdx
incq %r13
jmp 0x269d1
movl 0x20(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jge 0x26b45
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x6b18e
movl $0x240, %esi            # imm = 0x240
movq %r14, %rdi
callq 0x13500
movq 0x40(%rsp), %r12
jmp 0x26bca
testb $0x1, 0x50(%rsp)
movq 0x40(%rsp), %r12
je 0x26bbb
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x28760
movapd %xmm0, %xmm1
mulsd 0xa0(%rsp), %xmm1
mulsd %xmm0, %xmm1
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
movapd 0xe0(%rsp), %xmm0
divsd %xmm2, %xmm0
addq $0x130, %r15            # imm = 0x130
xorpd %xmm2, %xmm2
xorpd %xmm3, %xmm3
xorpd %xmm4, %xmm4
movq %r15, %rdi
movsd 0xa1f7e(%rip), %xmm5    # 0xc8b20
callq 0x8b300
movq %r15, %rdi
callq 0x84812
ucomisd 0xa17c9(%rip), %xmm0    # 0xc8380
jne 0x26bbb
jnp 0x26bd7
movq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1784c
movq 0x18(%rsp), %rax
incq %rax
jmp 0x26975
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x6b18e
movl $0x240, %esi            # imm = 0x240
movq %r14, %rdi
callq 0x13500
jmp 0x26bca
movq 0x78(%rsp), %rdi
callq 0x136a0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x26c0f
callq 0x136a0
movq 0x58(%rsp), %rdi
callq 0x136a0
movq 0x90(%rsp), %rdi
callq 0x136a0
movq 0x28(%rsp), %rdi
callq 0x136a0
movq 0x48(%rsp), %rax
movq (%rax), %rax
imulq $0x70, %rax, %r14
leaq 0x8(%r14), %rbx
testq %rax, %rax
je 0x26c5d
movq 0x48(%rsp), %r15
addq $-0x68, %r15
leaq (%r15,%r14), %rdi
callq 0x286f2
addq $-0x70, %r14
jne 0x26c4e
movq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x139f0
movq 0x30(%rsp), %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x10
popq %rsi
movq 0x30(%rsp), %rdi
jmp 0x26cd7
movq %rax, %rbx
testq %r12, %r12
je 0x26cb1
negq %r12
movq 0x48(%rsp), %r15
addq $-0x68, %r15
leaq (%r15,%r12), %rdi
callq 0x286f2
addq $-0x70, %r12
jne 0x26ca2
movq 0x48(%rsp), %rdi
jmp 0x26cc0
movq %rax, %rbx
movq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x139f0
jmp 0x26cdc
movq %rax, %rbx
movl $0x240, %esi            # imm = 0x240
movq 0x8(%rsp), %rdi
callq 0x13500
movq %rbx, %rdi
callq 0x138f0