// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/networkio.cc
// Function: readCUCFile(char*, ATOM_NETWORK*, bool)
bool readCUCFile(char *filename, ATOM_NETWORK *cell, bool radial){
  fstream input;
  input.open(filename);
  char garbage[256];
  int numAtoms;

  if(!input.is_open()){
    cout << "\n" << "Failed to open .cuc input file " << filename << "\n";
    cout << "Exiting ..." << "\n";
//    exit(1);
    return false;
  }
  else{
    cout << "Reading input file " << filename << "\n";

    // Read and store information about the unit cell
    cell->name = filename;
    cell->name.erase(cell->name.end()-4, cell->name.end());
    input.getline(garbage, 256);
    input >> garbage;
    input >> cell->a >> cell->b >> cell->c;
    input >> cell->alpha >> cell->beta >> cell->gamma;
    cell->initialize(); // Initializes the unit cell vectors using the
			// angles and side lengths

    // Read and store information about each atom
    numAtoms = 0;
    while(!input.eof()){
      ATOM newAtom;
      input >> newAtom.type;
      if(newAtom.type.empty())
	break;

      changeAtomType(&newAtom); // Converts to atom type
      input >> newAtom.a_coord >> newAtom.b_coord >> newAtom.c_coord;
      newAtom.a_coord = trans_to_origuc(newAtom.a_coord);
      newAtom.b_coord = trans_to_origuc(newAtom.b_coord);
      newAtom.c_coord = trans_to_origuc(newAtom.c_coord);
      Point newCoords = cell->abc_to_xyz (newAtom.a_coord,newAtom.b_coord,newAtom.c_coord);
      newAtom.x = newCoords[0]; newAtom.y = newCoords[1]; newAtom.z = newCoords[2];
      newAtom.radius = lookupRadius(newAtom.type, radial);
      newAtom.label=newAtom.type;
      cell->atoms.push_back(newAtom);
      numAtoms++;
    }
    cell->numAtoms= numAtoms;
    input.close();
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xf0(%rsp), %r15
movq %r15, %rdi
callq 0x4540
pushq $0x18
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4410
leaq 0x170(%rsp), %rdi
callq 0x4130
movl %eax, %ebp
testb %al, %al
je 0x1ed94
movl %r12d, 0xc(%rsp)
movq 0x1314c2(%rip), %rdi    # 0x14ffc0
leaq 0xde5c0(%rip), %rsi     # 0xfd0c5
callq 0x4480
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
leaq 0xe3a62(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0x320(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4810
movq 0x320(%r14), %rax
movq 0x328(%r14), %rcx
leaq (%rax,%rcx), %rdx
leaq (%rax,%rcx), %rsi
addq $-0x4, %rsi
movq %r15, %rdi
callq 0x4100
leaq 0xf0(%rsp), %rdi
leaq 0x300(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x41b0
leaq 0xf0(%rsp), %rdi
leaq 0x300(%rsp), %rsi
callq 0x245a6
leaq 0x8(%r14), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x42d0
leaq 0x10(%r14), %rsi
movq %rax, %rdi
callq 0x42d0
leaq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x42d0
leaq 0x20(%r14), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x42d0
leaq 0x28(%r14), %rsi
movq %rax, %rdi
callq 0x42d0
leaq 0x30(%r14), %rsi
movq %rax, %rdi
callq 0x42d0
movq %r14, %rdi
callq 0x3e5a4
movb %bpl, 0xb(%rsp)
leaq 0x60(%rsp), %r15
movq %r14, 0x10(%rsp)
leaq 0x2f0(%r14), %rax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
leaq 0x20(%rsp), %r13
leaq 0xd8(%rsp), %rbx
leaq 0xb8(%rsp), %r12
movzbl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0xf0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x110(%rsp,%rax)
jne 0x1ed74
movq %r13, %rdi
callq 0x3dc5a
leaq 0xf0(%rsp), %rdi
movq %r15, %rsi
callq 0x4580
movq 0x68(%rsp), %rbp
testq %rbp, %rbp
je 0x1ed63
movq %r13, %rdi
callq 0x1ee54
leaq 0xf0(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x48(%rsp), %rsi
callq 0x42d0
movsd 0x38(%rsp), %xmm0
callq 0x6377f
movsd %xmm0, 0x38(%rsp)
movsd 0x40(%rsp), %xmm0
callq 0x6377f
movsd %xmm0, 0x40(%rsp)
movsd 0x48(%rsp), %xmm0
callq 0x6377f
movaps %xmm0, %xmm2
movsd %xmm0, 0x48(%rsp)
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0x3f0e6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
pushq $0x2
popq %rsi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x45d0
movq %r12, %rdi
movl 0xc(%rsp), %esi
callq 0x1b1bb
movsd %xmm0, 0x50(%rsp)
movq %r12, %rdi
callq 0x4210
leaq 0x80(%rsp), %rdi
movq %r15, %rsi
callq 0x4270
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0xa7d8
incl %r14d
movq %r13, %rdi
callq 0xa808
testq %rbp, %rbp
jne 0x1ec1d
movq 0x10(%rsp), %rax
movl %r14d, 0x110(%rax)
leaq 0xf0(%rsp), %rdi
callq 0x4080
movb 0xb(%rsp), %bpl
jmp 0x1edf2
movq 0x131225(%rip), %rdi    # 0x14ffc0
leaq 0xe37dc(%rip), %rsi     # 0x10257e
callq 0x4480
leaq 0xde380(%rip), %rsi     # 0xfd12e
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
leaq 0xe37b6(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
movq 0x1311e9(%rip), %rdi    # 0x14ffc0
leaq 0xdddd5(%rip), %rsi     # 0xfcbb3
callq 0x4480
leaq 0xe3794(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0xf0(%rsp), %rdi
callq 0x4120
movl %ebp, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1ee2b
jmp 0x1ee2b
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x4210
jmp 0x1ee35
jmp 0x1ee2b
movq %rax, %rbx
jmp 0x1ee3f
jmp 0x1ee32
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xa808
leaq 0xf0(%rsp), %rdi
callq 0x4120
movq %rbx, %rdi
callq 0x4780