// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/networkio.cc
// Function: readNet(std::istream*, VORONOI_NETWORK*)
void readNet(istream *input, VORONOI_NETWORK *vornet){
  char buff [256];
  input->getline(buff,256); // Read line "Vertex table:"
  VOR_NODE node;
  string garbage;

  // Read information about each Voronoi node
  int i = 0;
  while(true){
    (*input) >> garbage;
    if(strcmp(garbage.data(), "Edge") == 0)
      break;

    (*input) >> node.x >> node.y >> node.z >> node.rad_stat_sphere;

    // Read node connectivity information
    char *connectBuff = new char [256];
    char *origBuff = connectBuff;
    input->getline(connectBuff,256);
    connectBuff+= 1; //Skip space character
    char *currentChar = connectBuff;
    vector<int> nearestAtoms;

    while(true){
      if(*currentChar == ' ' || *currentChar == '\0'){
	char nextID[256];
	strncpy(nextID,connectBuff,currentChar-connectBuff);
	nextID[currentChar-connectBuff] = '\0';
	nearestAtoms.push_back(atoi(nextID));
	connectBuff = currentChar + 1;
      }
      if(*currentChar == '\0')
	break;
      currentChar++;
    }

    delete [] origBuff;
    node.atomIDs = nearestAtoms;
    vornet->nodes.push_back(node);
    i++;
  }

  input->getline(buff,256); // Reads remainder of line "Edge table:"

  //Read information about each Voronoi edge
  VOR_EDGE edge;
  while(!input->eof()){
    (*input) >> edge.from >> garbage >> edge.to >> edge.rad_moving_sphere
	     >> edge.delta_uc_x >> edge.delta_uc_y >> edge.delta_uc_z >> edge.length;
    vornet->edges.push_back(edge);
  }
  vornet->edges.pop_back();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x1b0(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x41b0
leaq 0x70(%rsp), %r12
movq %r12, %rdi
callq 0x408b6
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rbx, 0x10(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0xb0(%rsp), %r14
leaq 0x50(%rsp), %r13
leaq 0xc(%rsp), %rbp
movq %r15, 0x18(%rsp)
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
callq 0x4580
movq 0x30(%rsp), %rdi
leaq 0xdbd61(%rip), %rsi     # 0xfd382
callq 0x45f0
testl %eax, %eax
je 0x21730
movq %r15, %rdi
movq %r12, %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x78(%rsp), %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0x88(%rsp), %rsi
callq 0x42d0
movl $0x100, %edi            # imm = 0x100
callq 0x4030
movq %rax, %r12
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
movq %rax, %rsi
callq 0x41b0
leaq 0x1(%r12), %r15
andq $0x0, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq %r12, 0x28(%rsp)
addq $0x2, %r12
movq %r15, %rbx
movzbl -0x1(%r12), %eax
testb $-0x21, %al
jne 0x216ea
movq %r15, %rdx
subq %rbx, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4250
movq %r14, %rax
subq %rbx, %rax
movb $0x0, (%rax,%r15)
movq %r14, %rdi
callq 0x4680
movl %eax, 0xc(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x10324
cmpb $0x0, -0x1(%r12)
movq %r12, %rbx
je 0x216f2
incq %r12
incq %r15
jmp 0x216a2
movq 0x28(%rsp), %rdi
callq 0x4590
leaq 0x90(%rsp), %rdi
movq %r13, %rsi
callq 0xc178
leaq 0x70(%rsp), %r12
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0xa89e
movq %r13, %rdi
callq 0xb290
movq 0x18(%rsp), %r15
jmp 0x21608
leaq 0x1b0(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x41b0
leaq 0xb0(%rsp), %rdi
callq 0x40878
leaq 0xc8(%rsp), %rbp
leaq 0xd0(%rsp), %rbx
movq 0x10(%rsp), %rax
leaq 0x60(%rax), %r14
leaq 0xb0(%rsp), %r12
leaq 0x30(%rsp), %r13
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
jne 0x21803
movq %r15, %rdi
movq %r12, %rsi
callq 0x42a0
movq %rax, %rdi
movq %r13, %rsi
callq 0x4580
movq %rax, %rdi
leaq 0xb4(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0xb8(%rsp), %rsi
callq 0x42d0
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0xc4(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x42a0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42d0
movq %r14, %rdi
movq %r12, %rsi
callq 0xa8ca
jmp 0x21778
movq 0x10(%rsp), %rax
addq $-0x28, 0x68(%rax)
leaq 0x30(%rsp), %rdi
callq 0x4210
leaq 0x90(%rsp), %rdi
callq 0xb290
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x21842
jmp 0x21842
jmp 0x21842
jmp 0x21842
jmp 0x21847
jmp 0x21842
movq %rax, %rbx
jmp 0x21854
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xb290
leaq 0x30(%rsp), %rdi
callq 0x4210
leaq 0x90(%rsp), %rdi
callq 0xb290
movq %rbx, %rdi
callq 0x4780