// File: /workspace/github_cpp_makefile_star2_O3/ingowald[P]closestSurfacePointQueries/examples/benchmark.cpp
// Function: main
int main(int ac, char **av)
{
  if (ac != 2)
    throw std::runtime_error("usage: ./distanceTest <directory_with_dumps>");
  const std::string dir = av[1];

  loadTriangles(dir+"/triang_input.txt");
  loadPoints(dir+"/point_input.txt");

  bool couldLoadReference = true;
  try {
//     loadReference(dir+"/dennis.dist.txt");
    loadReference(dir+"/tim.xyzs.txt");
    loadDennis(dir+"/dennis.dist.txt");
  } catch (std::runtime_error e) {
    couldLoadReference = false;
    printf("********************** could NOT load reference results **********************\n");
  }

  
  auto begin = std::chrono::system_clock::now();
  std::cout << "creating embree query object" << std::endl;
  distance_query_scene scene
    = rtdqNewTriangleMeshdi(vertex_x.data(),vertex_y.data(),vertex_z.data(),1,
                            index_x.data(),index_y.data(),index_z.data(),1,
                            index_x.size());
  auto done_build = std::chrono::system_clock::now();

  result_dist.resize(point_x.size());
  result_x.resize(point_x.size());
  result_y.resize(point_x.size());
  result_z.resize(point_x.size());

  std::cout << "calling query (scalar)" << std::endl;
  rtdqComputeClosestPointsdi(scene,
                             // closest point:
                             result_x.data(),
                             result_y.data(),
                             result_z.data(),
                             1,
                             // distance:
                             result_dist.data(),1,
                             // no prim IDs
                             NULL,0,
                             // input: the query points
                             point_x.data(),point_y.data(),point_z.data(),1,
                             // num points:
                             point_x.size());
  auto done_all = std::chrono::system_clock::now();
  
  size_t numPoints = point_x.size();
  size_t numTriangles = index_x.size();

  std::chrono::duration<double> buildTime = done_build - begin;
  std::chrono::duration<double> queryTime = done_all   - done_build;
  std::cout << "time to build tree " << (1000.f*buildTime.count()) << "ms" << std::endl;
  std::cout << "time to query " << numPoints << " points: " << queryTime.count() << "s" << std::endl;
  std::cout << "(this is " << (1000000.f * queryTime.count()/numPoints) << " micro seconds/query)" << std::endl;

  if (couldLoadReference) {
  double most_further_tim_mag = 0.f;
  double most_further_tim_myDist;
  double most_further_tim_hisDist;
  double most_further_tim_input[3];
  double most_further_tim_result[3];

  double most_closer_tim_mag = 0.f;
  double most_closer_tim_myDist;
  double most_closer_tim_hisDist;
  double most_closer_tim_input[3];
  double most_closer_tim_result[3];


  double most_further_dennis_mag = 0.f;
  double most_further_dennis_myDist;
  double most_further_dennis_hisDist;
  double most_further_dennis_input[3];
  double most_further_dennis_result[3];

  double most_closer_dennis_mag = 0.f;
  double most_closer_dennis_myDist;
  double most_closer_dennis_hisDist;
  double most_closer_dennis_input[3];
  double most_closer_dennis_result[3];


  std::cout << "echcking ..." << std::endl;
  for (int i=0;i<point_x.size();i++) {

    printf("results for %8i: mine %18.16f    tim %18.16f    dennis %18.16f\n",i,result_dist[i],reference_dist[i],dennis_dist[i]);
    

    float closer_dennis = dennis_dist[i] - result_dist[i];
    if (closer_dennis > most_closer_dennis_mag) {
      most_closer_dennis_mag = closer_dennis;
      most_closer_dennis_input[0] = point_x[i];
      most_closer_dennis_input[1] = point_y[i];
      most_closer_dennis_input[2] = point_z[i];
      most_closer_dennis_result[0] = result_x[i];
      most_closer_dennis_result[1] = result_y[i];
      most_closer_dennis_result[2] = result_z[i];
      most_closer_dennis_myDist    = result_dist[i];
      most_closer_dennis_hisDist    = dennis_dist[i];
    }

    float further_dennis = result_dist[i] - dennis_dist[i];
    if (further_dennis > most_further_dennis_mag) {
      most_further_dennis_mag = further_dennis;
      most_further_dennis_input[0] = point_x[i];
      most_further_dennis_input[1] = point_y[i];
      most_further_dennis_input[2] = point_z[i];
      most_further_dennis_result[0] = result_x[i];
      most_further_dennis_result[1] = result_y[i];
      most_further_dennis_result[2] = result_z[i];
      most_further_dennis_myDist    = result_dist[i];
      most_further_dennis_hisDist    = dennis_dist[i];
    }

    float closer_tim = reference_dist[i] - result_dist[i];
    if (closer_tim > most_closer_tim_mag) {
      most_closer_tim_mag = closer_tim;
      most_closer_tim_input[0] = point_x[i];
      most_closer_tim_input[1] = point_y[i];
      most_closer_tim_input[2] = point_z[i];
      most_closer_tim_result[0] = result_x[i];
      most_closer_tim_result[1] = result_y[i];
      most_closer_tim_result[2] = result_z[i];
      most_closer_tim_myDist    = result_dist[i];
      most_closer_tim_hisDist    = reference_dist[i];
    }

    float further_tim = result_dist[i] - reference_dist[i];
    if (further_tim > most_further_tim_mag) {
      most_further_tim_mag = further_tim;
      most_further_tim_input[0] = point_x[i];
      most_further_tim_input[1] = point_y[i];
      most_further_tim_input[2] = point_z[i];
      most_further_tim_result[0] = result_x[i];
      most_further_tim_result[1] = result_y[i];
      most_further_tim_result[2] = result_z[i];
      most_further_tim_myDist    = result_dist[i];
      most_further_tim_hisDist    = reference_dist[i];
    }


  }
  printf("biggest dist (to tim) where we're closer: input %g %g %g ours %g %g %g dist %g his-dist %g\n",
         most_closer_tim_input[0],
         most_closer_tim_input[1],
         most_closer_tim_input[2],
         most_closer_tim_result[0],
         most_closer_tim_result[1],
         most_closer_tim_result[2],
         most_closer_tim_myDist,
         most_closer_tim_hisDist);
  printf("biggest dist (to tim) where we're further: input %g %g %g ours %g %g %g dist %g his-dist %g\n",
         most_further_tim_input[0],
         most_further_tim_input[1],
         most_further_tim_input[2],
         most_further_tim_result[0],
         most_further_tim_result[1],
         most_further_tim_result[2],
         most_further_tim_myDist,
         most_further_tim_hisDist);
         
  printf("biggest dist (to dennis) where we're closer: input %g %g %g ours %g %g %g dist %g his-dist %g\n",
         most_closer_dennis_input[0],
         most_closer_dennis_input[1],
         most_closer_dennis_input[2],
         most_closer_dennis_result[0],
         most_closer_dennis_result[1],
         most_closer_dennis_result[2],
         most_closer_dennis_myDist,
         most_closer_dennis_hisDist);
  printf("biggest dist (to dennis) where we're further: input %g %g %g ours %g %g %g dist %g his-dist %g\n",
         most_further_dennis_input[0],
         most_further_dennis_input[1],
         most_further_dennis_input[2],
         most_further_dennis_result[0],
         most_further_dennis_result[1],
         most_further_dennis_result[2],
         most_further_dennis_myDist,
         most_further_dennis_hisDist);
         
  }
  rtdqDestroy(scene);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
cmpl $0x2, %edi
jne 0x41ec
movq 0x8(%rsi), %rsi
leaq 0x70(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x452a
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x4606
leaq 0x5a83(%rip), %rsi      # 0x923d
leaq 0x48(%rsp), %rdi
callq 0x2320
leaq 0x48(%rsp), %rdi
callq 0x27ac
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x37e5
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21e0
leaq 0x48(%rsp), %rdi
movq %r15, (%rdi)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
callq 0x4606
leaq 0x5a49(%rip), %rsi      # 0x924f
leaq 0x48(%rsp), %rdi
callq 0x2320
leaq 0x48(%rsp), %rdi
callq 0x34ad
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x3831
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21e0
leaq 0x48(%rsp), %rdi
movq %r15, (%rdi)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
callq 0x4606
leaq 0x5a0e(%rip), %rsi      # 0x9260
leaq 0x48(%rsp), %rdi
callq 0x2320
leaq 0x48(%rsp), %rdi
callq 0x2fd0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x387d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21e0
leaq 0x48(%rsp), %rdi
movq %r15, (%rdi)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
callq 0x4606
leaq 0x59d0(%rip), %rsi      # 0x926e
leaq 0x48(%rsp), %rdi
callq 0x2320
leaq 0x48(%rsp), %rdi
callq 0x32a0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x38c9
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21e0
movb $0x1, %bpl
callq 0x2050
movq %rax, %r15
movq 0x86f5(%rip), %rbx      # 0xbfd0
leaq 0x599d(%rip), %rsi      # 0x927f
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x2200
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x86c3(%rip), %rdi      # 0xbfd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x88ef(%rip), %rdi      # 0xc210
movq 0x8900(%rip), %rsi      # 0xc228
movq 0x8911(%rip), %rdx      # 0xc240
movq 0x8922(%rip), %r8       # 0xc258
movq 0x8933(%rip), %r9       # 0xc270
movq 0x8944(%rip), %rax      # 0xc288
movq 0x8915(%rip), %rcx      # 0xc260
subq %r8, %rcx
sarq $0x2, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, (%rsp)
movq $0x1, 0x8(%rsp)
movl $0x1, %ecx
callq 0x4b8e
movq %rax, %rbx
callq 0x2050
movq %rax, %r14
movq 0x8850(%rip), %rsi      # 0xc1d0
subq 0x8841(%rip), %rsi      # 0xc1c8
sarq $0x3, %rsi
leaq 0x8956(%rip), %rdi      # 0xc2e8
callq 0x4568
movq 0x8832(%rip), %rsi      # 0xc1d0
subq 0x8823(%rip), %rsi      # 0xc1c8
sarq $0x3, %rsi
leaq 0x88f0(%rip), %rdi      # 0xc2a0
callq 0x4568
movq 0x8814(%rip), %rsi      # 0xc1d0
subq 0x8805(%rip), %rsi      # 0xc1c8
sarq $0x3, %rsi
leaq 0x88ea(%rip), %rdi      # 0xc2b8
callq 0x4568
movq 0x87f6(%rip), %rsi      # 0xc1d0
subq 0x87e7(%rip), %rsi      # 0xc1c8
sarq $0x3, %rsi
leaq 0x88e4(%rip), %rdi      # 0xc2d0
callq 0x4568
movq 0x85d8(%rip), %r12      # 0xbfd0
leaq 0x589d(%rip), %rsi      # 0x929c
movl $0x16, %edx
movq %r12, %rdi
callq 0x2200
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x85a5(%rip), %rdi      # 0xbfd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x8861(%rip), %rsi      # 0xc2a0
movq 0x8872(%rip), %rdx      # 0xc2b8
movq 0x8883(%rip), %rcx      # 0xc2d0
movq 0x8894(%rip), %r9       # 0xc2e8
movq 0x876d(%rip), %rax      # 0xc1c8
movq 0x877e(%rip), %rdi      # 0xc1e0
movq 0x878f(%rip), %r8       # 0xc1f8
movq 0x8760(%rip), %r10      # 0xc1d0
subq %rax, %r10
sarq $0x3, %r10
movq %r10, 0x38(%rsp)
movl $0x1, %r10d
movq %r10, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movq %rax, 0x18(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rsp)
movq %r10, (%rsp)
movl $0x1, %r8d
movq %rbx, %rdi
callq 0x51d0
callq 0x2050
movq %rax, %r13
movq 0x870f(%rip), %r12      # 0xc1d0
subq 0x8700(%rip), %r12      # 0xc1c8
movq 0x8501(%rip), %rdi      # 0xbfd0
leaq 0x57dd(%rip), %rsi      # 0x92b3
movl $0x13, %edx
callq 0x2200
movq %r14, %rax
subq %r15, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x5512(%rip), %xmm0     # 0x9008
mulsd 0x5512(%rip), %xmm0     # 0x9010
movq 0x84cb(%rip), %rdi      # 0xbfd0
callq 0x22a0
movq %rax, %r15
leaq 0x57b3(%rip), %rsi      # 0x92c7
movl $0x2, %edx
movq %rax, %rdi
callq 0x2200
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x8481(%rip), %rdi      # 0xbfd0
leaq 0x5774(%rip), %rsi      # 0x92ca
movl $0xe, %edx
callq 0x2200
sarq $0x3, %r12
movq 0x8465(%rip), %rdi      # 0xbfd0
movq %r12, %rsi
callq 0x2120
movq %rax, %r15
leaq 0x575c(%rip), %rsi      # 0x92d9
movl $0x9, %edx
movq %rax, %rdi
callq 0x2200
subq %r14, %r13
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
divsd 0x546b(%rip), %xmm0     # 0x9008
movq %r15, %rdi
movsd %xmm0, 0x68(%rsp)
callq 0x22a0
movq %rax, %r14
leaq 0x5564(%rip), %rsi      # 0x9119
movl $0x1, %edx
movq %rax, %rdi
callq 0x2200
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x83e0(%rip), %rdi      # 0xbfd0
leaq 0x56ec(%rip), %rsi      # 0x92e3
movl $0x9, %edx
callq 0x2200
movsd 0x68(%rsp), %xmm0
mulsd 0x5409(%rip), %xmm0     # 0x9018
movq %r12, %xmm2
punpckldq 0x5404(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x540c(%rip), %xmm2     # 0x9030
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq 0x8395(%rip), %rdi      # 0xbfd0
callq 0x22a0
movq %rax, %r14
leaq 0x56a3(%rip), %rsi      # 0x92ed
movl $0x15, %edx
movq %rax, %rdi
callq 0x2200
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
testb %bpl, %bpl
je 0x41af
movq 0x8342(%rip), %r14      # 0xbfd0
leaq 0x566e(%rip), %rsi      # 0x9303
movl $0xc, %edx
movq %r14, %rdi
callq 0x2200
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x8310(%rip), %rdi      # 0xbfd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x8614(%rip), %rcx      # 0xc2e8
movq 0x8625(%rip), %rdx      # 0xc300
xorpd %xmm0, %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0x8674(%rip), %rax      # 0xc360
xorl %r14d, %r14d
leaq 0x561a(%rip), %r15      # 0x9310
xorps %xmm0, %xmm0
movsd %xmm0, 0xa0(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x98(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x90(%rsp)
movsd (%rcx,%r14,8), %xmm0
movsd (%rdx,%r14,8), %xmm1
movsd (%rax,%r14,8), %xmm2
movq %r15, %rdi
movl %r14d, %esi
movb $0x3, %al
callq 0x2040
movq 0x8620(%rip), %rax      # 0xc360
movsd (%rax,%r14,8), %xmm1
movq 0x859b(%rip), %rcx      # 0xc2e8
movsd (%rcx,%r14,8), %xmm0
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd 0xa0(%rsp), %xmm2
movq 0x8455(%rip), %rsi      # 0xc1c8
jbe 0x3e11
movsd (%rsi,%r14,8), %xmm3
movsd %xmm3, 0x170(%rsp)
movq 0x8451(%rip), %rdx      # 0xc1e0
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x160(%rsp)
movq 0x8453(%rip), %rdx      # 0xc1f8
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x150(%rsp)
movq 0x84e5(%rip), %rdx      # 0xc2a0
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x168(%rsp)
movq 0x84e7(%rip), %rdx      # 0xc2b8
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x158(%rsp)
movq 0x84e9(%rip), %rdx      # 0xc2d0
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x148(%rsp)
movsd %xmm2, 0xa0(%rsp)
movsd %xmm0, 0x128(%rsp)
movsd %xmm1, 0x130(%rsp)
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd 0x98(%rsp), %xmm2
jbe 0x3ec8
movsd (%rsi,%r14,8), %xmm3
movsd %xmm3, 0x1a0(%rsp)
movq 0x839a(%rip), %rdx      # 0xc1e0
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x190(%rsp)
movq 0x839c(%rip), %rdx      # 0xc1f8
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x180(%rsp)
movq 0x842e(%rip), %rdx      # 0xc2a0
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x198(%rsp)
movq 0x8430(%rip), %rdx      # 0xc2b8
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x188(%rsp)
movq 0x8432(%rip), %rdx      # 0xc2d0
movsd (%rdx,%r14,8), %xmm3
movsd %xmm3, 0x178(%rsp)
movsd %xmm2, 0x98(%rsp)
movsd %xmm0, 0x138(%rsp)
movsd %xmm1, 0x140(%rsp)
movq 0x8431(%rip), %rdx      # 0xc300
movsd (%rdx,%r14,8), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd 0x90(%rsp), %xmm2
jbe 0x3f8c
movsd (%rsi,%r14,8), %xmm3
movsd %xmm3, 0xf0(%rsp)
movq 0x82d6(%rip), %rdi      # 0xc1e0
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0xe0(%rsp)
movq 0x82d8(%rip), %rdi      # 0xc1f8
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0xc8(%rsp)
movq 0x836a(%rip), %rdi      # 0xc2a0
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0xe8(%rsp)
movq 0x836c(%rip), %rdi      # 0xc2b8
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0xd8(%rsp)
movq 0x836e(%rip), %rdi      # 0xc2d0
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0xc0(%rsp)
movsd %xmm2, 0x90(%rsp)
movsd %xmm0, 0xa8(%rsp)
movsd %xmm1, 0xb0(%rsp)
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd 0x68(%rsp), %xmm2
jbe 0x403d
movsd (%rsi,%r14,8), %xmm3
movsd %xmm3, 0x120(%rsp)
movq 0x8222(%rip), %rdi      # 0xc1e0
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0x110(%rsp)
movq 0x8224(%rip), %rdi      # 0xc1f8
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0x100(%rsp)
movq 0x82b6(%rip), %rdi      # 0xc2a0
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0x118(%rsp)
movq 0x82b8(%rip), %rdi      # 0xc2b8
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0x108(%rsp)
movq 0x82ba(%rip), %rdi      # 0xc2d0
movsd (%rdi,%r14,8), %xmm3
movsd %xmm3, 0xf8(%rsp)
movsd %xmm0, 0xb8(%rsp)
movsd %xmm1, 0xd0(%rsp)
movsd %xmm2, 0x68(%rsp)
incq %r14
movq 0x8189(%rip), %rdi      # 0xc1d0
subq %rsi, %rdi
sarq $0x3, %rdi
cmpq %r14, %rdi
ja 0x3d1a
leaq 0x52f2(%rip), %rdi      # 0x9350
movsd 0xf0(%rsp), %xmm0
movsd 0xe0(%rsp), %xmm1
movsd 0xc8(%rsp), %xmm2
movsd 0xe8(%rsp), %xmm3
movsd 0xd8(%rsp), %xmm4
movsd 0xc0(%rsp), %xmm5
movsd 0xa8(%rsp), %xmm6
movsd 0xb0(%rsp), %xmm7
movb $0x8, %al
callq 0x2040
leaq 0x52f8(%rip), %rdi      # 0x93ac
movsd 0x120(%rsp), %xmm0
movsd 0x110(%rsp), %xmm1
movsd 0x100(%rsp), %xmm2
movsd 0x118(%rsp), %xmm3
movsd 0x108(%rsp), %xmm4
movsd 0xf8(%rsp), %xmm5
movsd 0xb8(%rsp), %xmm6
movsd 0xd0(%rsp), %xmm7
movb $0x8, %al
callq 0x2040
leaq 0x52ff(%rip), %rdi      # 0x9409
movsd 0x170(%rsp), %xmm0
movsd 0x160(%rsp), %xmm1
movsd 0x150(%rsp), %xmm2
movsd 0x168(%rsp), %xmm3
movsd 0x158(%rsp), %xmm4
movsd 0x148(%rsp), %xmm5
movsd 0x128(%rsp), %xmm6
movsd 0x130(%rsp), %xmm7
movb $0x8, %al
callq 0x2040
leaq 0x5308(%rip), %rdi      # 0x9468
movsd 0x1a0(%rsp), %xmm0
movsd 0x190(%rsp), %xmm1
movsd 0x180(%rsp), %xmm2
movsd 0x198(%rsp), %xmm3
movsd 0x188(%rsp), %xmm4
movsd 0x178(%rsp), %xmm5
movsd 0x138(%rsp), %xmm6
movsd 0x140(%rsp), %xmm7
movb $0x8, %al
callq 0x2040
movq %rbx, %rdi
callq 0x5359
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41d8
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21e0
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x5010(%rip), %rsi      # 0x9210
movq %rax, %rdi
callq 0x20a0
movq 0x7de1(%rip), %rsi      # 0xbff0
movq 0x7db2(%rip), %rdx      # 0xbfc8
movq %r14, %rdi
callq 0x22e0
movq %rax, %rbx
movq %r14, %rdi
callq 0x2150
jmp 0x42fd
jmp 0x423b
jmp 0x42d9
jmp 0x423b
jmp 0x425a
jmp 0x423b
movq %rdx, %r14
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x4260
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x4260
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x42dc
movq %rbx, %rdi
callq 0x2230
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x20c0
movq %rbx, %rdi
callq 0x20b0
leaq 0x5299(%rip), %rdi      # 0x9526
callq 0x2260
movq %r14, %rdi
callq 0x2338
callq 0x22d0
xorl %ebp, %ebp
jmp 0x38cc
jmp 0x42d9
jmp 0x42b0
jmp 0x42b0
jmp 0x42d9
jmp 0x42b0
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x42dc
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x42dc
jmp 0x42d9
movq %rax, %rbx
jmp 0x42fd
jmp 0x42d9
jmp 0x42d9
jmp 0x42d9
movq %rax, %rbx
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x42fd
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x22f0
nop