// File: /workspace/github_cpp_makefile_star2_O2/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 0x3b02
movq 0x8(%rsi), %rsi
leaq 0x188(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x3d44
leaq 0x4fdd(%rip), %rdx      # 0x823d
leaq 0x50(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x3d7f
leaq 0x50(%rsp), %rdi
callq 0x278c
leaq 0x50(%rsp), %rdi
callq 0x20e0
leaq 0x4fc2(%rip), %rdx      # 0x824f
leaq 0x50(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x3d7f
leaq 0x50(%rsp), %rdi
callq 0x306e
leaq 0x50(%rsp), %rdi
callq 0x20e0
leaq 0x4fa6(%rip), %rdx      # 0x8260
leaq 0x50(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x3d7f
leaq 0x50(%rsp), %rdi
callq 0x2d0b
leaq 0x50(%rsp), %rdi
callq 0x20e0
leaq 0x4f87(%rip), %rdx      # 0x826e
leaq 0x50(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x3d7f
leaq 0x50(%rsp), %rdi
callq 0x2ee5
leaq 0x50(%rsp), %rdi
callq 0x20e0
movb $0x1, %bpl
callq 0x2040
movq %rax, %r15
movq 0x8cb1(%rip), %rdi      # 0xbfd0
leaq 0x4f59(%rip), %rsi      # 0x827f
callq 0x21c0
movq %rax, %rdi
callq 0x20f0
movq 0x8ef6(%rip), %rdi      # 0xc230
movq 0x8f07(%rip), %rsi      # 0xc248
movq 0x8f18(%rip), %rdx      # 0xc260
movq 0x8f29(%rip), %r8       # 0xc278
movq 0x8f3a(%rip), %r9       # 0xc290
movq 0x8f4b(%rip), %rax      # 0xc2a8
movq 0x8f1c(%rip), %rcx      # 0xc280
subq %r8, %rcx
sarq $0x2, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, (%rsp)
movq $0x1, 0x8(%rsp)
pushq $0x1
popq %r12
movq %r12, %rcx
callq 0x4454
movq %rax, %rbx
callq 0x2040
movq %rax, %r14
movq 0x8e55(%rip), %rsi      # 0xc1f0
subq 0x8e46(%rip), %rsi      # 0xc1e8
sarq $0x3, %rsi
leaq 0x8f5b(%rip), %rdi      # 0xc308
callq 0x3dc2
movq 0x8e37(%rip), %rsi      # 0xc1f0
subq 0x8e28(%rip), %rsi      # 0xc1e8
sarq $0x3, %rsi
leaq 0x8ef5(%rip), %rdi      # 0xc2c0
callq 0x3dc2
movq 0x8e19(%rip), %rsi      # 0xc1f0
subq 0x8e0a(%rip), %rsi      # 0xc1e8
sarq $0x3, %rsi
leaq 0x8eef(%rip), %rdi      # 0xc2d8
callq 0x3dc2
movq 0x8dfb(%rip), %rsi      # 0xc1f0
subq 0x8dec(%rip), %rsi      # 0xc1e8
sarq $0x3, %rsi
leaq 0x8ee9(%rip), %rdi      # 0xc2f0
callq 0x3dc2
movq 0x8bbd(%rip), %rdi      # 0xbfd0
leaq 0x4e82(%rip), %rsi      # 0x829c
callq 0x21c0
movq %rax, %rdi
callq 0x20f0
movq 0x8e92(%rip), %rsi      # 0xc2c0
movq 0x8ea3(%rip), %rdx      # 0xc2d8
movq 0x8eb4(%rip), %rcx      # 0xc2f0
movq 0x8ec5(%rip), %r9       # 0xc308
movq 0x8d9e(%rip), %rax      # 0xc1e8
movq 0x8daf(%rip), %rdi      # 0xc200
movq 0x8dc0(%rip), %r8       # 0xc218
movq 0x8d91(%rip), %r10      # 0xc1f0
subq %rax, %r10
sarq $0x3, %r10
movq %r10, 0x38(%rsp)
movq %r12, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movq %rax, 0x18(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rsp)
movq %r12, (%rsp)
movq %rbx, %rdi
movq %r12, %r8
callq 0x496a
callq 0x2040
movq %rax, %r13
movq 0x8d49(%rip), %r12      # 0xc1f0
subq 0x8d3a(%rip), %r12      # 0xc1e8
movq 0x8b1b(%rip), %rdi      # 0xbfd0
leaq 0x4df7(%rip), %rsi      # 0x82b3
callq 0x21c0
movq %r14, %rcx
subq %r15, %rcx
cvtsi2sd %rcx, %xmm0
divsd 0x4b34(%rip), %xmm0     # 0x8008
mulsd 0x4b34(%rip), %xmm0     # 0x8010
movq %rax, %rdi
callq 0x22c0
leaq 0x4ddc(%rip), %rsi      # 0x82c7
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x20f0
movq 0x8ace(%rip), %rdi      # 0xbfd0
leaq 0x4dc1(%rip), %rsi      # 0x82ca
callq 0x21c0
sarq $0x3, %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x2130
leaq 0x4db5(%rip), %rsi      # 0x82d9
movq %rax, %rdi
callq 0x21c0
subq %r14, %r13
cvtsi2sd %r13, %xmm0
divsd 0x4acc(%rip), %xmm0     # 0x8008
movq %rax, %rdi
movsd %xmm0, 0x48(%rsp)
callq 0x22c0
leaq 0x4bc8(%rip), %rsi      # 0x8119
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x20f0
movq 0x8a68(%rip), %rdi      # 0xbfd0
leaq 0x4d74(%rip), %rsi      # 0x82e3
callq 0x21c0
movsd 0x48(%rsp), %xmm0
mulsd 0x4a96(%rip), %xmm0     # 0x8018
movq %r12, %xmm2
punpckldq 0x4a91(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x4a99(%rip), %xmm2     # 0x8030
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x22c0
leaq 0x4d37(%rip), %rsi      # 0x82ed
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x20f0
testb %bpl, %bpl
je 0x3ad9
movq 0x89fa(%rip), %rdi      # 0xbfd0
leaq 0x4d26(%rip), %rsi      # 0x8303
callq 0x21c0
movq %rax, %rdi
callq 0x20f0
xorpd %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
xorl %r14d, %r14d
leaq 0x4d12(%rip), %r15      # 0x8310
xorps %xmm0, %xmm0
movsd %xmm0, 0x80(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0x8bcc(%rip), %rax      # 0xc1f0
subq 0x8bbd(%rip), %rax      # 0xc1e8
sarq $0x3, %rax
cmpq %r14, %rax
jbe 0x3981
movq 0x8cc9(%rip), %rax      # 0xc308
movsd (%rax,%r14,8), %xmm0
movq 0x8cd4(%rip), %rax      # 0xc320
movsd (%rax,%r14,8), %xmm1
movq 0x8d27(%rip), %rax      # 0xc380
movsd (%rax,%r14,8), %xmm2
movq %r15, %rdi
movl %r14d, %esi
movb $0x3, %al
callq 0x2030
movq 0x8d0d(%rip), %rax      # 0xc380
movsd (%rax,%r14,8), %xmm1
movq 0x8c88(%rip), %rax      # 0xc308
movsd (%rax,%r14,8), %xmm0
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd 0x78(%rsp), %xmm2
jbe 0x373e
movq 0x8b3f(%rip), %rax      # 0xc1e8
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0xf0(%rsp)
movq 0x8b41(%rip), %rax      # 0xc200
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0xf8(%rsp)
movq 0x8b43(%rip), %rax      # 0xc218
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x100(%rsp)
movq 0x8bd5(%rip), %rax      # 0xc2c0
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0xc8(%rsp)
movq 0x8bd7(%rip), %rax      # 0xc2d8
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0xd0(%rsp)
movq 0x8bd9(%rip), %rax      # 0xc2f0
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0xd8(%rsp)
movsd %xmm2, 0x78(%rsp)
movsd %xmm0, 0xe8(%rsp)
movsd %xmm1, 0xe0(%rsp)
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd 0x80(%rsp), %xmm2
jbe 0x37fc
movq 0x8a84(%rip), %rax      # 0xc1e8
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x170(%rsp)
movq 0x8a86(%rip), %rax      # 0xc200
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x178(%rsp)
movq 0x8a88(%rip), %rax      # 0xc218
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x180(%rsp)
movq 0x8b1a(%rip), %rax      # 0xc2c0
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x148(%rsp)
movq 0x8b1c(%rip), %rax      # 0xc2d8
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x150(%rsp)
movq 0x8b1e(%rip), %rax      # 0xc2f0
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x158(%rsp)
movsd %xmm2, 0x80(%rsp)
movsd %xmm0, 0x168(%rsp)
movsd %xmm1, 0x160(%rsp)
movq 0x8b1d(%rip), %rax      # 0xc320
movsd (%rax,%r14,8), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd 0x48(%rsp), %xmm2
jbe 0x38c1
movq 0x89bc(%rip), %rax      # 0xc1e8
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0xb0(%rsp)
movq 0x89be(%rip), %rax      # 0xc200
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0xb8(%rsp)
movq 0x89c0(%rip), %rax      # 0xc218
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0xc0(%rsp)
movq 0x8a52(%rip), %rax      # 0xc2c0
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x88(%rsp)
movq 0x8a54(%rip), %rax      # 0xc2d8
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x90(%rsp)
movq 0x8a56(%rip), %rax      # 0xc2f0
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x98(%rsp)
movsd %xmm2, 0x48(%rsp)
movsd %xmm0, 0xa8(%rsp)
movsd %xmm1, 0xa0(%rsp)
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd 0x70(%rsp), %xmm2
jbe 0x3979
movq 0x8904(%rip), %rax      # 0xc1e8
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x130(%rsp)
movq 0x8906(%rip), %rax      # 0xc200
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x138(%rsp)
movq 0x8908(%rip), %rax      # 0xc218
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x140(%rsp)
movq 0x899a(%rip), %rax      # 0xc2c0
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x108(%rsp)
movq 0x899c(%rip), %rax      # 0xc2d8
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x110(%rsp)
movq 0x899e(%rip), %rax      # 0xc2f0
movsd (%rax,%r14,8), %xmm3
movsd %xmm3, 0x118(%rsp)
movsd %xmm0, 0x128(%rsp)
movsd %xmm1, 0x120(%rsp)
movsd %xmm2, 0x70(%rsp)
incq %r14
jmp 0x361d
leaq 0x49c8(%rip), %rdi      # 0x8350
movsd 0xb0(%rsp), %xmm0
movsd 0xb8(%rsp), %xmm1
movsd 0xc0(%rsp), %xmm2
movsd 0x88(%rsp), %xmm3
movsd 0x90(%rsp), %xmm4
movsd 0x98(%rsp), %xmm5
movsd 0xa8(%rsp), %xmm6
movsd 0xa0(%rsp), %xmm7
movb $0x8, %al
callq 0x2030
leaq 0x49ce(%rip), %rdi      # 0x83ac
movsd 0x130(%rsp), %xmm0
movsd 0x138(%rsp), %xmm1
movsd 0x140(%rsp), %xmm2
movsd 0x108(%rsp), %xmm3
movsd 0x110(%rsp), %xmm4
movsd 0x118(%rsp), %xmm5
movsd 0x128(%rsp), %xmm6
movsd 0x120(%rsp), %xmm7
movb $0x8, %al
callq 0x2030
leaq 0x49d5(%rip), %rdi      # 0x8409
movsd 0xf0(%rsp), %xmm0
movsd 0xf8(%rsp), %xmm1
movsd 0x100(%rsp), %xmm2
movsd 0xc8(%rsp), %xmm3
movsd 0xd0(%rsp), %xmm4
movsd 0xd8(%rsp), %xmm5
movsd 0xe8(%rsp), %xmm6
movsd 0xe0(%rsp), %xmm7
movb $0x8, %al
callq 0x2030
leaq 0x49de(%rip), %rdi      # 0x8468
movsd 0x170(%rsp), %xmm0
movsd 0x178(%rsp), %xmm1
movsd 0x180(%rsp), %xmm2
movsd 0x148(%rsp), %xmm3
movsd 0x150(%rsp), %xmm4
movsd 0x158(%rsp), %xmm5
movsd 0x168(%rsp), %xmm6
movsd 0x160(%rsp), %xmm7
movb $0x8, %al
callq 0x2030
movq %rbx, %rdi
callq 0x4ae6
leaq 0x188(%rsp), %rdi
callq 0x20e0
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x2100
movq %rax, %r14
leaq 0x46fc(%rip), %rsi      # 0x8210
movq %rax, %rdi
callq 0x20a0
movq 0x84cd(%rip), %rsi      # 0xbff0
movq 0x849e(%rip), %rdx      # 0xbfc8
movq %r14, %rdi
callq 0x2300
movq %rax, %rbx
movq %r14, %rdi
callq 0x2150
jmp 0x3bde
jmp 0x3bce
jmp 0x3b50
jmp 0x3bce
jmp 0x3b62
movq %rdx, %r14
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x20e0
jmp 0x3b68
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x3bd1
movq %rbx, %rdi
callq 0x2220
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x20c0
movq %rbx, %rdi
callq 0x20b0
leaq 0x4991(%rip), %rdi      # 0x8526
callq 0x2280
movq %r14, %rdi
callq 0x2378
callq 0x22f0
xorl %ebp, %ebp
jmp 0x3310
jmp 0x3bce
jmp 0x3bb4
jmp 0x3bce
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x20e0
jmp 0x3bd1
jmp 0x3bce
movq %rax, %rbx
jmp 0x3bde
jmp 0x3bce
jmp 0x3bce
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2310