// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/grid.cc
// Function: GaussianCube::loadHistogramData(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void GaussianCube::loadHistogramData(std::string inputfilename){

 fstream input;
 input.open(inputfilename.c_str());
 if(input.is_open()==false){
 cerr << "Error: CSSR failed to open " << inputfilename << endl;
 }else{

 // reading in datapoints (expect points in "Liverpool format" (fractional coordinates)

 int n = 0; // number of points 
 double a,b,c;
 int code;
 int pocketID;
 string ptStatus; 
 while(!input.eof())
    {
    input >> a;

    if(input.eof())
      {
      n--;
      break;
      };

    input >> b >> c >> code >> ptStatus >> pocketID;

    n++;

    // analysis of the read-in data
    a = trans_to_origuc(a);
    b = trans_to_origuc(b);
    c = trans_to_origuc(c);    

    // projecting into a grid

    int ca, cb, cc;

    ca = floor(a * na);
    cb = floor(b * nb);
    cc = floor(c * nc);

    cube[ca][cb][cc] += 1.0; // increase count at grid point ca, cb, cc

    };

 cout << n << " lines read." << "\n";

 input.close();
 };



}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x4520
movq (%r14), %rsi
movq %r15, %rdi
movl $0x18, %edx
callq 0x43d0
leaq 0xc8(%rsp), %rdi
callq 0x4120
testb %al, %al
je 0x88446
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
xorl %ebp, %ebp
testb $0x2, 0x68(%rsp,%rax)
jne 0x883e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0x48(%rsp), %r14
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x42a0
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x68(%rsp,%rax)
jne 0x883e5
movq %r14, %rdi
movq %rsp, %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x44(%rsp), %rsi
callq 0x4270
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0x4560
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x4270
movsd 0x8(%rsp), %xmm0
callq 0x839b6
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
callq 0x839b6
movsd %xmm0, (%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x839b6
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x78(%rbx), %xmm0
mulsd 0x8(%rsp), %xmm0
callq 0x4700
cvttsd2si %xmm0, %r13d
xorps %xmm0, %xmm0
cvtsi2sdl 0x7c(%rbx), %xmm0
mulsd (%rsp), %xmm0
callq 0x4700
cvttsd2si %xmm0, %r12d
xorps %xmm0, %xmm0
cvtsi2sdl 0x80(%rbx), %xmm0
mulsd 0x18(%rsp), %xmm0
callq 0x4700
cvttsd2si %xmm0, %eax
movq 0x88(%rbx), %rcx
movslq %r13d, %rdx
movq (%rcx,%rdx,8), %rcx
movslq %r12d, %rdx
movq (%rcx,%rdx,8), %rcx
cltq
movsd (%rcx,%rax,8), %xmm0
addsd 0xc4c90(%rip), %xmm0    # 0x14d058
movsd %xmm0, (%rcx,%rax,8)
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
incl %ebp
testb $0x2, 0x68(%rsp,%rax)
je 0x882c6
incl %ebp
movq 0x10cbd4(%rip), %rdi    # 0x194fc0
movl %ebp, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xcd572(%rip), %rsi     # 0x15596f
movl $0xc, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xcb20d(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0x48(%rsp), %rdi
callq 0x4090
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x8849b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x8849b
movq 0x10cba3(%rip), %rdi    # 0x194ff0
leaq 0xc5d53(%rip), %rsi     # 0x14e1a7
movl $0x1b, %edx
callq 0x44e0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x10cb84(%rip), %rdi    # 0x194ff0
callq 0x44e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42c0
leaq 0x48(%rsp), %rdi
callq 0x4110
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x884be
movq %rax, %rbx
jmp 0x884dd
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x884dd
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x48(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780