// File: /workspace/github_cpp_makefile_star2_O1/dannycalegari[P]circle_pack/./graphics.cc
// Function: draw_3d_circle(Point, double, bool)
void draw_3d_circle(Point P, double R, bool front){
	double t;
	double theta,r;
	double fraction;
	fraction=0.003/R;	// the bigger the radius, the smaller fraction should be
	Matrix M;
	Point Q;
	int x1,y1,x2,y2;
    theta=sph_ang(P);
    r=acos(P.z);
    M=ROT(theta)*XZ_ROT(-r);
    Q.x=0.0;
    Q.y=0.0;
    Q.z=1.0;
  //  write_Point(M(Q));
	// write_Point(P);
	if(front){
	    for(t=0.0;t<=TWOPI*(1.0+fraction);t=t+TWOPI*fraction){
    		Q.x=sin(R)*cos(t);
    		Q.y=sin(R)*sin(t);
    		Q.z=cos(R);
    		Q=M(Q);
    		x2=x1;
    		y2=y1;
    		x1=(int) (300.0+Q.x*200.0);
    		y1=(int) (300.0+Q.y*200.0);
    		if(t!=0.0 && Q.z>=0.0){
    			draw_line(x1,y1,x2,y2);
    		};
    	};
	} else {
	    for(t=0.0;t<=TWOPI*(1.0+fraction);t=t+TWOPI*fraction){
    		Q.x=sin(R)*cos(t);
    		Q.y=sin(R)*sin(t);
    		Q.z=cos(R);
    		Q=M(Q);
    		x2=x1;
    		y2=y1;
    		x1=(int) (300.0+Q.x*200.0);
    		y1=(int) (300.0+Q.y*200.0);
    		if(t!=0.0 && Q.z<=0.0){
    			draw_line(x1,y1,x2,y2);
    		};
    	};
	};
	

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movl %edi, %ebx
movsd %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movsd 0x100(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd 0x3b8b(%rip), %xmm0     # 0xb010
jae 0x74ad
leaq 0xf0(%rsp), %rax
movsd (%rax), %xmm1
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rax), %xmm0
callq 0x2040
movapd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
callq 0x21c0
movapd %xmm0, 0x30(%rsp)
leaq 0x80(%rsp), %rdi
movsd 0x10(%rsp), %xmm0
callq 0x2894
movapd 0x30(%rsp), %xmm0
xorpd 0x3be1(%rip), %xmm0     # 0xb0c0
leaq 0x68(%rsp), %rdi
callq 0x2b7e
leaq 0x98(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x9188
movsd 0x3b75(%rip), %xmm0     # 0xb080
divsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
xorpd %xmm0, %xmm0
leaq 0xb0(%rsp), %rdi
movapd %xmm0, (%rdi)
movaps 0x40(%rsp), %xmm0
movq 0x50(%rsp), %rax
leaq 0x98(%rsp), %r14
movups (%r14), %xmm1
movaps %xmm1, 0x40(%rsp)
movq 0x10(%r14), %rcx
movq %rcx, 0x50(%rsp)
movapd (%rdi), %xmm1
movaps %xmm0, (%rdi)
movq %rax, 0x10(%rdi)
movupd %xmm1, (%r14)
movq $0x0, 0x10(%r14)
callq 0x9496
movq %r14, %rdi
callq 0x9496
leaq 0x68(%rsp), %rdi
callq 0x9496
leaq 0x80(%rsp), %rdi
callq 0x9496
movsd 0x3a81(%rip), %xmm0     # 0xb010
addsd 0x30(%rsp), %xmm0
mulsd 0x3a8b(%rip), %xmm0     # 0xb028
testb %bl, %bl
movsd %xmm0, 0x60(%rsp)
xorpd %xmm1, %xmm1
je 0x7742
ucomisd %xmm1, %xmm0
jb 0x78d4
movsd 0x30(%rsp), %xmm0
mulsd 0x3a61(%rip), %xmm0     # 0xb028
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, 0x10(%rsp)
movl %ebp, %ebx
movl %r15d, %r14d
movsd 0x28(%rsp), %xmm0
callq 0x2060
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x23d0
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x2060
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x2060
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x23d0
movsd 0x18(%rsp), %xmm6
movsd 0x20(%rsp), %xmm5
movq 0x40(%rsp), %rax
movq (%rax), %rcx
movq 0x18(%rax), %rdx
movsd 0x8(%rcx), %xmm1
mulsd %xmm6, %xmm1
movsd (%rcx), %xmm2
mulsd %xmm5, %xmm2
addsd %xmm1, %xmm2
movsd 0x10(%rcx), %xmm1
mulsd %xmm0, %xmm1
addsd %xmm2, %xmm1
movsd 0x8(%rdx), %xmm2
mulsd %xmm6, %xmm2
movsd (%rdx), %xmm3
mulsd %xmm5, %xmm3
addsd %xmm2, %xmm3
movsd 0x10(%rdx), %xmm2
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
movsd 0x39f1(%rip), %xmm3     # 0xb088
mulsd %xmm3, %xmm1
movsd 0x39ed(%rip), %xmm4     # 0xb090
addsd %xmm4, %xmm1
cvttsd2si %xmm1, %ebp
movsd 0x10(%rsp), %xmm1
mulsd %xmm3, %xmm2
addsd %xmm4, %xmm2
cvttsd2si %xmm2, %r15d
ucomisd 0x398a(%rip), %xmm1     # 0xb050
jne 0x76ca
jnp 0x7727
movq 0x30(%rax), %rax
mulsd 0x8(%rax), %xmm6
mulsd (%rax), %xmm5
mulsd 0x10(%rax), %xmm0
addsd %xmm6, %xmm5
addsd %xmm5, %xmm0
ucomisd 0x3964(%rip), %xmm0     # 0xb050
jb 0x7727
movq 0x7b33(%rip), %rdi      # 0xf228
movq 0x7c0c(%rip), %rsi      # 0xf308
movq 0x7bfd(%rip), %rdx      # 0xf300
movl $0x258, %r8d            # imm = 0x258
subl %r15d, %r8d
movl $0x258, %eax            # imm = 0x258
subl %r14d, %eax
movl %eax, (%rsp)
movl %ebp, %ecx
movl %ebx, %r9d
callq 0x2310
movsd 0x10(%rsp), %xmm1
addsd 0x30(%rsp), %xmm1
movsd 0x60(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jae 0x75cd
jmp 0x78d4
ucomisd %xmm1, %xmm0
jb 0x78d4
movsd 0x30(%rsp), %xmm0
mulsd 0x38ce(%rip), %xmm0     # 0xb028
movsd %xmm0, 0x30(%rsp)
xorpd %xmm2, %xmm2
movsd %xmm2, 0x10(%rsp)
movl %ebp, %ebx
movl %r15d, %r14d
movsd 0x28(%rsp), %xmm0
callq 0x2060
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x23d0
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x2060
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x2060
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x23d0
movsd 0x18(%rsp), %xmm6
movsd 0x20(%rsp), %xmm5
movq 0x40(%rsp), %rax
movq (%rax), %rcx
movq 0x18(%rax), %rdx
movsd 0x8(%rcx), %xmm1
mulsd %xmm6, %xmm1
movsd (%rcx), %xmm2
mulsd %xmm5, %xmm2
addsd %xmm1, %xmm2
movsd 0x10(%rcx), %xmm1
mulsd %xmm0, %xmm1
addsd %xmm2, %xmm1
movsd 0x8(%rdx), %xmm2
mulsd %xmm6, %xmm2
movsd (%rdx), %xmm3
mulsd %xmm5, %xmm3
addsd %xmm2, %xmm3
movsd 0x10(%rdx), %xmm2
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
movsd 0x385a(%rip), %xmm3     # 0xb088
mulsd %xmm3, %xmm1
movsd 0x3856(%rip), %xmm4     # 0xb090
addsd %xmm4, %xmm1
cvttsd2si %xmm1, %ebp
mulsd %xmm3, %xmm2
addsd %xmm4, %xmm2
cvttsd2si %xmm2, %r15d
movsd 0x10(%rsp), %xmm2
ucomisd 0x37f3(%rip), %xmm2     # 0xb050
jne 0x7861
jnp 0x78be
movq 0x30(%rax), %rax
mulsd 0x8(%rax), %xmm6
mulsd (%rax), %xmm5
mulsd 0x10(%rax), %xmm0
addsd %xmm6, %xmm5
addsd %xmm5, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jb 0x78be
movq 0x799c(%rip), %rdi      # 0xf228
movq 0x7a75(%rip), %rsi      # 0xf308
movq 0x7a66(%rip), %rdx      # 0xf300
movl $0x258, %r8d            # imm = 0x258
subl %r15d, %r8d
movl $0x258, %eax            # imm = 0x258
subl %r14d, %eax
movl %eax, (%rsp)
movl %ebp, %ecx
movl %ebx, %r9d
callq 0x2310
movsd 0x10(%rsp), %xmm2
addsd 0x30(%rsp), %xmm2
movsd 0x60(%rsp), %xmm0
ucomisd %xmm2, %xmm0
jae 0x7764
leaq 0x40(%rsp), %rdi
callq 0x9496
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x9496
jmp 0x78fe
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x9496
jmp 0x7914
jmp 0x7911
jmp 0x7911
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x9496
movq %rbx, %rdi
callq 0x23b0