// File: /workspace/github_cpp_makefile_star2_O1/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 0x1c09f8
testq %rax, %rax
je 0x73f22
cmpq $0x2, %rbx
jb 0x73dd9
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 0x1b17a0(%rip), %xmm0   # 0x225568
movq %r15, %rdi
callq 0x1c09f8
testq %rax, %rax
je 0x73f22
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 0x73e89
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 0x73e89
testq %r10, %r10
jle 0x73e89
incq %r11
addq $0x1c, %r14
testq %rdx, %rdx
jg 0x73e24
cmpq $0x101, %r10            # imm = 0x101
jl 0x73ead
xorps %xmm0, %xmm0
cvtsi2sd %r10, %xmm0
cvtsi2sd %rcx, %xmm1
mulsd 0x1b16c1(%rip), %xmm1   # 0x225568
ucomisd %xmm1, %xmm0
ja 0x73f22
cmpq $0x100, %r10            # imm = 0x100
jg 0x73ed4
xorps %xmm0, %xmm0
cvtsi2sd %r10, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %rcx, %xmm1
mulsd 0x1b15ba(%rip), %xmm1   # 0x225488
ucomisd %xmm1, %xmm0
ja 0x73f22
cmpq $0x101, %rdx            # imm = 0x101
jl 0x73efb
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
mulsd 0x1b1673(%rip), %xmm1   # 0x225568
ucomisd %xmm1, %xmm0
ja 0x73f22
cmpq $0x100, %rdx            # imm = 0x100
jg 0x73f33
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
mulsd 0x1b156c(%rip), %xmm1   # 0x225488
ucomisd %xmm1, %xmm0
jbe 0x73f33
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
jmp 0x73f24