// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %r15
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x4520
movq %rbx, %rdi
movq %r15, %rsi
movl $0x10, %edx
callq 0x43d0
leaq 0x98(%rsp), %rdi
callq 0x4120
movl %eax, %ebp
testb %al, %al
je 0x2cdc8
movq 0x16a22d(%rip), %rbx    # 0x196fc0
leaq 0x123898(%rip), %rsi    # 0x150632
movl $0x27, %edx
movq %rbx, %rdi
callq 0x44e0
testq %r15, %r15
je 0x2ce0b
movq %r15, %rdi
callq 0x41e0
movq 0x16a205(%rip), %rdi    # 0x196fc0
movq %r15, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x2ce22
movq 0x16a221(%rip), %rbx    # 0x196ff0
leaq 0x123833(%rip), %rsi    # 0x150609
movl $0x28, %edx
movq %rbx, %rdi
callq 0x44e0
testq %r15, %r15
je 0x2cf74
movq %r15, %rdi
callq 0x41e0
movq 0x16a1f5(%rip), %rdi    # 0x196ff0
movq %r15, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x2cf8b
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x16a197(%rip), %rdi    # 0x196fc0
leaq 0x1286fe(%rip), %rsi    # 0x15552e
movl $0x1, %edx
callq 0x44e0
movq 0x48(%r14), %rax
movq 0x50(%r14), %rcx
xorl %esi, %esi
cmpq %rcx, %rax
je 0x2ce68
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rax), %xmm0
xorl %edx, %edx
ucomisd %xmm1, %xmm0
seta %dl
addl %edx, %esi
addq $0x40, %rax
cmpq %rcx, %rax
jne 0x2ce4f
movb %bpl, 0xf(%rsp)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x4750
leaq 0x12a095(%rip), %rsi    # 0x156f16
movl $0x2, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x48(%r14), %r12
cmpq 0x50(%r14), %r12
je 0x2cf63
leaq 0x12a5e3(%rip), %r13    # 0x157486
leaq 0x128684(%rip), %rbp    # 0x15552e
movsd 0x18(%r12), %xmm0
ucomisd 0x10(%rsp), %xmm0
jbe 0x2cf55
movl $0x3, %edx
movq %r15, %rdi
leaq 0x1237ad(%rip), %rsi    # 0x150679
callq 0x44e0
movsd (%r12), %xmm0
movq %r15, %rdi
callq 0x46b0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movsd 0x8(%r12), %xmm0
movq %rbx, %rdi
callq 0x46b0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movsd 0x10(%r12), %xmm0
movq %rbx, %rdi
callq 0x46b0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movsd 0x18(%r12), %xmm0
movq %rbx, %rdi
callq 0x46b0
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x44e0
addq $0x40, %r12
cmpq 0x50(%r14), %r12
jne 0x2ceaa
leaq 0x18(%rsp), %rdi
callq 0x4090
movb 0xf(%rsp), %bpl
jmp 0x2cfa3
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x16a05e(%rip), %rdi    # 0x196ff0
leaq 0x128595(%rip), %rsi    # 0x15552e
movl $0x1, %edx
callq 0x44e0
leaq 0x18(%rsp), %rdi
callq 0x4110
movl %ebp, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2cfc5
jmp 0x2cfc5
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780