// File: /workspace/github_cpp_makefile_star2_O3/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 $0x2a8, %rsp            # imm = 0x2A8
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %ecx
leaq 0x1a0(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
callq 0x4830
leaq 0x60(%rsp), %r13
movq %r13, %rdi
callq 0x5521c
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rbx, 0x28(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0xa0(%rsp), %rbx
movq %r14, 0x50(%rsp)
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x4560
movq 0x30(%rsp), %rdi
leaq 0x123ef8(%rip), %rsi    # 0x14e382
callq 0x45c0
testl %eax, %eax
je 0x2a5d3
movq %r14, %rdi
movq %r13, %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x70(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0x78(%rsp), %rsi
callq 0x42a0
movl $0x100, %edi            # imm = 0x100
callq 0x4030
movq %rax, %rbp
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %ecx
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %rbp, %rsi
callq 0x4830
leaq 0x1(%rbp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %rbp, %r15
addq $0x2, %r15
movq %r14, %r12
movzbl -0x1(%r15), %eax
testb $-0x21, %al
jne 0x2a57f
movq %r14, %rdx
subq %r12, %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4210
movq %rbx, %rax
subq %r12, %rax
movb $0x0, (%rax,%r14)
movq %rbx, %rdi
callq 0x4680
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x2a566
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2a575
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x14198
cmpb $0x0, -0x1(%r15)
movq %r15, %r12
je 0x2a587
incq %r15
incq %r14
jmp 0x2a51c
movq %rbp, %rdi
callq 0x4570
leaq 0x80(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x100d2
movq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0xe9d4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
movq 0x50(%rsp), %r14
je 0x2a471
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x2a471
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4420
movsbl %al, %ecx
leaq 0x1a0(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
callq 0x4830
leaq 0xa0(%rsp), %rdi
callq 0x551de
leaq 0xb8(%rsp), %rbp
leaq 0xc0(%rsp), %rbx
movq 0x28(%rsp), %rax
leaq 0x60(%rax), %r15
leaq 0xa0(%rsp), %r12
leaq 0x30(%rsp), %r13
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r14,%rax)
jne 0x2a6bd
movq %r14, %rdi
movq %r12, %rsi
callq 0x4270
movq %rax, %rdi
movq %r13, %rsi
callq 0x4560
movq %rax, %rdi
leaq 0xa4(%rsp), %rsi
callq 0x4270
movq %rax, %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x4270
movq %rax, %rdi
leaq 0xb4(%rsp), %rsi
callq 0x4270
movq %rax, %rdi
movq %rbp, %rsi
callq 0x4270
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42a0
movq %r15, %rdi
movq %r12, %rsi
callq 0xea2c
jmp 0x2a632
movq 0x28(%rsp), %rax
addq $-0x28, 0x68(%rax)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x2a6e3
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x2a700
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a71e
jmp 0x2a71e
jmp 0x2a71e
jmp 0x2a723
jmp 0x2a71e
jmp 0x2a71e
movq %rax, %rbx
jmp 0x2a73d
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2a73d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x2a759
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x2a776
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780