// File: /workspace/github_cpp_makefile_star2_O3/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 0x2cbd7
movq 0x16841e(%rip), %rbx    # 0x194fc0
leaq 0x121af9(%rip), %rsi    # 0x14e6a2
movl $0x27, %edx
movq %rbx, %rdi
callq 0x44e0
testq %r15, %r15
je 0x2cc1a
movq %r15, %rdi
callq 0x41e0
movq 0x1683f6(%rip), %rdi    # 0x194fc0
movq %r15, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x2cc31
movq 0x168412(%rip), %rbx    # 0x194ff0
leaq 0x121a94(%rip), %rsi    # 0x14e679
movl $0x28, %edx
movq %rbx, %rdi
callq 0x44e0
testq %r15, %r15
je 0x2cd89
movq %r15, %rdi
callq 0x41e0
movq 0x1683e6(%rip), %rdi    # 0x194ff0
movq %r15, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x2cda0
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x168388(%rip), %rdi    # 0x194fc0
leaq 0x1269df(%rip), %rsi    # 0x15361e
movl $0x1, %edx
callq 0x44e0
movq 0x48(%r14), %rax
movq 0x50(%r14), %rcx
xorl %esi, %esi
cmpq %rcx, %rax
je 0x2cc77
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 0x2cc5e
movb %bpl, 0xf(%rsp)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x4750
leaq 0x1283bb(%rip), %rsi    # 0x15504b
movl $0x2, %edx
movq %rax, %rdi
callq 0x44e0
movq 0x48(%r14), %r12
movq 0x50(%r14), %rax
cmpq %rax, %r12
je 0x2cd78
leaq 0x128921(%rip), %r13    # 0x1555d6
leaq 0x126962(%rip), %rbp    # 0x15361e
movsd 0x18(%r12), %xmm0
ucomisd 0x10(%rsp), %xmm0
jbe 0x2cd6b
movl $0x3, %edx
movq %r15, %rdi
leaq 0x121a0b(%rip), %rsi    # 0x14e6e9
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
movq 0x50(%r14), %rax
addq $0x40, %r12
cmpq %rax, %r12
jne 0x2ccbc
leaq 0x18(%rsp), %rdi
callq 0x4090
movb 0xf(%rsp), %bpl
jmp 0x2cdb8
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x4710
movq 0x168249(%rip), %rdi    # 0x194ff0
leaq 0x126870(%rip), %rsi    # 0x15361e
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 0x2cdda
jmp 0x2cdda
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x4780