// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/lchain.c
// Function: mg_chain_backtrack
uint64_t *mg_chain_backtrack(void *km, int64_t n, const int32_t *f, const int64_t *p, int32_t *v, int32_t *t, int32_t min_cnt, int32_t min_sc, int32_t max_drop,
							 int32_t extra_u, int32_t *n_u_, int32_t *n_v_)
{
	mg128_t *z;
	uint64_t *u;
	int64_t i, k, n_z, n_v;
	int32_t n_u;

	*n_u_ = *n_v_ = 0;
	for (i = 0, n_z = 0; i < n; ++i) // precompute n_z
		if (f[i] >= min_sc) ++n_z;
	if (n_z == 0) return 0;
	KMALLOC(km, z, n_z);
	for (i = 0, k = 0; i < n; ++i) // populate z[]
		if (f[i] >= min_sc) z[k].x = f[i], z[k++].y = i;
	radix_sort_128x(z, z + n_z);

	memset(t, 0, n * 4);
	for (k = n_z - 1, n_v = n_u = 0; k >= 0; --k) { // precompute n_u
		if (t[z[k].y] == 0) {
			int64_t n_v0 = n_v, end_i;
			int32_t sc;
			end_i = mg_chain_bk_end(max_drop, z, f, p, t, k);
			for (i = z[k].y; i != end_i; i = p[i])
				++n_v, t[i] = 1;
			sc = i < 0? z[k].x : (int32_t)z[k].x - f[i];
			if (sc >= min_sc && n_v > n_v0 && n_v - n_v0 >= min_cnt)
				++n_u;
			else n_v = n_v0;
		}
	}
	KMALLOC(km, u, n_u + extra_u);
	memset(t, 0, n * 4);
	for (k = n_z - 1, n_v = n_u = 0; k >= 0; --k) { // populate u[]
		if (t[z[k].y] == 0) {
			int64_t n_v0 = n_v, end_i;
			int32_t sc;
			end_i = mg_chain_bk_end(max_drop, z, f, p, t, k);
			for (i = z[k].y; i != end_i; i = p[i])
				v[n_v++] = i, t[i] = 1;
			sc = i < 0? z[k].x : (int32_t)z[k].x - f[i];
			if (sc >= min_sc && n_v > n_v0 && n_v - n_v0 >= min_cnt)
				u[n_u++] = (uint64_t)sc << 32 | (n_v - n_v0);
			else n_v = n_v0;
		}
	}
	kfree(km, z);
	assert(n_v < INT32_MAX);
	*n_u_ = n_u, *n_v_ = n_v;
	return u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq 0x38(%rbp), %rax
movl $0x0, (%rax)
movq 0x30(%rbp), %rax
movl $0x0, (%rax)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x21b81
movq -0x20(%rbp), %rax
movq -0x50(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x18(%rbp), %eax
jl 0x21b71
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x21b73
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x21b4b
cmpq $0x0, -0x60(%rbp)
jne 0x21b95
movq $0x0, -0x8(%rbp)
jmp 0x21fd9
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
shlq $0x4, %rsi
callq 0x2890
movq %rax, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x21c24
movq -0x20(%rbp), %rax
movq -0x50(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x18(%rbp), %eax
jl 0x21c14
movq -0x20(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x58(%rbp)
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0x21c16
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x21bba
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x60(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x15f50
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2190
movq -0x60(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x6c(%rbp)
movq $0x0, -0x68(%rbp)
cmpq $0x0, -0x58(%rbp)
jl 0x21daf
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x21d9c
movq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movl 0x20(%rbp), %edi
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x58(%rbp), %r9
callq 0x21ff0
movq %rax, -0x80(%rbp)
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x80(%rbp), %rax
je 0x21d0c
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
jmp 0x21cd5
cmpq $0x0, -0x50(%rbp)
jge 0x21d2e
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
jmp 0x21d54
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq -0x50(%rbp), %rdx
subl (%rcx,%rdx,4), %eax
cltq
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl 0x18(%rbp), %eax
jl 0x21d92
movq -0x68(%rbp), %rax
cmpq -0x78(%rbp), %rax
jle 0x21d92
movq -0x68(%rbp), %rax
subq -0x78(%rbp), %rax
movslq 0x10(%rbp), %rcx
cmpq %rcx, %rax
jl 0x21d92
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x21d9a
movq -0x78(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x21d9c
jmp 0x21d9e
movq -0x58(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x21c6a
movq -0x10(%rbp), %rdi
movl -0x6c(%rbp), %eax
addl 0x28(%rbp), %eax
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x2890
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2190
movq -0x60(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x6c(%rbp)
movq $0x0, -0x68(%rbp)
cmpq $0x0, -0x58(%rbp)
jl 0x21f84
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x21f71
movq -0x68(%rbp), %rax
movq %rax, -0x90(%rbp)
movl 0x20(%rbp), %edi
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x58(%rbp), %r9
callq 0x21ff0
movq %rax, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x98(%rbp), %rax
je 0x21eb2
movq -0x50(%rbp), %rax
movl %eax, %edx
movq -0x30(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movl %edx, (%rax,%rcx,4)
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
jmp 0x21e68
cmpq $0x0, -0x50(%rbp)
jge 0x21ed4
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
jmp 0x21efa
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq -0x50(%rbp), %rdx
subl (%rcx,%rdx,4), %eax
cltq
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl 0x18(%rbp), %eax
jl 0x21f64
movq -0x68(%rbp), %rax
cmpq -0x90(%rbp), %rax
jle 0x21f64
movq -0x68(%rbp), %rax
subq -0x90(%rbp), %rax
movslq 0x10(%rbp), %rcx
cmpq %rcx, %rax
jl 0x21f64
movslq -0x9c(%rbp), %rdx
shlq $0x20, %rdx
movq -0x68(%rbp), %rax
subq -0x90(%rbp), %rax
orq %rax, %rdx
movq -0x48(%rbp), %rax
movl -0x6c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x6c(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x21f6f
movq -0x90(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x21f71
jmp 0x21f73
movq -0x58(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x21df7
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x2670
cmpq $0x7fffffff, -0x68(%rbp) # imm = 0x7FFFFFFF
jge 0x21f9d
jmp 0x21fbc
leaq 0x1b1c4(%rip), %rdi     # 0x3d168
leaq 0x1b1cd(%rip), %rsi     # 0x3d178
movl $0x4a, %edx
leaq 0x1b1ca(%rip), %rcx     # 0x3d181
callq 0x2170
movl -0x6c(%rbp), %ecx
movq 0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x68(%rbp), %rax
movl %eax, %ecx
movq 0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)