// File: /workspace/github_cpp_makefile_star2_O1/cdalitz[P]kdtree-cpp/demo_kdtree.cpp
// Function: main
int main(int argc, char** argv) {

  //
  // functionality tests
  //
  cout << "Functionality tests" << endl;
  cout << "-------------------" << endl;
  
  // 1.1) construction of kd-tree
  Kdtree::KdNodeVector nodes;
  double points[10][2] = {{1, 1}, {2, 1}, {1, 2}, {2, 4}, {3, 4},
                          {7, 2}, {8, 3}, {8, 5}, {7, 3}, {7, 3}};
  for (int i = 0; i < 10; ++i) {
    std::vector<double> point(2);
    point[0] = points[i][0];
    point[1] = points[i][1];
    nodes.push_back(Kdtree::KdNode(point));
  }
  Kdtree::KdTree tree(&nodes);
  cout << "Points in kd-tree:\n  ";
  print_nodes(tree.allnodes);

  // 1.2) kNN search
  Kdtree::KdNodeVector result;
  std::vector<double> test_point(2);
  test_point[0] = 8;
  test_point[1] = 3;
  tree.k_nearest_neighbors(test_point, 3, &result);
  cout << "3NNs of (" << test_point[0] << "," << test_point[1] << "):\n  ";
  print_nodes(result);

  // 1.3) kNN search with predicate
  struct Predicate : Kdtree::KdNodePredicate {
    std::vector<double> point;
    Predicate(std::vector<double> p) {
      this->point = p;
    }
    // only search for points with smaller y-coordinate
    bool operator()(const Kdtree::KdNode& kn) const {
      return this->point[1] > kn.point[1];
    }
  };
  Predicate pred(test_point);
  tree.k_nearest_neighbors(test_point, 3, &result, &pred);
  cout << "3NNs of (" << test_point[0] << "," << test_point[1] << ") with smaller y-coordinate:\n  ";
  print_nodes(result);

  // 1.4) range query
  test_point[0] = 8;
  test_point[1] = 2;
  tree.range_nearest_neighbors(test_point, 1.1, &result);
  cout << "Neighbors of (" << test_point[0] << "," << test_point[1] << ") with distance <= 1.1:\n  ";
  print_nodes(result);
  // same with maximum distance (distance_type=0)
  Kdtree::KdTree tree0(&nodes, 0);
  tree0.range_nearest_neighbors(test_point, 1.1, &result);
  cout << "Neighbors of (" << test_point[0] << "," << test_point[1] << ") with maximum distance <= 1.1:\n  ";
  print_nodes(result);

  //
  // speed tests
  //
  cout << "\nSpeed tests" << endl;
  cout << "-----------" << endl;

  double diff;
  size_t N = 500000;
  nodes.clear();
  for (size_t i = 0; i < N; ++i) {
    std::vector<double> point(2);
    point[0] = (double)rand() / RAND_MAX;
    point[1] = (double)rand() / RAND_MAX;
    nodes.push_back(Kdtree::KdNode(point));
  }
  
  // 2.1) build time
  clock_t begin = clock();
  Kdtree::KdTree tree2(&nodes);
  clock_t end = clock();
  diff = double(end - begin) / CLOCKS_PER_SEC;
  cout << "Creation time for " << N << " random points:\n  " << diff << "s" << endl;

  // 2.2) one kNN query
  test_point[0] = (double)rand() / RAND_MAX;
  test_point[1] = (double)rand() / RAND_MAX;
  begin = clock();
  tree.k_nearest_neighbors(test_point, 3, &result);
  end = clock();
  diff = double(end - begin) / CLOCKS_PER_SEC;
  cout << "3NN search time for one random point:\n  " << diff << "s" << endl;

  // 2.3) all NN query
  begin = clock();
  for (size_t i = 0; i < N; ++i) {
    std::vector<double> point(2);
    tree.k_nearest_neighbors(nodes[i].point, 2, &result);
  }
  end = clock();
  diff = double(end - begin) / CLOCKS_PER_SEC;
  cout << "Time for all nearest neighbor search:\n  " << diff << "s" << endl;

  // 2.4) range query
  double r = 0.3;
  begin = clock();
  tree.range_nearest_neighbors(test_point, r, &result);
  end = clock();
  diff = double(end - begin) / CLOCKS_PER_SEC;
  cout << "Range search time for one random point (r=" << r << "):\n  " << diff << endl;

  // 2.5) for comparison: loop version
  std::vector<Kdtree::CoordPoint> res;
  begin = clock();
  for (size_t i = 0; i < N; ++i) {
    if ((nodes[i].point[0] - test_point[0]) *
        (nodes[i].point[0] - test_point[0]) +
        (nodes[i].point[1] - test_point[1]) *
        (nodes[i].point[1] - test_point[1]) < r * r)
        res.push_back(nodes[i].point);
    }
    end = clock();
    diff = double(end - begin) / CLOCKS_PER_SEC;
    cout << "Loop version of a single range search for comparison:\n  " << diff << "s" << endl;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq 0x7afd(%rip), %rbx      # 0x9fc8
leaq 0x4b72(%rip), %rsi      # 0x7044
movl $0x13, %edx
movq %rbx, %rdi
callq 0x2130
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x4b4b(%rip), %rsi      # 0x7058
movl $0x13, %edx
movq %rbx, %rdi
callq 0x2130
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
xorpd %xmm0, %xmm0
leaq 0x60(%rsp), %rbx
movapd %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movl $0x8, %r12d
leaq 0x4cad(%rip), %r13      # 0x7210
leaq 0x128(%rsp), %r14
leaq 0xb0(%rsp), %r15
xorpd %xmm0, %xmm0
movapd %xmm0, 0xb0(%rsp)
movq $0x0, 0xc0(%rsp)
movl $0x10, %edi
callq 0x2110
movq %rax, 0xb0(%rsp)
movq %rax, 0xb8(%rsp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, 0xc0(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq %rcx, 0xb8(%rsp)
movapd -0x8(%r12,%r13), %xmm0
movupd %xmm0, (%rax)
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x320c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x349a
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x260a
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x2627
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
addq $0x10, %r12
cmpq $0xa8, %r12
jne 0x2573
leaq 0x128(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl $0x2, %edx
callq 0x396a
movq 0x7972(%rip), %rdi      # 0x9fc8
leaq 0x4a0f(%rip), %rsi      # 0x706c
movl $0x15, %edx
callq 0x2130
leaq 0x170(%rsp), %rdi
callq 0x237c
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movq %rax, 0x10(%rsp)
movapd %xmm0, (%rsp)
movl $0x10, %edi
callq 0x2110
movq %rsp, %rsi
movq %rax, (%rsi)
movq %rax, 0x8(%rsi)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, 0x10(%rsi)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq %rcx, 0x8(%rsi)
movabsq $0x4020000000000000, %r14 # imm = 0x4020000000000000
movq %r14, (%rax)
movabsq $0x4008000000000000, %rcx # imm = 0x4008000000000000
movq %rcx, 0x8(%rax)
leaq 0x128(%rsp), %rdi
leaq 0x40(%rsp), %rcx
movl $0x3, %edx
xorl %r8d, %r8d
callq 0x3dc4
movq 0x78d2(%rip), %rdi      # 0x9fc8
leaq 0x4985(%rip), %rsi      # 0x7082
movl $0x9, %edx
callq 0x2130
movq (%rsp), %rax
movsd (%rax), %xmm0
movq 0x78b2(%rip), %rdi      # 0x9fc8
callq 0x2160
movq %rax, %rbx
leaq 0x491b(%rip), %rsi      # 0x7040
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
movq (%rsp), %rax
movsd 0x8(%rax), %xmm0
movq %rbx, %rdi
callq 0x2160
leaq 0x4942(%rip), %rsi      # 0x708c
movl $0x5, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x40(%rsp), %rdi
callq 0x237c
leaq 0x98(%rsp), %rdi
movq %rsp, %rsi
callq 0x3256
leaq 0x7448(%rip), %r13      # 0x9bc0
leaq 0x80(%rsp), %rdi
movq %r13, -0x8(%rdi)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x98(%rsp), %rsi
callq 0x339e
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x27be
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
leaq 0x128(%rsp), %rdi
movq %rsp, %rsi
leaq 0x40(%rsp), %rcx
leaq 0x78(%rsp), %r8
movl $0x3, %edx
callq 0x3dc4
movq 0x77e4(%rip), %rdi      # 0x9fc8
leaq 0x4897(%rip), %rsi      # 0x7082
movl $0x9, %edx
callq 0x2130
movq (%rsp), %rax
movsd (%rax), %xmm0
movq 0x77c4(%rip), %rdi      # 0x9fc8
callq 0x2160
movq %rax, %rbx
leaq 0x482d(%rip), %rsi      # 0x7040
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
movq (%rsp), %rax
movsd 0x8(%rax), %xmm0
movq %rbx, %rdi
callq 0x2160
leaq 0x485a(%rip), %rsi      # 0x7092
movl $0x1f, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x40(%rsp), %rdi
callq 0x237c
movq %rsp, %rsi
movq (%rsi), %rax
movq %r14, (%rax)
movabsq $0x4000000000000000, %rcx # imm = 0x4000000000000000
movq %rcx, 0x8(%rax)
leaq 0x128(%rsp), %rdi
movsd 0x4792(%rip), %xmm0     # 0x7008
leaq 0x40(%rsp), %rdx
callq 0x424a
movq 0x7741(%rip), %rdi      # 0x9fc8
leaq 0x4824(%rip), %rsi      # 0x70b2
movl $0xe, %edx
callq 0x2130
movq (%rsp), %rax
movsd (%rax), %xmm0
movq 0x7721(%rip), %rdi      # 0x9fc8
callq 0x2160
movq %rax, %rbx
leaq 0x478a(%rip), %rsi      # 0x7040
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
movq (%rsp), %rax
movsd 0x8(%rax), %xmm0
movq %rbx, %rdi
callq 0x2160
leaq 0x47e6(%rip), %rsi      # 0x70c1
movl $0x1a, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x40(%rsp), %rdi
callq 0x237c
leaq 0xb0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
xorl %edx, %edx
callq 0x396a
leaq 0xb0(%rsp), %rdi
movq %rsp, %rsi
movsd 0x46ef(%rip), %xmm0     # 0x7008
leaq 0x40(%rsp), %rdx
callq 0x424a
movq 0x769e(%rip), %rdi      # 0x9fc8
leaq 0x4781(%rip), %rsi      # 0x70b2
movl $0xe, %edx
callq 0x2130
movq (%rsp), %rax
movsd (%rax), %xmm0
movq 0x767e(%rip), %rdi      # 0x9fc8
callq 0x2160
movq %rax, %rbx
leaq 0x46e7(%rip), %rsi      # 0x7040
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
movq (%rsp), %rax
movsd 0x8(%rax), %xmm0
movq %rbx, %rdi
callq 0x2160
leaq 0x475e(%rip), %rsi      # 0x70dc
movl $0x22, %edx
movq %rax, %rdi
callq 0x2130
leaq 0x40(%rsp), %rdi
callq 0x237c
movq 0x762c(%rip), %rbx      # 0x9fc8
leaq 0x475c(%rip), %rsi      # 0x70ff
movl $0xc, %edx
movq %rbx, %rdi
callq 0x2130
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq 0x75fa(%rip), %rdi      # 0x9fc8
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq 0x75e6(%rip), %rbx      # 0x9fc8
leaq 0x4677(%rip), %rsi      # 0x7060
movl $0xb, %edx
movq %rbx, %rdi
callq 0x2130
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq 0x75b4(%rip), %rdi      # 0x9fc8
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movq 0x60(%rsp), %rbx
movq 0x68(%rsp), %r14
cmpq %rbx, %r14
je 0x2a55
movq %rbx, %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0x2a47
movq 0x10(%r15), %rsi
subq %rdi, %rsi
callq 0x2120
addq $0x28, %r15
cmpq %r14, %r15
jne 0x2a33
movq %rbx, 0x68(%rsp)
movl $0x7a120, %r12d         # imm = 0x7A120
leaq 0x198(%rsp), %rbx
leaq 0x20(%rsp), %r14
leaq 0x60(%rsp), %r15
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movl $0x10, %edi
callq 0x2110
movq %rax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, 0x30(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq %rcx, 0x28(%rsp)
callq 0x2040
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x454f(%rip), %xmm1     # 0x7010
divsd %xmm1, %xmm0
movq 0x20(%rsp), %rax
movsd %xmm0, (%rax)
callq 0x2040
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x452e(%rip), %xmm0     # 0x7010
movq 0x20(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x320c
movq %r15, %rdi
movq %rbx, %rsi
callq 0x349a
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x2b26
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2b3d
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
decq %r12
jne 0x2a6d
callq 0x20a0
movq %rax, %rbx
leaq 0x198(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl $0x2, %edx
callq 0x396a
callq 0x20a0
movq %rax, %r14
movq 0x7454(%rip), %rdi      # 0x9fc8
leaq 0x4591(%rip), %rsi      # 0x710c
movl $0x12, %edx
callq 0x2130
movq 0x743c(%rip), %rdi      # 0x9fc8
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x20b0
movq %rax, %r15
leaq 0x457f(%rip), %rsi      # 0x711f
movl $0x12, %edx
movq %rax, %rdi
callq 0x2130
subq %rbx, %r14
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
divsd 0x4458(%rip), %xmm0     # 0x7018
movq %r15, %rdi
callq 0x2160
movq %rax, %rbx
leaq 0x4538(%rip), %rsi      # 0x710a
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
callq 0x2040
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x43f6(%rip), %xmm1     # 0x7010
divsd %xmm1, %xmm0
movq %rsp, %r14
movq (%r14), %rax
movsd %xmm0, (%rax)
callq 0x2040
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x43d4(%rip), %xmm0     # 0x7010
movq (%r14), %rax
movsd %xmm0, 0x8(%rax)
callq 0x20a0
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
leaq 0x40(%rsp), %rcx
movl $0x3, %edx
movq %r14, %rsi
xorl %r8d, %r8d
callq 0x3dc4
callq 0x20a0
movq %rax, %r14
movq 0x7350(%rip), %rdi      # 0x9fc8
leaq 0x44b3(%rip), %rsi      # 0x7132
movl $0x28, %edx
callq 0x2130
subq %rbx, %r14
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
divsd 0x437c(%rip), %xmm0     # 0x7018
movq 0x7325(%rip), %rdi      # 0x9fc8
callq 0x2160
movq %rax, %rbx
leaq 0x4458(%rip), %rsi      # 0x710a
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
xorl %ebp, %ebp
callq 0x20a0
movq %rax, %rbx
leaq 0x128(%rsp), %r14
leaq 0x40(%rsp), %r15
movl $0x10, %edi
callq 0x2110
movq %rax, %r12
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq 0x60(%rsp), %rsi
addq %rbp, %rsi
movl $0x2, %edx
movq %r14, %rdi
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x3dc4
movl $0x10, %esi
movq %r12, %rdi
callq 0x2120
addq $0x28, %rbp
cmpq $0x1312d00, %rbp        # imm = 0x1312D00
jne 0x2cfd
callq 0x20a0
movq %rax, %r14
movq 0x7272(%rip), %rdi      # 0x9fc8
leaq 0x43fe(%rip), %rsi      # 0x715b
movl $0x28, %edx
callq 0x2130
subq %rbx, %r14
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
divsd 0x429e(%rip), %xmm0     # 0x7018
movq 0x7247(%rip), %rdi      # 0x9fc8
callq 0x2160
movq %rax, %rbx
leaq 0x437a(%rip), %rsi      # 0x710a
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
callq 0x20a0
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
movq %rsp, %rsi
movsd 0x4241(%rip), %xmm0     # 0x7020
leaq 0x40(%rsp), %rdx
callq 0x424a
callq 0x20a0
movq %rax, %r14
movq 0x71d0(%rip), %rdi      # 0x9fc8
leaq 0x4385(%rip), %rsi      # 0x7184
movl $0x2a, %edx
callq 0x2130
movq 0x71b8(%rip), %rdi      # 0x9fc8
movsd 0x4208(%rip), %xmm0     # 0x7020
callq 0x2160
movq %rax, %r15
leaq 0x4265(%rip), %rsi      # 0x708c
movl $0x5, %edx
movq %rax, %rdi
callq 0x2130
subq %rbx, %r14
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
divsd 0x41d1(%rip), %xmm0     # 0x7018
movq %r15, %rdi
callq 0x2160
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %r14
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
xorl %r15d, %r15d
callq 0x20a0
movq %rax, %rbx
movsd 0x4186(%rip), %xmm2     # 0x7028
movq 0x60(%rsp), %rsi
movq (%rsi,%r15), %rax
movq (%rsp), %rcx
movsd (%rax), %xmm0
subsd (%rcx), %xmm0
movsd 0x8(%rax), %xmm1
subsd 0x8(%rcx), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm0, %xmm2
jbe 0x2ee6
addq %r15, %rsi
movq %r14, %rdi
callq 0x32d6
movsd 0x4142(%rip), %xmm2     # 0x7028
addq $0x28, %r15
cmpq $0x1312d00, %r15        # imm = 0x1312D00
jne 0x2ea2
callq 0x20a0
movq %rax, %r14
movq 0x70c6(%rip), %rdi      # 0x9fc8
leaq 0x42a6(%rip), %rsi      # 0x71af
movl $0x38, %edx
callq 0x2130
subq %rbx, %r14
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
divsd 0x40f2(%rip), %xmm0     # 0x7018
movq 0x709b(%rip), %rdi      # 0x9fc8
callq 0x2160
movq %rax, %rbx
leaq 0x41ce(%rip), %rsi      # 0x710a
movl $0x1, %edx
movq %rax, %rdi
callq 0x2130
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2100
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x20(%rsp), %rdi
callq 0x3302
leaq 0x198(%rsp), %rdi
callq 0x38f4
leaq 0xb0(%rsp), %rdi
callq 0x38f4
movq %r13, 0x78(%rsp)
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x2fb6
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2fcc
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
leaq 0x40(%rsp), %rdi
callq 0x3350
leaq 0x128(%rsp), %rdi
callq 0x38f4
leaq 0x60(%rsp), %rdi
callq 0x3350
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x30a8
jmp 0x3069
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x3028
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x3118
movq 0xa8(%rsp), %rsi
jmp 0x3110
jmp 0x305f
movq %rax, %rbx
jmp 0x312e
jmp 0x3157
movq %rax, %rbx
jmp 0x3138
jmp 0x3073
movq %rax, %rbx
jmp 0x3118
jmp 0x3084
movq %rax, %rbx
jmp 0x30f6
jmp 0x30a8
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3302
jmp 0x3099
jmp 0x3084
movq %rax, %rbx
jmp 0x3099
movq %rax, %rbx
movl $0x10, %esi
movq %r12, %rdi
callq 0x2120
leaq 0x198(%rsp), %rdi
callq 0x38f4
jmp 0x30e9
movq %rax, %rbx
jmp 0x30e9
movq %rax, %rbx
jmp 0x30d2
movq %rax, %rbx
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x30d2
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x30e9
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
leaq 0xb0(%rsp), %rdi
callq 0x38f4
movq %r13, 0x78(%rsp)
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x3118
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x312e
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
leaq 0x40(%rsp), %rdi
callq 0x3350
leaq 0x128(%rsp), %rdi
callq 0x38f4
leaq 0x60(%rsp), %rdi
callq 0x3350
movq %rbx, %rdi
callq 0x21a0
movq %rax, %rbx
jmp 0x3145
movq %rax, %rbx
jmp 0x3181
movq %rax, %rbx
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x3181
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x3145
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
jmp 0x3145