// File: /workspace/github_cpp_makefile_star2_O2/dannycalegari[P]circle_pack/./Layout_routine.cc
// Function: Packing::change_geometry(char)
void Packing::change_geometry(char new_geometry){
	Point Pcent,Pin,Pout,ORIGIN,Q;
	double d,theta;
	double R;
	int i;
	if(verbose){
		cout << "changing geometry from " << geometry << " to " << new_geometry << "\n";
	};
	ORIGIN.x=0.0;
	ORIGIN.y=0.0;
	ORIGIN.z=1.0;
	if(new_geometry=='E' && geometry=='H'){
		for(i=0;i<(int) adj.size();i++){	// for each point
			if(i==INFV){	// special case
				center[i]=ORIGIN;
				rad[i]=-1.0;
			} else {
				Pcent=center[i];	// hyperbolic center
				d=hyp_dist(Pcent);		// hyperbolic distance to 0
				theta=hyp_ang(Pcent);	// hyperbolic angle from 0
				R=rad[i];		// hyperbolic radius
				Pin=(ROT(theta)*HTR(d-R))(ORIGIN);
				Pin=hyperboloid_to_Poincare(Pin);
				Pout=(ROT(theta)*HTR(d+R))(ORIGIN);
				Pout=hyperboloid_to_Poincare(Pout);
				Pcent=midpoint(Pin,Pout);
				R=Euc_dist(Pin,Pout)/2.0;
				center[i]=Pcent;	// Euclidean center
				rad[i]=R;			// Euclidean radius
			};
		};
		geometry='E';
	} else if(new_geometry=='S' && geometry=='H'){
		for(i=0;i<(int) adj.size();i++){	// for each point
			if(i==INFV){	// special case
				center[i]=ORIGIN;
				center[i].z=-1.0;	// actually, we want center at (0,0,-1), i.e. infinity
				rad[i]=PI/2.0;
			} else {
				Pcent=center[i];	// hyperbolic center
				d=hyp_dist(Pcent);		// hyperbolic distance to 0
				theta=hyp_ang(Pcent);	// hyperbolic angle from 0
				R=rad[i];		// hyperbolic radius
				Pin=(ROT(theta)*HTR(d-R))(ORIGIN);
				Pin=hyperboloid_to_sphere(Pin);
				Pout=(ROT(theta)*HTR(d+R))(ORIGIN);
				Pout=hyperboloid_to_sphere(Pout);
				Pcent=midpoint(Pin,Pout);
				Pcent=Pcent/norm(Pcent);
				R=sph_dist(Pin,Pout)/2.0;
				center[i]=Pcent;	// Spherical center
				rad[i]=R;			// Spherical radius
			};
		};
		geometry='S';	
	} else if(new_geometry=='S' && geometry=='E'){
		for(i=0;i<(int) adj.size();i++){	// for each point
			Pcent=center[i];	// Euclidean center
			R=fabs(rad[i]);		// Euclidean radius
			theta=Euc_ang(Pcent);	// Euclidean angle from origin
			Q.x=cos(theta)*R;
			Q.y=sin(theta)*R;
			Q.z=0.0;
			Pin=Pcent-Q;
			Pin=Euclidean_to_sphere(Pin);
			Pout=Pcent+Q;
			Pout=Euclidean_to_sphere(Pout);
			Pcent=midpoint(Pin,Pout);	// new Pcent
			if(norm(Pcent)==0.0){
				Pcent=ORIGIN;
			} else {
				Pcent=Pcent/norm(Pcent);
			};
			R=sph_dist(Pin,Pout)/2.0;
			center[i]=Pcent;	// Spherical center
			rad[i]=R;			// Spherical radius
		};
		geometry='S';	
	};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rdi, %r8
cmpb $0x1, 0xb8(%rdi)
movsbl %sil, %ebp
movq %rdi, 0x40(%rsp)
jne 0x510f
movq 0x7f0b(%rip), %rdi      # 0xcfd0
leaq 0x4305(%rip), %rsi      # 0x93d1
callq 0x21e0
movq 0x40(%rsp), %rcx
movsbl 0x60(%rcx), %esi
movq %rax, %rdi
callq 0x2230
leaq 0x4300(%rip), %rsi      # 0x93e9
movq %rax, %rdi
callq 0x21e0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2230
leaq 0x462f(%rip), %rsi      # 0x9731
movq %rax, %rdi
callq 0x21e0
movq 0x40(%rsp), %r8
cmpl $0x53, %ebp
je 0x5429
cmpl $0x45, %ebp
jne 0x5a69
cmpb $0x48, 0x60(%r8)
jne 0x5a69
xorl %r13d, %r13d
pushq $0x18
popq %rsi
leaq 0x98(%rsp), %r12
leaq 0x1e0(%rsp), %r14
leaq 0x240(%rsp), %rbx
xorl %ebp, %ebp
movq 0x8(%r8), %rax
subq (%r8), %rax
cqto
idivq %rsi
cltq
cmpq %rax, %rbp
jge 0x5668
movl 0xbc(%r8), %ecx
movq 0xa0(%r8), %rax
cmpq %rcx, %rbp
jne 0x5197
leaq (%rax,%r13), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movsd 0x3f38(%rip), %xmm0     # 0x90c0
movabsq $0x3ff0000000000000, %r14 # imm = 0x3FF0000000000000
jmp 0x53ff
movups (%rax,%r13), %xmm2
movsd 0x10(%rax,%r13), %xmm3
xorpd %xmm1, %xmm1
movsd 0x3ed9(%rip), %xmm0     # 0x9088
ucomisd %xmm3, %xmm0
ja 0x51d8
movapd %xmm3, %xmm0
movaps %xmm2, 0x20(%rsp)
movsd %xmm3, 0x30(%rsp)
callq 0x23b0
movsd 0x30(%rsp), %xmm3
movaps 0x20(%rsp), %xmm2
movapd %xmm0, %xmm1
movsd %xmm1, 0x70(%rsp)
movaps %xmm2, 0x140(%rsp)
movsd %xmm3, 0x150(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x140(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x30da
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movsd (%rax,%rbp,8), %xmm1
movsd %xmm1, 0x48(%rsp)
movq %r12, %rdi
movsd %xmm0, 0x90(%rsp)
callq 0x279b
movsd 0x70(%rsp), %xmm0
subsd 0x48(%rsp), %xmm0
movq %r14, %rdi
callq 0x2c7d
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x768c
xorpd %xmm0, %xmm0
movapd %xmm0, 0x1c0(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x1d0(%rsp)
movq 0x1d0(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd %xmm0, (%rsp)
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x7600
movaps 0x50(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movsd 0x60(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rbx, %rdi
callq 0x78f0
movq %r14, %rdi
callq 0x78f0
movq %r12, %rdi
callq 0x78f0
movapd 0x20(%rsp), %xmm0
addsd 0x3dbb(%rip), %xmm0     # 0x9088
movapd %xmm0, 0x20(%rsp)
movq %r12, %rdi
movsd 0x90(%rsp), %xmm0
callq 0x279b
movsd 0x70(%rsp), %xmm0
addsd 0x48(%rsp), %xmm0
leaq 0x228(%rsp), %r15
movq %r15, %rdi
callq 0x2c7d
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x768c
movapd 0x20(%rsp), %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd 0x30(%rsp), %xmm1
divpd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x1a0(%rsp)
movabsq $0x3ff0000000000000, %r14 # imm = 0x3FF0000000000000
movq %r14, 0x1b0(%rsp)
movq 0x1b0(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd %xmm0, (%rsp)
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x7600
movsd 0x60(%rsp), %xmm0
addsd 0x3d14(%rip), %xmm0     # 0x9088
movapd %xmm0, 0x70(%rsp)
movaps 0x50(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rbx, %rdi
callq 0x78f0
movq %r15, %rdi
callq 0x78f0
movq %r12, %rdi
callq 0x78f0
movapd 0x70(%rsp), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movapd 0x20(%rsp), %xmm0
divpd %xmm1, %xmm0
movapd 0x30(%rsp), %xmm2
movapd %xmm2, %xmm1
addpd %xmm0, %xmm1
mulpd 0x3c4a(%rip), %xmm1     # 0x9010
subpd %xmm0, %xmm2
movapd %xmm2, %xmm0
mulpd %xmm2, %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
sqrtsd %xmm2, %xmm0
mulsd 0x3c96(%rip), %xmm0     # 0x9080
movq 0x40(%rsp), %r8
movq 0xa0(%r8), %rax
movupd %xmm1, (%rax,%r13)
pushq $0x18
popq %rsi
movq %r14, 0x10(%rax,%r13)
movq 0x18(%r8), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
addq $0x18, %r13
leaq 0x98(%rsp), %r12
leaq 0x1e0(%rsp), %r14
jmp 0x514c
movzbl 0x60(%r8), %eax
cmpl $0x48, %eax
je 0x5672
cmpl $0x45, %eax
jne 0x5a69
pushq $0x2
popq %r14
xorl %r15d, %r15d
pushq $0x18
popq %r12
movq 0x8(%r8), %rax
subq (%r8), %rax
cqto
idivq %r12
cltq
cmpq %rax, %r15
jge 0x5a64
movq 0x18(%r8), %rax
movq 0xa0(%r8), %rcx
movsd (%rcx,%r14,8), %xmm0
movsd (%rax,%r15,8), %xmm1
movaps %xmm1, 0x30(%rsp)
movups -0x10(%rcx,%r14,8), %xmm1
movaps %xmm1, 0x20(%rsp)
movaps %xmm1, 0xc0(%rsp)
movsd %xmm0, 0xd0(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0xc0(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x311a
movsd %xmm0, 0x48(%rsp)
callq 0x23e0
movaps %xmm0, 0x70(%rsp)
movsd 0x48(%rsp), %xmm0
callq 0x2060
movapd 0x30(%rsp), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
andpd 0x3b6b(%rip), %xmm1     # 0x9050
movapd 0x70(%rsp), %xmm6
unpcklpd %xmm0, %xmm6            # xmm6 = xmm6[0],xmm0[0]
mulpd %xmm1, %xmm6
movapd 0x20(%rsp), %xmm1
movapd %xmm1, %xmm0
subpd %xmm6, %xmm0
addpd %xmm1, %xmm6
movapd %xmm6, %xmm1
movsd %xmm0, %xmm1            # xmm1 = xmm0[0],xmm1[1]
movapd %xmm0, %xmm2
movsd %xmm6, %xmm2            # xmm2 = xmm6[0],xmm2[1]
movapd %xmm6, %xmm4
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
mulpd %xmm4, %xmm4
movapd 0x3b17(%rip), %xmm5     # 0x9040
movapd %xmm5, %xmm3
subpd %xmm4, %xmm3
addpd %xmm5, %xmm4
unpckhpd %xmm0, %xmm6            # xmm6 = xmm6[1],xmm0[1]
mulpd %xmm6, %xmm6
addpd %xmm6, %xmm4
addpd %xmm2, %xmm2
divpd %xmm4, %xmm2
addpd %xmm1, %xmm1
subpd %xmm6, %xmm3
divpd %xmm4, %xmm3
shufpd $0x1, %xmm4, %xmm4      # xmm4 = xmm4[1,0]
divpd %xmm4, %xmm1
movapd %xmm2, %xmm4
addpd %xmm1, %xmm4
mulpd 0x3aa2(%rip), %xmm4     # 0x9010
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
movapd %xmm0, %xmm7
addsd %xmm3, %xmm7
mulsd 0x3afa(%rip), %xmm7     # 0x9080
movapd %xmm4, %xmm5
mulpd %xmm4, %xmm5
unpckhpd %xmm5, %xmm5            # xmm5 = xmm5[1,1]
movapd %xmm4, %xmm6
mulsd %xmm4, %xmm6
addsd %xmm5, %xmm6
movapd %xmm7, %xmm5
mulsd %xmm7, %xmm5
addsd %xmm6, %xmm5
sqrtsd %xmm5, %xmm5
ucomisd 0x3b12(%rip), %xmm5     # 0x90c8
divsd %xmm5, %xmm7
jne 0x55c6
jp 0x55c6
movsd 0x3ac2(%rip), %xmm7     # 0x9088
movapd %xmm7, 0x30(%rsp)
movapd %xmm5, %xmm6
cmpeqsd 0x3aef(%rip), %xmm6     # 0x90c8
movq %xmm6, %rax
andl $0x1, %eax
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
divpd %xmm5, %xmm4
movd %eax, %xmm5
pshufd $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0]
pslld $0x1f, %xmm5
psrad $0x1f, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm5, 0x20(%rsp)
movapd %xmm2, %xmm4
mulpd %xmm1, %xmm4
unpckhpd %xmm4, %xmm4            # xmm4 = xmm4[1,1]
mulsd %xmm2, %xmm1
addsd %xmm4, %xmm1
mulsd %xmm3, %xmm0
addsd %xmm1, %xmm0
callq 0x21c0
mulsd 0x3a51(%rip), %xmm0     # 0x9080
movq 0x40(%rsp), %r8
movq 0xa0(%r8), %rax
movaps 0x20(%rsp), %xmm1
movups %xmm1, -0x10(%rax,%r14,8)
movapd 0x30(%rsp), %xmm1
movsd %xmm1, (%rax,%r14,8)
movq 0x18(%r8), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
addq $0x3, %r14
jmp 0x544b
movb $0x45, 0x60(%r8)
jmp 0x5a69
pushq $0x2
popq %rsi
xorl %r12d, %r12d
pushq $0x18
popq %rdi
leaq 0x98(%rsp), %r14
leaq 0x240(%rsp), %r15
leaq 0x1f8(%rsp), %rbp
movq 0x8(%r8), %rax
subq (%r8), %rax
cqto
idivq %rdi
cltq
cmpq %rax, %r12
jge 0x5a64
movl 0xbc(%r8), %ecx
movq 0xa0(%r8), %rax
cmpq %rcx, %r12
jne 0x56e6
leaq (%rax,%rsi,8), %rax
addq $-0x10, %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movabsq $-0x4010000000000000, %rcx # imm = 0xBFF0000000000000
movq %rcx, 0x10(%rax)
movsd 0x39d7(%rip), %xmm0     # 0x90b8
jmp 0x5a4e
movupd -0x10(%rax,%rsi,8), %xmm2
movq %rsi, 0x48(%rsp)
movsd (%rax,%rsi,8), %xmm3
xorpd %xmm1, %xmm1
movsd 0x3986(%rip), %xmm0     # 0x9088
ucomisd %xmm3, %xmm0
ja 0x572d
movapd %xmm3, %xmm0
movapd %xmm2, 0x20(%rsp)
movsd %xmm3, 0x30(%rsp)
callq 0x23b0
movsd 0x30(%rsp), %xmm3
movapd 0x20(%rsp), %xmm2
movapd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movapd %xmm2, 0x120(%rsp)
movsd %xmm3, 0x130(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x120(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x30da
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq %r12, 0x90(%rsp)
movsd (%rax,%r12,8), %xmm1
movsd %xmm1, 0x30(%rsp)
movq %r14, %rdi
movsd %xmm0, 0x70(%rsp)
callq 0x279b
movsd 0x20(%rsp), %xmm0
subsd 0x30(%rsp), %xmm0
movq %r14, %r12
leaq 0x210(%rsp), %r14
movq %r14, %rdi
callq 0x2c7d
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x768c
xorpd %xmm0, %xmm0
movapd %xmm0, 0x180(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x190(%rsp)
movq 0x190(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd %xmm0, (%rsp)
leaq 0x50(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x7600
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
movaps 0x50(%rsp), %xmm0
movaps %xmm0, 0xb0(%rsp)
movq %r15, %rdi
callq 0x78f0
movq %r14, %rdi
callq 0x78f0
movq %r12, %rdi
callq 0x78f0
movaps 0xb0(%rsp), %xmm0
movaps %xmm0, 0x100(%rsp)
movsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x110(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x100(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
callq 0x329f
movaps 0x50(%rsp), %xmm0
movaps %xmm0, 0xb0(%rsp)
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
movq %r12, %rdi
movsd 0x70(%rsp), %xmm0
callq 0x279b
movsd 0x20(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movq %rbp, %rdi
callq 0x2c7d
movq %r12, %r14
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x768c
xorpd %xmm0, %xmm0
movapd %xmm0, 0x160(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x170(%rsp)
movq 0x170(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd %xmm0, (%rsp)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x7600
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movaps 0x50(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq %r15, %rdi
callq 0x78f0
movq %rbp, %rdi
callq 0x78f0
movq %r14, %rdi
callq 0x78f0
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0xe0(%rsp)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0xe0(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
callq 0x329f
movsd 0x60(%rsp), %xmm4
movsd 0x88(%rsp), %xmm0
movapd %xmm0, %xmm2
addsd %xmm4, %xmm2
movsd 0x36f3(%rip), %xmm1     # 0x9080
mulsd %xmm1, %xmm2
movapd %xmm2, %xmm6
movapd 0x50(%rsp), %xmm1
movapd 0xb0(%rsp), %xmm5
movapd %xmm5, %xmm7
addpd %xmm1, %xmm7
mulpd 0x365c(%rip), %xmm7     # 0x9010
movapd %xmm7, %xmm2
mulpd %xmm7, %xmm2
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
movapd %xmm7, %xmm3
mulsd %xmm7, %xmm3
addsd %xmm2, %xmm3
movapd %xmm6, %xmm2
mulsd %xmm6, %xmm2
addsd %xmm3, %xmm2
sqrtsd %xmm2, %xmm2
divsd %xmm2, %xmm6
movsd %xmm6, 0x20(%rsp)
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
divpd %xmm2, %xmm7
movapd %xmm7, 0x30(%rsp)
movapd %xmm5, %xmm2
mulpd %xmm1, %xmm2
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
mulsd %xmm1, %xmm5
addsd %xmm2, %xmm5
mulsd %xmm4, %xmm0
addsd %xmm5, %xmm0
callq 0x21c0
mulsd 0x3663(%rip), %xmm0     # 0x9080
movq 0x40(%rsp), %r8
movq 0xa0(%r8), %rax
movq 0x48(%rsp), %rsi
movaps 0x30(%rsp), %xmm1
movups %xmm1, -0x10(%rax,%rsi,8)
movsd 0x20(%rsp), %xmm1
movsd %xmm1, (%rax,%rsi,8)
pushq $0x18
popq %rdi
movq 0x90(%rsp), %r12
movq 0x18(%r8), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
addq $0x3, %rsi
jmp 0x5693
movb $0x53, 0x60(%r8)
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
jmp 0x5ab8
jmp 0x5aa8
jmp 0x5aa8
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
jmp 0x5ab8
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
jmp 0x5ab8
jmp 0x5aa8
movq %rax, %rbx
jmp 0x5abd
movq %rax, %rbx
leaq 0x1e0(%rsp), %rdi
callq 0x78f0
leaq 0x98(%rsp), %rdi
callq 0x78f0
movq %rbx, %rdi
callq 0x23c0