// File: /workspace/github_cpp_makefile_star2_O3/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 0x2ec5(%rip), %xmm0     # 0xa088
jae 0x71eb
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 0x78(%rsp), %rdi
movsd 0x10(%rsp), %xmm0
callq 0x2859
movapd 0x30(%rsp), %xmm0
xorpd 0x2e06(%rip), %xmm0     # 0xa020
leaq 0x60(%rsp), %rdi
callq 0x2b33
leaq 0x90(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x8e20
movsd 0x2ea5(%rip), %xmm0     # 0xa0e8
divsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x50(%rsp), %rax
leaq 0x90(%rsp), %r14
movaps (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x50(%rsp)
movapd 0x40(%rsp), %xmm1
movaps %xmm0, 0x40(%rsp)
leaq 0xb0(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x9106
movq %r14, %rdi
callq 0x9106
leaq 0x60(%rsp), %rdi
callq 0x9106
leaq 0x78(%rsp), %rdi
callq 0x9106
movsd 0x2dcc(%rip), %xmm0     # 0xa088
addsd 0x30(%rsp), %xmm0
mulsd 0x2dd6(%rip), %xmm0     # 0xa0a0
testb %bl, %bl
movsd %xmm0, 0x58(%rsp)
xorpd %xmm1, %xmm1
je 0x746f
ucomisd %xmm1, %xmm0
jb 0x7601
movsd 0x30(%rsp), %xmm0
mulsd 0x2dac(%rip), %xmm0     # 0xa0a0
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 0x2d2c(%rip), %xmm3     # 0xa0f0
mulsd %xmm3, %xmm1
movsd 0x2d28(%rip), %xmm4     # 0xa0f8
addsd %xmm4, %xmm1
cvttsd2si %xmm1, %ebp
movsd 0x10(%rsp), %xmm1
mulsd %xmm3, %xmm2
addsd %xmm4, %xmm2
cvttsd2si %xmm2, %r15d
ucomisd 0x2cc5(%rip), %xmm1     # 0xa0b8
jne 0x73f7
jnp 0x7454
movq 0x30(%rax), %rax
mulsd 0x8(%rax), %xmm6
mulsd (%rax), %xmm5
mulsd 0x10(%rax), %xmm0
addsd %xmm6, %xmm5
addsd %xmm5, %xmm0
ucomisd 0x2c9f(%rip), %xmm0     # 0xa0b8
jb 0x7454
movq 0x6e06(%rip), %rdi      # 0xe228
movq 0x6edf(%rip), %rsi      # 0xe308
movq 0x6ed0(%rip), %rdx      # 0xe300
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 0x58(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jae 0x72fa
jmp 0x7601
ucomisd %xmm1, %xmm0
jb 0x7601
movsd 0x30(%rsp), %xmm0
mulsd 0x2c19(%rip), %xmm0     # 0xa0a0
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 0x2b95(%rip), %xmm3     # 0xa0f0
mulsd %xmm3, %xmm1
movsd 0x2b91(%rip), %xmm4     # 0xa0f8
addsd %xmm4, %xmm1
cvttsd2si %xmm1, %ebp
mulsd %xmm3, %xmm2
addsd %xmm4, %xmm2
cvttsd2si %xmm2, %r15d
movsd 0x10(%rsp), %xmm2
ucomisd 0x2b2e(%rip), %xmm2     # 0xa0b8
jne 0x758e
jnp 0x75eb
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 0x75eb
movq 0x6c6f(%rip), %rdi      # 0xe228
movq 0x6d48(%rip), %rsi      # 0xe308
movq 0x6d39(%rip), %rdx      # 0xe300
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 0x58(%rsp), %xmm0
ucomisd %xmm2, %xmm0
jae 0x7491
leaq 0x40(%rsp), %rdi
callq 0x9106
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x9106
jmp 0x762b
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x9106
jmp 0x763e
jmp 0x763b
jmp 0x763b
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x9106
movq %rbx, %rdi
callq 0x23b0