// File: /workspace/github_cpp_makefile_star2_O1/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 0x74515
addq $0x10, %r14
leaq 0xe2d59(%rip), %rsi     # 0x156a06
movl $0x4, %edx
movq %r14, %rdi
callq 0x44e0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x44e0
movq %rax, %r12
leaq 0xe25a2(%rip), %rsi     # 0x156275
movl $0x2, %edx
movq %rax, %rdi
callq 0x44e0
movq %r12, %rdi
movl %ebp, %esi
callq 0x4750
movq %rax, %r13
leaq 0xe2634(%rip), %rsi     # 0x156328
movl $0x3, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0xe1826(%rip), %r12     # 0x15552e
movl $0x1, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x44e0
leaq 0xe2cec(%rip), %rsi     # 0x156a0b
movl $0x8, %edx
movq %r13, %rdi
callq 0x44e0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r13, %rdi
callq 0x44e0
movq %rax, %r15
leaq 0xe253f(%rip), %rsi     # 0x156284
movl $0x7, %edx
movq %rax, %rdi
callq 0x44e0
movq %r15, %rdi
movl %ebp, %esi
callq 0x4750
movq %rax, %r15
leaq 0xe25de(%rip), %rsi     # 0x156344
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 0x7448a
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 0x74504
movq %rcx, %r13
movq %rbx, %r12
leaq (%rbx,%rbx,2), %rbx
leaq (%rax,%rbx,8), %rsi
leaq 0x58(%rsp), %rdi
callq 0xe886
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 0x744f1
movq 0x58(%rsp), %rdi
cmpq %rdi, 0x60(%rsp)
leaq 0xe365e(%rip), %r13     # 0x157486
je 0x74448
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 0x744e3
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 0x38318
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 0xdf44c(%rip), %rsi     # 0x153433
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 0xe221f(%rip), %rsi     # 0x1562b2
callq 0x44e0
movq 0x58(%rsp), %rax
movq 0x60(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0x744d2
movl (%rax,%rbx,4), %esi
movq %rbp, %rdi
callq 0x4750
movq %rax, %rbp
movl $0x20, %edx
movq %rax, %rdi
leaq 0xe21f8(%rip), %rsi     # 0x1562c7
callq 0x44e0
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xe144b(%rip), %rsi     # 0x15552e
callq 0x44e0
movq 0xe0(%rsp), %rdi
cmpq %rdi, 0xe8(%rsp)
je 0x74417
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 0x744c4
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 0x38318
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 0xdf27a(%rip), %rsi     # 0x153510
callq 0x44e0
leaq 0xe31e4(%rip), %r13     # 0x157486
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 0xe0078(%rip), %rsi     # 0x15437b
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 0xdf23c(%rip), %rsi     # 0x1535df
callq 0x44e0
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xe1177(%rip), %rsi     # 0x15552e
callq 0x44e0
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
movl 0x54(%rsp), %ebx
je 0x743dd
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 0x74106
movq 0x78(%rsp), %rbx
testq %rdi, %rdi
je 0x7442c
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 0x73e74
testq %rdi, %rdi
movq 0x70(%rsp), %rbx
je 0x7445f
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 0x73db6
leaq 0xe1dfd(%rip), %rsi     # 0x15628e
movl $0x1, %edx
movq %r14, %rdi
callq 0x44e0
leaq 0xe1089(%rip), %rsi     # 0x15552e
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 0xdb1da(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xdb1cc(%rip), %rdi     # 0x14f6a5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xdb1bb(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xdb1ad(%rip), %rdi     # 0x14f6a5
movq 0x70(%rsp), %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xdb19a(%rip), %rdi     # 0x14f6a5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
movq 0x122ad4(%rip), %rdi    # 0x196ff0
leaq 0xe24c0(%rip), %rsi     # 0x1569e3
callq 0x4440
movq %rax, %rdi
movq %r15, %rsi
callq 0x43c0
leaq 0xe2469(%rip), %rsi     # 0x1569a3
movq %rax, %rdi
callq 0x4440
leaq 0xe0fe5(%rip), %rbx     # 0x15552e
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4440
leaq 0xdb5e8(%rip), %rsi     # 0x14fb43
movq %rax, %rdi
callq 0x4440
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4440
movl $0x1, %edi
callq 0x710c
jmp 0x7457c
jmp 0x7457c
movq %rax, %rbx
jmp 0x745c9
jmp 0x74587
jmp 0x74587
jmp 0x74587
movq %rax, %rbx
jmp 0x745ac
movq %rax, %rbx
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x745ac
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x745c9
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x745e0
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780