// File: 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
movq %rsp, %rbp
subq $0x360, %rsp            # imm = 0x360
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x51d0
leaq -0x150(%rbp), %rdi
callq 0x99ae0
leaq -0x170(%rbp), %rdi
callq 0x5720
movl $0x0, -0x174(%rbp)
jmp 0x53e5c
movq -0x8(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x56a0
jmp 0x53e6e
leaq -0x170(%rbp), %rdi
callq 0x52c0
movq %rax, %rdi
leaq 0x19f6d7(%rip), %rsi    # 0x1f355b
callq 0x5730
cmpl $0x0, %eax
jne 0x53eaa
jmp 0x540d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
jmp 0x54246
movq -0x8(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x5420
movq %rax, -0x2f8(%rbp)
jmp 0x53ec3
movq -0x2f8(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x5420
movq %rax, -0x300(%rbp)
jmp 0x53edf
movq -0x300(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x5420
movq %rax, -0x308(%rbp)
jmp 0x53efb
movq -0x308(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x5420
jmp 0x53f10
movl $0x100, %edi            # imm = 0x100
callq 0x5030
movq %rax, -0x310(%rbp)
jmp 0x53f23
movq -0x310(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x8(%rbp), %rdi
movq -0x190(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x51d0
jmp 0x53f56
movq -0x190(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0xd0d0
jmp 0x53f84
movq -0x1a0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
je 0x53fa6
movq -0x1a0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x54041
movq -0x190(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
subq %rsi, %rdx
leaq -0x2c0(%rbp), %rdi
movq %rdi, -0x318(%rbp)
callq 0x5280
movq -0x318(%rbp), %rdi
movq -0x1a0(%rbp), %rax
movq -0x190(%rbp), %rcx
subq %rcx, %rax
movb $0x0, -0x2c0(%rbp,%rax)
callq 0x57d0
movl %eax, -0x2c4(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x2c4(%rbp), %rsi
callq 0xffc0
jmp 0x5400a
movq -0x1a0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x190(%rbp)
jmp 0x54041
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0xec80
jmp 0x54246
movq -0x1a0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x54052
jmp 0x54069
movq -0x1a0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1a0(%rbp)
jmp 0x53f82
movq -0x198(%rbp), %rax
movq %rax, -0x320(%rbp)
cmpq $0x0, %rax
je 0x54089
movq -0x320(%rbp), %rdi
callq 0x56c0
leaq -0x130(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x17a10
jmp 0x5409e
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
leaq -0x150(%rbp), %rsi
callq 0xf440
jmp 0x540b4
movl -0x174(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x174(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0xec80
jmp 0x53e5a
movq -0x8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x51d0
jmp 0x540eb
leaq -0x2f0(%rbp), %rdi
callq 0x99a20
jmp 0x540f9
jmp 0x540fb
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x5960
movb %al, -0x321(%rbp)
jmp 0x54116
movb -0x321(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x54127
jmp 0x54218
movq -0x8(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x52f0
movq %rax, -0x330(%rbp)
jmp 0x54140
movq -0x330(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x56a0
movq %rax, -0x338(%rbp)
jmp 0x5415c
movq -0x338(%rbp), %rdi
leaq -0x2ec(%rbp), %rsi
callq 0x52f0
movq %rax, -0x340(%rbp)
jmp 0x54178
movq -0x340(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x5420
movq %rax, -0x348(%rbp)
jmp 0x54194
movq -0x348(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x52f0
movq %rax, -0x350(%rbp)
jmp 0x541b0
movq -0x350(%rbp), %rdi
leaq -0x2dc(%rbp), %rsi
callq 0x52f0
movq %rax, -0x358(%rbp)
jmp 0x541cc
movq -0x358(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x52f0
movq %rax, -0x360(%rbp)
jmp 0x541e8
movq -0x360(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x5420
jmp 0x541fd
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
leaq -0x2f0(%rbp), %rsi
callq 0xf5e0
jmp 0x54213
jmp 0x540fb
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
callq 0x595b0
leaq -0x170(%rbp), %rdi
callq 0x5300
leaq -0x150(%rbp), %rdi
callq 0xf5c0
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
leaq -0x170(%rbp), %rdi
callq 0x5300
leaq -0x150(%rbp), %rdi
callq 0xf5c0
movq -0x180(%rbp), %rdi
callq 0x58f0
nopw (%rax,%rax)