// File: 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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movl (%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %ecx
movsd -0x18(%rbp), %xmm0
callq 0x2c8a40
cmpq $0x0, %rax
jne 0x7b052
movq $0x0, -0x8(%rbp)
jmp 0x7b3b5
cmpq $0x1, -0x28(%rbp)
jbe 0x7b0cd
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rax
subq $0x1, %rax
imulq $0x1c, %rax, %rax
addq %rax, %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movl (%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %ecx
movsd 0x307223(%rip), %xmm0   # 0x3822d8
callq 0x2c8a40
cmpq $0x0, %rax
jne 0x7b0cd
movq $0x0, -0x8(%rbp)
jmp 0x7b3b5
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x30(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x30(%rbp), %rcx
subl 0x10(%rcx), %eax
movl %eax, %eax
movq %rax, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x61(%rbp)
jae 0x7b123
xorl %eax, %eax
cmpq $0x0, -0x40(%rbp)
movb %al, -0x61(%rbp)
jle 0x7b123
cmpq $0x0, -0x48(%rbp)
setg %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x7b12f
jmp 0x7b2b3
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
imulq $0x1c, -0x38(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jb 0x7b153
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x68(%rbp)
jmp 0x7b165
movq -0x20(%rbp), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x20(%rbp), %rcx
imulq $0x1c, -0x38(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
ja 0x7b192
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x6c(%rbp)
jmp 0x7b1a4
movq -0x20(%rbp), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jle 0x7b1c5
movq -0x58(%rbp), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x7b1cd
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0x7b1cd
movq -0x78(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
movq -0x40(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x20(%rbp), %rcx
imulq $0x1c, -0x38(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jb 0x7b208
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x7c(%rbp)
jmp 0x7b21a
movq -0x20(%rbp), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x20(%rbp), %rcx
imulq $0x1c, -0x38(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
ja 0x7b247
movq -0x30(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x80(%rbp)
jmp 0x7b259
movq -0x20(%rbp), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jle 0x7b27d
movq -0x58(%rbp), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x7b288
xorl %eax, %eax
movq %rax, -0x88(%rbp)
jmp 0x7b288
movq -0x88(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x7b0fd
cmpq $0x100, -0x40(%rbp)     # imm = 0x100
jle 0x7b2f3
cvtsi2sdq -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
movl 0x8(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
movsd 0x306ffc(%rip), %xmm2   # 0x3822d8
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7b2f3
movq $0x0, -0x8(%rbp)
jmp 0x7b3b5
cmpq $0x100, -0x40(%rbp)     # imm = 0x100
jg 0x7b333
cvtsi2sdq -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
movl 0x8(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
movsd 0x306ef4(%rip), %xmm2   # 0x382210
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7b333
movq $0x0, -0x8(%rbp)
jmp 0x7b3b5
cmpq $0x100, -0x48(%rbp)     # imm = 0x100
jle 0x7b370
cvtsi2sdq -0x48(%rbp), %xmm0
movq -0x30(%rbp), %rax
movl 0x10(%rax), %ecx
movl 0x14(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
movsd 0x306f7c(%rip), %xmm2   # 0x3822d8
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7b370
movq $0x0, -0x8(%rbp)
jmp 0x7b3b5
cmpq $0x100, -0x48(%rbp)     # imm = 0x100
jg 0x7b3ad
cvtsi2sdq -0x48(%rbp), %xmm0
movq -0x30(%rbp), %rax
movl 0x10(%rax), %ecx
movl 0x14(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
movsd 0x306e77(%rip), %xmm2   # 0x382210
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7b3ad
movq $0x0, -0x8(%rbp)
jmp 0x7b3b5
movq $0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)