// File: chhylp123[P]hifiasm/inter.cpp
// Function: check_trans_rate_gap(vec_mg_lchain_t*, kv_ul_ov_t*, overlap_region_alloc*, haplotype_evdience_alloc*, ul_idx_t const*, double, long, float)
int64_t check_trans_rate_gap(vec_mg_lchain_t *uc, kv_ul_ov_t *buf, overlap_region_alloc* olist, 
haplotype_evdience_alloc *hap, const ul_idx_t *uref, double diff_ec_ul, int64_t winLen, float trans_thres)
{
	if(uc->n <= 0) return 0;
	int64_t k, m, ucn = uc->n, k_cnt, z; mg_lchain_t *ix; buf->n = 0; 
	for (k = m = 0; k < ucn; k += k_cnt) {
		ix = &(uc->a[k]); assert(ix->v == (uint32_t)-1); k_cnt = ix->cnt + 1;
		if(ds_check_vec_mg_lchain_t(uc->a + k + 1, ix->cnt, buf, olist, hap, uref, diff_ec_ul, winLen, trans_thres)) {
			if(m == k) {
				m += k_cnt; 
			} else {
				for (z = 0; z < k_cnt; z++) uc->a[m++] = uc->a[k+z];
			}
		}
	}
	uc->n = m;
	if(uc->n) return 1;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movsd %xmm0, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movss %xmm1, -0x44(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
ja 0x299ad5
movq $0x0, -0x8(%rbp)
jmp 0x299c60
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x60(%rbp), %rax
jge 0x299c37
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpl $-0x1, 0x8(%rax)
jne 0x299b2a
jmp 0x299b49
leaq 0xf7c1a(%rip), %rdi     # 0x39174b
leaq 0xf6cf7(%rip), %rsi     # 0x39082f
movl $0x124a, %edx           # imm = 0x124A
leaq 0xf7c1d(%rip), %rcx     # 0x391761
callq 0x2130
movq -0x78(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
sarl %eax
addl $0x1, %eax
cltq
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
imulq $0x28, -0x50(%rbp), %rax
addq %rax, %rdi
addq $0x28, %rdi
movq -0x78(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
sarl %eax
movslq %eax, %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movsd -0x38(%rbp), %xmm0
movq -0x40(%rbp), %rax
movss -0x44(%rbp), %xmm1
movq %rax, (%rsp)
callq 0x2995b0
cmpq $0x0, %rax
je 0x299c24
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x299bc3
movq -0x68(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x299c22
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jge 0x299c20
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x50(%rbp), %rax
addq -0x70(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x58(%rbp)
imulq $0x28, %rax, %rax
addq %rax, %rdi
movl $0x28, %edx
callq 0x2180
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x299bcb
jmp 0x299c22
jmp 0x299c24
jmp 0x299c26
movq -0x68(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x299afd
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x299c58
movq $0x1, -0x8(%rbp)
jmp 0x299c60
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)