// File: ingowald[P]closestSurfacePointQueries/examples/benchmark.cpp
// Function: loadReference(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void loadReference(const std::string &fileName)
{
  FILE *file = fopen(fileName.c_str(),"r");
  if (!file) throw std::runtime_error("could not open "+fileName);

  for (int i=0;i<point_x.size();i++) {
    double x,y,z,s;
    if (fscanf(file,"%lf %lf %lf %lf\n",&x,&y,&z,&s) != 4)
      throw std::runtime_error("could not read reference result from "+fileName);
    reference_x.push_back(x);
    reference_y.push_back(y);
    reference_z.push_back(z);
    reference_dist.push_back(s);
  }
  std::cout << "loaded " << reference_dist.size() << " reference distances" << std::endl;
  fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30f0
movq %rax, %rdi
leaq 0xcdae(%rip), %rsi      # 0x11040
callq 0x3300
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x4342
movb $0x1, -0x3d(%rbp)
movl $0x10, %edi
callq 0x3130
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rdx
leaq 0xcd7c(%rip), %rsi      # 0x11042
leaq -0x30(%rbp), %rdi
callq 0x5b70
jmp 0x42d1
movq -0x98(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3390
jmp 0x42e3
movq -0x98(%rbp), %rdi
movb $0x0, -0x3d(%rbp)
movq 0x13cfb(%rip), %rsi     # 0x17ff0
movq 0x13ccc(%rip), %rdx     # 0x17fc8
callq 0x33c0
jmp 0x4508
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x4329
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3180
testb $0x1, -0x3d(%rbp)
jne 0x4331
jmp 0x433d
movq -0x98(%rbp), %rdi
callq 0x31d0
jmp 0x44ff
movl $0x0, -0x44(%rbp)
movslq -0x44(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq 0x13f15(%rip), %rdi     # 0x18270
callq 0x5e60
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x449a
movq -0x10(%rbp), %rdi
leaq 0xcdd6(%rip), %rsi      # 0x11154
leaq -0x50(%rbp), %rdx
leaq -0x58(%rbp), %rcx
leaq -0x60(%rbp), %r8
leaq -0x68(%rbp), %r9
movb $0x0, %al
callq 0x3420
cmpl $0x4, %eax
je 0x444c
movb $0x1, -0x89(%rbp)
movl $0x10, %edi
callq 0x3130
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rdx
leaq 0xcda4(%rip), %rsi      # 0x11165
leaq -0x88(%rbp), %rdi
callq 0x5b70
jmp 0x43cf
movq -0xa8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3390
jmp 0x43e4
movq -0xa8(%rbp), %rdi
movb $0x0, -0x89(%rbp)
movq 0x13bf7(%rip), %rsi     # 0x17ff0
movq 0x13bc8(%rip), %rdx     # 0x17fc8
callq 0x33c0
jmp 0x4508
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x4430
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3180
testb $0x1, -0x89(%rbp)
jne 0x443b
jmp 0x4447
movq -0xa8(%rbp), %rdi
callq 0x31d0
jmp 0x44ff
leaq 0x13f6d(%rip), %rdi     # 0x183c0
leaq -0x50(%rbp), %rsi
callq 0x5df0
leaq 0x13f75(%rip), %rdi     # 0x183d8
leaq -0x58(%rbp), %rsi
callq 0x5df0
leaq 0x13f7d(%rip), %rdi     # 0x183f0
leaq -0x60(%rbp), %rsi
callq 0x5df0
leaq 0x13f25(%rip), %rdi     # 0x183a8
leaq -0x68(%rbp), %rsi
callq 0x5df0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x4349
movq 0x13b2f(%rip), %rdi     # 0x17fd0
leaq 0xcc51(%rip), %rsi      # 0x110f9
callq 0x3260
movq %rax, -0xb0(%rbp)
leaq 0x13eed(%rip), %rdi     # 0x183a8
callq 0x5e60
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x3080
movq %rax, %rdi
leaq 0xccb2(%rip), %rsi      # 0x1118b
callq 0x3260
movq %rax, %rdi
movq 0x13ad0(%rip), %rsi     # 0x17fb8
callq 0x32a0
movq -0x10(%rbp), %rdi
callq 0x3270
addq $0xb0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x33e0
nopl (%rax,%rax)