// File: Luthaf[P]zeopp/voronoicell.cc
// Function: writeVornet(std::basic_fstream<char, std::char_traits<char>>&, ATOM_NETWORK*, VORONOI_NETWORK*)
void writeVornet(fstream &output, ATOM_NETWORK *atmnet, VORONOI_NETWORK *vornet){
  output << "set vornets(0) {" << "\n";

  // Iterate over all Voronoi nodes
  for(unsigned int i = 0; i < vornet->nodes.size(); i++){
    VOR_NODE curNode = vornet->nodes.at(i);
    output << "{color $nodeColors("<< i << ") }" << "\n"
	       << "{sphere {" << curNode.x << " " << curNode.y << " " << curNode.z 
	       << "} radius $nodeRadii(" << i << ") resolution $sphere_resolution}" << "\n";
  }

  // Iterate over all Voronoi edges
  output << "{color $vornetColors(0)}" << "\n";
  for(unsigned int i = 0; i < vornet->edges.size(); i++){
    VOR_EDGE curEdge = vornet->edges.at(i);
    VOR_NODE startNode = vornet->nodes.at(curEdge.from);
    Point start = Point(startNode.x, startNode.y, startNode.z);
    VOR_NODE endNode = vornet->nodes.at(curEdge.to);
    Point end = Point(endNode.x, endNode.y, endNode.z);
    atmnet->translatePoint(&end, curEdge.delta_uc_x, curEdge.delta_uc_y, curEdge.delta_uc_z);
    output << "{line {" 
	   << start[0] << " " << start[1] << " " << start[2] << "} " 
	   << "{" << end[0] << " " << end[1] << " " << end[2] << "}" 
	   << "}" << "\n";
  }
  output << "}" << "\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
leaq 0x13868f(%rip), %rsi    # 0x1f6595
callq 0x5540
movq %rax, %rdi
leaq 0x13b710(%rip), %rsi    # 0x1f9625
callq 0x5540
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq %rax, -0x150(%rbp)
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
callq 0xf270
movq %rax, %rcx
movq -0x150(%rbp), %rax
cmpq %rcx, %rax
jae 0xbe10e
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0xf390
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0xf3d0
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
leaq 0x13d093(%rip), %rsi    # 0x1fb00b
callq 0x5540
movq %rax, -0x158(%rbp)
jmp 0xbdf86
movq -0x158(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x56f0
movq %rax, -0x160(%rbp)
jmp 0xbdf9e
movq -0x160(%rbp), %rdi
leaq 0x13d04d(%rip), %rsi    # 0x1faff9
callq 0x5540
movq %rax, -0x168(%rbp)
jmp 0xbdfba
movq -0x168(%rbp), %rdi
leaq 0x13b65d(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0x170(%rbp)
jmp 0xbdfd6
movq -0x170(%rbp), %rdi
leaq 0x1384f7(%rip), %rsi    # 0x1f64db
callq 0x5540
movq %rax, -0x178(%rbp)
jmp 0xbdff2
movq -0x178(%rbp), %rdi
movsd -0x60(%rbp), %xmm0
callq 0x5980
movq %rax, -0x180(%rbp)
jmp 0xbe00c
movq -0x180(%rbp), %rdi
leaq 0x13e294(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x188(%rbp)
jmp 0xbe028
movq -0x188(%rbp), %rdi
movsd -0x58(%rbp), %xmm0
callq 0x5980
movq %rax, -0x190(%rbp)
jmp 0xbe042
movq -0x190(%rbp), %rdi
leaq 0x13e25e(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x198(%rbp)
jmp 0xbe05e
movq -0x198(%rbp), %rdi
movsd -0x50(%rbp), %xmm0
callq 0x5980
movq %rax, -0x1a0(%rbp)
jmp 0xbe078
movq -0x1a0(%rbp), %rdi
leaq 0x13cf99(%rip), %rsi    # 0x1fb01f
callq 0x5540
movq %rax, -0x1a8(%rbp)
jmp 0xbe094
movq -0x1a8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x56f0
movq %rax, -0x1b0(%rbp)
jmp 0xbe0ac
movq -0x1b0(%rbp), %rdi
leaq 0x13cf7a(%rip), %rsi    # 0x1fb034
callq 0x5540
movq %rax, -0x1b8(%rbp)
jmp 0xbe0c8
movq -0x1b8(%rbp), %rdi
leaq 0x13b54f(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0xbe0dd
leaq -0x60(%rbp), %rdi
callq 0xf5c0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbdf21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xf5c0
jmp 0xbe539
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
leaq 0x13cf9e(%rip), %rsi    # 0x1fb0bb
callq 0x5540
movq %rax, %rdi
leaq 0x13b4f9(%rip), %rsi    # 0x1f9625
callq 0x5540
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
movq %rax, -0x1c0(%rbp)
movq -0x18(%rbp), %rdi
addq $0x60, %rdi
callq 0xf290
movq %rax, %rcx
movq -0x1c0(%rbp), %rax
cmpq %rcx, %rax
jae 0xbe50d
movq -0x18(%rbp), %rdi
addq $0x60, %rdi
movl -0x70(%rbp), %eax
movl %eax, %esi
callq 0xf2c0
movq %rax, %rsi
leaq -0x98(%rbp), %rdi
callq 0x99a90
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
movslq -0x98(%rbp), %rsi
callq 0xf390
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
callq 0xf3d0
movsd -0xd8(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
movsd -0xc8(%rbp), %xmm2
leaq -0xf0(%rbp), %rdi
callq 0xe9c70
jmp 0xbe1cc
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
movslq -0x94(%rbp), %rsi
callq 0xf390
movq %rax, -0x1c8(%rbp)
jmp 0xbe1e9
movq -0x1c8(%rbp), %rsi
leaq -0x130(%rbp), %rdi
callq 0xf3d0
jmp 0xbe1fe
movsd -0x130(%rbp), %xmm0
movsd -0x128(%rbp), %xmm1
movsd -0x120(%rbp), %xmm2
leaq -0x148(%rbp), %rdi
callq 0xe9c70
jmp 0xbe224
movq -0x10(%rbp), %rdi
cvtsi2sdl -0x88(%rbp), %xmm0
cvtsi2sdl -0x84(%rbp), %xmm1
cvtsi2sdl -0x80(%rbp), %xmm2
leaq -0x148(%rbp), %rsi
callq 0x97d20
jmp 0xbe24b
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
leaq 0x13835e(%rip), %rsi    # 0x1f65b8
callq 0x5540
movq %rax, -0x1d0(%rbp)
jmp 0xbe268
leaq -0xf0(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0x1d8(%rbp)
jmp 0xbe27f
movq -0x1d0(%rbp), %rdi
movq -0x1d8(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0x1e0(%rbp)
jmp 0xbe29f
movq -0x1e0(%rbp), %rdi
leaq 0x13e001(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x1e8(%rbp)
jmp 0xbe2bb
leaq -0xf0(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0x1f0(%rbp)
jmp 0xbe2d5
movq -0x1e8(%rbp), %rdi
movq -0x1f0(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0x1f8(%rbp)
jmp 0xbe2f5
movq -0x1f8(%rbp), %rdi
leaq 0x13dfab(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x200(%rbp)
jmp 0xbe311
leaq -0xf0(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0x208(%rbp)
jmp 0xbe32b
movq -0x200(%rbp), %rdi
movq -0x208(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0x210(%rbp)
jmp 0xbe34b
movq -0x210(%rbp), %rdi
leaq 0x138257(%rip), %rsi    # 0x1f65b0
callq 0x5540
movq %rax, -0x218(%rbp)
jmp 0xbe367
movq -0x218(%rbp), %rdi
leaq 0x13cd22(%rip), %rsi    # 0x1fb097
callq 0x5540
movq %rax, -0x220(%rbp)
jmp 0xbe383
leaq -0x148(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0x228(%rbp)
jmp 0xbe39a
movq -0x220(%rbp), %rdi
movq -0x228(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0x230(%rbp)
jmp 0xbe3ba
movq -0x230(%rbp), %rdi
leaq 0x13dee6(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x238(%rbp)
jmp 0xbe3d6
leaq -0x148(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0x240(%rbp)
jmp 0xbe3f0
movq -0x238(%rbp), %rdi
movq -0x240(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0x248(%rbp)
jmp 0xbe410
movq -0x248(%rbp), %rdi
leaq 0x13de90(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x250(%rbp)
jmp 0xbe42c
leaq -0x148(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0x258(%rbp)
jmp 0xbe446
movq -0x250(%rbp), %rdi
movq -0x258(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0x260(%rbp)
jmp 0xbe466
movq -0x260(%rbp), %rdi
leaq 0x13cb87(%rip), %rsi    # 0x1faffb
callq 0x5540
movq %rax, -0x268(%rbp)
jmp 0xbe482
movq -0x268(%rbp), %rdi
leaq 0x13cb6b(%rip), %rsi    # 0x1faffb
callq 0x5540
movq %rax, -0x270(%rbp)
jmp 0xbe49e
movq -0x270(%rbp), %rdi
leaq 0x13b179(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0xbe4b3
leaq -0x130(%rbp), %rdi
callq 0xf5c0
leaq -0xd8(%rbp), %rdi
callq 0xf5c0
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0xbe138
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xbe4ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0xf5c0
leaq -0xd8(%rbp), %rdi
callq 0xf5c0
jmp 0xbe539
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
leaq 0x13cadf(%rip), %rsi    # 0x1faffb
callq 0x5540
movq %rax, %rdi
leaq 0x13b0fa(%rip), %rsi    # 0x1f9625
callq 0x5540
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x58f0
nopw %cs:(%rax,%rax)