// File: 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
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0xa520
movl %eax, -0x18(%rbp)
callq 0x82b0
movq -0xf0(%rbp), %rax
movsbl 0x60(%rax), %eax
cmpl $0x45, %eax
jne 0x8b5a
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x8b55
movq -0xf0(%rbp), %rdi
movq %rdi, %rax
addq $0xc8, %rax
movq %rax, -0x108(%rbp)
addq $0xa0, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xa5c0
movq -0x108(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xa750
movq -0xf0(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
movsd 0x865b(%rip), %xmm1     # 0x11078
mulsd %xmm1, %xmm0
movsd 0x8657(%rip), %xmm1     # 0x11080
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xc(%rbp)
movq %rdi, %rax
addq $0xc8, %rax
movq %rax, -0x100(%rbp)
addq $0xa0, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xa5c0
movq -0x100(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, -0x80(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x78(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x80(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xa750
movq -0xf0(%rbp), %rdi
movsd -0x60(%rbp), %xmm0
movsd 0x85cc(%rip), %xmm1     # 0x11078
mulsd %xmm1, %xmm0
movsd 0x85c8(%rip), %xmm1     # 0x11080
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10(%rbp)
addq $0xc8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa250
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa270
movq -0xf0(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xf8(%rbp)
addq $0x18, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xa270
movsd -0xf8(%rbp), %xmm0
mulsd (%rax), %xmm0
movsd 0x8565(%rip), %xmm1     # 0x11078
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %edi
movl -0x10(%rbp), %esi
movl -0x14(%rbp), %edx
cvtsi2sdl -0x1c(%rbp), %xmm0
cvtsi2sdl -0x18(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0x8320
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8992
jmp 0x8ddb
movq -0xf0(%rbp), %rax
movsbl 0x60(%rax), %eax
cmpl $0x53, %eax
jne 0x8dd9
movl $0x12c, %esi            # imm = 0x12C
movl $0xc8, %edx
movsd 0x8508(%rip), %xmm0     # 0x11088
movl %esi, %edi
callq 0x8320
movq 0xf6b2(%rip), %rdi      # 0x18240
movq 0xf783(%rip), %rsi      # 0x18318
movl $0xf0f0f5, %edx         # imm = 0xF0F0F5
callq 0x20b0
movq 0xf69a(%rip), %rdi      # 0x18240
movq 0xf76b(%rip), %rsi      # 0x18318
movl $0x1, %r9d
movl $0x2, %ecx
movl %r9d, %edx
movl %r9d, %r8d
callq 0x2350
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x8caf
movq -0xf0(%rbp), %rdi
movq %rdi, %rax
addq $0xc8, %rax
movq %rax, -0x110(%rbp)
addq $0xa0, %rdi
movslq -0x84(%rbp), %rsi
callq 0xa5c0
movq -0x110(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, -0xb8(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0xb0(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xb8(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xa750
movq -0xf0(%rbp), %rdi
addq $0x18, %rdi
movslq -0x84(%rbp), %rsi
callq 0xa270
movsd (%rax), %xmm0
leaq -0xa0(%rbp), %rax
xorl %edi, %edi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8430
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x8bcd
movq 0xf58a(%rip), %rdi      # 0x18240
movq 0xf65b(%rip), %rsi      # 0x18318
movl $0x1000, %edx           # imm = 0x1000
callq 0x20b0
movq 0xf572(%rip), %rdi      # 0x18240
movq 0xf643(%rip), %rsi      # 0x18318
movl $0x1, %r9d
xorl %ecx, %ecx
movl %r9d, %edx
movl %r9d, %r8d
callq 0x2350
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x8dd7
movq -0xf0(%rbp), %rdi
movq %rdi, %rax
addq $0xc8, %rax
movq %rax, -0x118(%rbp)
addq $0xa0, %rdi
movslq -0x84(%rbp), %rsi
callq 0xa5c0
movq -0x118(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, -0xe8(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0xe0(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xe8(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xa750
movq -0xf0(%rbp), %rdi
addq $0x18, %rdi
movslq -0x84(%rbp), %rsi
callq 0xa270
movsd (%rax), %xmm0
leaq -0xd0(%rbp), %rax
movl $0x1, %edi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8430
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x8cf2
jmp 0x8dd9
jmp 0x8ddb
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw %cs:(%rax,%rax)