// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Correct.cpp
// Function: is_cover_ul_ov_t(ma_ug_t*, double, ul_ov_t*, unsigned long, ul_ov_t*)
uint64_t is_cover_ul_ov_t(ma_ug_t *ug, double diff, ul_ov_t *ref, uint64_t ref_n, ul_ov_t *in)
{
    if((!check_ul_ov_t_consist(in, &(ref[0]), ug->g->seq[in->qn].len, ug->g->seq[in->tn].len, diff))) return 0;
    if((ref_n > 1) && (!check_ul_ov_t_consist(in, &(ref[ref_n-1]), ug->g->seq[in->qn].len, ug->g->seq[in->tn].len, 0.06))) return 0;
    uint64_t i; int64_t sql, stl, os, oe, ovlp;
    sql = in->qe - in->qs; stl = in->te - in->ts;   
    for (i = 0; i < ref_n && sql > 0 && stl > 0; i++) {
        os = MAX(in->qs, ref[i].qs); oe = MIN(in->qe, ref[i].qe);
		ovlp = ((oe>os)?(oe-os):(0)); sql -= ovlp;

        os = MAX(in->ts, ref[i].ts); oe = MIN(in->te, ref[i].te);
        ovlp = ((oe>os)?(oe-os):(0)); stl -= ovlp;
    }
    if((sql > 256) && (sql > ((in->qe - in->qs)*0.06))) return 0;
    if((sql <= 256) && (sql > ((in->qe - in->qs)*0.6))) return 0;
    if((stl > 256) && (stl > ((in->te - in->ts)*0.06))) return 0;
    if((stl <= 256) && (stl > ((in->te - in->ts)*0.6))) return 0;
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movq 0x18(%rdi), %rax
movq 0x20(%rax), %rax
movl (%rcx), %ecx
movl 0xc(%r15), %esi
movl (%rax,%rcx,8), %edx
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andq %rdi, %rdx
movl (%rax,%rsi,8), %ecx
andq %rdi, %rcx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1ca9e4
testq %rax, %rax
je 0x739ee
cmpq $0x2, %rbx
jb 0x738df
leaq (%rbx,%rbx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rbx, %rax
leaq (%r14,%rax), %rsi
addq $-0x1c, %rsi
movq 0x18(%r12), %rax
movq 0x20(%rax), %rax
movl (%r15), %ecx
movl 0xc(%r15), %edi
movl (%rax,%rcx,8), %edx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
andq %r8, %rdx
movl (%rax,%rdi,8), %ecx
andq %r8, %rcx
movsd 0x1bdd9a(%rip), %xmm0   # 0x231668
movq %r15, %rdi
callq 0x1ca9e4
testq %rax, %rax
je 0x739ee
movl 0x4(%r15), %esi
movl 0x8(%r15), %edi
testq %rbx, %rbx
setne %al
movl %edi, %ecx
subl %esi, %ecx
movl 0x14(%r15), %r8d
movl 0x10(%r15), %r9d
setne %dl
andb %al, %dl
movl %r8d, %eax
subl %r9d, %eax
setne %r11b
andb %dl, %r11b
movq %rcx, %r10
movq %rax, %rdx
cmpb $0x1, %r11b
jne 0x7398f
addq $0x14, %r14
movl $0x1, %r11d
xorl %r15d, %r15d
movq %rax, %rdx
movq %rcx, %r10
movq %r10, %r12
movl -0x10(%r14), %r13d
movl -0xc(%r14), %ebp
cmpl %r13d, %esi
cmoval %esi, %r13d
cmpl %ebp, %edi
cmovbl %edi, %ebp
movq %r13, %r10
subq %rbp, %r10
cmpl %r13d, %ebp
cmovbeq %r15, %r10
addq %r12, %r10
movl -0x4(%r14), %r12d
cmpl %r12d, %r9d
cmoval %r9d, %r12d
movq %rdx, %r13
movl (%r14), %ebp
cmpl %ebp, %r8d
cmovbl %r8d, %ebp
movq %r12, %rdx
subq %rbp, %rdx
cmpl %r12d, %ebp
cmovbeq %r15, %rdx
addq %r13, %rdx
cmpq %rbx, %r11
jae 0x7398f
testq %r10, %r10
jle 0x7398f
incq %r11
addq $0x1c, %r14
testq %rdx, %rdx
jg 0x7392a
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
cvtsi2sd %r10, %xmm1
cmpq $0x101, %r10            # imm = 0x101
jl 0x739af
mulsd 0x1bdcbb(%rip), %xmm0   # 0x231668
jmp 0x739b7
mulsd 0x1bdbd1(%rip), %xmm0   # 0x231588
ucomisd %xmm0, %xmm1
ja 0x739ee
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %rdx, %xmm1
cmpq $0x101, %rdx            # imm = 0x101
jl 0x739e0
mulsd 0x1bdc8a(%rip), %xmm0   # 0x231668
jmp 0x739e8
mulsd 0x1bdba0(%rip), %xmm0   # 0x231588
ucomisd %xmm0, %xmm1
jbe 0x739ff
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
jmp 0x739f0