// File: /workspace/github_cpp_makefile_star2_O2/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, 0x8(%rsp)
movq %rdi, %rbx
leaq 0x100(%rsp), %r14
movq %r14, %rdi
callq 0x4540
pushq $0x18
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4410
leaq 0x180(%rsp), %rdi
callq 0x4130
movb %al, 0x7(%rsp)
testb %al, %al
je 0x2102d
movq 0x12f306(%rip), %rdi    # 0x14ffc0
leaq 0xdc404(%rip), %rsi     # 0xfd0c5
callq 0x4480
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
leaq 0xe18a6(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0x100(%rsp), %rdi
leaq 0x310(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x41b0
leaq 0x100(%rsp), %rdi
leaq 0x310(%rsp), %rsi
callq 0x245a6
movq 0x8(%rsp), %rcx
leaq 0x38(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
movq 0x8(%rsp), %rcx
leaq 0x40(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
movq 0x8(%rsp), %rcx
leaq 0x48(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
leaq 0x100(%rsp), %rdi
leaq 0x310(%rsp), %rsi
callq 0x245a6
movq 0x8(%rsp), %rcx
leaq 0x50(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
movq 0x8(%rsp), %rcx
leaq 0x58(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
movq 0x8(%rsp), %rcx
leaq 0x60(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
leaq 0x100(%rsp), %rdi
leaq 0x310(%rsp), %rsi
callq 0x245a6
movq 0x8(%rsp), %rcx
leaq 0x68(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
movq 0x8(%rsp), %rcx
leaq 0x70(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
movq 0x8(%rsp), %rcx
leaq 0x78(%rcx), %rsi
movq %rax, %rdi
callq 0x42d0
movq 0x8(%rsp), %rax
leaq 0x110(%rax), %rsi
leaq 0x100(%rsp), %rdi
movq %rsi, 0x28(%rsp)
callq 0x42a0
movq 0x8(%rsp), %rdi
callq 0x3e88c
movq 0x8(%rsp), %rbx
movsd 0x38(%rbx), %xmm0
movsd %xmm0, 0x8(%rbx)
movsd 0x58(%rbx), %xmm1
mulsd %xmm1, %xmm1
movsd 0x68(%rbx), %xmm0
movsd 0x70(%rbx), %xmm2
mulsd %xmm2, %xmm2
movapd %xmm0, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
unpcklpd %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0]
movsd 0x50(%rbx), %xmm2
movhpd 0x78(%rbx), %xmm2       # xmm2 = xmm2[0],mem[0]
mulpd %xmm2, %xmm2
addpd %xmm1, %xmm2
sqrtpd %xmm2, %xmm1
movupd %xmm1, 0x10(%rbx)
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
divsd %xmm1, %xmm0
callq 0x4450
mulsd 0xdbc90(%rip), %xmm0    # 0xfcaf0
divsd 0xdbc90(%rip), %xmm0    # 0xfcaf8
movsd %xmm0, 0x28(%rbx)
movsd 0x50(%rbx), %xmm0
divsd 0x10(%rbx), %xmm0
callq 0x4450
movsd 0xdbc6c(%rip), %xmm2    # 0xfcaf0
mulsd %xmm2, %xmm0
movsd 0xdbc68(%rip), %xmm3    # 0xfcaf8
divsd %xmm3, %xmm0
movsd %xmm0, 0x30(%rbx)
movsd 0x70(%rbx), %xmm1
divsd 0x18(%rbx), %xmm1
movsd %xmm1, 0x20(%rsp)
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm0
callq 0x4110
movsd %xmm0, 0x18(%rsp)
movsd 0x30(%rbx), %xmm0
mulsd 0xdbc37(%rip), %xmm0    # 0xfcb00
callq 0x47e0
movsd %xmm0, 0x10(%rsp)
movsd 0xdbc24(%rip), %xmm0    # 0xfcb00
mulsd 0x28(%rbx), %xmm0
callq 0x47e0
mulsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
addsd %xmm1, %xmm0
callq 0x4450
mulsd 0xdbbff(%rip), %xmm0    # 0xfcb08
movsd %xmm0, 0x20(%rbx)
addq $0x2f0, %rbx            # imm = 0x2F0
xorl %r12d, %r12d
leaq 0x30(%rsp), %r13
movl %ebp, %eax
leaq 0xe8(%rsp), %rbp
leaq 0xc8(%rsp), %r15
movzbl %al, %r14d
movq 0x28(%rsp), %rax
cmpl (%rax), %r12d
jge 0x2107e
movq %r13, %rdi
callq 0x3dc5a
leaq 0x100(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x4580
movq %rax, %rdi
movq %r13, %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x42d0
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movsd 0x40(%rsp), %xmm2
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x3f1ce
movq %rbp, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
callq 0x6377f
movsd %xmm0, 0x48(%rsp)
movq %rbp, %rdi
pushq $0x1
popq %rsi
callq 0x63c78
movsd (%rax), %xmm0
callq 0x6377f
movsd %xmm0, 0x50(%rsp)
movq %rbp, %rdi
pushq $0x2
popq %rsi
callq 0x63c78
movsd (%rax), %xmm0
callq 0x6377f
movsd %xmm0, 0x58(%rsp)
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x45d0
movq %r15, %rdi
movl %r14d, %esi
callq 0x1b1bb
movsd %xmm0, 0x60(%rsp)
movq %r15, %rdi
callq 0x4210
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa7d8
movq %r13, %rdi
callq 0xa808
incl %r12d
jmp 0x20f33
movq 0x12ef8c(%rip), %rdi    # 0x14ffc0
leaq 0xdc314(%rip), %rsi     # 0xfd34f
callq 0x4480
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
leaq 0xe152c(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
movq 0x12ef5f(%rip), %rdi    # 0x14ffc0
leaq 0xdbb4b(%rip), %rsi     # 0xfcbb3
callq 0x4480
leaq 0xe150a(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
jmp 0x2108b
leaq 0x100(%rsp), %rdi
callq 0x4080
leaq 0x100(%rsp), %rdi
callq 0x4120
movb 0x7(%rsp), %al
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x210c2
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x4210
jmp 0x210cc
movq %rax, %rbx
jmp 0x210d6
jmp 0x210c9
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xa808
leaq 0x100(%rsp), %rdi
callq 0x4120
movq %rbx, %rdi
callq 0x4780