// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/networkio.cc
// Function: readV1File(char*, ATOM_NETWORK*, bool)
bool readV1File(char *filename, ATOM_NETWORK *cell, bool radial){
  fstream input;
  char garbage[256];
  int i;
  input.open(filename);
  if(!input.is_open()){
    cout<< "Failed to open .v1 file " << filename << "\n";
    cout<<"Exiting ..." << "\n";
//    exit(1);
    return false;
  }
  else{
    cout  << "Reading input file " << filename << "\n";
    input.getline(garbage, 256);

    // Read and store information about the unit cell. While the
    // vector components are known, the side lengths and angles remain unknown
    input >> garbage >> cell->v_a.x >> cell->v_a.y >> cell->v_a.z;
    input >> garbage >> cell->v_b.x >> cell->v_b.y >> cell->v_b.z;
    input >> garbage >> cell->v_c.x >> cell->v_c.y >> cell->v_c.z;
    input >> cell->numAtoms;
    cell->initMatrices();

    //Recover information about unit cell angles and side lengths from
    //vector components. Essentially reverses the steps performed in
    //the initialize() method for ATOM_NETWORK instances as contained
    //in the file networkstorage.cc
    cell->a = cell->v_a.x;
    cell->b = sqrt(cell->v_b.x*cell->v_b.x+cell->v_b.y*cell->v_b.y);
    cell->c = sqrt(cell->v_c.x*cell->v_c.x+cell->v_c.y*cell->v_c.y+cell->v_c.z*cell->v_c.z);
    cell->beta = acos(cell->v_c.x/cell->c)*360.0/(2.0*PI);
    cell->gamma = acos(cell->v_b.x/cell->b)*360.0/(2.0*PI);
    cell->alpha = 360.0/(2*PI)*acos((cell->v_c.y/cell->c*sin(2.0*PI*cell->gamma/360.0))
				    +cos(2.0*PI/360.0*cell->gamma)*cos(2.0*PI/360.0*cell->beta));

    // Read and store information about each atom. The coordinates
    // relative to the unit cell vectors remain unknown
    for(i=0; i<cell->numAtoms; i++){
      ATOM newAtom;
      input >> newAtom.type >> newAtom.x >> newAtom.y >> newAtom.z;
      Point abcCoords = cell->xyz_to_abc(newAtom.x, newAtom.y, newAtom.z);
      newAtom.a_coord = trans_to_origuc(abcCoords[0]); newAtom.b_coord = trans_to_origuc(abcCoords[1]); newAtom.c_coord = trans_to_origuc(abcCoords[2]);
      newAtom.radius = lookupRadius(newAtom.type, radial);
      cell->atoms.push_back(newAtom);
    }
    input.close();
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %edx, %ebp
movq %rsi, (%rsp)
movq %rdi, %r15
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
callq 0x4520
movq %rbx, %rdi
movq %r15, %rsi
movl $0x18, %edx
callq 0x43d0
leaq 0x168(%rsp), %rdi
callq 0x4120
movb %al, 0xf(%rsp)
testb %al, %al
je 0x29907
movq 0x16d6ee(%rip), %r12    # 0x196fc0
leaq 0x12677c(%rip), %rsi    # 0x150055
movl $0x13, %edx
movq %r12, %rdi
callq 0x44e0
testq %r15, %r15
je 0x2994a
movq %r15, %rdi
callq 0x41e0
movq 0x16d6c6(%rip), %rdi    # 0x196fc0
movq %r15, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x29963
movq 0x16d6b2(%rip), %rbx    # 0x196fc0
leaq 0x1269ca(%rip), %rsi    # 0x1502df
movl $0x18, %edx
movq %rbx, %rdi
callq 0x44e0
testq %r15, %r15
je 0x29e9e
movq %r15, %rdi
callq 0x41e0
movq 0x16d686(%rip), %rdi    # 0x196fc0
movq %r15, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x29eb5
movq (%r12), %rax
movq -0x18(%rax), %rax
leaq (%r12,%rax), %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x16d656(%rip), %rdi    # 0x196fc0
leaq 0x12bbbd(%rip), %rsi    # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0xe8(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %ecx
leaq 0xe8(%rsp), %rdi
leaq 0x310(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4830
leaq 0xe8(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq 0xf8(%rsp,%rax), %rbx
leaq 0x310(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4740
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x108(%rsp,%rax)
jne 0x29a16
addq $-0x101, %rbx           # imm = 0xFEFF
cmpq $-0x101, %rbx           # imm = 0xFEFF
ja 0x29a16
movq 0x1d0(%rsp,%rax), %rdi
movq 0x10(%rdi), %rax
cmpq 0x18(%rdi), %rax
jae 0x29f20
movq (%rsp), %rax
leaq 0x38(%rax), %rsi
leaq 0xe8(%rsp), %rdi
callq 0x42a0
movq (%rsp), %rcx
leaq 0x40(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
movq (%rsp), %rcx
leaq 0x48(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
leaq 0xe8(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq 0xf8(%rsp,%rax), %rbx
leaq 0x310(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4740
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x108(%rsp,%rax)
jne 0x29ab0
addq $-0x101, %rbx           # imm = 0xFEFF
cmpq $-0x101, %rbx           # imm = 0xFEFF
ja 0x29ab0
movq 0x1d0(%rsp,%rax), %rdi
movq 0x10(%rdi), %rax
cmpq 0x18(%rdi), %rax
jae 0x29f56
movq (%rsp), %rax
leaq 0x50(%rax), %rsi
leaq 0xe8(%rsp), %rdi
callq 0x42a0
movq (%rsp), %rcx
leaq 0x58(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
movq (%rsp), %rcx
leaq 0x60(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
leaq 0xe8(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq 0xf8(%rsp,%rax), %rbx
leaq 0x310(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4740
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x108(%rsp,%rax)
jne 0x29b4a
addq $-0x101, %rbx           # imm = 0xFEFF
cmpq $-0x101, %rbx           # imm = 0xFEFF
ja 0x29b4a
movq 0x1d0(%rsp,%rax), %rdi
movq 0x10(%rdi), %rax
cmpq 0x18(%rdi), %rax
jae 0x29f8c
movq (%rsp), %rax
leaq 0x68(%rax), %rsi
leaq 0xe8(%rsp), %rdi
callq 0x42a0
movq (%rsp), %rcx
leaq 0x70(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
movq (%rsp), %rcx
leaq 0x78(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
movq (%rsp), %rax
leaq 0x110(%rax), %rsi
leaq 0xe8(%rsp), %rdi
movq %rsi, 0x48(%rsp)
callq 0x4270
movq (%rsp), %rdi
callq 0x52604
movq (%rsp), %rax
movsd 0x38(%rax), %xmm1
movsd 0x50(%rax), %xmm0
movsd %xmm1, 0x8(%rax)
movsd 0x58(%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0x29bd9
sqrtsd %xmm0, %xmm0
jmp 0x29be2
callq 0x4350
xorpd %xmm2, %xmm2
movq (%rsp), %rax
movsd %xmm0, 0x10(%rax)
movsd 0x68(%rax), %xmm1
movsd 0x70(%rax), %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
movsd 0x78(%rax), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jb 0x29c1a
sqrtsd %xmm0, %xmm0
jmp 0x29c1f
callq 0x4350
movq (%rsp), %rbx
movsd %xmm0, 0x18(%rbx)
movsd 0x68(%rbx), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x4400
mulsd 0x125e6e(%rip), %xmm0   # 0x14fab0
divsd 0x125e6e(%rip), %xmm0   # 0x14fab8
movsd %xmm0, 0x28(%rbx)
movsd 0x50(%rbx), %xmm0
divsd 0x10(%rbx), %xmm0
callq 0x4400
movsd 0x125e4a(%rip), %xmm2   # 0x14fab0
mulsd %xmm2, %xmm0
movsd 0x125e46(%rip), %xmm3   # 0x14fab8
divsd %xmm3, %xmm0
movsd %xmm0, 0x30(%rbx)
movsd 0x70(%rbx), %xmm1
divsd 0x18(%rbx), %xmm1
movsd %xmm1, 0x40(%rsp)
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm0
callq 0x4100
movsd %xmm0, 0x38(%rsp)
movsd 0x30(%rbx), %xmm0
mulsd 0x125e15(%rip), %xmm0   # 0x14fac0
callq 0x4800
movsd %xmm0, 0x30(%rsp)
movsd 0x125e02(%rip), %xmm0   # 0x14fac0
mulsd 0x28(%rbx), %xmm0
callq 0x4800
mulsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
mulsd 0x40(%rsp), %xmm1
addsd %xmm1, %xmm0
callq 0x4400
mulsd 0x125ddd(%rip), %xmm0   # 0x14fac8
movsd %xmm0, 0x20(%rbx)
cmpl $0x0, 0x110(%rbx)
jle 0x29e8f
movq (%rsp), %rax
leaq 0x2f0(%rax), %rbx
xorl %r14d, %r14d
leaq 0x50(%rsp), %r12
movl %ebp, %eax
leaq 0x2f8(%rsp), %rbp
leaq 0x10(%rsp), %r13
movzbl %al, %r15d
movq %r12, %rdi
callq 0x5162c
leaq 0xe8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x4560
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x58(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x42a0
movsd 0x50(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movsd 0x60(%rsp), %xmm2
movq %rbp, %rdi
movq (%rsp), %rsi
callq 0x531ea
movq %rbp, %rdi
xorl %esi, %esi
callq 0x85478
movsd (%rax), %xmm0
callq 0x84e6b
movsd %xmm0, 0x68(%rsp)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x85478
movsd (%rax), %xmm0
callq 0x84e6b
movsd %xmm0, 0x70(%rsp)
movq %rbp, %rdi
movl $0x2, %esi
callq 0x85478
movsd (%rax), %xmm0
callq 0x84e6b
movsd %xmm0, 0x78(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xf32a
movq %r13, %rdi
movl %r15d, %esi
callq 0x21e42
movsd %xmm0, 0x80(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x29e29
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4470
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe936
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x29e59
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x29e7e
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4470
incl %r14d
movq 0x48(%rsp), %rax
cmpl (%rax), %r14d
jl 0x29d23
leaq 0xe8(%rsp), %rdi
callq 0x4090
jmp 0x29efd
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x16d104(%rip), %rdi    # 0x196fc0
leaq 0x12b66b(%rip), %rsi    # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x16d0ec(%rip), %rdi    # 0x196fc0
leaq 0x125c68(%rip), %rsi    # 0x14fb43
movl $0xb, %edx
callq 0x44e0
movq 0x16d0d4(%rip), %rdi    # 0x196fc0
leaq 0x12b63b(%rip), %rsi    # 0x15552e
movl $0x1, %edx
callq 0x44e0
leaq 0xe8(%rsp), %rdi
callq 0x4110
movb 0xf(%rsp), %al
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rdi), %rax
callq *0x48(%rax)
cmpl $-0x1, %eax
jne 0x29a16
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0xe8, %rdi
movl 0x20(%rdi), %esi
orl $0x2, %esi
callq 0x4710
jmp 0x29a16
movq (%rdi), %rax
callq *0x48(%rax)
cmpl $-0x1, %eax
jne 0x29ab0
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0xe8, %rdi
movl 0x20(%rdi), %esi
orl $0x2, %esi
callq 0x4710
jmp 0x29ab0
movq (%rdi), %rax
callq *0x48(%rax)
cmpl $-0x1, %eax
jne 0x29b4a
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0xe8, %rdi
movl 0x20(%rdi), %esi
orl $0x2, %esi
callq 0x4710
jmp 0x29b4a
jmp 0x29fe5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x29fef
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x29fef
movq %rax, %rbx
jmp 0x29ff9
jmp 0x29fec
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2f814
leaq 0xe8(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780