// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3MeshSearchTree.cpp
// Function: gaps::R3MeshSearchTree::FindAll(gaps::R3Point const&, gaps::R3Vector const&, gaps::RNArray<gaps::R3MeshIntersection*>&, double, double, int (*)(gaps::R3Point const&, gaps::R3Vector const&, gaps::R3Mesh*, gaps::R3MeshFace*, void*), void*, gaps::R3MeshFace*) const
void R3MeshSearchTree::
FindAll(const R3Point& query_position, const R3Vector& query_normal, RNArray<R3MeshIntersection *>& hits, 
  RNScalar min_distance_squared, RNScalar max_distance_squared, 
  int (*IsCompatible)(const R3Point&, const R3Vector&, R3Mesh *, R3MeshFace *, void *), void *compatible_data,
  R3MeshFace *face) const
{
  // Initialize hit info
  R3MeshIntersection hit;
  hit.type = R3_MESH_NULL_TYPE;

  // Check face normal
  const R3Vector& face_normal = mesh->FaceNormal(face);
  if (RNIsZero(face_normal.Dot(face_normal))) {
    // Face is degenerate -- assume centroid is closest point on face
    R3Point p = mesh->FaceCentroid(face);
    RNScalar distance_squared = DistanceSquared(query_position, p);
    if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
      hit.type = R3_MESH_FACE_TYPE;
      hit.face = face;
      hit.point = p;
    }
  }
  else {  
    // Check distance to plane
    const R3Plane& plane = mesh->FacePlane(face);
    RNScalar plane_signed_distance = R3SignedDistance(plane, query_position);
    RNScalar plane_distance_squared = plane_signed_distance * plane_signed_distance;
    if (plane_distance_squared >= max_distance_squared) return;

    // Check distance to bounding box
    RNScalar bbox_distance_squared = DistanceSquared(query_position, mesh->FaceBBox(face), max_distance_squared);
    if (bbox_distance_squared >= max_distance_squared) return;

    // Check compatibility 
    if (IsCompatible) {
      if (!(*IsCompatible)(query_position, query_normal, mesh, face, compatible_data)) return;
    }

    // Get face vertices
    R3MeshVertex *v0 = mesh->VertexOnFace(face, 0);
    R3MeshVertex *v1 = mesh->VertexOnFace(face, 1);
    R3MeshVertex *v2 = mesh->VertexOnFace(face, 2);

    // Get vertex positions
    const R3Point& p0 = mesh->VertexPosition(v0);
    const R3Point& p1 = mesh->VertexPosition(v1);
    const R3Point& p2 = mesh->VertexPosition(v2);

    // Project query point onto face plane
    const R3Vector& face_normal = mesh->FaceNormal(face);
    R3Point plane_point = query_position - plane_signed_distance * face_normal;

    // Check sides of edges
    R3Vector e0 = p1 - p0;
    e0.Normalize();
    R3Vector n0 = mesh->FaceNormal(face) % e0;
    R3Plane s0(p0, n0);
    RNScalar b0 = R3SignedDistance(s0, plane_point);
    R3Vector e1 = p2 - p1;
    e1.Normalize();
    R3Vector n1 = mesh->FaceNormal(face) % e1;
    R3Plane s1(p1, n1);
    RNScalar b1 = R3SignedDistance(s1, plane_point);
    R3Vector e2 = p0 - p2;
    e2.Normalize();
    R3Vector n2 = mesh->FaceNormal(face) % e2;
    R3Plane s2(p2, n2);
    RNScalar b2 = R3SignedDistance(s2, plane_point);

    // Consider plane_point's position in relation to edges of the triangle
    if ((b0 >= 0) && (b1 >= 0) && (b2 >= 0)) {
      // Point is inside face
      if (plane_distance_squared >= min_distance_squared) {
        hit.type = R3_MESH_FACE_TYPE;
        hit.vertex = NULL;
        hit.edge = NULL;
        hit.face = face;
        hit.point = plane_point;
        hit.t = sqrt(plane_distance_squared);
      }
    }
    else {
      // Point is outside face -- check each edge
      if (b0 < 0) {
        // Outside edge0
        R3Vector edge_vector = p1 - p0;
        RNScalar edge_length = edge_vector.Length();
        if (edge_length > 0) {
          edge_vector /= edge_length;
          R3Vector point_vector = plane_point - p0;
          RNScalar t = edge_vector.Dot(point_vector);
          if (t <= 0) {
            RNScalar distance_squared = DistanceSquared(query_position, p0);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_VERTEX_TYPE;
              hit.vertex = v0;
              hit.edge = mesh->EdgeOnVertex(hit.vertex, face);
              hit.face = face;
              hit.point = p0;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
          else if (t >= edge_length) {
            RNScalar distance_squared = DistanceSquared(query_position, p1);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_VERTEX_TYPE;
              hit.vertex = v1;
              hit.edge = mesh->EdgeOnVertex(hit.vertex, face);
              hit.face = face;
              hit.point = p1;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
          else {
            R3Point point = p0 + t * edge_vector;
            RNScalar distance_squared = DistanceSquared(query_position, point);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_EDGE_TYPE;
              hit.vertex = NULL;
              hit.edge = mesh->EdgeOnFace(face, 0);
              hit.face = face;
              hit.point = point;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
        }
      }
      if (b1 < 0) {
        // Outside edge1
        R3Vector edge_vector = p2 - p1;
        RNScalar edge_length = edge_vector.Length();
        if (edge_length > 0) {
          edge_vector /= edge_length;
          R3Vector point_vector = plane_point - p1;
          RNScalar t = edge_vector.Dot(point_vector);
          if (t <= 0) {
            RNScalar distance_squared = DistanceSquared(query_position, p1);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_VERTEX_TYPE;
              hit.vertex = v1;
              hit.edge = mesh->EdgeOnVertex(hit.vertex, face);
              hit.face = face;
              hit.point = p1;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
          else if (t >= edge_length) {
            RNScalar distance_squared = DistanceSquared(query_position, p2);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_VERTEX_TYPE;
              hit.vertex = v2;
              hit.edge = mesh->EdgeOnVertex(hit.vertex, face);
              hit.face = face;
              hit.point = p2;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
          else {
            R3Point point = p1 + t * edge_vector;
            RNScalar distance_squared = DistanceSquared(query_position, point);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_EDGE_TYPE;
              hit.vertex = NULL;
              hit.edge = mesh->EdgeOnFace(face, 1);
              hit.face = face;
              hit.point = point;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
        }
      }
      if (b2 < 0) {
        // Outside edge2
        R3Vector edge_vector = p0 - p2;
        RNScalar edge_length = edge_vector.Length();
        if (edge_length > 0) {
          edge_vector /= edge_length;
          R3Vector point_vector = plane_point - p2;
          RNScalar t = edge_vector.Dot(point_vector);
          if (t <= 0) {
            RNScalar distance_squared = DistanceSquared(query_position, p2);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_VERTEX_TYPE;
              hit.vertex = v2;
              hit.edge = mesh->EdgeOnVertex(hit.vertex, face);
              hit.face = face;
              hit.point = p2;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
          else if (t >= edge_length) {
            RNScalar distance_squared = DistanceSquared(query_position, p0);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_VERTEX_TYPE;
              hit.vertex = v0;
              hit.edge = mesh->EdgeOnVertex(hit.vertex, face);
              hit.face = face;
              hit.point = p0;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
          else {
            R3Point point = p2 + t * edge_vector;
            RNScalar distance_squared = DistanceSquared(query_position, point);
            if ((distance_squared >= min_distance_squared) && (distance_squared < max_distance_squared)) {
              hit.type = R3_MESH_EDGE_TYPE;
              hit.vertex = NULL;
              hit.edge = mesh->EdgeOnFace(face, 2);
              hit.face = face;
              hit.point = point;
              hit.t = sqrt(distance_squared);
              max_distance_squared = distance_squared;
            }
          }
        }
      }
    }
  }
  
  // Insert hit
  if (hit.type != R3_MESH_NULL_TYPE) {
    hits.Insert(new R3MeshIntersection(hit));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %r9, %r14
movq %r8, %rbx
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x28(%rsp)
movq %rcx, 0xd8(%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, 0x10(%rsp)
movq 0x250(%rsp), %r15
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
callq 0x508cc
movl $0x0, -0x20(%rbp)
testb $0x4, 0xa8(%r15)
jne 0x17934
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x2c8(%rax)
leaq 0x38(%r15), %rbp
movq %rbp, %rdi
movq %rbp, %rsi
callq 0x515fe
leaq 0xd825e(%rip), %rax     # 0xefba8
movsd (%rax), %xmm1
movapd 0x926da(%rip), %xmm2    # 0xaa030
xorpd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jb 0x17a4c
ucomisd %xmm0, %xmm1
jb 0x17a4c
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x128(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rdx
callq 0x24280
movsd (%r13), %xmm1
movsd 0x8(%r13), %xmm2
subsd (%rbx), %xmm1
subsd 0x8(%rbx), %xmm2
movsd 0x10(%r13), %xmm0
subsd 0x10(%rbx), %xmm0
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x28(%rsp), %xmm0
jb 0x179f0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x179f0
movl $0x3, 0x40(%rsp)
movq %r15, 0x58(%rsp)
leaq 0x128(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x50c3c
cmpl $0x0, 0x40(%rsp)
je 0x17d8d
movl $0x40, %edi
callq 0xe440
movq %rax, %rbx
movups 0x40(%rsp), %xmm0
movupd 0x50(%rsp), %xmm1
movups %xmm0, (%rax)
movupd %xmm1, 0x10(%rax)
leaq 0x20(%rax), %rdi
leaq 0x60(%rsp), %rsi
callq 0x508de
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x38(%rbx)
movq 0xd8(%rsp), %rdi
movl 0xc(%rdi), %edx
movq %rbx, %rsi
callq 0x7855a
jmp 0x17d8d
testb $0x4, 0xa8(%r15)
jne 0x17a6a
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x2c8(%rax)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2101b
movsd %xmm0, 0x18(%rsp)
mulsd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
ucomisd 0x8(%rsp), %xmm0
jae 0x17d8d
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %r15, %rsi
callq 0x25d8e
movq %r13, %rsi
movq %rax, %rdx
movsd 0x8(%rsp), %xmm0
callq 0x17242
ucomisd 0x8(%rsp), %xmm0
jae 0x17d8d
testq %rbx, %rbx
je 0x17ae1
movq 0x10(%rsp), %rax
movq (%rax), %rdx
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rcx
movq %r14, %r8
callq *%rbx
testl %eax, %eax
je 0x17d8d
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x18(%r15), %rbx
movq %rax, 0x90(%rsp)
leaq 0x18(%rax), %r14
movq %rcx, 0x80(%rsp)
leaq 0x18(%rcx), %rax
movq %rax, 0x30(%rsp)
testb $0x4, 0xa8(%r15)
jne 0x17b28
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x2c8(%rax)
movq %rbx, 0x88(%rsp)
leaq 0x18(%rbx), %r12
leaq 0x128(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movsd 0x18(%rsp), %xmm0
callq 0x51d36
leaq 0xb8(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x512f5
leaq 0x178(%rsp), %rbx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movq %r14, 0x18(%rsp)
movq %r14, %rdx
callq 0x50b30
movq %rbx, %rdi
callq 0x51688
testb $0x4, 0xa8(%r15)
jne 0x17ba3
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x2c8(%rax)
leaq 0x1c0(%rsp), %rbx
leaq 0x178(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x51cba
leaq 0x128(%rsp), %r14
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movq %rbx, %rdx
callq 0x4f44e
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
callq 0x2101b
movsd %xmm0, 0xd0(%rsp)
leaq 0x160(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq 0x30(%rsp), %rdx
callq 0x50b30
movq %rbx, %rdi
callq 0x51688
testb $0x4, 0xa8(%r15)
jne 0x17c2d
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x2c8(%rax)
leaq 0x1a8(%rsp), %rbx
leaq 0x160(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x51cba
leaq 0x1f8(%rsp), %r14
movq %r14, %rdi
movq 0x30(%rsp), %rsi
movq %rbx, %rdx
callq 0x4f44e
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
callq 0x2101b
movsd %xmm0, 0x98(%rsp)
leaq 0x148(%rsp), %rbx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movq %r12, %rdx
callq 0x50b30
movq %rbx, %rdi
callq 0x51688
testb $0x4, 0xa8(%r15)
jne 0x17cb7
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x2c8(%rax)
leaq 0x190(%rsp), %rbx
leaq 0x148(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x51cba
leaq 0x1d8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rbp
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4f44e
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
callq 0x2101b
movapd %xmm0, %xmm2
xorpd %xmm0, %xmm0
movsd 0xd0(%rsp), %xmm3
ucomisd %xmm0, %xmm3
jb 0x17d9f
movsd 0x98(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x17d9f
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm2
jb 0x17d9f
movsd 0x38(%rsp), %xmm0
ucomisd 0x28(%rsp), %xmm0
jb 0x179f0
movl $0x3, 0x40(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x48(%rsp)
movq %r15, 0x58(%rsp)
leaq 0xb8(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x50c3c
xorpd %xmm0, %xmm0
movsd 0x38(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
jb 0x18621
sqrtsd %xmm0, %xmm0
jmp 0x18626
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
ucomisd %xmm3, %xmm0
movsd %xmm2, 0x20(%rsp)
jbe 0x18064
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movq 0x18(%rsp), %r14
movq %r14, %rdx
callq 0x50b30
movq %rbx, %rdi
callq 0x5146c
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x18086
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movsd %xmm0, 0x38(%rsp)
callq 0x51f94
movq %r14, %rdx
leaq 0x110(%rsp), %r14
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
callq 0x50b30
movq %rbx, %rdi
movq %r14, %rsi
callq 0x515fe
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x17efd
ucomisd 0x38(%rsp), %xmm0
jae 0x17fa5
leaq 0xf8(%rsp), %rbx
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x51d36
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movq %rbx, %rdx
callq 0x50c19
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
subsd (%r14), %xmm0
subsd 0x8(%r14), %xmm1
movsd 0x10(%r13), %xmm3
subsd 0x10(%r14), %xmm3
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm3, %xmm3
addsd %xmm0, %xmm3
ucomisd 0x28(%rsp), %xmm3
jb 0x18631
movsd 0x8(%rsp), %xmm0
ucomisd %xmm3, %xmm0
movq 0x18(%rsp), %r14
movsd 0x20(%rsp), %xmm2
jbe 0x1808c
movl $0x2, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x20(%r15), %rax
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0xe0(%rsp), %rsi
leaq 0x60(%rsp), %rdi
movsd %xmm3, 0x8(%rsp)
jmp 0x18046
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movq 0x90(%rsp), %rax
subsd 0x18(%rax), %xmm0
subsd 0x20(%rax), %xmm1
movsd 0x10(%r13), %xmm3
subsd 0x28(%rax), %xmm3
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm3, %xmm3
addsd %xmm0, %xmm3
ucomisd 0x28(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
jb 0x18064
movsd 0x8(%rsp), %xmm0
ucomisd %xmm3, %xmm0
movq 0x18(%rsp), %r14
jbe 0x1808c
movl $0x1, 0x40(%rsp)
movq 0x90(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %r15, %rdx
xorl %ecx, %ecx
movsd %xmm3, 0x8(%rsp)
callq 0x25f04
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
jmp 0x18046
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movq 0x80(%rsp), %rax
subsd 0x18(%rax), %xmm0
subsd 0x20(%rax), %xmm1
movsd 0x10(%r13), %xmm3
subsd 0x28(%rax), %xmm3
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm3, %xmm3
addsd %xmm0, %xmm3
ucomisd 0x28(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
jb 0x18064
movsd 0x8(%rsp), %xmm0
ucomisd %xmm3, %xmm0
movq 0x18(%rsp), %r14
jbe 0x1808c
movl $0x1, 0x40(%rsp)
movq 0x80(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %r15, %rdx
xorl %ecx, %ecx
movsd %xmm3, 0x8(%rsp)
callq 0x25f04
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x50c3c
movsd 0x8(%rsp), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0x1806b
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0x1807a
movq 0x18(%rsp), %r14
jmp 0x1808c
movapd %xmm1, %xmm0
callq 0xe340
movsd 0x8(%rsp), %xmm1
movsd %xmm0, 0x78(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd 0x20(%rsp), %xmm2
movq 0x30(%rsp), %r12
xorpd %xmm1, %xmm1
ucomisd 0x98(%rsp), %xmm1
jbe 0x1838d
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x50b30
movq %rbx, %rdi
callq 0x5146c
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x181eb
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movsd %xmm0, 0x38(%rsp)
callq 0x51f94
leaq 0x110(%rsp), %r14
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x50b30
movq %rbx, %rdi
movq %r14, %rsi
callq 0x515fe
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x181f6
ucomisd 0x38(%rsp), %xmm0
jae 0x182a0
leaq 0xf8(%rsp), %rbx
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x51d36
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
movq 0x30(%rsp), %rsi
movq %rbx, %rdx
callq 0x50c19
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
subsd (%r14), %xmm0
subsd 0x8(%r14), %xmm1
movsd 0x10(%r13), %xmm3
subsd 0x10(%r14), %xmm3
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm3, %xmm3
addsd %xmm0, %xmm3
ucomisd 0x28(%rsp), %xmm3
jb 0x1863b
movsd 0x8(%rsp), %xmm0
ucomisd %xmm3, %xmm0
movq 0x18(%rsp), %r14
movsd 0x20(%rsp), %xmm2
jbe 0x18389
movl $0x2, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x28(%r15), %rax
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0xe0(%rsp), %rsi
leaq 0x60(%rsp), %rdi
movsd %xmm3, 0x8(%rsp)
jmp 0x18343
movsd 0x20(%rsp), %xmm2
jmp 0x1838d
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movq 0x80(%rsp), %rax
subsd 0x18(%rax), %xmm0
subsd 0x20(%rax), %xmm1
movsd 0x10(%r13), %xmm3
subsd 0x28(%rax), %xmm3
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm3, %xmm3
addsd %xmm0, %xmm3
ucomisd 0x28(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
jb 0x18384
movsd 0x8(%rsp), %xmm0
ucomisd %xmm3, %xmm0
movq 0x18(%rsp), %r14
jbe 0x18389
movl $0x1, 0x40(%rsp)
movq 0x80(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %r15, %rdx
xorl %ecx, %ecx
movsd %xmm3, 0x8(%rsp)
callq 0x25f04
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq 0x30(%rsp), %rsi
jmp 0x18343
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movq 0x88(%rsp), %rax
subsd 0x18(%rax), %xmm0
subsd 0x20(%rax), %xmm1
movsd 0x10(%r13), %xmm3
subsd 0x28(%rax), %xmm3
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm3, %xmm3
addsd %xmm0, %xmm3
ucomisd 0x28(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
jb 0x18384
movsd 0x8(%rsp), %xmm0
ucomisd %xmm3, %xmm0
movq 0x18(%rsp), %r14
jbe 0x18389
movl $0x1, 0x40(%rsp)
movq 0x88(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %r15, %rdx
xorl %ecx, %ecx
movsd %xmm3, 0x8(%rsp)
callq 0x25f04
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %rbp, %rsi
callq 0x50c3c
movsd 0x8(%rsp), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0x18361
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0x18370
movapd %xmm1, %xmm0
callq 0xe340
movsd 0x8(%rsp), %xmm1
movsd %xmm0, 0x78(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd 0x20(%rsp), %xmm2
jmp 0x18389
movq 0x18(%rsp), %r14
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
jbe 0x179f0
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x50b30
movq %rbx, %rdi
callq 0x5146c
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x179f0
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movsd %xmm0, 0x38(%rsp)
callq 0x51f94
leaq 0x110(%rsp), %r14
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
movq %rbp, %rdx
callq 0x50b30
movq %rbx, %rdi
movq %r14, %rsi
callq 0x515fe
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x184d1
ucomisd 0x38(%rsp), %xmm0
jae 0x1856e
leaq 0xf8(%rsp), %rbx
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x51d36
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x50c19
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
subsd (%r14), %xmm0
subsd 0x8(%r14), %xmm1
movsd 0x10(%r13), %xmm2
subsd 0x10(%r14), %xmm2
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
ucomisd 0x28(%rsp), %xmm2
jb 0x179f0
movsd 0x8(%rsp), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x179f0
movl $0x2, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x30(%r15), %rax
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0xe0(%rsp), %rsi
leaq 0x60(%rsp), %rdi
movsd %xmm2, 0x10(%rsp)
jmp 0x18608
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movq 0x88(%rsp), %rax
subsd 0x18(%rax), %xmm0
subsd 0x20(%rax), %xmm1
movsd 0x10(%r13), %xmm2
subsd 0x28(%rax), %xmm2
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
ucomisd 0x28(%rsp), %xmm2
jb 0x179f0
movsd 0x8(%rsp), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x179f0
movl $0x1, 0x40(%rsp)
movq 0x88(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %r15, %rdx
xorl %ecx, %ecx
movsd %xmm2, 0x10(%rsp)
callq 0x25f04
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %rbp, %rsi
jmp 0x18608
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movq 0x90(%rsp), %rax
subsd 0x18(%rax), %xmm0
subsd 0x20(%rax), %xmm1
movsd 0x10(%r13), %xmm2
subsd 0x28(%rax), %xmm2
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
ucomisd 0x28(%rsp), %xmm2
jb 0x179f0
movsd 0x8(%rsp), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x179f0
movl $0x1, 0x40(%rsp)
movq 0x90(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %r15, %rdx
xorl %ecx, %ecx
movsd %xmm2, 0x10(%rsp)
callq 0x25f04
movq %rax, 0x50(%rsp)
movq %r15, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x50c3c
movsd 0x10(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x17d84
callq 0xe340
movsd %xmm0, 0x78(%rsp)
jmp 0x179f0
movq 0x18(%rsp), %r14
jmp 0x18086
movq 0x18(%rsp), %r14
jmp 0x1837c
movq %rax, %r14
movl $0x40, %esi
movq %rbx, %rdi
callq 0xe450
movq %r14, %rdi
callq 0xe7f0
nop