// File: chhylp123[P]hifiasm/Correct.cpp
// Function: if_direct_mask(ul_idx_t const*, ug_opt_t const*, ul_ov_t*, ul_ov_t*, unsigned long, double)
uint64_t if_direct_mask(const ul_idx_t *uref, const ug_opt_t *uopt, ul_ov_t *p, ul_ov_t *q, uint64_t bw, double len_diff)
{
    ul_ov_t *li, *lj; uint64_t os, oe, ovlp;
    if(p->qe > q->qe) li = p, lj = q;
    else if(p->qe == q->qe && p->qs >= q->qs) li = p, lj = q;
    else lj = p, li = q;
    os = MAX(li->qs, lj->qs), oe = MIN(li->qe, lj->qe);
    ovlp = ((oe > os)? (oe - os):0);
    if(!ovlp) return 0;//no overlap

    if(lj->qs <= li->qs+G_CHAIN_INDEL) {
        if(govlp_check(uref, uopt, bw, len_diff, li, lj)) return 1;
    } else if((lj->qe+G_CHAIN_INDEL>=li->qe) && (lj->qs+G_CHAIN_INDEL>=li->qs)) {
        if(govlp_check(uref, uopt, bw, len_diff, lj, li)) return 1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movsd %xmm0, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jbe 0x82203
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x82247
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x82235
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x82235
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x82245
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x82247
movq -0x40(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x48(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x82263
movq -0x40(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x64(%rbp)
jmp 0x8226d
movq -0x48(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x48(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x82292
movq -0x40(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x68(%rbp)
jmp 0x8229c
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jbe 0x822bd
movq -0x58(%rbp), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x822c5
xorl %eax, %eax
movq %rax, -0x70(%rbp)
jmp 0x822c5
movq -0x70(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x822e1
movq $0x0, -0x8(%rbp)
jmp 0x8238b
movq -0x48(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x40(%rbp), %rcx
movl 0x4(%rcx), %ecx
addl $0x80, %ecx
cmpl %ecx, %eax
ja 0x82328
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
movsd -0x38(%rbp), %xmm0
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %r8
callq 0x72aa0
cmpl $0x0, %eax
je 0x82326
movq $0x1, -0x8(%rbp)
jmp 0x8238b
jmp 0x82383
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x80, %eax
movq -0x40(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jb 0x82381
movq -0x48(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x80, %eax
movq -0x40(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x82381
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
movsd -0x38(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %r8
callq 0x72aa0
cmpl $0x0, %eax
je 0x8237f
movq $0x1, -0x8(%rbp)
jmp 0x8238b
jmp 0x82381
jmp 0x82383
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)