// File: /workspace/github_cpp_makefile_star2_O3/dannycalegari[P]circle_pack/./Layout_routine.cc
// Function: Packing::determine_layout()
void Packing::determine_layout(){			// figure out layout order of vertices
	int first,second;
	int i,j,k,e;
	vector<int> triangle;
	if(verbose){
		cout << "determining layout order.\n";
	};
	if(geometry=='H'){	// don't lay out circle INFV
		lay.clear();	// initialize layout vector
		compute_distances_to_vertex_INFV();
		if(ZERV==-1 || ZERV==INFV || which_edge(ZERV,INFV)>-1){ // we don't yet have a vertex centered at 0
			for(i=0;i<(int) adj.size();i++){
				if(dist[i]==maximum_distance){
					first=i;					
					ZERV=i;		// new ZERV for future reference
				};
			};
		} else {
			first=ZERV;	// note: should *not be* adjacent to INFV
			cout << "We know ZERV, and it is " << ZERV << "\n";
		};
		triangle.clear();
		triangle.push_back(first);
		triangle.push_back(-1);
		triangle.push_back(-1);
		lay.push_back(triangle);	// add first triangle (special case)
		second=adj[first][0];
		triangle.clear();
		triangle.push_back(second);
		triangle.push_back(first);
		triangle.push_back(-1);
		lay.push_back(triangle);	// add second triangle (special case)
		while((int) lay.size() < (int) adj.size()-1){	// hyperbolic geometry: don't lay out INFV!
			for(i=0;i<(int) adj.size();i++){	
				if(already_laid_out(i)==false && i!=INFV){	// not yet laid out; don't lay out INFV!
					for(e=0;e<(int) adj[i].size();e++){
						j=adj[i][e];
						k=adj[i][(e+1)%(int) adj[i].size()];
						if(already_laid_out(j) && already_laid_out(k)){	// neighbors are both laid out
							triangle.clear();
							triangle.push_back(i);
							triangle.push_back(j);
							triangle.push_back(k);
							lay.push_back(triangle);
							e=(int) adj[i].size();	// don't add it twice!
						};
					};
				};
			};
			if(verbose){
				cout << "total laid out: " << lay.size() << " out of " << adj.size()-1 << "\n";
			};
		};
	};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpb $0x1, 0xb8(%rdi)
jne 0x5200
movq 0x8de1(%rip), %rdi      # 0xdfd0
leaq 0x5138(%rip), %rsi      # 0xa32e
movl $0x1a, %edx
callq 0x2220
cmpb $0x48, 0x60(%rbx)
jne 0x5755
leaq 0x68(%rbx), %r14
movq 0x68(%rbx), %rsi
movq %r14, %rdi
callq 0x99f0
movq %rbx, %rdi
callq 0x4eb8
movslq 0xc0(%rbx), %rcx
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
cmpq $-0x1, %rcx
je 0x52bd
movl 0xbc(%rbx), %edx
movq (%rbx), %rax
cmpl %edx, %ecx
je 0x52c0
leaq (%rcx,%rcx,2), %rdi
movq (%rax,%rdi,8), %rsi
movq 0x8(%rax,%rdi,8), %rdi
subq %rsi, %rdi
shrq $0x2, %rdi
testl %edi, %edi
jle 0x5279
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
xorl %r8d, %r8d
cmpl %edx, (%rsi,%r8,4)
je 0x52c0
incq %r8
cmpq %r8, %rdi
jne 0x526b
movl %ecx, 0x20(%rsp)
movq 0x8d4c(%rip), %rdi      # 0xdfd0
leaq 0x50be(%rip), %rsi      # 0xa349
movl $0x18, %edx
callq 0x2220
movl 0xc0(%rbx), %esi
movq 0x8d2e(%rip), %rdi      # 0xdfd0
callq 0x2390
leaq 0x5473(%rip), %rsi      # 0xa721
movl $0x1, %edx
movq %rax, %rdi
callq 0x2220
jmp 0x530b
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
imulq %r13, %rcx
movl $0x0, 0x28(%rsp)
testl %ecx, %ecx
jle 0x530b
movq 0x80(%rbx), %rax
movl 0x98(%rbx), %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %esi, %esi
cmpl %edx, (%rax,%rsi,4)
jne 0x52ff
movl %esi, 0x20(%rsp)
movl %esi, 0xc0(%rbx)
incq %rsi
movl %esi, 0x28(%rsp)
cmpq %rsi, %rcx
jne 0x52f0
movq (%rsp), %rax
movq 0x8(%rsp), %rsi
cmpq %rax, %rsi
je 0x5321
movq %rax, 0x8(%rsp)
movq %rax, %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x533c
movl 0x20(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x5353
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x98b4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
cmpq %rax, %rsi
je 0x5371
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x5388
movq %rsp, %rdi
leaq 0x24(%rsp), %rdx
callq 0x9ca0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
cmpq %rax, %rsi
je 0x53a6
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x53b3
movq %rsp, %rdi
leaq 0x24(%rsp), %rdx
callq 0x9ca0
movq %rsp, %rsi
movq %r14, %rdi
callq 0x8df4
movslq 0x20(%rsp), %rax
movq (%rbx), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %rax
movl (%rax), %ecx
movl %ecx, 0x34(%rsp)
movq (%rsp), %rax
movq 0x8(%rsp), %rsi
cmpq %rax, %rsi
je 0x53ea
movq %rax, 0x8(%rsp)
movq %rax, %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x5401
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x5418
movq %rsp, %rdi
leaq 0x34(%rsp), %rdx
callq 0x98b4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x542e
movl 0x20(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x5445
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x98b4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
cmpq %rax, %rsi
je 0x5463
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x5470
movq %rsp, %rdi
leaq 0x24(%rsp), %rdx
callq 0x9ca0
movq %rsp, %rsi
movq %r14, %rdi
callq 0x8df4
movq %rsp, %r15
movq 0x70(%rbx), %rax
subq 0x68(%rbx), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %edx # imm = 0xAAAAAAAB
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
movq %rax, %rcx
subq %rsi, %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
leal -0x1(%rcx), %edi
cmpl %edx, %edi
jle 0x5755
movl $0x0, 0x28(%rsp)
testl %ecx, %ecx
jle 0x56ca
xorl %edi, %edi
movq 0x68(%rbx), %rcx
movq 0x70(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
testl %edx, %edx
jle 0x5511
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %r8d, %r8d
movq (%rcx), %r9
cmpl %edi, (%r9)
sete %r9b
orb %r9b, %r8b
addq $0x18, %rcx
decq %rdx
jne 0x54e4
cmpl 0xbc(%rbx), %edi
sete %cl
orb %cl, %r8b
testb $0x1, %r8b
je 0x551d
jmp 0x56ac
cmpl 0xbc(%rbx), %edi
je 0x56ac
movslq %edi, %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rsi,%rcx,8), %r8
movq 0x8(%rsi,%rcx,8), %r10
subq %r8, %r10
shrq $0x2, %r10
testl %r10d, %r10d
jle 0x56ac
xorl %ecx, %ecx
movslq %ecx, %rcx
movl (%r8,%rcx,4), %r9d
movl %r9d, 0x30(%rsp)
incl %ecx
movl %ecx, %eax
cltd
idivl %r10d
movslq %edx, %rax
movl (%r8,%rax,4), %eax
movl %eax, 0x2c(%rsp)
movq 0x68(%rbx), %rdx
movq 0x70(%rbx), %r8
subq %rdx, %r8
sarq $0x3, %r8
imulq %r13, %r8
testl %r8d, %r8d
jle 0x5688
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
xorl %r10d, %r10d
movq %rdx, %r11
movq %r8, %r12
movq (%r11), %rbp
cmpl %r9d, (%rbp)
sete %bpl
orb %bpl, %r10b
addq $0x18, %r11
decq %r12
jne 0x558a
testb $0x1, %r10b
je 0x5688
xorl %r9d, %r9d
movq (%rdx), %r10
cmpl %eax, (%r10)
sete %r10b
orb %r10b, %r9b
addq $0x18, %rdx
decq %r8
jne 0x55ae
testb $0x1, %r9b
je 0x5688
movq (%rsp), %rax
movq 0x8(%rsp), %rsi
cmpq %rax, %rsi
je 0x55e4
movq %rax, 0x8(%rsp)
movq %rax, %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x55fb
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x5612
movq %r15, %rdi
leaq 0x28(%rsp), %rdx
callq 0x98b4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x5628
movl 0x30(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x563f
movq %r15, %rdi
leaq 0x30(%rsp), %rdx
callq 0x98b4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
cmpq %rax, %rsi
je 0x5655
movl 0x2c(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x5662
movq %r15, %rdi
leaq 0x2c(%rsp), %rdx
callq 0x98b4
movq %r14, %rdi
movq %r15, %rsi
callq 0x8df4
movslq 0x28(%rsp), %rdi
movq (%rbx), %rsi
leaq (%rdi,%rdi,2), %rax
movq 0x8(%rsi,%rax,8), %rcx
subq (%rsi,%rax,8), %rcx
shrq $0x2, %rcx
incl %ecx
movslq %edi, %rax
leaq (%rax,%rax,2), %rax
movq (%rsi,%rax,8), %r8
movq 0x8(%rsi,%rax,8), %r10
subq %r8, %r10
shrq $0x2, %r10
cmpl %r10d, %ecx
jl 0x553f
movq 0x8(%rbx), %rax
incl %edi
movl %edi, 0x28(%rsp)
movq %rax, %rcx
subq %rsi, %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cmpl %ecx, %edi
jl 0x54c4
cmpb $0x1, 0xb8(%rbx)
jne 0x547e
movl $0x10, %edx
movq 0x88ed(%rip), %rdi      # 0xdfd0
leaq 0x4c78(%rip), %rsi      # 0xa362
callq 0x2220
movq 0x70(%rbx), %rsi
subq 0x68(%rbx), %rsi
sarq $0x3, %rsi
imulq %r13, %rsi
movq 0x88ca(%rip), %rdi      # 0xdfd0
callq 0x2130
movq %rax, %r12
movl $0x8, %edx
movq %rax, %rdi
leaq 0x4c56(%rip), %rsi      # 0xa373
callq 0x2220
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x3, %rsi
imulq %r13, %rsi
decq %rsi
movq %r12, %rdi
callq 0x2130
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4fd6(%rip), %rsi      # 0xa721
callq 0x2220
jmp 0x547e
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x576b
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5784
jmp 0x5784
jmp 0x5784
jmp 0x5784
jmp 0x5784
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x579d
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x23b0