// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Correct.cpp
// Function: verify_single_window(long long, long long, long long, long long, int, int, int, char*, char*, All_reads*)
int verify_single_window(long long x_start, long long x_end, 
long long overlap_x_s, long long overlap_y_s, int x_id,
int y_id, int x_strand, char* x_buffer, char* y_buffer,
All_reads* R_INF)
{
    char* x_string = NULL;
    char* y_string = NULL;
    int extra_begin, extra_end, x_len, threshold;
    long long y_start;
    long long Window_Len, o_len;
    unsigned int error;

    

    x_len = x_end - x_start + 1;
    threshold = x_len * asm_opt.max_ov_diff_ec;
    /****************************may have bugs********************************/
    threshold = Adjust_Threshold(threshold, x_len);
    /****************************may have bugs********************************/
        
    y_start = (x_start - overlap_x_s) + overlap_y_s;
    
    Window_Len = x_len + (threshold << 1);

    if(!determine_overlap_region(threshold, y_start, y_id, Window_Len, Get_READ_LENGTH((*R_INF), y_id),
    &extra_begin, &extra_end, &y_start, &o_len))
    {
        return 0;
    }

    ///use unusual direction here
    /**
    fill_subregion(y_buffer, y_start, o_len, y_strand, R_INF, y_id, extra_begin, extra_end);
    ///x is always forward strand
    recover_UC_Read_sub_region(x_buffer, x_start, x_len, 0, R_INF, x_id);
    **/
   ///use unusual direction here, here y is always forward strand
    fill_subregion(y_buffer, y_start, o_len, 0, R_INF, y_id, extra_begin, extra_end);
    recover_UC_Read_sub_region(x_buffer, x_start, x_len, x_strand, R_INF, x_id);


    x_string = x_buffer;
    y_string = y_buffer;

    Reserve_Banded_BPM(y_string, Window_Len, x_string, x_len, threshold, &error);

    if (error!=(unsigned int)-1)
    {
        return 1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r11d
movq %rsi, %rax
movq %rdi, %r14
subl %r14d, %eax
leal 0x1(%rax), %edi
cvtsi2sd %edi, %xmm0
leaq 0x242395(%rip), %rsi    # 0x28a758
mulsd 0xc0(%rsi), %xmm0
movq 0x68(%rsp), %r8
cvttsd2si %xmm0, %esi
testl %esi, %esi
movl $0x1, %ebp
cmovnel %esi, %ebp
movl %edi, (%rsp)
cmpl $0x4, %edi
cmovll %esi, %ebp
movq %r14, %rsi
subq %rdx, %rsi
addq %rcx, %rsi
leal 0x1(%rax,%rbp,2), %r15d
movslq %r9d, %r9
movq 0x18(%r8), %rax
movq (%rax,%r9,8), %r13
sets %dl
movq %r13, %rdi
subq %rsi, %rdi
setle %r10b
movb $0x1, %cl
xorl %eax, %eax
orb %dl, %r10b
movl %r15d, 0x4(%rsp)
jne 0x48435
leal (,%rbp,2), %r10d
movslq %r15d, %rdx
movslq %r10d, %r10
addq %r10, %rdi
addq $0x1f, %rdi
cmpq %rdx, %rdi
jge 0x4843c
xorl %r15d, %r15d
xorl %ebx, %ebx
jmp 0x48481
movslq %ebp, %rcx
subq %rcx, %rsi
subq %rsi, %r13
cmpq %rdx, %r13
cmovgeq %rdx, %r13
movl %r15d, %edx
subl %r13d, %edx
movl %esi, %edi
negl %edi
xorl %ecx, %ecx
testq %rsi, %rsi
movl $0x0, %r12d
cmovgq %rsi, %r12
movslq %edi, %rdi
sarq $0x3f, %rsi
movl %edi, %r10d
andl %esi, %r10d
subq %r10, %r13
andq %rdi, %rsi
movslq %edx, %rbx
movq %rsi, %r15
movq %r12, %rsi
testb %cl, %cl
jne 0x4851b
movq 0x60(%rsp), %rax
leaq (%rax,%r15), %r12
movq %r12, %rdi
movq %r13, %rdx
xorl %ecx, %ecx
movq %r14, 0x8(%rsp)
movl %r11d, %r14d
callq 0x337f7
movq 0x60(%rsp), %rdi
movl $0x4e, %esi
movq %r15, %rdx
callq 0x20e0
addq %r13, %r12
movq %r12, %rdi
movl $0x4e, %esi
movq %rbx, %rdx
callq 0x20e0
movl (%rsp), %ebx
movslq %ebx, %rdx
movslq %r14d, %r9
movl 0x50(%rsp), %eax
movzbl %al, %ecx
movq 0x58(%rsp), %r15
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq 0x68(%rsp), %r8
callq 0x337f7
movzwl %bp, %r8d
leaq 0x14(%rsp), %r14
movq 0x60(%rsp), %rdi
movl 0x4(%rsp), %esi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r9
callq 0x8578f
xorl %eax, %eax
cmpl $-0x1, (%r14)
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq