// File: /workspace/github_c_makefile_star2_O1/rikuu[P]kermit/miniasm/asg.c
// Function: asg_pop_bubble
int asg_pop_bubble(asg_t *g, int max_dist)
{
	uint32_t v, n_vtx = g->n_seq * 2;
	uint64_t n_pop = 0;
	buf_t b;
	if (!g->is_symm) asg_symm(g);
	memset(&b, 0, sizeof(buf_t));
	b.a = (binfo_t*)calloc(n_vtx, sizeof(binfo_t));
	for (v = 0; v < n_vtx; ++v) {
		uint32_t i, n_arc = 0, nv = asg_arc_n(g, v);
		asg_arc_t *av = asg_arc_a(g, v);
		if (nv < 2 || g->seq[v>>1].del) continue;
		for (i = 0; i < nv; ++i) // asg_bub_pop1() may delete some edges/arcs
			if (!av[i].del) ++n_arc;
		if (n_arc > 1)
			n_pop += asg_bub_pop1(g, v, max_dist, &b);
	}
	free(b.a); free(b.S.a); free(b.T.a); free(b.b.a); free(b.e.a);
	if (n_pop) asg_cleanup(g);
	fprintf(stderr, "[M::%s] popped %d bubbles and trimmed %d tips\n", __func__, (uint32_t)n_pop, (uint32_t)(n_pop>>32));
	return n_pop;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %esi, 0x98(%rsp)
movq %rdi, 0x10(%rsp)
movl 0x14(%rdi), %eax
leal (%rax,%rax), %ebx
testl %eax, %eax
js 0x46eb
movq 0x10(%rsp), %rdi
leaq 0x14(%rdi), %rsi
callq 0x1ba3
movl %ebx, %edi
movl $0x10, %esi
movq %rdi, 0xa8(%rsp)
callq 0x10f0
movq %rax, %r14
movq $0x0, 0x20(%rsp)
movl $0x0, %eax
movq %rax, 0x68(%rsp)
movl $0x0, %r10d
movl $0x0, %r9d
movl $0x0, %eax
movq %rax, 0x60(%rsp)
testl %ebx, %ebx
jne 0x47b8
movq %r14, %rdi
movq %r9, %rbx
movq %r10, %r14
callq 0x1040
movq 0x20(%rsp), %rdi
callq 0x1040
movq 0x68(%rsp), %rdi
callq 0x1040
movq %r14, %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x1040
cmpq $0x0, 0x60(%rsp)
je 0x4777
movq 0x10(%rsp), %rdi
callq 0x41c9
movq 0xa87a(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq 0x60(%rsp), %rbx
movq %rbx, %r8
shrq $0x20, %r8
leaq 0x5a6a(%rip), %rsi      # 0xa1fe
leaq 0x5a92(%rip), %rdx      # 0xa22d
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1120
movl %ebx, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
movq $0x0, 0x60(%rsp)
xorl %r9d, %r9d
xorl %r11d, %r11d
xorl %r10d, %r10d
xorl %ebx, %ebx
movq $0x0, 0x68(%rsp)
xorl %eax, %eax
movq $0x0, 0x20(%rsp)
movq $0x0, 0x70(%rsp)
movq %r14, 0xa0(%rsp)
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax,%r13,8), %rax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x4886
movq 0x10(%rsp), %rcx
movq 0x18(%rcx), %rcx
movl %r13d, %edx
shrl %edx
movl (%rcx,%rdx,4), %ecx
testl %ecx, %ecx
js 0x4886
movq 0x10(%rsp), %rdx
movq 0x8(%rdx), %rsi
movq %rax, %rdi
shrq $0x20, %rdi
movl %eax, %edx
shlq $0x4, %rdi
addq %rsi, %rdi
addq $0xc, %rdi
xorl %esi, %esi
movl (%rdi), %r8d
notl %r8d
shrl $0x1f, %r8d
addl %r8d, %esi
addq $0x10, %rdi
decq %rdx
jne 0x4841
cmpl $0x2, %esi
jb 0x4886
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x48a1
testl %ecx, %ecx
js 0x48a1
movq %r13, %rax
shlq $0x4, %rax
movq $0x0, 0x4(%r14,%rax)
cmpq $0x0, 0x70(%rsp)
je 0x48a9
movq 0x20(%rsp), %rax
jmp 0x48da
movq 0x18(%rsp), %rax
incq %r13
cmpq 0xa8(%rsp), %r13
jne 0x47f4
jmp 0x4733
xorl %r15d, %r15d
jmp 0x4fa1
movl $0x8, %esi
movq 0x20(%rsp), %rdi
movq %rbx, %rbp
movq %r9, %rbx
movq %r10, %r15
movq %r11, %r12
callq 0x1180
movq %r12, %r11
movq %r15, %r10
movq %rbx, %r9
movq %rbp, %rbx
movl $0x2, %ecx
movq %rcx, 0x70(%rsp)
movl %r13d, (%rax)
xorl %r15d, %r15d
movl $0x1, %edx
xorl %r8d, %r8d
xorl %ebp, %ebp
movl $0x0, 0x30(%rsp)
movq %r13, 0x80(%rsp)
movq %rax, 0x20(%rsp)
movl -0x4(%rax,%rdx,4), %esi
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax,%rsi,8), %rdi
movq %rdi, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
andq %rax, %rcx
movq %rcx, 0x58(%rsp)
je 0x4fcf
movq %r15, 0x78(%rsp)
movq %rbx, 0x88(%rsp)
decq %rdx
movq %rdx, 0x48(%rsp)
movq %rsi, %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rcx
movl 0x4(%r14,%rax), %eax
movl %eax, 0x9c(%rsp)
shrq $0x1c, %rdi
andq $-0x10, %rdi
movq 0x10(%rsp), %rax
addq 0x8(%rax), %rdi
movl 0x8(%rcx), %eax
incl %eax
movl %eax, 0x34(%rsp)
xorl %r15d, %r15d
movq %rbp, %rbx
movq %rsi, 0x50(%rsp)
movq %rdi, %r14
movb $0x1, %dil
movq 0x58(%rsp), %rdx
movq %r14, 0x90(%rsp)
movq %r15, %rax
shlq $0x4, %rax
movl 0x8(%r14,%rax), %ebp
movl $0x9, %r12d
cmpq %rbp, %r13
je 0x4d49
leaq (%r14,%rax), %rcx
cmpl $0x0, 0xc(%rcx)
js 0x4b60
movq %rbp, 0x28(%rsp)
movl (%r14,%rax), %ebp
cmpq %r11, %rbx
jne 0x4a1d
leaq (%r11,%r11), %r12
testq %r11, %r11
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,4), %rsi
movb %dil, 0xf(%rsp)
movq %r9, %rdi
movq %r10, %r13
movq %rbx, %r14
movq %r8, %rbx
callq 0x1180
movb 0xf(%rsp), %dil
movq 0x58(%rsp), %rdx
movq 0x50(%rsp), %rsi
movq %rbx, %r8
movq %r14, %rbx
movq 0x90(%rsp), %r14
movq %r13, %r10
movq 0x80(%rsp), %r13
movq %rax, %r9
movq %r12, %r11
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movl 0x4(%rax,%rsi,8), %eax
addl %r15d, %eax
movl %eax, (%r9,%rbx,4)
incq %rbx
addl 0x9c(%rsp), %ebp
movl $0x6, %r12d
cmpl 0x98(%rsp), %ebp
ja 0x4d49
movq 0x28(%rsp), %r12
shlq $0x4, %r12
addq 0xa0(%rsp), %r12
cmpl $0x0, 0xc(%r12)
js 0x4b6b
movq 0x88(%rsp), %rax
cmpq %rax, %r8
jne 0x4ade
leaq (%rax,%rax), %r13
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r13
leaq (,%r13,4), %rsi
movb %dil, 0xf(%rsp)
movq %r10, %rdi
movq %r9, 0x40(%rsp)
movq %r11, 0x38(%rsp)
movq %r8, 0xb0(%rsp)
callq 0x1180
movb 0xf(%rsp), %dil
movq 0x50(%rsp), %rsi
movq 0xb0(%rsp), %r8
movq 0x38(%rsp), %r11
movq 0x40(%rsp), %r9
movq %rax, %r10
movq %r13, 0x88(%rsp)
movq 0x80(%rsp), %r13
movq 0x28(%rsp), %rax
movl %eax, (%r10,%r8,4)
movl %esi, (%r12)
orb $-0x80, 0xf(%r12)
movl %ebp, 0x4(%r12)
movq %rax, %rbp
xorq $0x1, %rax
movq 0x10(%rsp), %rcx
movq 0x20(%rcx), %rcx
movq (%rcx,%rax,8), %rcx
movq %rcx, %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rax
je 0x4b7c
movl %edi, %ebp
movq 0x10(%rsp), %rdx
movq 0x8(%rdx), %rdx
shrq $0x20, %rcx
shlq $0x4, %rax
shlq $0x4, %rcx
addq %rcx, %rdx
addq $0xc, %rdx
xorl %esi, %esi
xorl %ecx, %ecx
movl (%rdx,%rsi), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %ecx
addq $0x10, %rsi
cmpq %rsi, %rax
jne 0x4b39
orl $0x80000000, %ecx       # imm = 0x80000000
movq 0x50(%rsp), %rsi
movl %ebp, %edi
movq 0x28(%rsp), %rbp
jmp 0x4b81
movl $0x8, %r12d
jmp 0x4d49
movl 0x8(%r12), %eax
cmpl %eax, 0x34(%rsp)
jbe 0x4b94
movl %esi, (%r12)
jmp 0x4b9d
movl $0x80000000, %ecx       # imm = 0x80000000
incq %r8
movl %ecx, 0xc(%r12)
incl 0x30(%rsp)
movq 0x58(%rsp), %rdx
jmp 0x4bbd
jne 0x4b9d
cmpl 0x4(%r12), %ebp
ja 0x4b76
cmpl %eax, 0x34(%rsp)
jbe 0x4bac
movl 0x34(%rsp), %eax
movl %eax, 0x8(%r12)
cmpl 0x4(%r12), %ebp
jae 0x4bb8
movl %ebp, 0x4(%r12)
movq 0x28(%rsp), %rbp
movl 0xc(%r12), %eax
testl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
je 0x4fb0
leal -0x1(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, 0xc(%r12)
xorl %r12d, %r12d
testl %ecx, %ecx
jne 0x4d49
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
cmpl $0x0, (%rax,%rbp,8)
je 0x4c8b
movq 0x70(%rsp), %rax
cmpq %rax, 0x48(%rsp)
jne 0x4d28
leaq (%rax,%rax), %r13
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r13
leaq (,%r13,4), %rsi
movb %dil, 0xf(%rsp)
movq 0x20(%rsp), %rdi
movq %r9, 0x40(%rsp)
movq %r10, %rbp
movq %r11, 0x38(%rsp)
movq %rbx, %r14
movq %r8, %rbx
callq 0x1180
movb 0xf(%rsp), %dil
movq 0x58(%rsp), %rdx
movq 0x50(%rsp), %rsi
movq %rbx, %r8
movq %r14, %rbx
movq 0x90(%rsp), %r14
movq 0x38(%rsp), %r11
movq %rbp, %r10
movq 0x28(%rsp), %rbp
movq 0x40(%rsp), %r9
movq %r13, 0x70(%rsp)
movq 0x80(%rsp), %r13
jmp 0x4d2d
movq 0x18(%rsp), %rcx
cmpq %rcx, 0x78(%rsp)
movq 0x68(%rsp), %rax
jne 0x4d10
leaq (%rcx,%rcx), %r13
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %r13
leaq (,%r13,4), %rsi
movb %dil, 0xf(%rsp)
movq %rax, %rdi
movq %r9, 0x40(%rsp)
movq %r10, %rbp
movq %r11, 0x38(%rsp)
movq %rbx, %r14
movq %r8, %rbx
callq 0x1180
movb 0xf(%rsp), %dil
movq 0x58(%rsp), %rdx
movq 0x50(%rsp), %rsi
movq %rbx, %r8
movq %r14, %rbx
movq 0x90(%rsp), %r14
movq 0x38(%rsp), %r11
movq %rbp, %r10
movq 0x28(%rsp), %rbp
movq 0x40(%rsp), %r9
movq %r13, 0x18(%rsp)
movq 0x80(%rsp), %r13
movq %rax, 0x68(%rsp)
movq 0x78(%rsp), %rcx
leaq (%rax,%rcx,4), %rax
incq %rcx
movq %rcx, 0x78(%rsp)
jmp 0x4d43
movq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rcx
leaq (%rax,%rcx,4), %rax
incq %rcx
movq %rcx, 0x48(%rsp)
movl %ebp, (%rax)
decl 0x30(%rsp)
testl %r12d, %r12d
je 0x4d54
cmpl $0x8, %r12d
jne 0x4d66
incq %r15
cmpq %rdx, %r15
setb %dil
jne 0x498a
jmp 0x4d6c
cmpl $0x6, %r12d
jne 0x4d94
movq %rbx, %rbp
movl $0x9, %r12d
testb $0x1, %dil
movq 0x88(%rsp), %rbx
jne 0x4d9f
xorl %eax, %eax
cmpq $0x0, 0x48(%rsp)
sete %al
leal (%rax,%rax,8), %r12d
jmp 0x4d9f
movq %rbx, %rbp
movq 0x88(%rsp), %rbx
testl %r12d, %r12d
movq 0xa0(%rsp), %r14
jne 0x4f69
movq 0x48(%rsp), %rdx
cmpq $0x1, %rdx
movq 0x20(%rsp), %rax
movq 0x78(%rsp), %r15
ja 0x48fa
cmpl $0x0, 0x30(%rsp)
jne 0x48fa
cmpq $0x1, %rdx
jne 0x4fee
testq %r8, %r8
je 0x4e05
xorl %eax, %eax
movq 0x10(%rsp), %rcx
movq 0x18(%rcx), %rcx
movl (%r10,%rax,4), %edx
shrl %edx
orl $0x80000000, (%rcx,%rdx,4) # imm = 0x80000000
incq %rax
movl %eax, %ecx
cmpq %rcx, %r8
ja 0x4de5
movq %r8, %r12
testq %rbp, %rbp
je 0x4e92
xorl %eax, %eax
movq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rdx
movl (%r9,%rax,4), %esi
shlq $0x4, %rsi
orl $0x80000000, 0xc(%rdx,%rsi) # imm = 0x80000000
movl 0x8(%rdx,%rsi), %ecx
xorq $0x1, %rcx
movq 0x20(%rdi), %rdi
movq (%rdi,%rcx,8), %rdi
movq %rdi, %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
andq %r8, %rcx
je 0x4e88
movl 0x4(%rdx,%rsi), %edx
movq 0x10(%rsp), %rsi
movq 0x8(%rsi), %rsi
shrq $0x20, %rdi
shlq $0x4, %rcx
shlq $0x4, %rdi
addq %rdi, %rsi
addq $0xc, %rsi
xorl %edi, %edi
movl -0x4(%rsi,%rdi), %r8d
xorl %edx, %r8d
cmpl $0x1, %r8d
jne 0x4e7f
orb $-0x80, 0x3(%rsi,%rdi)
addq $0x10, %rdi
cmpq %rdi, %rcx
jne 0x4e6c
incq %rax
movl %eax, %ecx
cmpq %rcx, %rbp
ja 0x4e13
movq 0x20(%rsp), %rax
movl (%rax), %ecx
movq %r12, %r8
movl %ecx, %eax
shlq $0x4, %rax
movl (%r14,%rax), %eax
movq 0x10(%rsp), %rdi
movq 0x18(%rdi), %rdx
movl %ecx, %esi
shrl %esi
andl $0x7fffffff, (%rdx,%rsi,4) # imm = 0x7FFFFFFF
movq 0x20(%rdi), %rdx
movq (%rdx,%rax,8), %rsi
movq %rsi, %rdx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
andq %rdi, %rdx
je 0x4f01
movq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rdi
shrq $0x20, %rsi
shlq $0x4, %rdx
shlq $0x4, %rsi
addq %rdi, %rsi
addq $0xc, %rsi
xorl %edi, %edi
cmpl %ecx, -0x4(%rsi,%rdi)
jne 0x4ef8
andb $0x7f, 0x3(%rsi,%rdi)
addq $0x10, %rdi
cmpq %rdi, %rdx
jne 0x4eed
xorl $0x1, %ecx
movq 0x10(%rsp), %rdx
movq 0x20(%rdx), %rdx
movq (%rdx,%rcx,8), %rdx
movq %rdx, %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %rsi, %rcx
je 0x4f55
movq 0x10(%rsp), %rsi
movq 0x8(%rsi), %rsi
shrq $0x20, %rdx
shlq $0x4, %rcx
shlq $0x4, %rdx
addq %rsi, %rdx
addq $0xc, %rdx
xorl %esi, %esi
movl -0x4(%rdx,%rsi), %edi
xorl %eax, %edi
cmpl $0x1, %edi
jne 0x4f4c
andb $0x7f, 0x3(%rdx,%rsi)
addq $0x10, %rsi
cmpq %rsi, %rcx
jne 0x4f3c
movl %eax, %ecx
cmpq %rax, %r13
jne 0x4e9c
shlq $0x20, %r15
incq %r15
jmp 0x4f72
cmpl $0x9, %r12d
jne 0x4fa1
xorl %r15d, %r15d
movq 0x18(%rsp), %rax
testq %r8, %r8
je 0x4fa6
xorl %eax, %eax
movl (%r10,%rax,4), %ecx
shlq $0x4, %rcx
movq $0x0, 0x4(%r14,%rcx)
andb $0x7f, 0xf(%r14,%rcx)
incq %rax
movl %eax, %ecx
cmpq %rcx, %r8
ja 0x4f7e
jmp 0x4fa1
movq 0x18(%rsp), %rax
addq %r15, 0x60(%rsp)
jmp 0x488b
leaq 0x52c3(%rip), %rdi      # 0xa27a
leaq 0x51e3(%rip), %rsi      # 0xa1a1
leaq 0x527e(%rip), %rcx      # 0xa243
movl $0x187, %edx            # imm = 0x187
callq 0x10c0
leaq 0x5266(%rip), %rdi      # 0xa23c
leaq 0x51c4(%rip), %rsi      # 0xa1a1
leaq 0x525f(%rip), %rcx      # 0xa243
movl $0x175, %edx            # imm = 0x175
callq 0x10c0
leaq 0x528e(%rip), %rdi      # 0xa283
leaq 0x51a5(%rip), %rsi      # 0xa1a1
leaq 0x528c(%rip), %rcx      # 0xa28f
movl $0x155, %edx            # imm = 0x155
callq 0x10c0
nopl (%rax)