// File: /workspace/github_cpp_makefile_star2_O1/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 0x268d8
movq 0x17071d(%rip), %r12    # 0x196fc0
leaq 0x1297ab(%rip), %rsi    # 0x150055
movl $0x13, %edx
movq %r12, %rdi
callq 0x44e0
testq %rbx, %rbx
je 0x26933
movq %rbx, %rdi
callq 0x41e0
movq 0x1706f5(%rip), %rdi    # 0x196fc0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x2694c
movq 0x1706e1(%rip), %rdi    # 0x196fc0
leaq 0x12ec48(%rip), %rsi    # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x1706c9(%rip), %r14    # 0x196fc0
leaq 0x1297c0(%rip), %rsi    # 0x1500be
movl $0x1f, %edx
movq %r14, %rdi
callq 0x44e0
testq %rbx, %rbx
je 0x26cef
movq %rbx, %rdi
callq 0x41e0
movq 0x17069d(%rip), %rdi    # 0x196fc0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x26d07
movq (%r12), %rax
movq -0x18(%rax), %rax
leaq (%r12,%rax), %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x17066d(%rip), %rdi    # 0x196fc0
leaq 0x12ebd4(%rip), %rsi    # 0x15552e
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 0x26a50
addq $-0x101, %rbx           # imm = 0xFEFF
cmpq $-0x101, %rbx           # imm = 0xFEFF
ja 0x26a50
movq 0x1d8(%rsp,%rax), %rdi
movq 0x10(%rdi), %rax
cmpq 0x18(%rdi), %rax
jae 0x26d70
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 0x521f4
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 0x26ccf
movq %r13, %rdi
callq 0x5162c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4560
movq 0x88(%rsp), %r14
testq %r14, %r14
je 0x26c7c
movq %r13, %rdi
callq 0x26df4
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 0x84e6b
movsd %xmm0, 0x58(%rsp)
movsd 0x60(%rsp), %xmm0
callq 0x84e6b
movsd %xmm0, 0x60(%rsp)
movsd 0x68(%rsp), %xmm0
callq 0x84e6b
movaps %xmm0, %xmm2
movsd %xmm0, 0x68(%rsp)
movsd 0x58(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x53092
movq %rbp, %rdi
xorl %esi, %esi
callq 0x85478
movsd (%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x85478
movsd (%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbp, %rdi
movl $0x2, %esi
callq 0x85478
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 0xf32a
leaq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x21e42
movsd %xmm0, 0x70(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x26c5c
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 0xe936
incl %r12d
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x26ca1
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x26cc6
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4470
testq %r14, %r14
jne 0x26b07
movq 0x8(%rsp), %rax
movl %r12d, 0x110(%rax)
leaq 0xf0(%rsp), %rdi
callq 0x4090
movb 0x7(%rsp), %bpl
jmp 0x26d4f
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x1702b2(%rip), %rdi    # 0x196fc0
leaq 0x12e819(%rip), %rsi    # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x17029a(%rip), %rdi    # 0x196fc0
leaq 0x128e16(%rip), %rsi    # 0x14fb43
movl $0xb, %edx
callq 0x44e0
movq 0x170282(%rip), %rdi    # 0x196fc0
leaq 0x12e7e9(%rip), %rsi    # 0x15552e
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 0x26a50
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 0x26a50
jmp 0x26dcb
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x26dd5
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x26dd5
jmp 0x26dcb
movq %rax, %rbx
jmp 0x26ddf
jmp 0x26dd2
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2f814
leaq 0xf0(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780