// File: /workspace/github_cpp_makefile_star2_O2/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 0x4540
movq (%r14), %rsi
pushq $0x18
popq %rdx
movq %r15, %rdi
callq 0x4410
leaq 0xc8(%rsp), %rdi
callq 0x4130
testb %al, %al
je 0x67845
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %ebp, %ebp
leaq 0x48(%rsp), %r14
leaq 0x8(%rsp), %r15
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x68(%rsp,%rax)
jne 0x6786f
movq %r14, %rdi
movq %r15, %rsi
callq 0x42d0
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x68(%rsp,%rax)
jne 0x6786d
movq %r14, %rdi
movq %rsp, %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x24(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x28(%rsp), %rsi
callq 0x4580
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0x42a0
movsd 0x8(%rsp), %xmm0
callq 0x6377f
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
callq 0x6377f
movsd %xmm0, (%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x6377f
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x18(%rsp)
cvtsi2sdl 0x78(%rbx), %xmm0
mulsd 0x8(%rsp), %xmm0
callq 0x4720
cvttsd2si %xmm0, %r13d
cvtsi2sdl 0x7c(%rbx), %xmm0
mulsd (%rsp), %xmm0
callq 0x4720
cvttsd2si %xmm0, %r12d
cvtsi2sdl 0x80(%rbx), %xmm0
mulsd 0x18(%rsp), %xmm0
callq 0x4720
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 0x9481f(%rip), %xmm0    # 0xfc058
movsd %xmm0, (%rcx,%rax,8)
incl %ebp
jmp 0x6772c
movq 0xe87a4(%rip), %rdi     # 0x14fff0
leaq 0x95954(%rip), %rsi     # 0xfd1a7
callq 0x4480
movq %rax, %rdi
movq %r14, %rsi
callq 0x43f0
movq %rax, %rdi
callq 0x4230
jmp 0x678af
decl %ebp
movq 0xe874a(%rip), %rdi     # 0x14ffc0
movl %ebp, %esi
callq 0x4760
leaq 0x9d02b(%rip), %rsi     # 0x1048af
movq %rax, %rdi
callq 0x4480
leaq 0x9aceb(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0x48(%rsp), %rdi
callq 0x4080
leaq 0x28(%rsp), %rdi
callq 0x4210
leaq 0x48(%rsp), %rdi
callq 0x4120
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x678d2
movq %rax, %rbx
jmp 0x678df
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x4210
leaq 0x48(%rsp), %rdi
callq 0x4120
movq %rbx, %rdi
callq 0x4780