// File: /workspace/github_cpp_makefile_star2_O2/dannycalegari[P]circle_pack/./graphics.cc
// Function: Packing::draw_circles()
void Packing::draw_circles(){
	int X,Y,R;
	int SIZE;
	SIZE=(int) adj.size();
	erase_field();
	if(geometry=='E'){	
		int i;
		for(i=0;i<SIZE;i++){
			X=(int) (300.0+VIEWMATRIX(center[i]).x*200.0);
			Y=(int) (300.0+VIEWMATRIX(center[i]).y*200.0);
			R=(int) (VIEWMATRIX.e[0][0]*rad[i]*200.0);	// will this work?
			R=abs(R);	//	infinite circle drawn in ordinary way
			draw_circle(X,Y,R,(double) i/(double) SIZE);
		};
	} else if(geometry=='S'){
		int i;
		draw_circle(300,300,200,0.5);	// draw sphere outline
		XSetForeground(display, gc,(long) 0xF0F0F5);	// wonder what color this is?
		XSetLineAttributes(display, gc, 1, LineDoubleDash, 1, 1);	
		for(i=0;i<SIZE;i++){	// first pass; draw part of circles on the "dark side"
			draw_3d_circle(VIEWMATRIX(center[i]),rad[i],false);
		};
		XSetForeground(display, gc,(long) 0x001000);
		XSetLineAttributes(display, gc, 1, LineSolid, 1, 1);
		for(i=0;i<SIZE;i++){	// second pass; draw part of circles on the "front side"	
			draw_3d_circle(VIEWMATRIX(center[i]),rad[i],true);
		};
	};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rax
subq (%rdi), %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
movq %rax, %r14
callq 0x5d68
movzbl 0x60(%rbx), %eax
cmpl $0x53, %eax
je 0x6432
cmpl $0x45, %eax
jne 0x658e
leaq 0xc8(%rbx), %rax
movq %rax, 0x20(%rsp)
cvtsi2sd %r14d, %xmm0
movsd %xmm0, 0x28(%rsp)
xorl %r13d, %r13d
testl %r14d, %r14d
cmovlel %r13d, %r14d
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x658e
movq 0xa0(%rbx), %rax
movq 0x10(%rax,%r13), %rcx
movq %rcx, 0x10(%rsp)
movups (%rax,%r13), %xmm0
movups %xmm0, (%rsp)
movq %r14, %r15
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rbp
movq 0x20(%rsp), %rbx
movq %rbx, %rsi
callq 0x7600
movsd 0x60(%rsp), %xmm0
movsd 0x2d76(%rip), %xmm1     # 0x9100
mulsd %xmm1, %xmm0
movsd 0x2d72(%rip), %xmm1     # 0x9108
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x1c(%rsp)
movq 0xa0(%rbp), %rax
movq 0x10(%rax,%r13), %rcx
movq %rcx, 0x10(%rsp)
movups (%rax,%r13), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %r14
movq %rbx, %rsi
movq %rbp, %rbx
callq 0x7600
movsd 0x68(%rsp), %xmm0
movsd 0x2d25(%rip), %xmm1     # 0x9100
mulsd %xmm1, %xmm0
addsd 0x2d21(%rip), %xmm0     # 0x9108
cvttsd2si %xmm0, %esi
movq 0x18(%rbp), %rax
movq 0xc8(%rbp), %rcx
movq (%rcx), %rcx
movsd (%rcx), %xmm0
mulsd (%rax,%r12,8), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
cvtsi2sd %r12d, %xmm0
divsd 0x28(%rsp), %xmm0
movl 0x1c(%rsp), %edi
callq 0x5db8
incq %r12
addq $0x18, %r13
jmp 0x633e
movsd 0x2c46(%rip), %xmm0     # 0x9080
movl $0x12c, %edi            # imm = 0x12C
movl $0x12c, %esi            # imm = 0x12C
movl $0xc8, %edx
callq 0x5db8
movq 0x6ddb(%rip), %rdi      # 0xd230
movq 0x6eac(%rip), %rsi      # 0xd308
movl $0xf0f0f5, %edx         # imm = 0xF0F0F5
callq 0x20a0
movq 0x6dc3(%rip), %rdi      # 0xd230
movq 0x6e94(%rip), %rsi      # 0xd308
pushq $0x2
popq %rcx
pushq $0x1
popq %rdx
movl %edx, %r8d
movl %edx, %r9d
callq 0x2330
leaq 0xc8(%rbx), %r15
xorl %r13d, %r13d
testl %r14d, %r14d
cmovlel %r13d, %r14d
leaq 0x48(%rsp), %r12
xorl %ebp, %ebp
cmpq %rbp, %r14
je 0x64f5
movq 0xa0(%rbx), %rax
movq 0x10(%rax,%r13), %rcx
movq %rcx, 0x10(%rsp)
movups (%rax,%r13), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x7600
movq 0x18(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x48(%rsp), %xmm1
movupd %xmm1, (%rsp)
xorl %edi, %edi
callq 0x5e8e
incq %rbp
addq $0x18, %r13
jmp 0x649d
movq 0x6d34(%rip), %rdi      # 0xd230
movq 0x6e05(%rip), %rsi      # 0xd308
movl $0x1000, %edx           # imm = 0x1000
callq 0x20a0
movq 0x6d1c(%rip), %rdi      # 0xd230
movq 0x6ded(%rip), %rsi      # 0xd308
xorl %r13d, %r13d
pushq $0x1
popq %rdx
xorl %ecx, %ecx
movl %edx, %r8d
movl %edx, %r9d
callq 0x2330
leaq 0x30(%rsp), %r12
xorl %ebp, %ebp
cmpq %rbp, %r14
je 0x658e
movq 0xa0(%rbx), %rax
movq 0x10(%rax,%r13), %rcx
movq %rcx, 0x10(%rsp)
movups (%rax,%r13), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x7600
movq 0x18(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x30(%rsp), %xmm1
movupd %xmm1, (%rsp)
pushq $0x1
popq %rdi
callq 0x5e8e
incq %rbp
addq $0x18, %r13
jmp 0x6535
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop