// File: Luthaf[P]zeopp/networkio.cc
// Function: writeToXYZ(char*, VORONOI_NETWORK*, double)
bool writeToXYZ(char *filename, VORONOI_NETWORK *vornet, double minRad){
    fstream output;
    output.open(filename, fstream::out);
    if(!output.is_open()){
        cerr << "Error: Failed to open .net2 output file " << filename << "\n";
        return false;
    }
    else{
        cout << "Writing Voronoi network information to " << filename << "\n";

        // Write Voronoi node information
        //Compute the # of nodes to be written
        int i = 0;
        for (vector<VOR_NODE>::const_iterator iter = vornet->nodes.begin();
                iter != vornet->nodes.end(); iter++)
            if (iter->rad_stat_sphere > minRad){
                i++;
            }
        output << i << "\n\n";
        for (vector<VOR_NODE>::const_iterator iter = vornet->nodes.begin();
                iter != vornet->nodes.end(); iter++)
            if (iter->rad_stat_sphere > minRad)
                output << "X  " << iter->x << " " << iter->y << " "
                       << iter->z << " " << iter->rad_stat_sphere << "\n";
    }
    output.close();
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
leaq -0x230(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x5660
movq -0x290(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x10, %edx
callq 0x54b0
jmp 0x56e92
leaq -0x230(%rbp), %rdi
callq 0x58b0
movb %al, -0x291(%rbp)
jmp 0x56ea6
movb -0x291(%rbp), %al
testb $0x1, %al
jne 0x56f36
jmp 0x56eb6
movq 0x21c133(%rip), %rdi    # 0x272ff0
leaq 0x19c98e(%rip), %rsi    # 0x1f3852
callq 0x5540
movq %rax, -0x2a0(%rbp)
jmp 0x56ed2
movq -0x2a0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5540
movq %rax, -0x2a8(%rbp)
jmp 0x56eeb
movq -0x2a8(%rbp), %rdi
leaq 0x1a272c(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0x56f00
movb $0x0, -0x1(%rbp)
movl $0x1, -0x240(%rbp)
jmp 0x57219
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x5150
jmp 0x57233
movq 0x21c083(%rip), %rdi    # 0x272fc0
leaq 0x19c937(%rip), %rsi    # 0x1f387b
callq 0x5540
movq %rax, -0x2b0(%rbp)
jmp 0x56f52
movq -0x2b0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5540
movq %rax, -0x2b8(%rbp)
jmp 0x56f6b
movq -0x2b8(%rbp), %rdi
leaq 0x1a26ac(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0x56f80
movl $0x0, -0x244(%rbp)
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
callq 0x25230
movq %rax, -0x258(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x59af0
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
callq 0x250b0
movq %rax, -0x260(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x59b30
testb $0x1, %al
jne 0x56fde
jmp 0x5701e
leaq -0x250(%rbp), %rdi
callq 0x59b70
movsd 0x18(%rax), %xmm0
ucomisd -0x20(%rbp), %xmm0
jbe 0x57005
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x244(%rbp)
jmp 0x57007
leaq -0x250(%rbp), %rdi
xorl %esi, %esi
callq 0x59b90
movq %rax, -0x268(%rbp)
jmp 0x56fb1
leaq -0x220(%rbp), %rdi
movl -0x244(%rbp), %esi
callq 0x58d0
movq %rax, -0x2c0(%rbp)
jmp 0x57039
movq -0x2c0(%rbp), %rdi
leaq 0x1a4c37(%rip), %rsi    # 0x1fbc7e
callq 0x5540
jmp 0x5704e
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
callq 0x25230
movq %rax, -0x278(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x59af0
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
callq 0x250b0
movq %rax, -0x280(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x59b30
testb $0x1, %al
jne 0x570a5
jmp 0x571fb
leaq -0x270(%rbp), %rdi
callq 0x59b70
movsd 0x18(%rax), %xmm0
ucomisd -0x20(%rbp), %xmm0
jbe 0x571df
leaq -0x220(%rbp), %rdi
leaq 0x19c7f3(%rip), %rsi    # 0x1f38c2
callq 0x5540
movq %rax, -0x2c8(%rbp)
jmp 0x570dd
leaq -0x270(%rbp), %rdi
callq 0x59b70
movq -0x2c8(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0x2d0(%rbp)
jmp 0x57102
movq -0x2d0(%rbp), %rdi
leaq 0x1a519e(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x2d8(%rbp)
jmp 0x5711e
leaq -0x270(%rbp), %rdi
callq 0x59b70
movq -0x2d8(%rbp), %rdi
movsd 0x8(%rax), %xmm0
callq 0x5980
movq %rax, -0x2e0(%rbp)
jmp 0x57144
movq -0x2e0(%rbp), %rdi
leaq 0x1a515c(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x2e8(%rbp)
jmp 0x57160
leaq -0x270(%rbp), %rdi
callq 0x59b70
movq -0x2e8(%rbp), %rdi
movsd 0x10(%rax), %xmm0
callq 0x5980
movq %rax, -0x2f0(%rbp)
jmp 0x57186
movq -0x2f0(%rbp), %rdi
leaq 0x1a511a(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x2f8(%rbp)
jmp 0x571a2
leaq -0x270(%rbp), %rdi
callq 0x59b70
movq -0x2f8(%rbp), %rdi
movsd 0x18(%rax), %xmm0
callq 0x5980
movq %rax, -0x300(%rbp)
jmp 0x571c8
movq -0x300(%rbp), %rdi
leaq 0x1a244f(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0x571dd
jmp 0x571df
jmp 0x571e1
leaq -0x270(%rbp), %rdi
xorl %esi, %esi
callq 0x59b90
movq %rax, -0x288(%rbp)
jmp 0x57075
jmp 0x571fd
leaq -0x230(%rbp), %rdi
callq 0x50a0
jmp 0x5720b
movb $0x1, -0x1(%rbp)
movl $0x1, -0x240(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x5150
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
movq -0x238(%rbp), %rdi
callq 0x58f0
nop