// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/channel.cc
// Function: CHANNEL::writeToVMD(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, std::basic_fstream<char, std::char_traits<char>>&)
void CHANNEL::writeToVMD(string type, int n, fstream &output){
    if(!output.is_open()){
        cerr << "Error: File stream needed to print" << type << " information was not open." << "\n"
        << "Exiting ..." << "\n";
        exit(1);
    }
    else{
        output << "set " << type << "s(" << n << ") {" << "\n"
        << "{color $" << type << "Colors(" << n << ")}" << "\n";
        
        // Draw the components located in each unit cell
        for(unsigned int i = 0; i < unitCells.size(); i++){
            vector<int> nodeIDs = ucNodes.at(i);
            DELTA_POS disp = unitCells.at(i);
            
            // Iterate over all nodes in the unit cell
            for(unsigned int j = 0; j < nodeIDs.size(); j++){
                DIJKSTRA_NODE curNode = nodes.at(nodeIDs.at(j));
                
                // Find node coordinates
                double xCoord = curNode.x + v_a.x*disp.x + v_b.x*disp.y + v_c.x*disp.z;
                double yCoord = curNode.y + v_a.y*disp.x + v_b.y*disp.y + v_c.y*disp.z;
                double zCoord = curNode.z + v_a.z*disp.x + v_b.z*disp.y + v_c.z*disp.z;
                
                // Command used to draw node
                output << "{sphere {" << xCoord <<  " " << yCoord << " " << zCoord
                << "} radius $nodeRadii(" << nodeIDs.at(j) <<") resolution $sphere_resolution}" << "\n";
                
                // Iterate over all connections stemming from the current node
                for(unsigned int k = 0; k < curNode.connections.size(); k++){
                    CONN curConn = curNode.connections.at(k);
                    DIJKSTRA_NODE otherNode = nodes.at(curConn.to);
                    int dx = disp.x + curConn.deltaPos.x;
                    int dy = disp.y + curConn.deltaPos.y;
                    int dz = disp.z + curConn.deltaPos.z;
                    
                    // Find end of edge coordinates
                    double newX = otherNode.x + v_a.x*dx + v_b.x*dy + v_c.x*dz;
                    double newY = otherNode.y + v_a.y*dx + v_b.y*dy + v_c.y*dz;
                    double newZ = otherNode.z + v_a.z*dx + v_b.z*dy + v_c.z*dz;
                    
                    // Command used to draw edge
                    output << "{line {" << xCoord << " " << yCoord << " " << zCoord << "} {"
                    << newX << " " << newY << " " << newZ<< "}}" <<  "\n";
                }
            }
        }
        output << "}" << "\n";
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x80(%rcx), %rdi
callq 0x4120
testb %al, %al
je 0x73811
addq $0x10, %r14
leaq 0xe1b75(%rip), %rsi     # 0x154b1e
movl $0x4, %edx
movq %r14, %rdi
callq 0x44e0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x44e0
movq %rax, %r12
leaq 0xe1396(%rip), %rsi     # 0x154365
movl $0x2, %edx
movq %rax, %rdi
callq 0x44e0
movq %r12, %rdi
movl %ebp, %esi
callq 0x4750
movq %rax, %r13
leaq 0xe1428(%rip), %rsi     # 0x154418
movl $0x3, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe061a(%rip), %r12     # 0x15361e
movl $0x1, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x44e0
leaq 0xe1b08(%rip), %rsi     # 0x154b23
movl $0x8, %edx
movq %r13, %rdi
callq 0x44e0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r13, %rdi
callq 0x44e0
movq %rax, %r15
leaq 0xe1333(%rip), %rsi     # 0x154374
movl $0x7, %edx
movq %rax, %rdi
callq 0x44e0
movq %r15, %rdi
movl %ebp, %esi
callq 0x4750
movq %rax, %r15
leaq 0xe13d2(%rip), %rsi     # 0x154434
movl $0x2, %edx
movq %rax, %rdi
callq 0x44e0
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x44e0
movq 0x98(%rbx), %rax
cmpq 0x90(%rbx), %rax
je 0x73786
movq %rbx, %r15
xorl %ebx, %ebx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
movq %r15, 0x80(%rsp)
movq %r14, 0xa0(%rsp)
movq 0xa8(%r15), %rax
movq 0xb0(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %rcx, %rdx
cmpq %rbx, %rdx
jbe 0x73800
movq %rcx, %r13
movq %rbx, %r12
leaq (%rbx,%rbx,2), %rbx
leaq (%rax,%rbx,8), %rsi
leaq 0x58(%rsp), %rdi
callq 0xe8f8
movq 0x90(%r15), %rax
movq 0x98(%r15), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
imulq %r13, %rdx
movq %r12, 0x70(%rsp)
cmpq %r12, %rdx
jbe 0x737ed
movq 0x58(%rsp), %rdi
cmpq %rdi, 0x60(%rsp)
leaq 0xe24b2(%rip), %r13     # 0x1555d6
je 0x73744
movl (%rax,%rbx,4), %ecx
movl 0x4(%rax,%rbx,4), %edx
movl %ecx, 0x50(%rsp)
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x98(%rsp)
movl %edx, 0x4c(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x90(%rsp)
movl 0x8(%rax,%rbx,4), %eax
movl %eax, 0x48(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x88(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x78(%rsp)
movslq (%rdi,%rbx,4), %rsi
movq 0x60(%r15), %rbx
movq 0x68(%r15), %rdx
subq %rbx, %rdx
sarq $0x3, %rdx
movabsq $-0x71c71c71c71c71c7, %rax # imm = 0x8E38E38E38E38E39
imulq %rax, %rdx
cmpq %rsi, %rdx
jbe 0x737df
leaq (%rsi,%rsi,8), %r15
leaq (%rbx,%r15,8), %rsi
addq $0x20, %rsi
movupd -0x20(%rsi), %xmm0
movupd -0x10(%rsi), %xmm1
movapd %xmm1, 0xd0(%rsp)
movapd %xmm0, 0xc0(%rsp)
leaq 0xe0(%rsp), %r12
movq %r12, %rdi
callq 0x37e9e
leaq (%rbx,%r15,8), %rax
movb 0x40(%rax), %cl
movb %cl, 0x20(%r12)
movq 0x38(%rax), %rax
movq %rax, 0x18(%r12)
movq 0x80(%rsp), %r15
movsd 0xc0(%r15), %xmm1
movsd 0x98(%rsp), %xmm0
mulsd %xmm0, %xmm1
addsd 0xc8(%rsp), %xmm1
movsd %xmm1, 0x40(%rsp)
movsd 0xd8(%r15), %xmm2
movsd 0x90(%rsp), %xmm1
mulsd %xmm1, %xmm2
movsd %xmm2, 0x38(%rsp)
movsd 0xf0(%r15), %xmm3
movsd 0x88(%rsp), %xmm2
mulsd %xmm2, %xmm3
movsd %xmm3, 0x10(%rsp)
movsd 0xc8(%r15), %xmm3
mulsd %xmm0, %xmm3
addsd 0xd0(%rsp), %xmm3
movsd %xmm3, 0x30(%rsp)
movsd 0xe0(%r15), %xmm3
mulsd %xmm1, %xmm3
movsd %xmm3, 0x28(%rsp)
movsd 0xf8(%r15), %xmm3
mulsd %xmm2, %xmm3
movsd %xmm3, 0x8(%rsp)
movsd 0xd0(%r15), %xmm3
mulsd %xmm0, %xmm3
addsd 0xd8(%rsp), %xmm3
movsd %xmm3, 0x20(%rsp)
movsd 0xe8(%r15), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x100(%r15), %xmm0
mulsd %xmm2, %xmm0
movsd %xmm0, (%rsp)
movl $0x9, %edx
movq %r14, %rdi
leaq 0xde1e0(%rip), %rsi     # 0x1514c3
callq 0x44e0
movq 0x78(%rsp), %rbx
movsd 0x38(%rsp), %xmm1
addsd 0x40(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movq %r14, %rdi
movsd %xmm0, 0x10(%rsp)
callq 0x46b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movsd 0x28(%rsp), %xmm1
addsd 0x30(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movq %rbp, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x46b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movsd 0x18(%rsp), %xmm1
addsd 0x20(%rsp), %xmm1
movsd (%rsp), %xmm0
addsd %xmm1, %xmm0
movq %rbp, %rdi
movsd %xmm0, (%rsp)
callq 0x46b0
movq %rax, %rbp
movl $0x14, %edx
movq %rax, %rdi
leaq 0xe1013(%rip), %rsi     # 0x1543a2
callq 0x44e0
movq 0x58(%rsp), %rax
movq 0x60(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0x737ce
movl (%rax,%rbx,4), %esi
movq %rbp, %rdi
callq 0x4750
movq %rax, %rbp
movl $0x20, %edx
movq %rax, %rdi
leaq 0xe0fec(%rip), %rsi     # 0x1543b7
callq 0x44e0
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xe023f(%rip), %rsi     # 0x15361e
callq 0x44e0
movq 0xe0(%rsp), %rdi
cmpq %rdi, 0xe8(%rsp)
je 0x73713
movl $0x1, %r8d
xorl %eax, %eax
leaq (%rax,%rax,4), %rax
movslq 0x4(%rdi,%rax,8), %rsi
movq 0x60(%r15), %rbx
movq 0x68(%r15), %rdx
subq %rbx, %rdx
sarq $0x3, %rdx
movabsq $-0x71c71c71c71c71c7, %rcx # imm = 0x8E38E38E38E38E39
imulq %rcx, %rdx
cmpq %rsi, %rdx
jbe 0x737c0
movl %r8d, 0x54(%rsp)
movl 0x18(%rdi,%rax,8), %r15d
movl 0x1c(%rdi,%rax,8), %r13d
movl 0x20(%rdi,%rax,8), %ebp
leaq (%rsi,%rsi,8), %r14
leaq 0x20(%rbx,%r14,8), %rsi
movupd -0x20(%rsi), %xmm0
movupd -0x10(%rsi), %xmm1
movapd %xmm1, 0x120(%rsp)
movapd %xmm0, 0x110(%rsp)
leaq 0x130(%rsp), %r12
movq %r12, %rdi
callq 0x37e9e
leaq (%rbx,%r14,8), %rax
movb 0x40(%rax), %cl
movb %cl, 0x20(%r12)
movq 0x38(%rax), %rax
movq %rax, 0x18(%r12)
addl 0x50(%rsp), %r15d
addl 0x4c(%rsp), %r13d
addl 0x48(%rsp), %ebp
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movq 0x80(%rsp), %r15
movsd 0xc0(%r15), %xmm1
mulsd %xmm0, %xmm1
addsd 0x118(%rsp), %xmm1
movsd %xmm1, 0x40(%rsp)
cvtsi2sd %r13d, %xmm2
movsd 0xd8(%r15), %xmm1
mulsd %xmm2, %xmm1
movsd %xmm1, 0x30(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
movsd 0xf0(%r15), %xmm3
mulsd %xmm1, %xmm3
movsd %xmm3, 0x38(%rsp)
movsd 0xc8(%r15), %xmm3
mulsd %xmm0, %xmm3
addsd 0x120(%rsp), %xmm3
movsd %xmm3, 0x28(%rsp)
movsd 0xe0(%r15), %xmm3
mulsd %xmm2, %xmm3
movsd %xmm3, 0x18(%rsp)
movsd 0xf8(%r15), %xmm3
mulsd %xmm1, %xmm3
movsd %xmm3, 0x20(%rsp)
mulsd 0xd0(%r15), %xmm0
addsd 0x128(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
mulsd 0xe8(%r15), %xmm2
movsd %xmm2, 0xa8(%rsp)
mulsd 0x100(%r15), %xmm1
movsd %xmm1, 0xb0(%rsp)
movl $0x7, %edx
movq 0xa0(%rsp), %r14
movq %r14, %rdi
leaq 0xde00e(%rip), %rsi     # 0x1515a0
callq 0x44e0
leaq 0xe2038(%rip), %r13     # 0x1555d6
movq %r14, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x46b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movq %rbp, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x46b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movq %rbp, %rdi
movsd (%rsp), %xmm0
callq 0x46b0
movq %rax, %rbp
movl $0x3, %edx
movq %rax, %rdi
leaq 0xdee2c(%rip), %rsi     # 0x15242b
callq 0x44e0
movsd 0x30(%rsp), %xmm1
addsd 0x40(%rsp), %xmm1
movsd 0x38(%rsp), %xmm0
addsd %xmm1, %xmm0
movq %rbp, %rdi
callq 0x46b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movsd 0x18(%rsp), %xmm1
addsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movq %rbp, %rdi
callq 0x46b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x44e0
movsd 0xa8(%rsp), %xmm1
addsd 0xb8(%rsp), %xmm1
movsd 0xb0(%rsp), %xmm0
addsd %xmm1, %xmm0
movq %rbp, %rdi
callq 0x46b0
movq %rax, %rbp
movl $0x2, %edx
movq %rax, %rdi
leaq 0xddff0(%rip), %rsi     # 0x15168f
callq 0x44e0
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xdff6b(%rip), %rsi     # 0x15361e
callq 0x44e0
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
movl 0x54(%rsp), %ebx
je 0x736d9
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movl %ebx, %eax
movq 0xe0(%rsp), %rdi
movq 0xe8(%rsp), %rcx
subq %rdi, %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
incl %ebx
cmpq %rax, %rcx
movl %ebx, %r8d
ja 0x73402
movq 0x78(%rsp), %rbx
testq %rdi, %rdi
je 0x73728
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
incl %ebx
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rax
subq %rdi, %rax
sarq $0x2, %rax
cmpq %rbx, %rax
ja 0x73170
testq %rdi, %rdi
movq 0x70(%rsp), %rbx
je 0x7375b
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x98(%r15), %rax
subq 0x90(%r15), %rax
incl %ebx
sarq $0x2, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq %rbx, %rax
ja 0x730b2
leaq 0xe0bf1(%rip), %rsi     # 0x15437e
movl $0x1, %edx
movq %r14, %rdi
callq 0x44e0
leaq 0xdfe7d(%rip), %rsi     # 0x15361e
movl $0x1, %edx
movq %r14, %rdi
callq 0x44e0
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd9f2e(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
leaq 0xd9f20(%rip), %rdi     # 0x14d6f5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xd9f0f(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
leaq 0xd9f01(%rip), %rdi     # 0x14d6f5
movq 0x70(%rsp), %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xd9eee(%rip), %rdi     # 0x14d6f5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
movq 0x1217d8(%rip), %rdi    # 0x194ff0
leaq 0xe12dc(%rip), %rsi     # 0x154afb
callq 0x4440
movq %rax, %rdi
movq %r15, %rsi
callq 0x43c0
leaq 0xe1285(%rip), %rsi     # 0x154abb
movq %rax, %rdi
callq 0x4440
leaq 0xdfdd9(%rip), %rbx     # 0x15361e
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4440
leaq 0xda35c(%rip), %rsi     # 0x14dbb3
movq %rax, %rdi
callq 0x4440
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4440
movl $0x1, %edi
callq 0x72bc
jmp 0x73878
jmp 0x73878
movq %rax, %rbx
jmp 0x738c5
jmp 0x73883
jmp 0x73883
jmp 0x73883
movq %rax, %rbx
jmp 0x738a8
movq %rax, %rbx
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x738a8
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x738c5
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x738dc
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780