// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Correct.cpp
// Function: push_consist_ul_ovlps(ma_ug_t*, kv_ul_ov_t*, unsigned long, unsigned long, double, ul_ov_t*, idx_emask_t*, kv_ul_ov_t*, unsigned long, unsigned long*)
void push_consist_ul_ovlps(ma_ug_t *ug, kv_ul_ov_t *ov_db, uint64_t s, uint64_t e, double len_diff, ul_ov_t *ref, idx_emask_t *mm, kv_ul_ov_t *out, uint64_t flip_res, uint64_t *is_exact)
{
    (*is_exact) = 0;
    if(s >= e) return;
    uint64_t k, z, ql = ug->g->seq[ref->qn].len, tl = ug->g->seq[ref->tn].len; ul_ov_t *p;
    for (k = s; k < e && ov_db->a[k].tn < ref->tn; k++);
    for (; k < e && ov_db->a[k].tn == ref->tn; k++) {
        if((!check_ul_ov_t_consist(ref, &(ov_db->a[k]), ql, tl, len_diff))) continue;
        z = k;
        if(is_ul_ov_pe(ov_db->a, ov_db->n, k, (*mm))) {
            k++; if((!check_ul_ov_t_consist(ref, &(ov_db->a[k]), ql, tl, len_diff))) continue;
        }
        if(is_exact_ov(ov_db->a[k], (*mm))) {
            (*is_exact) = 1; return;
        }

        for (; z <= k; z++) {
            kv_pushp(ul_ov_t, *out, &p);
            *p = ov_db->a[k];
            if(flip_res) {
                p->qn = ov_db->a[k].tn; p->tn = ov_db->a[k].qn;
                p->qs = ov_db->a[k].ts; p->qe = ov_db->a[k].te;
                p->ts = ov_db->a[k].qs; p->te = ov_db->a[k].qe;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x8(%rsp)
movsd %xmm0, 0x28(%rsp)
movq 0x80(%rsp), %rax
movq $0x0, (%rax)
cmpq %rcx, %rdx
jae 0x75223
movq %rdx, %r13
movq %rsi, %r12
movq 0x70(%rsp), %rbx
movq 0x18(%rdi), %rax
movq 0x20(%rax), %rsi
movl (%r8), %edx
movl 0xc(%r8), %eax
movl (%rsi,%rdx,8), %edi
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andq %rdx, %rdi
movq %rdi, 0x20(%rsp)
movl (%rsi,%rax,8), %esi
andq %rdx, %rsi
movq %rsi, 0x18(%rsp)
movq (%r12), %rsi
leaq (,%r13,8), %rdx
addq %r13, %rdx
leaq (%rdx,%rdx,2), %rdx
addq %r13, %rdx
addq %rsi, %rdx
addq $0xc, %rdx
cmpl %eax, (%rdx)
jae 0x74fa5
incq %r13
addq $0x1c, %rdx
cmpq %r13, %rcx
jne 0x74f92
movq %rcx, %r13
cmpq %rcx, %r13
jae 0x75223
movq %r8, 0x10(%rsp)
movq %rcx, 0x30(%rsp)
movq (%r12), %rsi
leaq (,%r13,8), %rax
addq %r13, %rax
leaq (%rax,%rax,2), %rbp
addq %r13, %rbp
movl 0xc(%rsi,%rbp), %eax
cmpl 0xc(%r8), %eax
jne 0x75223
addq %rbp, %rsi
movq %r8, %rdi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
movsd 0x28(%rsp), %xmm0
callq 0x1c09f8
testq %rax, %rax
je 0x75207
leaq 0x1(%r13), %r15
movq %r13, %r14
cmpq 0x8(%r12), %r15
jae 0x750f9
movq (%r12), %rax
leaq (%r15,%r15,8), %rcx
leaq (%rcx,%rcx,2), %rsi
addq %r15, %rsi
movl (%rax,%rsi), %ecx
movl (%rax,%rbp), %edx
movq %r13, %r14
cmpl %edx, %ecx
jne 0x750f9
addq %rax, %rsi
addq %rax, %rbp
movl 0xc(%rsi), %eax
movq %r13, %r14
cmpl 0xc(%rbp), %eax
jne 0x750f9
movl 0x18(%rsi), %eax
movl 0x18(%rbp), %edi
movl %edi, %r8d
xorl %eax, %r8d
movq %r13, %r14
js 0x750f9
movl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
andq %r8, %rax
andq %r8, %rdi
leal 0x1(%rdi), %r8d
movq %r13, %r14
cmpl %r8d, %eax
jne 0x750f9
movq 0x8(%rsp), %r8
movq (%r8), %r8
leaq (%rdx,%rdx,2), %rdx
movq %r13, %r14
cmpq %rdi, 0x8(%r8,%rdx,8)
jbe 0x750f9
leaq (%rcx,%rcx,2), %rcx
movq %r13, %r14
cmpq %rax, 0x8(%r8,%rcx,8)
jbe 0x750f9
leaq (%r8,%rdx,8), %rdx
movq (%rdx), %rdx
shlq $0x5, %rdi
movb 0x1c(%rdx,%rdi), %dl
movq %r13, %r14
testb $0x20, %dl
je 0x750f9
movq %r13, %r14
testb $0x1f, %dl
jne 0x750f9
leaq (%r8,%rcx,8), %rcx
movq (%rcx), %rcx
shlq $0x5, %rax
movb 0x1c(%rcx,%rax), %al
andb $0x3f, %al
movq %r13, %r14
cmpb $0x21, %al
jne 0x750f9
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
movsd 0x28(%rsp), %xmm0
callq 0x1c09f8
movq %r15, %r14
testq %rax, %rax
je 0x7520a
movq (%r12), %rax
leaq (%r14,%r14,8), %rcx
leaq (%rcx,%rcx,2), %r15
addq %r14, %r15
movl (%rax,%r15), %edx
movl 0x18(%rax,%r15), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
leaq (%rdx,%rdx,2), %rdx
cmpq %rax, 0x8(%rcx,%rdx,8)
jbe 0x75148
leaq (%rcx,%rdx,8), %rcx
movq (%rcx), %rcx
shlq $0x5, %rax
testb $0x20, 0x1c(%rcx,%rax)
jne 0x75148
addq %rax, %rcx
cmpl $-0x1, 0x8(%rcx)
je 0x75232
cmpq %r14, %r13
ja 0x75202
movq 0x78(%rsp), %rbp
movq 0x10(%rbx), %rax
cmpq %rax, 0x8(%rbx)
jne 0x7518a
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x10(%rbx)
movq (%rbx), %rdi
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rsi
addq %rcx, %rsi
callq 0x2370
movq %rax, (%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
leaq 0x1(%rdx), %rsi
leaq (%rdx,%rdx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rdx, %rcx
movq %rsi, 0x8(%rbx)
movq (%r12), %rdx
movups (%rdx,%r15), %xmm0
movups 0xc(%rdx,%r15), %xmm1
movups %xmm0, (%rax,%rcx)
movups %xmm1, 0xc(%rax,%rcx)
testq %rbp, %rbp
je 0x751f6
addq %rcx, %rax
movq (%r12), %rcx
movl 0xc(%rcx,%r15), %edx
movl %edx, (%rax)
movl (%rcx,%r15), %edx
movl %edx, 0xc(%rax)
movl 0x10(%rcx,%r15), %edx
movl %edx, 0x4(%rax)
movl 0x14(%rcx,%r15), %edx
movl %edx, 0x8(%rax)
movl 0x4(%rcx,%r15), %edx
movl %edx, 0x10(%rax)
movl 0x8(%rcx,%r15), %ecx
movl %ecx, 0x14(%rax)
incq %r13
cmpq %r14, %r13
jbe 0x75156
movq %r14, %r15
jmp 0x7520a
movq %r13, %r15
incq %r15
movq %r15, %r13
movq 0x30(%rsp), %rcx
cmpq %rcx, %r15
movq 0x10(%rsp), %r8
jb 0x74fb8
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x80(%rsp), %rax
movq $0x1, (%rax)
jmp 0x75223