// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Correct.cpp
// Function: verify_ul_window(long long, long long, overlap_region_alloc*, Correct_dumy*, ul_idx_t const*, char*, double, long long, long long, void*)
void verify_ul_window(long long window_start, long long window_end, overlap_region_alloc* overlap_list,Correct_dumy* dumy, const ul_idx_t *uref,
char* r_string, double max_ov_diff_ec, long long blockLen, long long max_error, void *km)
{
    long long i;
    long long currentID;
    long long x_start, y_start, o_len;
    long long Window_Len = blockLen + (max_error << 1);
    char* x_string = NULL;
    char* y_string = NULL;
    long long x_end, x_len;
    int end_site;
    unsigned int error;
    int groupLen = 0;
    int return_sites[GROUP_SIZE];
    unsigned int return_sites_error[GROUP_SIZE];
    uint64_t overlapID[GROUP_SIZE];
    uint64_t y_startGroup[GROUP_SIZE];
    int y_extra_begin[GROUP_SIZE];
    int y_extra_end[GROUP_SIZE];
    int error_threshold[GROUP_SIZE];
    int extra_begin;
    int extra_end;

    ///here are overlaps fully covered by blockLen
    for (i = 0; i < (long long)dumy->length; i++)
    {
        extra_begin = extra_end = 0;
        ///if the window has been fully covered, the interval at x is [window_start, window_end]
        x_len = blockLen;
        currentID = dumy->overlapID[i];
        x_start = window_start;
        ///offset of y
        y_start = (x_start - overlap_list->list[currentID].x_pos_s) + overlap_list->list[currentID].y_pos_s;
        /****************************may have bugs********************************/
        y_start += y_start_offset(x_start, &(overlap_list->list[currentID].f_cigar));
        /****************************may have bugs********************************/
        
  
        if(!determine_overlap_region(max_error, y_start, overlap_list->list[currentID].y_id, Window_Len, uref->ug->u.a[overlap_list->list[currentID].y_id].len,
        &extra_begin, &extra_end, &y_start, &o_len)) {
            continue;
        }

        // if(overlap_list->list[currentID].y_id == 4) {
        //     fprintf(stderr, "[M::%s] q_s::%lld, t_s::%lld, t_pri_l::%lld, aux_beg::%d, aux_end::%d, aln_l::%lld\n", __func__, 
        //         x_start, y_start, o_len, extra_begin, extra_end, Window_Len);
        // }

        fill_subregion_ul(dumy->overlap_region_group[groupLen], y_start, o_len, overlap_list->list[currentID].y_pos_strand, 
        uref, overlap_list->list[currentID].y_id, extra_begin, extra_end);

        y_extra_begin[groupLen] = extra_begin;
        y_extra_end[groupLen] = extra_end;
        overlapID[groupLen] = currentID;
        y_startGroup[groupLen] = y_start;
        error_threshold[groupLen] = max_error;
        x_string = r_string + x_start;
        groupLen++;
        

        if (groupLen == GROUP_SIZE)
        {
            // Reserve_Banded_BPM_4_SSE_only(dumy->overlap_region_group[0], dumy->overlap_region_group[1], 
            // dumy->overlap_region_group[2], dumy->overlap_region_group[3], Window_Len, x_string, blockLen,
            //     return_sites, return_sites_error, max_error, dumy->Peq_SSE);
            return_sites[0] = 
                    Reserve_Banded_BPM(dumy->overlap_region_group[0], Window_Len, x_string, blockLen, max_error, &return_sites_error[0]);
            return_sites[1] = 
                    Reserve_Banded_BPM(dumy->overlap_region_group[1], Window_Len, x_string, blockLen, max_error, &return_sites_error[1]);
            return_sites[2] = 
                    Reserve_Banded_BPM(dumy->overlap_region_group[2], Window_Len, x_string, blockLen, max_error, &return_sites_error[2]);
            return_sites[3] = 
                    Reserve_Banded_BPM(dumy->overlap_region_group[3], Window_Len, x_string, blockLen, max_error, &return_sites_error[3]);
            




            groupLen = 0;
            
            if (return_sites_error[0]!=(unsigned int)-1) {
                overlap_list->list[overlapID[0]].align_length += x_len;

                append_window_list(&overlap_list->list[overlapID[0]], window_start, window_end, 
                            y_startGroup[0], y_startGroup[0] + return_sites[0], (int)return_sites_error[0],
                            y_extra_begin[0], y_extra_end[0], error_threshold[0], blockLen, km);
            }
            

            if (return_sites_error[1]!=(unsigned int)-1) {
                overlap_list->list[overlapID[1]].align_length += x_len;
                append_window_list(&overlap_list->list[overlapID[1]], window_start, window_end, 
                            y_startGroup[1], y_startGroup[1] + return_sites[1], (int)return_sites_error[1],
                            y_extra_begin[1], y_extra_end[1], error_threshold[1], blockLen, km);
            }
            

            if (return_sites_error[2]!=(unsigned int)-1) {
                overlap_list->list[overlapID[2]].align_length += x_len;

                append_window_list(&overlap_list->list[overlapID[2]], window_start, window_end, 
                            y_startGroup[2], y_startGroup[2] + return_sites[2], (int)return_sites_error[2],
                            y_extra_begin[2], y_extra_end[2], error_threshold[2], blockLen, km);
            }
            

            if (return_sites_error[3]!=(unsigned int)-1) {
                overlap_list->list[overlapID[3]].align_length += x_len;

                append_window_list(&overlap_list->list[overlapID[3]], window_start, window_end, 
                            y_startGroup[3], y_startGroup[3] + return_sites[3], (int)return_sites_error[3],
                            y_extra_begin[3], y_extra_end[3], error_threshold[3], blockLen, km);
            } 
        }
    }

    if (groupLen == 1)
    {
        end_site = Reserve_Banded_BPM(dumy->overlap_region_group[0], Window_Len, x_string, blockLen, max_error, &error);

        if (error!=(unsigned int)-1) {
            overlap_list->list[overlapID[0]].align_length += x_len;

            append_window_list(&overlap_list->list[overlapID[0]], window_start, window_end, 
                                y_startGroup[0], y_startGroup[0] + end_site, (int)error,
                                y_extra_begin[0], y_extra_end[0], error_threshold[0], blockLen, km);
        }
    }
    else if (groupLen > 1)
    {
        // Reserve_Banded_BPM_4_SSE_only(dumy->overlap_region_group[0], dumy->overlap_region_group[1], 
        //         dumy->overlap_region_group[2], dumy->overlap_region_group[3], Window_Len, x_string, blockLen,
        //             return_sites, return_sites_error, max_error, dumy->Peq_SSE);

        for (i = 0; i < groupLen; i++)
        {
            return_sites[i] = Reserve_Banded_BPM(dumy->overlap_region_group[i], Window_Len, x_string, blockLen, max_error, &return_sites_error[i]);

            if (return_sites_error[i]!=(unsigned int)-1) {
                overlap_list->list[overlapID[i]].align_length += x_len;
                append_window_list(&overlap_list->list[overlapID[i]], window_start, window_end, 
                                y_startGroup[i], y_startGroup[i] + return_sites[i], (int)return_sites_error[i],
                                y_extra_begin[i], y_extra_end[i], error_threshold[i], blockLen, km);
            }
        }

        groupLen = 0;
    }

    long long reverse_i = dumy->size - 1;
    int threshold;
    
    ///here are overlaps partially covered by blockLen
    for (i = 0; i < (long long)dumy->lengthNT; i++)
    {
        extra_begin = extra_end = 0;
        currentID = dumy->overlapID[reverse_i--];
        x_start = MAX(window_start, (long long)overlap_list->list[currentID].x_pos_s);
        x_end = MIN(window_end, (long long)overlap_list->list[currentID].x_pos_e);

        ///overlap length between [window_start, window_end]
        x_len = x_end - x_start + 1;
        threshold = x_len * max_ov_diff_ec;
        /****************************may have bugs********************************/
        threshold = Adjust_Threshold(threshold, x_len);
        if(threshold > THRESHOLD_MAX_SIZE) threshold = THRESHOLD_MAX_SIZE;
        /****************************may have bugs********************************/
        
        ///offset of y
        y_start = (x_start - overlap_list->list[currentID].x_pos_s) + overlap_list->list[currentID].y_pos_s;
        /****************************may have bugs********************************/
        y_start += y_start_offset(x_start, &(overlap_list->list[currentID].f_cigar));
        /****************************may have bugs********************************/

        Window_Len = x_len + (threshold << 1);

        if(!determine_overlap_region(threshold, y_start, overlap_list->list[currentID].y_id, Window_Len, uref->ug->u.a[overlap_list->list[currentID].y_id].len,
        &extra_begin, &extra_end, &y_start, &o_len)) {
            continue;
        }

        // if(overlap_list->list[currentID].y_id == 4) {
        //     fprintf(stderr, "[M::%s] q_s::%lld, t_s::%lld, t_pri_l::%lld, aux_beg::%d, aux_end::%d, aln_l::%lld\n", __func__, 
        //         x_start, y_start, o_len, extra_begin, extra_end, Window_Len);
        // }
        
        fill_subregion_ul(dumy->overlap_region, y_start, o_len, overlap_list->list[currentID].y_pos_strand, 
        uref, overlap_list->list[currentID].y_id, extra_begin, extra_end);        

        x_string = r_string + x_start;
        y_string = dumy->overlap_region;

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

        if (error!=(unsigned int)-1) {
            overlap_list->list[currentID].align_length += x_len;
            append_window_list(&overlap_list->list[currentID], x_start, x_end, y_start, y_start + end_site, (int)error,
            extra_begin, extra_end, threshold, blockLen, km);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movsd %xmm0, 0xe8(%rsp)
movq %r8, 0xd0(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x178(%rsp), %rdx
movq 0x170(%rsp), %rax
leaq (%rax,%rdx,2), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x30(%rcx)
movq %rcx, 0x68(%rsp)
movq %rdi, 0x28(%rsp)
movq %r9, 0xe0(%rsp)
jle 0x4936f
leal (%rdx,%rdx), %eax
cltq
addq $0x1f, %rax
movq %rax, 0x88(%rsp)
movslq %edx, %rax
movq %rax, 0x80(%rsp)
leaq 0x244(%rcx), %rax
movq %rax, 0x60(%rsp)
leaq (%r9,%rdi), %rax
movq %rax, 0x48(%rsp)
leaq 0x438(%rcx), %rax
movq %rax, 0x78(%rsp)
leaq 0x62c(%rcx), %rax
movq %rax, 0x70(%rsp)
leaq 0x820(%rcx), %rax
movq %rax, 0xd8(%rsp)
xorl %r14d, %r14d
movzwl %dx, %eax
movl %eax, 0x9c(%rsp)
xorl %edx, %edx
movq $0x0, (%rsp)
movq 0x28(%rcx), %rax
movq %rdx, 0x58(%rsp)
movq (%rax,%rdx,8), %rcx
movq 0x8(%rsp), %r13
movq (%r13), %rax
movq %rcx, 0x50(%rsp)
imulq $0xa8, %rcx, %rbx
leaq (%rax,%rbx), %rsi
addq $0x38, %rsi
movl -0x34(%rsi), %eax
movl -0x24(%rsi), %r12d
movq 0x28(%rsp), %rdi
movq %rdi, %rbp
subq %rax, %rbp
callq 0x48df6
movq %rax, %r15
addq %r12, %r15
addq %rbp, %r15
movq (%r13), %rdx
movl 0x10(%rdx,%rbx), %ecx
movq 0xd0(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
leaq (%rcx,%rcx,4), %rcx
movl (%rax,%rcx,8), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movb $0x1, %cl
cmpq %rsi, %r15
jae 0x48fc9
movq 0x88(%rsp), %rdi
subq %r15, %rdi
addq %rsi, %rdi
movq 0x20(%rsp), %r8
cmpq %r8, %rdi
jge 0x48fd0
xorl %edi, %edi
xorl %r10d, %r10d
jmp 0x49018
movq %r8, %rdi
subq 0x80(%rsp), %r15
subq %r15, %rsi
cmpq %r8, %rsi
cmovgeq %r8, %rsi
movl %edi, %r10d
subl %esi, %r10d
movl %r15d, %r8d
negl %r8d
xorl %ecx, %ecx
testq %r15, %r15
movl $0x0, %r9d
cmovgq %r15, %r9
sarq $0x3f, %r15
movl %r15d, %edi
andl %r8d, %edi
subq %rdi, %rsi
movq %r9, %r15
movq %rsi, 0x90(%rsp)
testb %cl, %cl
jne 0x49356
movslq %r14d, %r14
movq %r14, (%rsp)
imulq $0x1f4, %r14, %r13      # imm = 0x1F4
addq 0x60(%rsp), %r13
movzbl 0x1c(%rdx,%rbx), %ecx
movl 0x10(%rdx,%rbx), %edx
movslq %edi, %rbx
leaq (%rbx,%r13), %rbp
leaq (%rdx,%rdx,4), %rdx
leaq (%rax,%rdx,8), %rdx
subq $0x8, %rsp
xorl %edi, %edi
movq %rbp, %rsi
movq %r15, %r8
movq 0x98(%rsp), %r12
movq %r12, %r9
pushq $0x0
movl %r10d, %r14d
callq 0x36b0d
addq $0x10, %rsp
movq %r13, %rdi
movl $0x4e, %esi
movq %rbx, %rdx
callq 0x20e0
addq %r12, %rbp
movslq %r14d, %r13
movq (%rsp), %r14
movq %rbp, %rdi
movl $0x4e, %esi
movq %r13, %rdx
callq 0x20e0
movl %ebx, 0xc0(%rsp,%r14,4)
movl %r13d, 0xb0(%rsp,%r14,4)
movq 0x50(%rsp), %rax
movq %rax, 0x110(%rsp,%r14,8)
movq %r15, 0xf0(%rsp,%r14,8)
movq 0x178(%rsp), %rax
movl %eax, 0xa0(%rsp,%r14,4)
incl %r14d
movq 0x48(%rsp), %rax
movq %rax, (%rsp)
cmpl $0x4, %r14d
jne 0x49356
movq 0x60(%rsp), %rdi
movq 0x20(%rsp), %r12
movl %r12d, %esi
movq 0x48(%rsp), %rbp
movq %rbp, %rdx
movq 0x170(%rsp), %r14
movl %r14d, %ecx
movl 0x9c(%rsp), %r15d
movl %r15d, %r8d
leaq 0x30(%rsp), %r9
callq 0x8578f
movl %eax, %ebx
movq 0x78(%rsp), %rdi
movl %r12d, %esi
movq %rbp, %rdx
movl %r14d, %ecx
movl %r15d, %r8d
leaq 0x34(%rsp), %r9
callq 0x8578f
movl %eax, %r13d
movq 0x70(%rsp), %rdi
movl %r12d, %esi
movq %rbp, %rdx
movl %r14d, %ecx
movl %r15d, %r8d
leaq 0x38(%rsp), %r9
callq 0x8578f
movl %eax, 0x50(%rsp)
movq 0xd8(%rsp), %rdi
movl %r12d, %esi
movq %rbp, %rdx
movl %r14d, %ecx
movl %r15d, %r8d
leaq 0x3c(%rsp), %r9
callq 0x8578f
movl %eax, %ebp
cmpl $-0x1, 0x30(%rsp)
je 0x491ea
imulq $0xa8, 0x110(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
addl %r14d, 0x28(%rcx,%rax)
leaq (%rcx,%rax), %rdi
movl 0xf0(%rsp), %ecx
addl %ecx, %ebx
movl 0x30(%rsp), %r9d
movl 0xc0(%rsp), %eax
movl 0xb0(%rsp), %r10d
movl 0xa0(%rsp), %r11d
subq $0x8, %rsp
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl %ebx, %r8d
pushq 0x188(%rsp)
pushq %r14
pushq %r11
pushq %r10
pushq %rax
callq 0x3fb41
addq $0x30, %rsp
cmpl $-0x1, 0x34(%rsp)
je 0x4925c
imulq $0xa8, 0x118(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
addl %r14d, 0x28(%rcx,%rax)
leaq (%rcx,%rax), %rdi
movl 0xf8(%rsp), %ecx
addl %ecx, %r13d
movl 0x34(%rsp), %r9d
movl 0xc4(%rsp), %eax
movl 0xb4(%rsp), %r10d
movl 0xa4(%rsp), %r11d
subq $0x8, %rsp
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl %r13d, %r8d
pushq 0x188(%rsp)
pushq %r14
pushq %r11
pushq %r10
pushq %rax
callq 0x3fb41
addq $0x30, %rsp
cmpl $-0x1, 0x38(%rsp)
movq 0x28(%rsp), %rbx
je 0x492d3
imulq $0xa8, 0x120(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
addl %r14d, 0x28(%rcx,%rax)
leaq (%rcx,%rax), %rdi
movl 0x100(%rsp), %ecx
movl 0x50(%rsp), %r8d
addl %ecx, %r8d
movl 0x38(%rsp), %r9d
movl 0xc8(%rsp), %eax
movl 0xb8(%rsp), %r10d
movl 0xa8(%rsp), %r11d
subq $0x8, %rsp
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
pushq 0x188(%rsp)
pushq %r14
pushq %r11
pushq %r10
pushq %rax
callq 0x3fb41
addq $0x30, %rsp
xorl %r14d, %r14d
cmpl $-0x1, 0x3c(%rsp)
je 0x4934d
imulq $0xa8, 0x128(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq 0x170(%rsp), %r15
addl %r15d, 0x28(%rcx,%rax)
leaq (%rcx,%rax), %rdi
movl 0x108(%rsp), %ecx
addl %ecx, %ebp
movl 0x3c(%rsp), %r9d
movl 0xcc(%rsp), %eax
movl 0xbc(%rsp), %r10d
movl 0xac(%rsp), %r11d
subq $0x8, %rsp
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
movl %ebp, %r8d
pushq 0x188(%rsp)
pushq %r15
pushq %r11
pushq %r10
pushq %rax
callq 0x3fb41
addq $0x30, %rsp
movq 0x48(%rsp), %rax
movq %rax, (%rsp)
movq 0x58(%rsp), %rdx
incq %rdx
movq 0x68(%rsp), %rcx
cmpq 0x30(%rcx), %rdx
jl 0x48f3c
jmp 0x4937a
movq $0x0, (%rsp)
xorl %r14d, %r14d
cmpl $0x1, %r14d
jne 0x49438
leaq 0x244(%rcx), %rdi
movq 0x178(%rsp), %rax
movzwl %ax, %r8d
leaq 0x14(%rsp), %rbx
movq 0x20(%rsp), %rsi
movq (%rsp), %rdx
movq 0x170(%rsp), %rcx
movq %rbx, %r9
callq 0x8578f
cmpl $-0x1, (%rbx)
movq 0x28(%rsp), %r13
je 0x4951a
imulq $0xa8, 0x110(%rsp), %rcx
movq 0x8(%rsp), %rdx
movq (%rdx), %rdx
movq 0x170(%rsp), %r14
addl %r14d, 0x28(%rdx,%rcx)
leaq (%rdx,%rcx), %rdi
movl 0xf0(%rsp), %ecx
addl %ecx, %eax
movl 0x14(%rsp), %r9d
movl 0xc0(%rsp), %r10d
movl 0xb0(%rsp), %r11d
movl 0xa0(%rsp), %ebx
subq $0x8, %rsp
movq %r13, %rsi
movq 0x20(%rsp), %rdx
movl %eax, %r8d
pushq 0x188(%rsp)
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x3fb41
addq $0x30, %rsp
jmp 0x4951a
movq 0x28(%rsp), %r13
jle 0x4951a
movl %r14d, %ecx
movq 0x68(%rsp), %rax
leaq 0x244(%rax), %rbx
shlq $0x2, %rcx
movq %rcx, 0x58(%rsp)
xorl %r12d, %r12d
movq 0x178(%rsp), %rax
movzwl %ax, %ebp
leaq (%rsp,%r12), %r15
addq $0x30, %r15
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
movq (%rsp), %rdx
movq 0x170(%rsp), %r14
movl %r14d, %ecx
movl %ebp, %r8d
movq %r15, %r9
callq 0x8578f
cmpl $-0x1, (%r15)
je 0x49504
imulq $0xa8, 0x110(%rsp,%r12,2), %rcx
movq 0x8(%rsp), %rdx
movq (%rdx), %rdx
addl %r14d, 0x28(%rdx,%rcx)
leaq (%rdx,%rcx), %rdi
movl 0xf0(%rsp,%r12,2), %ecx
addl %ecx, %eax
movl 0x30(%rsp,%r12), %r9d
movl 0xc0(%rsp,%r12), %r10d
movl 0xb0(%rsp,%r12), %r11d
movl 0xa0(%rsp,%r12), %r15d
subq $0x8, %rsp
movq %r13, %rsi
movq 0x20(%rsp), %rdx
movl %eax, %r8d
pushq 0x188(%rsp)
pushq %r14
pushq %r15
pushq %r11
pushq %r10
callq 0x3fb41
addq $0x30, %rsp
addq $0x4, %r12
addq $0x1f4, %rbx            # imm = 0x1F4
cmpq %r12, 0x58(%rsp)
jne 0x49469
movq 0x68(%rsp), %rcx
cmpq $0x0, 0x38(%rcx)
jle 0x497cd
movq 0x40(%rcx), %rax
leaq 0x50(%rcx), %rdx
movq %rdx, 0x70(%rsp)
leaq -0x8(,%rax,8), %rbx
xorl %r14d, %r14d
movq 0x28(%rcx), %rax
imulq $0xa8, (%rax,%rbx), %r9
movq 0x8(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rax,%r9), %ecx
movq %rcx, %r8
cmpq %r13, %rcx
jg 0x49566
movq %r13, %r8
movl 0x8(%rax,%r9), %r15d
cmpq 0x18(%rsp), %r15
jl 0x49577
movq 0x18(%rsp), %r15
movq %r15, (%rsp)
subq %r8, %r15
leaq 0x1(%r15), %rsi
movq %rsi, 0x20(%rsp)
cvtsi2sd %rsi, %xmm0
mulsd 0xe8(%rsp), %xmm0
cvttsd2si %xmm0, %edx
movl %edx, %esi
cmpl $0x1f, %edx
jl 0x495a5
movl $0x1f, %esi
cmpq $0x3, %r15
movl %esi, %r13d
movl $0x1, %edi
cmovgel %edi, %r13d
testl %edx, %edx
cmovnel %esi, %r13d
movq %r8, %rdx
subq %rcx, %rdx
leaq (%rax,%r9), %rsi
addq $0x38, %rsi
movl -0x24(%rsi), %r12d
addq %rdx, %r12
movq %r8, 0x50(%rsp)
movq %r8, %rdi
movq %r9, 0x58(%rsp)
callq 0x48df6
movq 0x58(%rsp), %r9
movq %rax, %rbp
addq %r12, %rbp
leal (,%r13,2), %eax
movslq %eax, %rdi
leaq (%r15,%rdi), %r10
incq %r10
movq 0x8(%rsp), %rax
movq (%rax), %rdx
movl 0x10(%rdx,%r9), %ecx
movq 0xd0(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
leaq (%rcx,%rcx,4), %rcx
movl (%rax,%rcx,8), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movb $0x1, %cl
xorl %r11d, %r11d
movq %rsi, %r8
subq %rbp, %r8
jbe 0x49641
addq %r8, %rdi
addq $0x1f, %rdi
cmpq %r10, %rdi
jge 0x49646
xorl %r15d, %r15d
jmp 0x49686
movslq %r13d, %rcx
subq %rcx, %rbp
subq %rbp, %rsi
cmpq %r10, %rsi
cmovgeq %r10, %rsi
xorl %ecx, %ecx
movq %rbp, %rdi
testq %rbp, %rbp
jg 0x49662
xorl %edi, %edi
movl %r10d, %r15d
subl %esi, %r15d
movl %ebp, %r8d
negl %r8d
sarq $0x3f, %rbp
movl %ebp, %r11d
andl %r8d, %r11d
subq %r11, %rsi
movq %rdi, %rbp
movq %rsi, 0x90(%rsp)
testb %cl, %cl
jne 0x497b2
movzbl 0x1c(%rdx,%r9), %ecx
movl 0x10(%rdx,%r9), %edx
movq %r15, 0x80(%rsp)
movslq %r11d, %r12
movq %rbx, 0x48(%rsp)
movq 0x70(%rsp), %rbx
leaq (%rbx,%r12), %r15
leaq (%rdx,%rdx,4), %rdx
leaq (%rax,%rdx,8), %rdx
subq $0x8, %rsp
xorl %edi, %edi
movq %r15, %rsi
movq %rbp, %r8
movq %r14, 0x68(%rsp)
movq 0x98(%rsp), %r14
movq %r14, %r9
pushq $0x0
movq %r10, 0x88(%rsp)
movq %r11, 0x98(%rsp)
callq 0x36b0d
addq $0x10, %rsp
movq %rbx, %rdi
movl $0x4e, %esi
movq %r12, %rdx
movq 0x80(%rsp), %r12
callq 0x20e0
addq %r14, %r15
movq 0x60(%rsp), %r14
movslq %r12d, %rdx
movq %r15, %rdi
movl $0x4e, %esi
callq 0x20e0
movq 0xe0(%rsp), %rax
movq 0x50(%rsp), %rcx
leaq (%rax,%rcx), %rdx
movzwl %r13w, %r8d
movq %rbx, %rdi
movq 0x48(%rsp), %rbx
movq 0x78(%rsp), %rsi
movq 0x20(%rsp), %rcx
leaq 0x14(%rsp), %r9
callq 0x8578f
movq 0x88(%rsp), %r10
movq 0x58(%rsp), %rdx
cmpl $-0x1, 0x14(%rsp)
je 0x497b2
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq 0x20(%rsp), %rsi
addl %esi, 0x28(%rcx,%rdx)
leaq (%rcx,%rdx), %rdi
addl %ebp, %eax
movl 0x14(%rsp), %r9d
subq $0x8, %rsp
movq 0x58(%rsp), %rsi
movq 0x8(%rsp), %rdx
movl %ebp, %ecx
movl %eax, %r8d
pushq 0x188(%rsp)
pushq 0x180(%rsp)
pushq %r13
pushq %r12
pushq %r10
callq 0x3fb41
addq $0x30, %rsp
incq %r14
addq $-0x8, %rbx
movq 0x68(%rsp), %rcx
cmpq 0x38(%rcx), %r14
movq 0x28(%rsp), %r13
jl 0x49542
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq