// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: verify_ul_sub_window(ul_idx_t const*, Correct_dumy*, UC_Read*, long long, long long, long long, long long, unsigned long, unsigned long, int, int, unsigned int*, int*, int*, int*)
inline int verify_ul_sub_window(const ul_idx_t *uref, Correct_dumy* dumy, UC_Read* g_read, 
long long x_beg, long long xLen, long long y_beg, long long yLen, uint64_t y_id, 
uint64_t y_pos_strand, int threshold, int alignment_strand,
unsigned int* get_error, int* get_y_end, int* get_x_end, int* get_aligned_xLen)
{
    (*get_aligned_xLen) = 0;
    (*get_y_end) = -1;
    (*get_x_end) = -1;
    (*get_error) = (unsigned int)-1;

    int extra_begin, extra_end, r_x_end, r_y_end, aligned_xLen;
    long long o_len;
    unsigned int r_error;
    if(!determine_overlap_region(threshold, y_beg, y_id, yLen, 
    uref->ug->u.a[y_id].len, &extra_begin, &extra_end, &y_beg, &o_len))
    {
        return 0;
    }

    fill_subregion_ul(dumy->overlap_region, y_beg, o_len, y_pos_strand, uref, 
    y_id, extra_begin, extra_end);

    // if(y_id == 6) {
    //     fprintf(stderr, "-[M::%s::aln_dir->%d] qs->%lld, ts->%lld, thres->%d, aux_beg->%d, aux_end->%d, t_pri_l->%lld\n", 
    //     __func__, alignment_strand, x_beg, y_beg, threshold, extra_begin, extra_end, o_len);
    // }

    char* x_string = g_read->seq + x_beg;
    char* y_string = dumy->overlap_region;

    aligned_xLen = 0;

    alignment_extension(y_string, yLen, x_string, xLen, threshold, 
                    alignment_strand, &r_error, &r_y_end, &r_x_end, &aligned_xLen);
    
    (*get_error) = r_error;
    (*get_y_end) = r_y_end;
    (*get_x_end) = r_x_end;
    (*get_aligned_xLen) = aligned_xLen;

    if(aligned_xLen == 0)
    {
        return 0;
    }
    else
    {
        return 1;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %rax
movq %r8, 0x10(%rsp)
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r13
movq 0xb0(%rsp), %rcx
leaq 0x20(%rsp), %rdx
movq %r9, (%rdx)
andl $0x0, (%rcx)
movq 0xa0(%rsp), %rcx
orl $-0x1, (%rcx)
movq 0xa8(%rsp), %rcx
orl $-0x1, (%rcx)
movq 0x98(%rsp), %rcx
orl $-0x1, (%rcx)
movl 0x88(%rsp), %edi
movq 0x78(%rsp), %rbp
movq (%r13), %rcx
movq 0x10(%rcx), %rcx
imulq $0x28, %rbp, %rsi
movl (%rcx,%rsi), %r8d
movq 0x70(%rsp), %rcx
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
subq $0x8, %rsp
leaq 0x20(%rsp), %r10
leaq 0x10(%rsp), %r11
leaq 0x14(%rsp), %r9
movq %rax, %rsi
pushq %r10
pushq %rdx
pushq %r11
callq 0x1b53a
addq $0x20, %rsp
testl %eax, %eax
je 0x649fa
movq 0x80(%rsp), %rax
addq $0x50, %r15
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0xc(%rsp), %r10d
movl 0x8(%rsp), %r11d
movzbl %al, %ecx
movq %r15, %rdi
movq %r13, %r8
movq %rbp, %r9
pushq %r11
pushq %r10
callq 0x1b4ca
popq %rax
popq %rcx
addq (%r12), %r14
leaq 0x2c(%rsp), %r12
andl $0x0, (%r12)
leaq 0x34(%rsp), %r13
leaq 0x30(%rsp), %rbp
leaq 0x28(%rsp), %rbx
movl 0x88(%rsp), %eax
movzwl %ax, %r8d
movq %r15, %rdi
movq 0x70(%rsp), %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
movl 0x90(%rsp), %r9d
pushq %r12
pushq %r13
pushq %rbp
pushq %rbx
callq 0x64a0b
addq $0x20, %rsp
movl (%rbx), %eax
movq 0x98(%rsp), %rcx
movl %eax, (%rcx)
movl (%rbp), %eax
movq 0xa0(%rsp), %rcx
movl %eax, (%rcx)
movl (%r13), %eax
movq 0xa8(%rsp), %rcx
movl %eax, (%rcx)
movl (%r12), %ecx
movq 0xb0(%rsp), %rax
movl %ecx, (%rax)
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x649fc
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq