// File: /workspace/github_c_makefile_star2_O0/rikuu[P]kermit/miniasm/asg.c
// Function: asg_bub_pop1
static uint64_t asg_bub_pop1(asg_t *g, uint32_t v0, int max_dist, buf_t *b)
{
	uint32_t i, n_pending = 0;
	uint64_t n_pop = 0;
	if (g->seq[v0>>1].del) return 0; // already deleted
	if ((uint32_t)g->idx[v0] < 2) return 0; // no bubbles
	b->S.n = b->T.n = b->b.n = b->e.n = 0;
	b->a[v0].c = b->a[v0].d = 0;
	kv_push(uint32_t, b->S, v0);
	do {
		uint32_t v = kv_pop(b->S), d = b->a[v].d, c = b->a[v].c;
		uint32_t nv = asg_arc_n(g, v);
		asg_arc_t *av = asg_arc_a(g, v);
		assert(nv > 0);
		for (i = 0; i < nv; ++i) { // loop through v's neighbors
			uint32_t w = av[i].v, l = (uint32_t)av[i].ul; // u->w with length l
			binfo_t *t = &b->a[w];
			if (w == v0) goto pop_reset;
			if (av[i].del) continue;
			kv_push(uint32_t, b->e, (g->idx[v]>>32) + i);
			if (d + l > max_dist) break; // too far
			if (t->s == 0) { // this vertex has never been visited
				kv_push(uint32_t, b->b, w); // save it for revert
				t->p = v, t->s = 1, t->d = d + l;
				t->r = count_out(g, w^1);
				++n_pending;
			} else { // visited before
				if (c + 1 > t->c || (c + 1 == t->c && d + l > t->d)) t->p = v;
				if (c + 1 > t->c) t->c = c + 1;
				if (d + l < t->d) t->d = d + l; // update dist
			}
			assert(t->r > 0);
			if (--(t->r) == 0) {
				uint32_t x = asg_arc_n(g, w);
				if (x) kv_push(uint32_t, b->S, w);
				else kv_push(uint32_t, b->T, w); // a tip
				--n_pending;
			}
		}
		if (i < nv || b->S.n == 0) goto pop_reset;
	} while (b->S.n > 1 || n_pending);
	asg_bub_backtrack(g, v0, b);
	n_pop = 1 | (uint64_t)b->T.n<<32;
pop_reset:
	for (i = 0; i < b->b.n; ++i) { // clear the states of visited vertices
		binfo_t *t = &b->a[b->b.a[i]];
		t->s = t->c = t->d = 0;
	}
	return n_pop;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x4adf
movq $0x0, -0x8(%rbp)
jmp 0x51d5
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x2, %eax
jae 0x4b00
movq $0x0, -0x8(%rbp)
jmp 0x51d5
movq -0x20(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x4bc9
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4b8e
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x70(%rbp)
jmp 0x4b99
movl $0x2, %eax
movq %rax, -0x70(%rbp)
jmp 0x4b99
movq -0x70(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x2, %rsi
callq 0x1170
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x8(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x8(%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x4bec
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $-0x1, %rsi
movq %rsi, 0x8(%rdx)
movl -0x4(%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x34(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x34(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x34(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x40(%rbp)
jbe 0x4c7c
jmp 0x4c9b
leaq 0xa591(%rip), %rdi      # 0xf214
leaq 0xa4ef(%rip), %rsi      # 0xf179
movl $0x175, %edx            # imm = 0x175
leaq 0xa585(%rip), %rcx      # 0xf21b
callq 0x10b0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x40(%rbp), %eax
jae 0x50fc
movq -0x48(%rbp), %rax
movl -0x24(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movl -0x24(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x4c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x4cf8
jmp 0x5165
movq -0x48(%rbp), %rax
movl -0x24(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x4d16
jmp 0x50ee
jmp 0x4d18
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0x4d81
movq -0x20(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x4d46
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rax
shlq %rax
movq %rax, -0x78(%rbp)
jmp 0x4d51
movl $0x2, %eax
movq %rax, -0x78(%rbp)
jmp 0x4d51
movq -0x78(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rsi
shlq $0x2, %rsi
callq 0x1170
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x34(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl -0x24(%rbp), %ecx
addq %rcx, %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x50(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x50(%rsi)
movl %edx, (%rax,%rcx,4)
movl -0x38(%rbp), %eax
addl -0x50(%rbp), %eax
cmpl -0x18(%rbp), %eax
jbe 0x4dca
jmp 0x50fc
movq -0x58(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x4ec9
jmp 0x4ddf
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jne 0x4e48
movq -0x20(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x4e0d
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
shlq %rax
movq %rax, -0x80(%rbp)
jmp 0x4e18
movl $0x2, %eax
movq %rax, -0x80(%rbp)
jmp 0x4e18
movq -0x80(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rsi
shlq $0x2, %rsi
callq 0x1170
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0x4c(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x38(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x38(%rsi)
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movq -0x58(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl -0x38(%rbp), %ecx
addl -0x50(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rdi
movl -0x4c(%rbp), %esi
xorl $0x1, %esi
callq 0x51f0
movl %eax, %edx
movq -0x58(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0xc(%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x4f39
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movq -0x58(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x4ef6
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movq -0x58(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x4eff
movl -0x38(%rbp), %eax
addl -0x50(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x4eff
movl -0x34(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movq -0x58(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jbe 0x4f1b
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x38(%rbp), %eax
addl -0x50(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x4f37
movl -0x38(%rbp), %ecx
addl -0x50(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x4f39
movq -0x58(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x0, %eax
jle 0x4f4c
jmp 0x4f6b
leaq 0xa2ff(%rip), %rdi      # 0xf252
leaq 0xa21f(%rip), %rsi      # 0xf179
movl $0x187, %edx            # imm = 0x187
leaq 0xa2b5(%rip), %rcx      # 0xf21b
callq 0x10b0
movq -0x58(%rbp), %rcx
movl 0xc(%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl $-0x1, %eax
movl 0xc(%rcx), %edx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %eax, %edx
movl %edx, 0xc(%rcx)
cmpl $0x0, %eax
jne 0x50ec
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x4c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
je 0x504c
jmp 0x4fb4
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x5026
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4fe5
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x88(%rbp)
jmp 0x4ff3
movl $0x2, %eax
movq %rax, -0x88(%rbp)
jmp 0x4ff3
movq -0x88(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x2, %rsi
callq 0x1170
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x4c(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x8(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x8(%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x50e3
jmp 0x504e
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jne 0x50c0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x507f
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
shlq %rax
movq %rax, -0x90(%rbp)
jmp 0x508d
movl $0x2, %eax
movq %rax, -0x90(%rbp)
jmp 0x508d
movq -0x90(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rsi
shlq $0x2, %rsi
callq 0x1170
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x30(%rax)
movl -0x4c(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x20(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x20(%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x50e3
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x50ee
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x4ca2
movl -0x24(%rbp), %eax
cmpl -0x40(%rbp), %eax
jb 0x510f
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x5111
jmp 0x5165
jmp 0x5113
movq -0x20(%rbp), %rcx
movb $0x1, %al
cmpq $0x1, 0x8(%rcx)
movb %al, -0x91(%rbp)
ja 0x5133
cmpl $0x0, -0x28(%rbp)
setne %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x4bec
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0x5280
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
shlq $0x20, %rax
orq $0x1, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jae 0x51cd
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x48(%rcx), %rcx
movl -0x24(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x68(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x68(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x516c
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)