// File: /workspace/github_c_makefile_star2_O2/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, 0x70(%rsp)
movq %rdi, 0x8(%rsp)
movl 0x14(%rdi), %eax
leal (%rax,%rax), %ebx
testl %eax, %eax
js 0x2f5f
movq 0x8(%rsp), %rdi
callq 0x2586
movl %ebx, %r14d
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x10f0
movq %rax, %r10
xorl %ebp, %ebp
movq $0x0, 0x58(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x78(%rsp)
xorl %r13d, %r13d
movq $0x0, 0x80(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x88(%rsp)
xorl %r11d, %r11d
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
movq %r14, 0x90(%rsp)
movq %rax, 0x28(%rsp)
cmpq %r14, %rbp
je 0x3590
movq 0x20(%rdi), %rax
movq (%rax,%rbp,8), %rax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x3058
movq 0x18(%rdi), %rcx
movl %ebp, %edx
shrl %edx
cmpl $0x0, (%rcx,%rdx,4)
js 0x3058
movq 0x8(%rdi), %rdx
movq %rax, %rsi
shrq $0x20, %rsi
movl %eax, %ecx
shlq $0x4, %rcx
shlq $0x4, %rsi
addq %rsi, %rdx
addq $0xc, %rdx
xorl %esi, %esi
xorl %r9d, %r9d
cmpq %rsi, %rcx
je 0x3022
movl (%rdx,%rsi), %r8d
notl %r8d
shrl $0x1f, %r8d
addl %r8d, %r9d
addq $0x10, %rsi
jmp 0x3009
cmpl $0x2, %r9d
jb 0x3058
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x3053
movq %rbp, %rax
shlq $0x4, %rax
andq $0x0, 0x4(%r10,%rax)
cmpq $0x0, 0x58(%rsp)
movq %rbx, 0x98(%rsp)
je 0x3060
movq 0x10(%rsp), %rcx
jmp 0x3088
xorl %edx, %edx
addq %rdx, %rbx
incq %rbp
jmp 0x2fc2
movq 0x10(%rsp), %rdi
pushq $0x8
popq %rsi
movq %r11, %rbx
callq 0x1180
movq %rbx, %r11
movq 0x28(%rsp), %r10
movq 0x8(%rsp), %rdi
movq %rax, %rcx
pushq $0x2
popq %rax
movq %rax, 0x58(%rsp)
movl %ebp, (%rcx)
movq $0x0, 0x60(%rsp)
xorl %esi, %esi
xorl %r8d, %r8d
pushq $0x1
popq %rax
movl $0x0, 0x1c(%rsp)
movq %rbp, 0x40(%rsp)
movq %r13, 0x20(%rsp)
movq %rax, %rdx
movq %rcx, 0x10(%rsp)
movl -0x4(%rcx,%rax,4), %r9d
movq 0x20(%rdi), %rax
movq (%rax,%r9,8), %rbx
movq %rbx, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
andq %rax, %rcx
movq %rcx, 0xa0(%rsp)
je 0x3627
decq %rdx
movq %rdx, 0x68(%rsp)
movq %r9, %rax
shlq $0x4, %rax
leaq (%r10,%rax), %rcx
shrq $0x1c, %rbx
andq $-0x10, %rbx
addq 0x8(%rdi), %rbx
movl 0x4(%r10,%rax), %eax
movl %eax, 0x74(%rsp)
movl 0x8(%rcx), %r14d
incl %r14d
xorl %r13d, %r13d
movq %r9, 0x50(%rsp)
movq %rbx, %rdx
movq %rbx, 0x38(%rsp)
movl %r14d, 0x18(%rsp)
cmpq 0xa0(%rsp), %r13
je 0x342b
movq %r13, %rax
shlq $0x4, %rax
movl 0x8(%rdx,%rax), %r12d
cmpq %r12, %rbp
je 0x3479
leaq (%rdx,%rax), %rcx
cmpl $0x0, 0xc(%rcx)
js 0x3423
movl (%rdx,%rax), %ebx
cmpq 0x88(%rsp), %r8
jne 0x31a6
leaq (%r8,%r8), %rcx
testq %r8, %r8
pushq $0x2
popq %rax
cmoveq %rax, %rcx
movq %rcx, 0x88(%rsp)
movq %rsi, %r14
leaq (,%rcx,4), %rsi
movq %r11, %rdi
movq %r8, %rbp
callq 0x1180
movq 0x50(%rsp), %r9
movq %rbp, %r8
movq %r14, %rsi
movl 0x18(%rsp), %r14d
movq 0x28(%rsp), %r10
movq 0x8(%rsp), %rdi
movq %rax, %r11
movq 0x20(%rdi), %rax
movl 0x4(%rax,%r9,8), %ecx
addl %r13d, %ecx
movl %ecx, (%r11,%r8,4)
addl 0x74(%rsp), %ebx
cmpl 0x70(%rsp), %ebx
ja 0x347d
movq %r12, %rbp
shlq $0x4, %rbp
addq %r10, %rbp
movl 0xc(%rbp), %ecx
testl %ecx, %ecx
js 0x322e
cmpq 0x80(%rsp), %rsi
movq %r8, 0x48(%rsp)
jne 0x3245
leaq (%rsi,%rsi), %rcx
testq %rsi, %rsi
pushq $0x2
popq %rax
cmoveq %rax, %rcx
movq %rcx, 0x80(%rsp)
movq %rsi, %r14
leaq (,%rcx,4), %rsi
movq %r15, %rdi
movq %r11, %r15
callq 0x1180
movq 0x50(%rsp), %r9
movq %r14, %rsi
movq %r15, %r14
movq 0x28(%rsp), %r10
movq 0x8(%rsp), %rdi
movq %rax, %r15
movq 0x20(%rdi), %rax
jmp 0x3248
cmpl 0x8(%rbp), %r14d
jbe 0x32bc
movl %r9d, (%rbp)
movl %r14d, 0x8(%rbp)
jmp 0x32c7
movq %r11, %r14
movq %rsi, %r11
movl %r12d, (%r15,%rsi,4)
movl %r9d, (%rbp)
movl %ebx, 0x4(%rbp)
movq %r12, %rcx
xorq $0x1, %rcx
movq (%rax,%rcx,8), %rcx
movq 0x8(%rdi), %rsi
movl %ecx, %edx
shrq $0x1c, %rcx
andq $-0x10, %rcx
addq %rcx, %rsi
addq $0xc, %rsi
shlq $0x4, %rdx
xorl %r9d, %r9d
xorl %ecx, %ecx
cmpq %r9, %rdx
je 0x3298
movl (%rsi,%r9), %r8d
notl %r8d
shrl $0x1f, %r8d
addl %r8d, %ecx
addq $0x10, %r9
jmp 0x327f
movq %r11, %rsi
incq %rsi
orl $0x80000000, %ecx       # imm = 0x80000000
incl 0x1c(%rsp)
movq %r14, %r11
movq 0x48(%rsp), %r8
movq 0x50(%rsp), %r9
movl 0x18(%rsp), %r14d
jmp 0x32cf
jne 0x32c7
cmpl 0x4(%rbp), %ebx
jbe 0x32c7
movl %r9d, (%rbp)
cmpl 0x4(%rbp), %ebx
jae 0x32cf
movl %ebx, 0x4(%rbp)
testl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0x3608
incq %r8
addl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %edx
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, 0xc(%rbp)
testl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0x3306
movq 0x40(%rsp), %rbp
movq 0x38(%rsp), %rdx
jmp 0x3423
cmpl $0x0, (%rax,%r12,8)
movq 0x40(%rsp), %rbp
je 0x3378
movq 0x68(%rsp), %r14
cmpq 0x58(%rsp), %r14
jne 0x33da
leaq (%r14,%r14), %rcx
testq %r14, %r14
pushq $0x2
popq %rax
cmoveq %rax, %rcx
movq %rcx, 0x58(%rsp)
movq %rsi, 0x30(%rsp)
leaq (,%rcx,4), %rsi
movq 0x10(%rsp), %rdi
movq %r11, %rbx
movq %r15, 0x48(%rsp)
movq %r8, %r15
callq 0x1180
movq 0x50(%rsp), %r9
movq %r15, %r8
movq 0x48(%rsp), %r15
movq 0x30(%rsp), %rsi
movq %rbx, %r11
movq 0x28(%rsp), %r10
movq 0x8(%rsp), %rdi
jmp 0x33df
movq %r15, 0x48(%rsp)
movq 0x60(%rsp), %r15
cmpq 0x78(%rsp), %r15
jne 0x33fc
leaq (%r15,%r15), %rcx
testq %r15, %r15
pushq $0x2
popq %rax
cmoveq %rax, %rcx
movq %rcx, 0x78(%rsp)
movq %rsi, 0x30(%rsp)
leaq (,%rcx,4), %rsi
movq 0x20(%rsp), %rdi
movq %r11, %rbx
movq %r8, %r14
callq 0x1180
movq 0x50(%rsp), %r9
movq %r14, %r8
movl 0x18(%rsp), %r14d
movq 0x30(%rsp), %rsi
movq %rbx, %r11
movq 0x28(%rsp), %r10
movq 0x8(%rsp), %rdi
jmp 0x3401
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rdx
movq %rax, 0x10(%rsp)
leaq (%rax,%r14,4), %rax
incq %r14
movq %r14, 0x68(%rsp)
movl 0x18(%rsp), %r14d
jmp 0x341c
movq 0x20(%rsp), %rax
movq 0x38(%rsp), %rdx
movq %rax, 0x20(%rsp)
leaq (%rax,%r15,4), %rax
incq %r15
movq %r15, 0x60(%rsp)
movq 0x48(%rsp), %r15
movl %r12d, (%rax)
decl 0x1c(%rsp)
incq %r13
jmp 0x311f
movq 0x68(%rsp), %rax
testq %rax, %rax
movq 0x20(%rsp), %r13
je 0x34be
cmpq $0x1, %rax
movq 0x10(%rsp), %rcx
jne 0x30a8
cmpl $0x0, 0x1c(%rsp)
jne 0x30a8
xorl %eax, %eax
pushq $0x1
popq %rbp
movl %eax, %eax
cmpq %rax, %rsi
jbe 0x34c2
movq 0x18(%rdi), %rcx
movl (%r15,%rax,4), %edx
shrl %edx
orl $0x80000000, (%rcx,%rdx,4) # imm = 0x80000000
incl %eax
jmp 0x345d
xorl %edx, %edx
jmp 0x3484
xorl %edx, %edx
movq 0x40(%rsp), %rbp
movq 0x20(%rsp), %r13
xorl %eax, %eax
movq 0x98(%rsp), %rbx
movq 0x90(%rsp), %r14
movl %eax, %eax
cmpq %rax, %rsi
jbe 0x3055
movl (%r15,%rax,4), %ecx
shlq $0x4, %rcx
andq $0x0, 0x4(%r10,%rcx)
andb $0x7f, 0xf(%r10,%rcx)
incl %eax
jmp 0x349b
xorl %edx, %edx
jmp 0x3489
movq %rsi, 0x30(%rsp)
xorl %eax, %eax
movq %r11, %r14
movl %eax, %ebx
cmpq %rbx, %r8
jbe 0x350f
movq 0x8(%rdi), %rax
movl (%r11,%rbx,4), %ecx
shlq $0x4, %rcx
orl $0x80000000, 0xc(%rax,%rcx) # imm = 0x80000000
movl 0x4(%rax,%rcx), %edx
movl 0x8(%rax,%rcx), %esi
xorl $0x1, %esi
xorl $0x1, %edx
movl %ebp, %ecx
movq %r8, %r12
callq 0x2edc
movq %r12, %r8
movq %r14, %r11
movq 0x8(%rsp), %rdi
leal 0x1(%rbx), %eax
jmp 0x34cc
movq %r15, %r12
movq 0x10(%rsp), %rax
movl (%rax), %r15d
movq 0x28(%rsp), %rbx
movl %r15d, %eax
shlq $0x4, %rax
movl (%rbx,%rax), %ebp
movq 0x18(%rdi), %rax
movl %r15d, %ecx
shrl %ecx
andl $0x7fffffff, (%rax,%rcx,4) # imm = 0x7FFFFFFF
movl %ebp, %esi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x2edc
xorl $0x1, %r15d
movl %ebp, %edx
xorl $0x1, %edx
movq 0x8(%rsp), %rdi
movl %r15d, %esi
xorl %ecx, %ecx
callq 0x2edc
movq 0x8(%rsp), %rdi
movl %ebp, %r15d
cmpq %rbp, 0x40(%rsp)
movq 0x40(%rsp), %rbp
jne 0x351f
movq 0x60(%rsp), %rdx
shlq $0x20, %rdx
incq %rdx
movq %rbx, %r10
movq %r14, %r11
movq %r12, %r15
movq 0x30(%rsp), %rsi
jmp 0x3489
movq %r10, %rdi
movq %r11, %r14
callq 0x1040
movq 0x10(%rsp), %rdi
callq 0x1040
movq %r13, %rdi
callq 0x1040
movq %r15, %rdi
callq 0x1040
movq %r14, %rdi
callq 0x1040
testq %rbx, %rbx
je 0x35cc
movq 0x8(%rsp), %rdi
callq 0x2447
movq 0xaa25(%rip), %rax      # 0xdff8
movq (%rax), %rdi
movq %rbx, %r8
shrq $0x20, %r8
leaq 0x5c1a(%rip), %rsi      # 0x91fe
leaq 0x5c42(%rip), %rdx      # 0x922d
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1120
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5c6b(%rip), %rdi      # 0x927a
leaq 0x5b8b(%rip), %rsi      # 0x91a1
leaq 0x5c26(%rip), %rcx      # 0x9243
movl $0x187, %edx            # imm = 0x187
callq 0x10c0
leaq 0x5c0e(%rip), %rdi      # 0x923c
leaq 0x5b6c(%rip), %rsi      # 0x91a1
leaq 0x5c07(%rip), %rcx      # 0x9243
movl $0x175, %edx            # imm = 0x175
callq 0x10c0
nop