// File: /workspace/github_cpp_makefile_star2_O3/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, %r14d
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
leaq 0xf0(%rsp), %r15
movq %r15, %rdi
callq 0x4520
movq %r15, %rdi
movq %rbx, %rsi
movl $0x18, %edx
callq 0x43d0
leaq 0x170(%rsp), %rdi
callq 0x4120
movl %eax, %ebp
testb %al, %al
je 0x26702
movq 0x16e8f3(%rip), %r12    # 0x194fc0
leaq 0x1279f1(%rip), %rsi    # 0x14e0c5
movl $0x13, %edx
movq %r12, %rdi
callq 0x44e0
testq %rbx, %rbx
je 0x2675d
movq %rbx, %rdi
callq 0x41e0
movq 0x16e8cb(%rip), %rdi    # 0x194fc0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x26776
movq 0x16e8b7(%rip), %rdi    # 0x194fc0
leaq 0x12cf0e(%rip), %rsi    # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq 0x16e89f(%rip), %r14    # 0x194fc0
leaq 0x127a06(%rip), %rsi    # 0x14e12e
movl $0x1f, %edx
movq %r14, %rdi
callq 0x44e0
testq %rbx, %rbx
je 0x26b19
movq %rbx, %rdi
callq 0x41e0
movq 0x16e873(%rip), %rdi    # 0x194fc0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x26b31
movq (%r12), %rax
movq -0x18(%rax), %rax
leaq (%r12,%rax), %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x16e843(%rip), %rdi    # 0x194fc0
leaq 0x12ce9a(%rip), %rsi    # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq 0x8(%rsp), %rax
leaq 0x320(%rax), %r12
movq 0x328(%rax), %r13
movq %rbx, %rdi
callq 0x41e0
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x4670
movq 0x8(%rsp), %rsi
movq 0x320(%rsi), %rax
movq 0x328(%rsi), %rcx
leaq -0x4(%rcx), %rdx
movq %rdx, 0x328(%rsi)
movb $0x0, -0x4(%rax,%rcx)
movq 0xf0(%rsp), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %ecx
leaq 0xf0(%rsp), %rdi
leaq 0x300(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4830
leaq 0xf0(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq 0x100(%rsp,%rax), %rbx
leaq 0x300(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x4740
movq 0xf0(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x110(%rsp,%rax)
jne 0x2687a
addq $-0x101, %rbx           # imm = 0xFEFF
cmpq $-0x101, %rbx           # imm = 0xFEFF
ja 0x2687a
movq 0x1d8(%rsp,%rax), %rdi
movq 0x10(%rdi), %rax
cmpq 0x18(%rdi), %rax
jae 0x26b9a
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x42a0
movq 0x8(%rsp), %rcx
leaq 0x10(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
movq 0x8(%rsp), %rcx
leaq 0x18(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x42a0
movq 0x8(%rsp), %rcx
leaq 0x28(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
movq 0x8(%rsp), %rcx
leaq 0x30(%rcx), %rsi
movq %rax, %rdi
callq 0x42a0
movq 0x8(%rsp), %rdi
callq 0x51db4
movb %bpl, 0x7(%rsp)
leaq 0x80(%rsp), %r15
movq 0x8(%rsp), %rax
addq $0x2f0, %rax            # imm = 0x2F0
movq %rax, 0x38(%rsp)
xorl %r12d, %r12d
leaq 0x40(%rsp), %r13
leaq 0xf0(%rsp), %rbx
leaq 0xd8(%rsp), %rbp
movzbl %r14b, %eax
movl %eax, 0x14(%rsp)
movq 0xf0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x110(%rsp,%rax)
jne 0x26af9
movq %r13, %rdi
callq 0x51264
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4560
movq 0x88(%rsp), %r14
testq %r14, %r14
je 0x26aa6
movq %r13, %rdi
callq 0x26c1e
movq %rbx, %rdi
leaq 0x58(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x42a0
movsd 0x58(%rsp), %xmm0
callq 0x839b6
movsd %xmm0, 0x58(%rsp)
movsd 0x60(%rsp), %xmm0
callq 0x839b6
movsd %xmm0, 0x60(%rsp)
movsd 0x68(%rsp), %xmm0
callq 0x839b6
movaps %xmm0, %xmm2
movsd %xmm0, 0x68(%rsp)
movsd 0x58(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x52d94
movq %rbp, %rdi
xorl %esi, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbp, %rdi
movl $0x2, %esi
callq 0x83f9a
movsd (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0xf3ce
leaq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x21d5e
movsd %xmm0, 0x70(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x26a86
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0xa0(%rsp), %rdi
movq %r15, %rsi
callq 0x4240
movq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0xe9a8
incl %r12d
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x26acb
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x26af0
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
testq %r14, %r14
jne 0x26931
movq 0x8(%rsp), %rax
movl %r12d, 0x110(%rax)
leaq 0xf0(%rsp), %rdi
callq 0x4090
movb 0x7(%rsp), %bpl
jmp 0x26b79
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x16e488(%rip), %rdi    # 0x194fc0
leaq 0x12cadf(%rip), %rsi    # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq 0x16e470(%rip), %rdi    # 0x194fc0
leaq 0x12705c(%rip), %rsi    # 0x14dbb3
movl $0xb, %edx
callq 0x44e0
movq 0x16e458(%rip), %rdi    # 0x194fc0
leaq 0x12caaf(%rip), %rsi    # 0x15361e
movl $0x1, %edx
callq 0x44e0
leaq 0xf0(%rsp), %rdi
callq 0x4110
movl %ebp, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rdi), %rax
callq *0x48(%rax)
cmpl $-0x1, %eax
jne 0x2687a
movq 0xf0(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0xf0, %rdi
movl 0x20(%rdi), %esi
orl $0x2, %esi
callq 0x4710
jmp 0x2687a
jmp 0x26bf5
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x26bff
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x26bff
jmp 0x26bf5
movq %rax, %rbx
jmp 0x26c09
jmp 0x26bfc
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2f5e8
leaq 0xf0(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780