// File: /workspace/github_cpp_makefile_star2_O2/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 0x17eb54
testq %rax, %rax
je 0x41a85
cmpq $0x2, %rbx
jb 0x419a2
imulq $0x1c, %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 0x1a1c27(%rip), %xmm0   # 0x1e35b8
movq %r15, %rdi
callq 0x17eb54
testq %rax, %rax
je 0x41a85
movl 0x4(%r15), %esi
movl 0x8(%r15), %edi
movl %edi, %edx
subl %esi, %edx
movl 0x14(%r15), %r8d
movl 0x10(%r15), %r9d
movl %r8d, %eax
subl %r9d, %eax
addq $0x14, %r14
xorl %r11d, %r11d
xorl %r15d, %r15d
movq %rdx, %r10
movq %rax, %rcx
cmpq %rbx, %r15
jae 0x41a2f
testq %r10, %r10
jle 0x41a2f
testq %rcx, %rcx
jle 0x41a2f
movl -0x10(%r14), %r12d
movl -0xc(%r14), %r13d
cmpl %r12d, %esi
cmoval %esi, %r12d
cmpl %r13d, %edi
cmovbl %edi, %r13d
movq %r12, %rbp
subq %r13, %rbp
cmpl %r12d, %r13d
cmovbeq %r11, %rbp
addq %rbp, %r10
movl -0x4(%r14), %r12d
cmpl %r12d, %r9d
cmoval %r9d, %r12d
movl (%r14), %r13d
cmpl %r13d, %r8d
cmovbl %r8d, %r13d
movq %r12, %rbp
subq %r13, %rbp
cmpl %r12d, %r13d
cmovbeq %r11, %rbp
addq %rbp, %rcx
incq %r15
addq $0x1c, %r14
jmp 0x419cc
cvtsi2sd %rdx, %xmm0
cvtsi2sd %r10, %xmm1
cmpq $0x101, %r10            # imm = 0x101
jl 0x41a4c
mulsd 0x1a1b6e(%rip), %xmm0   # 0x1e35b8
jmp 0x41a54
mulsd 0x1a1a84(%rip), %xmm0   # 0x1e34d8
ucomisd %xmm0, %xmm1
ja 0x41a85
cvtsi2sd %rax, %xmm0
cvtsi2sd %rcx, %xmm1
cmpq $0x101, %rcx            # imm = 0x101
jl 0x41a77
mulsd 0x1a1b43(%rip), %xmm0   # 0x1e35b8
jmp 0x41a7f
mulsd 0x1a1a59(%rip), %xmm0   # 0x1e34d8
ucomisd %xmm0, %xmm1
jbe 0x41a96
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rax
jmp 0x41a87