// File: /workspace/github_cpp_makefile_star2_O1/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 0x8a3dc
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 0x8a37b
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 0x8a37b
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 0x84e6b
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
callq 0x84e6b
movsd %xmm0, (%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x84e6b
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 0xc4cfa(%rip), %xmm0    # 0x14f058
movsd %xmm0, (%rcx,%rax,8)
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
incl %ebp
testb $0x2, 0x68(%rsp,%rax)
je 0x8a25c
incl %ebp
movq 0x10cc3e(%rip), %rdi    # 0x196fc0
movl %ebp, %esi
callq 0x4750
movq %rax, %rbx
leaq 0xcd47c(%rip), %rsi     # 0x15780f
movl $0xc, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xcb187(%rip), %rsi     # 0x15552e
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 0x8a431
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x8a431
movq 0x10cc0d(%rip), %rdi    # 0x196ff0
leaq 0xc5d4d(%rip), %rsi     # 0x150137
movl $0x1b, %edx
callq 0x44e0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x10cbee(%rip), %rdi    # 0x196ff0
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 0x8a454
movq %rax, %rbx
jmp 0x8a473
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x8a473
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x48(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780