// File: dannycalegari[P]circle_pack/./Layout_routine.cc
// Function: Packing::compute_distances_to_vertex_INFV()
void Packing::compute_distances_to_vertex_INFV(){
	bool all_found, one_not_done;
	int i,j,nearest;
	if(verbose){
		cout << "computing distances to vertex 0.\n";
	};
	dist.clear();				// clear distance list
	maximum_distance=0;					// reset maximum
	for(i=0;i<(int) adj.size();i++){	// initialize distances
		dist.push_back(-1);
	};
	dist[INFV]=0;	// initial vertex
	all_found=false;
	while(all_found==false){
		one_not_done=false;
		for(i=0;i<(int) adj.size();i++){	// for each vertex i
			if(dist[i]==-1){		// if we don't yet know the distance to 0
				one_not_done=true;			// note this fact
				nearest=1000000;			// initialize guess
				for(j=0;j<(int) adj[i].size();j++){	// for all neighbors of i
					if(dist[adj[i][j]]!=-1){
						nearest=nearest < dist[adj[i][j]] ? nearest : dist[adj[i][j]];
					};
				};
				if(nearest<1000000){		// if we found a neighbor
					dist[i]=nearest+1;
					maximum_distance= maximum_distance > nearest+1 ? maximum_distance : nearest+1;	// let's remember this while we're at it
				};
			};
		};
		if(one_not_done==false){
			all_found=true;
		};
	};
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
testb $0x1, 0xb8(%rax)
je 0x5340
movq 0x12c9c(%rip), %rdi     # 0x17fd0
leaq 0xbf61(%rip), %rsi      # 0x1129c
callq 0x21f0
movq -0x28(%rbp), %rdi
addq $0x80, %rdi
callq 0xa500
movq -0x28(%rbp), %rax
movl $0x0, 0x98(%rax)
movl $0x0, -0x10(%rbp)
movq -0x28(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, -0x2c(%rbp)
callq 0xa520
movq %rax, %rcx
movl -0x2c(%rbp), %eax
cmpl %ecx, %eax
jge 0x53a4
movq -0x28(%rbp), %rdi
addq $0x80, %rdi
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
leaq -0x1c(%rbp), %rsi
callq 0xa720
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5365
movq -0x28(%rbp), %rax
movq %rax, %rdi
addq $0x80, %rdi
movslq 0xbc(%rax), %rsi
callq 0xa4e0
movl $0x0, (%rax)
movb $0x0, -0x9(%rbp)
movb -0x9(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x55ba
movb $0x0, -0xa(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x28(%rbp), %rdi
movl -0x10(%rbp), %eax
movl %eax, -0x30(%rbp)
callq 0xa520
movq %rax, %rcx
movl -0x30(%rbp), %eax
cmpl %ecx, %eax
jge 0x55a4
movq -0x28(%rbp), %rdi
addq $0x80, %rdi
movslq -0x10(%rbp), %rsi
callq 0xa4e0
cmpl $-0x1, (%rax)
jne 0x5594
movb $0x1, -0xa(%rbp)
movl $0xf4240, -0x18(%rbp)   # imm = 0xF4240
movl $0x0, -0x14(%rbp)
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movslq -0x10(%rbp), %rsi
callq 0xa4a0
movq %rax, %rdi
callq 0xa4c0
movq %rax, %rcx
movl -0x34(%rbp), %eax
cmpl %ecx, %eax
jge 0x552b
movq -0x28(%rbp), %rdi
movq %rdi, %rax
addq $0x80, %rax
movq %rax, -0x40(%rbp)
movslq -0x10(%rbp), %rsi
callq 0xa4a0
movq %rax, %rdi
movslq -0x14(%rbp), %rsi
callq 0xa4e0
movq -0x40(%rbp), %rdi
movslq (%rax), %rsi
callq 0xa4e0
cmpl $-0x1, (%rax)
je 0x551b
movq -0x28(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, -0x44(%rbp)
movq %rdi, %rax
addq $0x80, %rax
movq %rax, -0x50(%rbp)
movslq -0x10(%rbp), %rsi
callq 0xa4a0
movq %rax, %rdi
movslq -0x14(%rbp), %rsi
callq 0xa4e0
movq -0x50(%rbp), %rdi
movslq (%rax), %rsi
callq 0xa4e0
movq %rax, %rcx
movl -0x44(%rbp), %eax
cmpl (%rcx), %eax
jge 0x54de
movl -0x18(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0x5515
movq -0x28(%rbp), %rdi
movq %rdi, %rax
addq $0x80, %rax
movq %rax, -0x60(%rbp)
movslq -0x10(%rbp), %rsi
callq 0xa4a0
movq %rax, %rdi
movslq -0x14(%rbp), %rsi
callq 0xa4e0
movq -0x60(%rbp), %rdi
movslq (%rax), %rsi
callq 0xa4e0
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x551d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5430
cmpl $0xf4240, -0x18(%rbp)   # imm = 0xF4240
jge 0x5592
movq -0x28(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
addq $0x80, %rdi
movslq -0x10(%rbp), %rsi
callq 0xa4e0
movl -0x64(%rbp), %edx
movq %rax, %rcx
movq -0x28(%rbp), %rax
movl %edx, (%rcx)
movl 0x98(%rax), %eax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0x557c
movq -0x28(%rbp), %rax
movl 0x98(%rax), %eax
movl %eax, -0x68(%rbp)
jmp 0x5585
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movl -0x68(%rbp), %ecx
movl %ecx, 0x98(%rax)
jmp 0x5594
jmp 0x5596
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x53e4
movb -0xa(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x55b5
movb $0x1, -0x9(%rbp)
jmp 0x53c8
addq $0x70, %rsp
popq %rbp
retq