// File: Luthaf[P]zeopp/feature.cc
// Function: FEATURE::segment_saveVis(std::basic_fstream<char, std::char_traits<char>>&)
void FEATURE::segment_saveVis(fstream &output)
{
	int k;

	if(!output.is_open()){
		cerr << "Error: File stream needed to print segment information was not open." << "\n"
			<< "Exiting ..." << "\n";
		exit(1);
	}
	else{

		for(k=0;k<nsegments;k++)
		{
			output << "\n" << "Segment " << k << " with max_r of " << segment_max_r.at(k) << "\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));

					if(segments.at(nodeIDs.at(j))==k)
					{
	// 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 << "draw sphere {" << xCoord <<  " " << yCoord << " " << zCoord << "} radius " <<  curNode.max_radius << "\n";	
						output << "draw sphere {" << xCoord <<  " " << yCoord << " " << zCoord << "} radius " <<  0.1 << "\n";

					};//printing segment block


				} // ends for loop

			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x58b0
testb $0x1, %al
jne 0xddb05
movq 0x19552e(%rip), %rdi    # 0x272ff0
leaq 0x11e053(%rip), %rsi    # 0x1fbb1c
callq 0x5540
movq %rax, %rdi
leaq 0x11bb4d(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, %rdi
leaq 0x11511c(%rip), %rsi    # 0x1f2c03
callq 0x5540
movq %rax, %rdi
leaq 0x11bb2f(%rip), %rsi    # 0x1f9625
callq 0x5540
movl $0x1, %edi
callq 0x67c0
movl $0x0, -0x14(%rbp)
movq -0xb8(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x138(%rcx), %eax
jge 0xddf73
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
leaq 0x11baf4(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, %rdi
leaq 0x11e021(%rip), %rsi    # 0x1fbb61
callq 0x5540
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x58d0
movq %rax, %rdi
leaq 0x11e010(%rip), %rsi    # 0x1fbb6a
callq 0x5540
movq -0xb8(%rbp), %rdi
movq %rax, -0xc0(%rbp)
addq $0x238, %rdi            # imm = 0x238
movslq -0x14(%rbp), %rsi
callq 0xfc80
movq -0xc0(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x11ba8e(%rip), %rsi    # 0x1f9625
callq 0x5540
movl $0x0, -0x18(%rbp)
movq -0xb8(%rbp), %rdi
movl -0x18(%rbp), %eax
movq %rax, -0xc8(%rbp)
addq $0x90, %rdi
callq 0x706e0
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jae 0xddf63
movq -0xb8(%rbp), %rdi
addq $0xa8, %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0xaf5b0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0xeec0
movq -0xb8(%rbp), %rdi
addq $0x90, %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0xcd720
movq %rax, -0xd0(%rbp)
jmp 0xddc18
movq -0xd0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x3c(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq %rax, -0xd8(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x10090
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
jae 0xddf41
movq -0xb8(%rbp), %rax
addq $0x60, %rax
movq %rax, -0xe8(%rbp)
movl -0x50(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x101d0
movq %rax, -0xe0(%rbp)
jmp 0xddc82
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rax
movslq (%rax), %rsi
callq 0x10130
movq %rax, -0xf0(%rbp)
jmp 0xddca1
movq -0xf0(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x64400
jmp 0xddcb6
movq -0xb8(%rbp), %rax
addq $0x140, %rax            # imm = 0x140
movq %rax, -0x100(%rbp)
movl -0x50(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x101d0
movq %rax, -0xf8(%rbp)
jmp 0xddce1
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rax
movslq (%rax), %rsi
callq 0x101d0
movq %rax, -0x108(%rbp)
jmp 0xddd00
movq -0x108(%rbp), %rax
movl (%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0xddf27
movq -0xb8(%rbp), %rax
movsd -0x90(%rbp), %xmm2
cvtsi2sdl -0x3c(%rbp), %xmm3
movsd 0xc0(%rax), %xmm0
movsd 0xd8(%rax), %xmm1
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
cvtsi2sdl -0x38(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0xf0(%rax), %xmm0
cvtsi2sdl -0x34(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x88(%rbp), %xmm2
cvtsi2sdl -0x3c(%rbp), %xmm3
movsd 0xc8(%rax), %xmm0
movsd 0xe0(%rax), %xmm1
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
cvtsi2sdl -0x38(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0xf8(%rax), %xmm0
cvtsi2sdl -0x34(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x80(%rbp), %xmm2
cvtsi2sdl -0x3c(%rbp), %xmm3
movsd 0xd0(%rax), %xmm0
movsd 0xe8(%rax), %xmm1
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
cvtsi2sdl -0x38(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x100(%rax), %xmm0
cvtsi2sdl -0x34(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
leaq 0x1196ff(%rip), %rsi    # 0x1f7511
callq 0x5540
movq %rax, -0x110(%rbp)
jmp 0xdde20
movq -0x110(%rbp), %rdi
movsd -0xa0(%rbp), %xmm0
callq 0x5980
movq %rax, -0x118(%rbp)
jmp 0xdde3d
movq -0x118(%rbp), %rdi
leaq 0x11e463(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x120(%rbp)
jmp 0xdde59
movq -0x120(%rbp), %rdi
movsd -0xa8(%rbp), %xmm0
callq 0x5980
movq %rax, -0x128(%rbp)
jmp 0xdde76
movq -0x128(%rbp), %rdi
leaq 0x11e42a(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0x130(%rbp)
jmp 0xdde92
movq -0x130(%rbp), %rdi
movsd -0xb0(%rbp), %xmm0
callq 0x5980
movq %rax, -0x138(%rbp)
jmp 0xddeaf
movq -0x138(%rbp), %rdi
leaq 0x118628(%rip), %rsi    # 0x1f64e5
callq 0x5540
movq %rax, -0x140(%rbp)
jmp 0xddecb
movq -0x140(%rbp), %rdi
movsd 0x11418e(%rip), %xmm0   # 0x1f2068
callq 0x5980
movq %rax, -0x148(%rbp)
jmp 0xddee8
movq -0x148(%rbp), %rdi
leaq 0x11b72f(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0xddefd
jmp 0xddf27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xddf58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x100e0
jmp 0xddf58
leaq -0x98(%rbp), %rdi
callq 0x100e0
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xddc33
leaq -0x30(%rbp), %rdi
callq 0xec80
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xddba3
leaq -0x30(%rbp), %rdi
callq 0xec80
jmp 0xddf7e
jmp 0xddf65
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xddb0c
jmp 0xddf75
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x58f0
nopw (%rax,%rax)