// File: 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
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rsi, -0x290(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x298(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x5660
movq -0x290(%rbp), %rdi
callq 0x5200
movq %rax, -0x288(%rbp)
movl $0x8, %edi
movl $0x10, %esi
callq 0x47640
movl %eax, -0x280(%rbp)
jmp 0xf1ddb
movl -0x280(%rbp), %edx
movq -0x288(%rbp), %rsi
leaq -0x220(%rbp), %rdi
callq 0x54b0
jmp 0xf1df6
leaq -0x220(%rbp), %rdi
callq 0x58b0
movb %al, -0x299(%rbp)
jmp 0xf1e0a
movb -0x299(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xf1e83
movq 0x1811cf(%rip), %rdi    # 0x272ff0
leaq 0x101558(%rip), %rsi    # 0x1f3380
callq 0x5540
movq %rax, -0x2a8(%rbp)
jmp 0xf1e36
movq -0x290(%rbp), %rsi
movq -0x2a8(%rbp), %rdi
callq 0x5480
movq %rax, -0x2b0(%rbp)
jmp 0xf1e52
movq -0x2b0(%rbp), %rdi
movq 0x181138(%rip), %rsi    # 0x272f98
callq 0x55b0
jmp 0xf1e67
jmp 0xf216a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0xf217f
movl $0x0, -0x230(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x5720
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x5960
movb %al, -0x2b1(%rbp)
jmp 0xf1eb9
movb -0x2b1(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xf1eca
jmp 0xf2104
leaq -0x220(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x5420
jmp 0xf1edf
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x5960
movb %al, -0x2b2(%rbp)
jmp 0xf1eff
movb -0x2b2(%rbp), %al
testb $0x1, %al
jne 0xf1f0b
jmp 0xf1f42
movl -0x230(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x230(%rbp)
jmp 0xf2104
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x5300
jmp 0xf217f
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x5420
movq %rax, -0x2c0(%rbp)
jmp 0xf1f5e
movq -0x2c0(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x5420
movq %rax, -0x2c8(%rbp)
jmp 0xf1f7a
movq -0x2c8(%rbp), %rdi
leaq -0x24c(%rbp), %rsi
callq 0x52f0
movq %rax, -0x2d0(%rbp)
jmp 0xf1f96
movq -0x2d0(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x56a0
movq %rax, -0x2d8(%rbp)
jmp 0xf1fb2
movq -0x2d8(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x52f0
jmp 0xf1fc7
movl -0x230(%rbp), %eax
incl %eax
movl %eax, -0x230(%rbp)
movsd -0x238(%rbp), %xmm0
callq 0xe9290
movsd %xmm0, -0x2e0(%rbp)
jmp 0xf1fec
movsd -0x2e0(%rbp), %xmm0
movsd %xmm0, -0x238(%rbp)
movsd -0x240(%rbp), %xmm0
callq 0xe9290
movsd %xmm0, -0x2e8(%rbp)
jmp 0xf2013
movsd -0x2e8(%rbp), %xmm0
movsd %xmm0, -0x240(%rbp)
movsd -0x248(%rbp), %xmm0
callq 0xe9290
movsd %xmm0, -0x2f0(%rbp)
jmp 0xf203a
movq -0x298(%rbp), %rax
movsd -0x2f0(%rbp), %xmm0
movsd %xmm0, -0x248(%rbp)
movsd -0x238(%rbp), %xmm0
cvtsi2sdl 0x78(%rax), %xmm1
mulsd %xmm1, %xmm0
callq 0x5870
movq -0x298(%rbp), %rax
cvttsd2si %xmm0, %ecx
movl %ecx, -0x274(%rbp)
movsd -0x240(%rbp), %xmm0
cvtsi2sdl 0x7c(%rax), %xmm1
mulsd %xmm1, %xmm0
callq 0x5870
movq -0x298(%rbp), %rax
cvttsd2si %xmm0, %ecx
movl %ecx, -0x278(%rbp)
movsd -0x248(%rbp), %xmm0
cvtsi2sdl 0x80(%rax), %xmm1
mulsd %xmm1, %xmm0
callq 0x5870
movq -0x298(%rbp), %rax
cvttsd2si %xmm0, %ecx
movl %ecx, -0x27c(%rbp)
movq 0x88(%rax), %rax
movslq -0x274(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x278(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x27c(%rbp), %rcx
movsd 0xfff5b(%rip), %xmm0    # 0x1f2050
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0xf1e99
movl -0x230(%rbp), %esi
movq 0x180eaf(%rip), %rdi    # 0x272fc0
callq 0x58d0
movq %rax, -0x2f8(%rbp)
jmp 0xf211f
movq -0x2f8(%rbp), %rdi
leaq 0x10a4db(%rip), %rsi    # 0x1fc608
callq 0x5540
movq %rax, -0x300(%rbp)
jmp 0xf213b
movq -0x300(%rbp), %rdi
leaq 0x1074dc(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0xf2150
leaq -0x220(%rbp), %rdi
callq 0x50a0
jmp 0xf215e
leaq -0x270(%rbp), %rdi
callq 0x5300
leaq -0x220(%rbp), %rdi
callq 0x5150
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x220(%rbp), %rdi
callq 0x5150
movq -0x228(%rbp), %rdi
callq 0x58f0
nopw (%rax,%rax)