// File: /workspace/github_c_makefile_star2_O3/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 $0xa8, %rsp
movl %esi, 0x78(%rsp)
movq %rdi, 0x18(%rsp)
movl 0x14(%rdi), %eax
leal (%rax,%rax), %ebx
testl %eax, %eax
js 0x45cf
movq 0x18(%rsp), %rdi
leaq 0x14(%rdi), %rsi
callq 0x1bbe
movl %ebx, %r15d
movl $0x10, %esi
movq %r15, %rdi
callq 0x10f0
movq %rax, %r10
xorl %ebp, %ebp
movl $0x0, %r13d
movl $0x0, %r12d
movl $0x0, %r11d
movl $0x0, %r14d
testl %ebx, %ebx
movq 0x18(%rsp), %r9
jne 0x467d
movq %r10, %rdi
movq %r11, %rbx
callq 0x1040
movq %rbp, %rdi
callq 0x1040
movq %r13, %rdi
callq 0x1040
movq %r12, %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x1040
testq %r14, %r14
je 0x463f
movq 0x18(%rsp), %rdi
callq 0x40c7
movq 0x99b2(%rip), %rax      # 0xdff8
movq (%rax), %rdi
movq %r14, %r8
shrq $0x20, %r8
leaq 0x5ba7(%rip), %rsi      # 0xa1fe
leaq 0x5bcf(%rip), %rdx      # 0xa22d
movl %r14d, %ecx
xorl %eax, %eax
callq 0x1120
movl %r14d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r8d, %r8d
xorl %r14d, %r14d
xorl %r11d, %r11d
movq $0x0, 0x90(%rsp)
xorl %r12d, %r12d
movq $0x0, 0x88(%rsp)
xorl %r13d, %r13d
movq $0x0, 0x80(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x58(%rsp)
movq %r10, 0x48(%rsp)
movq %r15, 0x68(%rsp)
movq 0x20(%r9), %rax
movq (%rax,%r8,8), %rax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x4d3b
movq 0x18(%r9), %rcx
movl %r8d, %edx
shrl %edx
cmpl $0x0, (%rcx,%rdx,4)
js 0x4d3b
movq 0x8(%r9), %rdx
movq %rax, %rsi
shrq $0x20, %rsi
movl %eax, %ecx
shlq $0x4, %rsi
addq %rdx, %rsi
addq $0xc, %rsi
xorl %edx, %edx
movl (%rsi), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %edx
addq $0x10, %rsi
decq %rcx
jne 0x4705
cmpl $0x2, %edx
jb 0x4d3b
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x4d36
movq %r8, %rax
shlq $0x4, %rax
movq $0x0, 0x4(%r10,%rax)
cmpq $0x0, 0x58(%rsp)
movq %r8, 0x8(%rsp)
movq %r14, 0x50(%rsp)
movq %r12, 0x28(%rsp)
jne 0x4781
movl $0x8, %esi
movq %rbp, %rdi
movq %r11, %rbx
callq 0x1180
movq 0x8(%rsp), %r8
movq %rbx, %r11
movq 0x48(%rsp), %r10
movq 0x18(%rsp), %r9
movq %rax, %rbp
movl $0x2, %eax
movq %rax, 0x58(%rsp)
movl %r8d, (%rbp)
xorl %eax, %eax
movl $0x1, %ecx
xorl %esi, %esi
xorl %r14d, %r14d
movl $0x0, 0x34(%rsp)
movq %rax, 0x40(%rsp)
movq %r13, 0x38(%rsp)
movq %rbp, 0x20(%rsp)
movl -0x4(%rbp,%rcx,4), %edx
movq 0x20(%r9), %rax
movq (%rax,%rdx,8), %r12
movq %r12, %rdi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
andq %rax, %rdi
movq %rdi, 0xa0(%rsp)
je 0x4d79
decq %rcx
movq %rcx, 0x70(%rsp)
movq %rdx, %rax
shlq $0x4, %rax
leaq (%r10,%rax), %rcx
shrq $0x1c, %r12
andq $-0x10, %r12
addq 0x8(%r9), %r12
movl 0x4(%r10,%rax), %eax
movl %eax, 0x7c(%rsp)
movl 0x8(%rcx), %edi
incl %edi
xorl %ebx, %ebx
movq %r14, %rbp
movq %rdx, 0x10(%rsp)
movl %edi, 0x4(%rsp)
movq %r12, 0x60(%rsp)
movq %rbx, %rax
shlq $0x4, %rax
movl 0x8(%r12,%rax), %r13d
cmpq %r13, %r8
je 0x4cf1
leaq (%r12,%rax), %rcx
cmpl $0x0, 0xc(%rcx)
js 0x4b1d
movl (%r12,%rax), %r15d
cmpq 0x90(%rsp), %rbp
jne 0x488b
leaq (,%rbp,2), %rcx
testq %rbp, %rbp
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x90(%rsp)
movq %rsi, %r14
leaq (,%rcx,4), %rsi
movq %r11, %rdi
callq 0x1180
movl 0x4(%rsp), %edi
movq 0x10(%rsp), %rdx
movq %r14, %rsi
movq 0x8(%rsp), %r8
movq 0x48(%rsp), %r10
movq 0x18(%rsp), %r9
movq %rax, %r11
movq 0x20(%r9), %r14
movl 0x4(%r14,%rdx,8), %ecx
addl %ebx, %ecx
movl %ecx, (%r11,%rbp,4)
addl 0x7c(%rsp), %r15d
cmpl 0x78(%rsp), %r15d
ja 0x4cf1
movq %r13, %r12
shlq $0x4, %r12
addq %r10, %r12
movl 0xc(%r12), %ecx
testl %ecx, %ecx
js 0x492b
cmpq 0x88(%rsp), %rsi
jne 0x4944
leaq (%rsi,%rsi), %rcx
testq %rsi, %rsi
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x88(%rsp)
movq %rbp, 0x98(%rsp)
movq %rsi, %rbp
leaq (,%rcx,4), %rsi
movq 0x28(%rsp), %rdi
movq %r11, %r14
callq 0x1180
movl 0x4(%rsp), %edi
movq 0x10(%rsp), %rdx
movq %rbp, %rsi
movq 0x98(%rsp), %rbp
movq 0x8(%rsp), %r8
movq %r14, %r11
movq 0x48(%rsp), %r10
movq 0x18(%rsp), %r9
movq 0x20(%r9), %r14
jmp 0x4949
cmpl 0x8(%r12), %edi
jbe 0x49ca
movl %edx, (%r12)
movl %edi, 0x8(%r12)
jmp 0x49d7
movq 0x28(%rsp), %rax
movq %rax, 0x28(%rsp)
movl %r13d, (%rax,%rsi,4)
movl %edx, (%r12)
movl %r15d, 0x4(%r12)
movq %r13, %rcx
xorq $0x1, %rcx
movq (%r14,%rcx,8), %rcx
movq %rcx, %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
andq %rax, %rdx
je 0x49bc
movq %rsi, %rax
movq 0x8(%r9), %rsi
shrq $0x20, %rcx
shlq $0x4, %rdx
shlq $0x4, %rcx
addq %rcx, %rsi
addq $0xc, %rsi
xorl %edi, %edi
xorl %ecx, %ecx
movl (%rsi,%rdi), %r8d
notl %r8d
shrl $0x1f, %r8d
addl %r8d, %ecx
addq $0x10, %rdi
cmpq %rdi, %rdx
jne 0x4991
orl $0x80000000, %ecx       # imm = 0x80000000
movq 0x8(%rsp), %r8
movq %rax, %rsi
movl 0x4(%rsp), %edi
jmp 0x49c1
movl $0x80000000, %ecx       # imm = 0x80000000
incq %rsi
incl 0x34(%rsp)
jmp 0x49e3
jne 0x49d7
cmpl 0x4(%r12), %r15d
jbe 0x49d7
movl %edx, (%r12)
cmpl 0x4(%r12), %r15d
jae 0x49e3
movl %r15d, 0x4(%r12)
testl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0x4d5a
incq %rbp
leal -0x1(%rcx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0xc(%r12)
testl %edx, %edx
je 0x4a1b
movq 0x10(%rsp), %rdx
movq 0x60(%rsp), %r12
jmp 0x4b1d
cmpl $0x0, (%r14,%r13,8)
je 0x4a7a
movq 0x70(%rsp), %r12
cmpq 0x58(%rsp), %r12
jne 0x4ad4
leaq (%r12,%r12), %rcx
testq %r12, %r12
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x58(%rsp)
movq %rsi, %r15
leaq (,%rcx,4), %rsi
movq 0x20(%rsp), %rdi
movq %r11, %r14
callq 0x1180
movl 0x4(%rsp), %edi
movq %r15, %rsi
movq 0x8(%rsp), %r8
movq %r14, %r11
movq 0x48(%rsp), %r10
movq 0x18(%rsp), %r9
jmp 0x4ad9
movq 0x40(%rsp), %r15
cmpq 0x80(%rsp), %r15
jne 0x4af6
leaq (%r15,%r15), %rcx
testq %r15, %r15
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x80(%rsp)
movq %rsi, %r12
leaq (,%rcx,4), %rsi
movq 0x38(%rsp), %rdi
movq %r11, %r14
callq 0x1180
movl 0x4(%rsp), %edi
movq %r12, %rsi
movq 0x8(%rsp), %r8
movq %r14, %r11
movq 0x48(%rsp), %r10
movq 0x18(%rsp), %r9
jmp 0x4afb
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rdx
movq %rax, 0x20(%rsp)
leaq (%rax,%r12,4), %rax
incq %r12
movq %r12, 0x70(%rsp)
movq 0x60(%rsp), %r12
jmp 0x4b16
movq 0x38(%rsp), %rax
movq 0x10(%rsp), %rdx
movq 0x60(%rsp), %r12
movq %rax, 0x38(%rsp)
leaq (%rax,%r15,4), %rax
incq %r15
movq %r15, 0x40(%rsp)
movl %r13d, (%rax)
decl 0x34(%rsp)
incq %rbx
cmpq 0xa0(%rsp), %rbx
jne 0x480d
movq 0x70(%rsp), %rcx
testq %rcx, %rcx
movq 0x68(%rsp), %r15
movq 0x38(%rsp), %r13
movq 0x40(%rsp), %rax
je 0x4d4c
movq %rbp, %r14
cmpq $0x1, %rcx
movq 0x20(%rsp), %rbp
jne 0x4799
cmpl $0x0, 0x34(%rsp)
jne 0x4799
testq %rsi, %rsi
movq 0x28(%rsp), %r12
je 0x4b8f
xorl %eax, %eax
movq 0x18(%r9), %rcx
movl (%r12,%rax,4), %edx
shrl %edx
orl $0x80000000, (%rcx,%rdx,4) # imm = 0x80000000
incq %rax
movl %eax, %ecx
cmpq %rcx, %rsi
ja 0x4b74
movq %rsi, 0x10(%rsp)
testq %r14, %r14
je 0x4c10
xorl %eax, %eax
movq 0x8(%r9), %rdx
movl (%r11,%rax,4), %esi
shlq $0x4, %rsi
orl $0x80000000, 0xc(%rdx,%rsi) # imm = 0x80000000
movl 0x8(%rdx,%rsi), %ecx
xorq $0x1, %rcx
movq 0x20(%r9), %rdi
movq (%rdi,%rcx,8), %rdi
movq %rdi, %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
andq %r8, %rcx
je 0x4c06
movl 0x4(%rdx,%rsi), %edx
movq 0x8(%r9), %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 0x4bfd
orb $-0x80, 0x3(%rsi,%rdi)
addq $0x10, %rdi
cmpq %rdi, %rcx
jne 0x4bea
incq %rax
movl %eax, %ecx
cmpq %rcx, %r14
ja 0x4b9b
movl (%rbp), %ecx
movq 0x50(%rsp), %r14
movl %ecx, %eax
shlq $0x4, %rax
movl (%r10,%rax), %eax
movq 0x18(%r9), %rdx
movl %ecx, %esi
shrl %esi
andl $0x7fffffff, (%rdx,%rsi,4) # imm = 0x7FFFFFFF
movq 0x8(%r9), %rdx
movq 0x20(%r9), %rdi
movq (%rdi,%rax,8), %r8
movq %r8, %rsi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
andq %rbx, %rsi
je 0x4c87
shrq $0x20, %r8
shlq $0x4, %rsi
shlq $0x4, %r8
addq %r8, %rdx
addq $0xc, %rdx
xorl %edi, %edi
movq 0x8(%rsp), %r8
movq 0x40(%rsp), %rbx
cmpl %ecx, -0x4(%rdx,%rdi)
jne 0x4c74
andb $0x7f, 0x3(%rdx,%rdi)
addq $0x10, %rdi
cmpq %rdi, %rsi
jne 0x4c69
movq 0x8(%r9), %rdx
movq 0x20(%r9), %rdi
jmp 0x4c91
movq 0x8(%rsp), %r8
movq 0x40(%rsp), %rbx
xorl $0x1, %ecx
movq (%rdi,%rcx,8), %rsi
movq %rsi, %rcx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
andq %rdi, %rcx
je 0x4cd3
shrq $0x20, %rsi
shlq $0x4, %rcx
shlq $0x4, %rsi
addq %rsi, %rdx
addq $0xc, %rdx
xorl %esi, %esi
movl -0x4(%rdx,%rsi), %edi
xorl %eax, %edi
cmpl $0x1, %edi
jne 0x4cca
andb $0x7f, 0x3(%rdx,%rsi)
addq $0x10, %rsi
cmpq %rsi, %rcx
jne 0x4cba
movl %eax, %ecx
cmpq %rax, %r8
jne 0x4c18
shlq $0x20, %rbx
incq %rbx
movq 0x8(%rsp), %r8
movq 0x10(%rsp), %rsi
jmp 0x4d0c
xorl %ebx, %ebx
movq 0x50(%rsp), %r14
movq 0x68(%rsp), %r15
movq 0x28(%rsp), %r12
movq 0x38(%rsp), %r13
movq 0x20(%rsp), %rbp
testq %rsi, %rsi
je 0x4d38
xorl %eax, %eax
movl (%r12,%rax,4), %ecx
shlq $0x4, %rcx
movq $0x0, 0x4(%r10,%rcx)
andb $0x7f, 0xf(%r10,%rcx)
incq %rax
movl %eax, %ecx
cmpq %rcx, %rsi
ja 0x4d13
jmp 0x4d38
xorl %ebx, %ebx
addq %rbx, %r14
incq %r8
cmpq %r15, %r8
jne 0x46c5
jmp 0x4605
xorl %ebx, %ebx
movq 0x50(%rsp), %r14
movq 0x28(%rsp), %r12
jmp 0x4d07
leaq 0x5519(%rip), %rdi      # 0xa27a
leaq 0x5439(%rip), %rsi      # 0xa1a1
leaq 0x54d4(%rip), %rcx      # 0xa243
movl $0x187, %edx            # imm = 0x187
callq 0x10c0
leaq 0x54bc(%rip), %rdi      # 0xa23c
leaq 0x541a(%rip), %rsi      # 0xa1a1
leaq 0x54b5(%rip), %rcx      # 0xa243
movl $0x175, %edx            # imm = 0x175
callq 0x10c0