// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpb $0x1, 0xb8(%rdi)
jne 0x531d
movq 0x9cc4(%rip), %rdi      # 0xefd0
leaq 0x6003(%rip), %rsi      # 0xb316
movl $0x1a, %edx
callq 0x2220
cmpb $0x48, 0x60(%rbx)
jne 0x587f
leaq 0x68(%rbx), %rdi
movq 0x68(%rbx), %rsi
movq %rdi, 0x38(%rsp)
callq 0x9d92
movq %rbx, %rdi
callq 0x4fcc
movslq 0xc0(%rbx), %rax
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
cmpq $-0x1, %rax
je 0x5362
movl 0xbc(%rbx), %ecx
cmpl %ecx, %eax
jne 0x53b2
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
imulq %r13, %rax
movl $0x0, 0xc(%rsp)
testl %eax, %eax
jle 0x5424
movq 0x80(%rbx), %rcx
movl 0x98(%rbx), %edx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %esi, %esi
cmpl %edx, (%rcx,%rsi,4)
jne 0x53a4
movl %esi, 0x28(%rsp)
movl %esi, 0xc0(%rbx)
incq %rsi
movl %esi, 0xc(%rsp)
cmpq %rsi, %rax
jne 0x5395
jmp 0x5424
movq (%rbx), %rsi
leaq (%rax,%rax,2), %rdi
movq (%rsi,%rdi,8), %rdx
movq 0x8(%rsi,%rdi,8), %rsi
subq %rdx, %rsi
shrq $0x2, %rsi
testl %esi, %esi
jle 0x53e2
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %edi, %edi
cmpl %ecx, (%rdx,%rdi,4)
je 0x5362
incq %rdi
cmpq %rdi, %rsi
jne 0x53d5
movl %eax, 0x28(%rsp)
movq 0x9be3(%rip), %rdi      # 0xefd0
leaq 0x5f3d(%rip), %rsi      # 0xb331
movl $0x18, %edx
callq 0x2220
movl 0xc0(%rbx), %esi
movq 0x9bc5(%rip), %rdi      # 0xefd0
callq 0x2390
leaq 0x62f2(%rip), %rsi      # 0xb709
movl $0x1, %edx
movq %rax, %rdi
callq 0x2220
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x5435
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5452
movl 0x28(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x5461
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x9c56
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5486
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x5495
leaq 0x10(%rsp), %rdi
leaq 0x2c(%rsp), %rdx
callq 0xa060
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x54ba
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x54c9
leaq 0x10(%rsp), %rdi
leaq 0x2c(%rsp), %rdx
callq 0xa060
leaq 0x10(%rsp), %rsi
movq 0x38(%rsp), %rdi
callq 0x915c
movslq 0x28(%rsp), %rax
movq (%rbx), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %rax
movl (%rax), %eax
movl %eax, 0x44(%rsp)
movq 0x10(%rsp), %rcx
cmpq %rcx, 0x18(%rsp)
je 0x54ff
movq %rcx, 0x18(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5518
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x5527
leaq 0x10(%rsp), %rdi
leaq 0x44(%rsp), %rdx
callq 0x9c56
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5544
movl 0x28(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x5553
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x9c56
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5578
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x5587
leaq 0x10(%rsp), %rdi
leaq 0x2c(%rsp), %rdx
callq 0xa060
leaq 0x10(%rsp), %rsi
movq 0x38(%rsp), %rdi
callq 0x915c
movl $0x1, %ebp
leaq 0x10(%rsp), %r15
movq 0x8(%rbx), %rax
movq 0x70(%rbx), %rcx
subq 0x68(%rbx), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
decl %eax
cmpl %ecx, %eax
jle 0x587f
movl $0x0, 0xc(%rsp)
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
testl %eax, %eax
jle 0x57f4
xorl %eax, %eax
movq 0x68(%rbx), %rcx
movq 0x70(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
testl %edx, %edx
jle 0x562e
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %esi, %esi
movq (%rcx), %rdi
cmpl %eax, (%rdi)
movzbl %sil, %esi
cmovel %ebp, %esi
addq $0x18, %rcx
decq %rdx
jne 0x560f
testb $0x1, %sil
jne 0x57d1
cmpl 0xbc(%rbx), %eax
je 0x57d1
movslq 0xc(%rsp), %rcx
movq (%rbx), %rax
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rdi
movq 0x8(%rax,%rdx,8), %r9
subq %rdi, %r9
shrq $0x2, %r9
testl %r9d, %r9d
jle 0x57d1
xorl %esi, %esi
movslq %esi, %rax
movl (%rdi,%rax,4), %r8d
movl %r8d, 0x34(%rsp)
incl %eax
cltd
idivl %r9d
movslq %edx, %rax
movl (%rdi,%rax,4), %eax
movl %eax, 0x30(%rsp)
movq 0x68(%rbx), %rdx
movq 0x70(%rbx), %r9
subq %rdx, %r9
sarq $0x3, %r9
imulq %r13, %r9
testl %r9d, %r9d
jle 0x57aa
movl %r9d, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
xorl %r10d, %r10d
movq %rdx, %r11
movq %rdi, %r12
movq (%r11), %r14
cmpl %r8d, (%r14)
movzbl %r10b, %r10d
cmovel %ebp, %r10d
addq $0x18, %r11
decq %r12
jne 0x56ab
testl %r9d, %r9d
jle 0x57aa
testb $0x1, %r10b
je 0x57aa
xorl %r8d, %r8d
movq (%rdx), %r9
cmpl %eax, (%r9)
movzbl %r8b, %r8d
cmovel %ebp, %r8d
addq $0x18, %rdx
decq %rdi
jne 0x56d8
testb $0x1, %r8b
je 0x57aa
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x570a
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5723
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x5730
movq %r15, %rdi
leaq 0xc(%rsp), %rdx
callq 0x9c56
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x574d
movl 0x34(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x575a
movq %r15, %rdi
leaq 0x34(%rsp), %rdx
callq 0x9c56
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x5777
movl 0x30(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x5784
movq %r15, %rdi
leaq 0x30(%rsp), %rdx
callq 0x9c56
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x915c
movslq 0xc(%rsp), %rax
movq (%rbx), %rcx
leaq (%rax,%rax,2), %rax
movq 0x8(%rcx,%rax,8), %rsi
subq (%rcx,%rax,8), %rsi
shrq $0x2, %rsi
incl %esi
movslq 0xc(%rsp), %rcx
movq (%rbx), %rax
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rdi
movq 0x8(%rax,%rdx,8), %r9
subq %rdi, %r9
shrq $0x2, %r9
cmpl %r9d, %esi
jl 0x5661
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
movq 0x8(%rbx), %rcx
subq (%rbx), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cmpl %ecx, %eax
jl 0x55f0
cmpb $0x1, 0xb8(%rbx)
jne 0x55a0
movl $0x10, %edx
movq 0x97c3(%rip), %rdi      # 0xefd0
leaq 0x5b36(%rip), %rsi      # 0xb34a
callq 0x2220
movq 0x70(%rbx), %rsi
subq 0x68(%rbx), %rsi
sarq $0x3, %rsi
imulq %r13, %rsi
movq 0x97a0(%rip), %rdi      # 0xefd0
callq 0x2130
movq %rax, %r12
movl $0x8, %edx
movq %rax, %rdi
leaq 0x5b14(%rip), %rsi      # 0xb35b
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 0x5e94(%rip), %rsi      # 0xb709
callq 0x2220
jmp 0x55a0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5896
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x58af
jmp 0x58af
jmp 0x58af
jmp 0x58af
jmp 0x58af
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x58c9
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x23b0