// File: chhylp123[P]hifiasm/Correct.cpp
// Function: verify_window(long long, long long, overlap_region_alloc*, Correct_dumy*, All_reads*, char*)
void verify_window(long long window_start, long long window_end, overlap_region_alloc* overlap_list,Correct_dumy* dumy, All_reads* R_INF,
char* r_string)
{
    long long i;
    long long currentID;
    long long x_start, y_start, o_len;
    long long Window_Len = WINDOW + (THRESHOLD << 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 WINDOW
    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 = WINDOW;
        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(THRESHOLD, y_start, overlap_list->list[currentID].y_id, Window_Len, Get_READ_LENGTH((*R_INF), overlap_list->list[currentID].y_id),
        &extra_begin, &extra_end, &y_start, &o_len)) {
            continue;
        }

        fill_subregion(dumy->overlap_region_group[groupLen], y_start, o_len, overlap_list->list[currentID].y_pos_strand, 
        R_INF, 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] = THRESHOLD;
        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, WINDOW,
                return_sites, return_sites_error, THRESHOLD, dumy->Peq_SSE);
            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], WINDOW, NULL);
            }
            

            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], WINDOW, NULL);
            }
            

            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], WINDOW, NULL);
            }
            

            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], WINDOW, NULL);
            }  
        }
    }

    if (groupLen == 1)
    {
        end_site = Reserve_Banded_BPM(dumy->overlap_region_group[0], Window_Len, x_string, WINDOW, THRESHOLD, &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], WINDOW, NULL);
        }
    }
    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, WINDOW,
			        return_sites, return_sites_error, THRESHOLD, dumy->Peq_SSE);

        for (i = 0; i < groupLen; 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], WINDOW, NULL);
            }
        }

        groupLen = 0;
    }

    long long reverse_i = dumy->size - 1;
    int threshold;
    
    ///here are overlaps partially covered by WINDOW
    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 * asm_opt.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, Get_READ_LENGTH((*R_INF), overlap_list->list[currentID].y_id),
        &extra_begin, &extra_end, &y_start, &o_len)) {
            continue;
        }
        
        fill_subregion(dumy->overlap_region, y_start, o_len, overlap_list->list[currentID].y_pos_strand, 
        R_INF, 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, WINDOW, NULL);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq $0x195, -0x68(%rbp)     # imm = 0x195
movq $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movl $0x0, -0x94(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jge 0x32b14
movl $0x0, -0x138(%rbp)
movl $0x0, -0x134(%rbp)
movq $0x177, -0x88(%rbp) # imm = 0x177
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x48(%rbp), %rdx
addq %rdx, %rcx
movl 0x4(%rcx), %ecx
subq %rcx, %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x48(%rbp), %rdx
addq %rdx, %rcx
movl 0x14(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
imulq $0xa8, -0x48(%rbp), %rax
addq %rax, %rsi
addq $0x38, %rsi
callq 0x331a0
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rsi
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, %edx
movq -0x68(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rdi
movq (%rdi), %rdi
imulq $0xa8, -0x48(%rbp), %r8
addq %r8, %rdi
movl 0x10(%rdi), %edi
movq (%rax,%rdi,8), %r8
movl $0xf, %edi
leaq -0x134(%rbp), %r9
leaq -0x138(%rbp), %r11
leaq -0x58(%rbp), %r10
leaq -0x60(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x32290
cmpl $0x0, %eax
jne 0x326c2
jmp 0x32b03
movq -0x28(%rbp), %rdi
addq $0x244, %rdi            # imm = 0x244
movslq -0x94(%rbp), %rax
imulq $0x1f4, %rax, %rax      # imm = 0x1F4
addq %rax, %rdi
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movb %al, %cl
movq -0x30(%rbp), %r8
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %r9
addq %r9, %rax
movl 0x10(%rax), %eax
movl %eax, %r9d
movl -0x134(%rbp), %r10d
movl -0x138(%rbp), %eax
movzbl %cl, %ecx
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x32160
movl -0x134(%rbp), %ecx
movslq -0x94(%rbp), %rax
movl %ecx, -0x110(%rbp,%rax,4)
movl -0x138(%rbp), %ecx
movslq -0x94(%rbp), %rax
movl %ecx, -0x120(%rbp,%rax,4)
movq -0x48(%rbp), %rcx
movslq -0x94(%rbp), %rax
movq %rcx, -0xe0(%rbp,%rax,8)
movq -0x58(%rbp), %rcx
movslq -0x94(%rbp), %rax
movq %rcx, -0x100(%rbp,%rax,8)
movslq -0x94(%rbp), %rax
movl $0xf, -0x130(%rbp,%rax,4)
movq -0x38(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
cmpl $0x4, -0x94(%rbp)
jne 0x32b01
movq -0x28(%rbp), %rdi
addq $0x244, %rdi            # imm = 0x244
movq -0x28(%rbp), %rsi
addq $0x244, %rsi            # imm = 0x244
addq $0x1f4, %rsi            # imm = 0x1F4
movq -0x28(%rbp), %rdx
addq $0x244, %rdx            # imm = 0x244
addq $0x3e8, %rdx            # imm = 0x3E8
movq -0x28(%rbp), %rcx
addq $0x244, %rcx            # imm = 0x244
addq $0x5dc, %rcx            # imm = 0x5DC
movq -0x68(%rbp), %rax
movl %eax, %r8d
movq -0x70(%rbp), %r9
leaq -0xb0(%rbp), %r11
leaq -0xc0(%rbp), %r10
movq -0x28(%rbp), %rax
addq $0x7d80, %rax           # imm = 0x7D80
movl $0x177, (%rsp)          # imm = 0x177
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movl $0xf, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x9c920
movl $0x0, -0x94(%rbp)
cmpl $-0x1, -0xc0(%rbp)
je 0x328fb
movq -0x88(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xe0(%rbp), %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0xe0(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x100(%rbp), %rax
movl %eax, %ecx
movq -0x100(%rbp), %rax
movslq -0xb0(%rbp), %r8
addq %r8, %rax
movl %eax, %r8d
movl -0xc0(%rbp), %r9d
movl -0x110(%rbp), %r11d
movl -0x120(%rbp), %r10d
movl -0x130(%rbp), %eax
xorl %ebx, %ebx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x177, 0x18(%rsp)      # imm = 0x177
movq $0x0, 0x20(%rsp)
callq 0x22d00
cmpl $-0x1, -0xbc(%rbp)
je 0x329a7
movq -0x88(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xd8(%rbp), %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0xd8(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0xf8(%rbp), %rax
movl %eax, %ecx
movq -0xf8(%rbp), %rax
movslq -0xac(%rbp), %r8
addq %r8, %rax
movl %eax, %r8d
movl -0xbc(%rbp), %r9d
movl -0x10c(%rbp), %r11d
movl -0x11c(%rbp), %r10d
movl -0x12c(%rbp), %eax
xorl %ebx, %ebx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x177, 0x18(%rsp)      # imm = 0x177
movq $0x0, 0x20(%rsp)
callq 0x22d00
cmpl $-0x1, -0xb8(%rbp)
je 0x32a53
movq -0x88(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xd0(%rbp), %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0xd0(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0xf0(%rbp), %rax
movl %eax, %ecx
movq -0xf0(%rbp), %rax
movslq -0xa8(%rbp), %r8
addq %r8, %rax
movl %eax, %r8d
movl -0xb8(%rbp), %r9d
movl -0x108(%rbp), %r11d
movl -0x118(%rbp), %r10d
movl -0x128(%rbp), %eax
xorl %ebx, %ebx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x177, 0x18(%rsp)      # imm = 0x177
movq $0x0, 0x20(%rsp)
callq 0x22d00
cmpl $-0x1, -0xb4(%rbp)
je 0x32aff
movq -0x88(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc8(%rbp), %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0xc8(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0xe8(%rbp), %rax
movl %eax, %ecx
movq -0xe8(%rbp), %rax
movslq -0xa4(%rbp), %r8
addq %r8, %rax
movl %eax, %r8d
movl -0xb4(%rbp), %r9d
movl -0x104(%rbp), %r11d
movl -0x114(%rbp), %r10d
movl -0x124(%rbp), %eax
xorl %ebx, %ebx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x177, 0x18(%rsp)      # imm = 0x177
movq $0x0, 0x20(%rsp)
callq 0x22d00
jmp 0x32b01
jmp 0x32b03
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x3259e
cmpl $0x1, -0x94(%rbp)
jne 0x32c04
movq -0x28(%rbp), %rdi
addq $0x244, %rdi            # imm = 0x244
movq -0x68(%rbp), %rax
movl %eax, %esi
movq -0x70(%rbp), %rdx
movl $0x177, %ecx            # imm = 0x177
movl $0xf, %r8d
leaq -0x90(%rbp), %r9
callq 0x9c2b0
movl %eax, -0x8c(%rbp)
cmpl $-0x1, -0x90(%rbp)
je 0x32bff
movq -0x88(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xe0(%rbp), %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0xe0(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x100(%rbp), %rax
movl %eax, %ecx
movq -0x100(%rbp), %rax
movslq -0x8c(%rbp), %r8
addq %r8, %rax
movl %eax, %r8d
movl -0x90(%rbp), %r9d
movl -0x110(%rbp), %r11d
movl -0x120(%rbp), %r10d
movl -0x130(%rbp), %eax
xorl %ebx, %ebx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x177, 0x18(%rsp)      # imm = 0x177
movq $0x0, 0x20(%rsp)
callq 0x22d00
jmp 0x32db1
cmpl $0x1, -0x94(%rbp)
jle 0x32daf
movq -0x28(%rbp), %rdi
addq $0x244, %rdi            # imm = 0x244
movq -0x28(%rbp), %rsi
addq $0x244, %rsi            # imm = 0x244
addq $0x1f4, %rsi            # imm = 0x1F4
movq -0x28(%rbp), %rdx
addq $0x244, %rdx            # imm = 0x244
addq $0x3e8, %rdx            # imm = 0x3E8
movq -0x28(%rbp), %rcx
addq $0x244, %rcx            # imm = 0x244
addq $0x5dc, %rcx            # imm = 0x5DC
movq -0x68(%rbp), %rax
movl %eax, %r8d
movq -0x70(%rbp), %r9
leaq -0xb0(%rbp), %r11
leaq -0xc0(%rbp), %r10
movq -0x28(%rbp), %rax
addq $0x7d80, %rax           # imm = 0x7D80
movl $0x177, (%rsp)          # imm = 0x177
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movl $0xf, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x9c920
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movslq -0x94(%rbp), %rcx
cmpq %rcx, %rax
jge 0x32da5
movq -0x40(%rbp), %rax
cmpl $-0x1, -0xc0(%rbp,%rax,4)
je 0x32d92
movq -0x88(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
imulq $0xa8, -0xe0(%rbp,%rcx,8), %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rax
imulq $0xa8, -0xe0(%rbp,%rax,8), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x40(%rbp), %rax
movq -0x100(%rbp,%rax,8), %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movq -0x100(%rbp,%rax,8), %rax
movq -0x40(%rbp), %r8
movslq -0xb0(%rbp,%r8,4), %r8
addq %r8, %rax
movl %eax, %r8d
movq -0x40(%rbp), %rax
movl -0xc0(%rbp,%rax,4), %r9d
movq -0x40(%rbp), %rax
movl -0x110(%rbp,%rax,4), %r11d
movq -0x40(%rbp), %rax
movl -0x120(%rbp,%rax,4), %r10d
movq -0x40(%rbp), %rax
movl -0x130(%rbp,%rax,4), %eax
xorl %ebx, %ebx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x177, 0x18(%rsp)      # imm = 0x177
movq $0x0, 0x20(%rsp)
callq 0x22d00
jmp 0x32d94
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x32ca0
movl $0x0, -0x94(%rbp)
jmp 0x32db1
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
subq $0x1, %rax
movq %rax, -0x140(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jge 0x3318b
movl $0x0, -0x138(%rbp)
movl $0x0, -0x134(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x140(%rbp), %rcx
movq %rcx, %rdx
addq $-0x1, %rdx
movq %rdx, -0x140(%rbp)
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x48(%rbp), %rdx
addq %rdx, %rcx
movl 0x4(%rcx), %ecx
cmpq %rcx, %rax
jl 0x32e42
movq -0x10(%rbp), %rax
movq %rax, -0x150(%rbp)
jmp 0x32e5e
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x48(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jg 0x32e94
movq -0x18(%rbp), %rax
movq %rax, -0x158(%rbp)
jmp 0x32eb0
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
subq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
cvtsi2sdq -0x88(%rbp), %xmm0
leaq 0x39191a(%rip), %rax    # 0x3c47f8
mulsd 0xc0(%rax), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x144(%rbp)
cmpl $0x0, -0x144(%rbp)
jne 0x32f10
cmpq $0x4, -0x88(%rbp)
jl 0x32f10
movl $0x1, %eax
movl %eax, -0x15c(%rbp)
jmp 0x32f1c
movl -0x144(%rbp), %eax
movl %eax, -0x15c(%rbp)
movl -0x15c(%rbp), %eax
movl %eax, -0x144(%rbp)
cmpl $0x1f, -0x144(%rbp)
jle 0x32f3b
movl $0x1f, -0x144(%rbp)
movq -0x50(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x48(%rbp), %rdx
addq %rdx, %rcx
movl 0x4(%rcx), %ecx
subq %rcx, %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x48(%rbp), %rdx
addq %rdx, %rcx
movl 0x14(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
imulq $0xa8, -0x48(%rbp), %rax
addq %rax, %rsi
addq $0x38, %rsi
callq 0x331a0
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x88(%rbp), %rax
movl -0x144(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movl -0x144(%rbp), %edi
movq -0x58(%rbp), %rsi
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, %edx
movq -0x68(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %r8
movq (%r8), %r8
imulq $0xa8, -0x48(%rbp), %r9
addq %r9, %r8
movl 0x10(%r8), %r8d
movq (%rax,%r8,8), %r8
leaq -0x134(%rbp), %r9
leaq -0x138(%rbp), %r11
leaq -0x58(%rbp), %r10
leaq -0x60(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x32290
cmpl $0x0, %eax
jne 0x3302d
jmp 0x3317a
movq -0x28(%rbp), %rdi
addq $0x50, %rdi
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movb %al, %cl
movq -0x30(%rbp), %r8
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %r9
addq %r9, %rax
movl 0x10(%rax), %eax
movl %eax, %r9d
movl -0x134(%rbp), %r10d
movl -0x138(%rbp), %eax
movzbl %cl, %ecx
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x32160
movq -0x38(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
movq -0x68(%rbp), %rax
movl %eax, %esi
movq -0x70(%rbp), %rdx
movq -0x88(%rbp), %rax
movl %eax, %ecx
movl -0x144(%rbp), %eax
leaq -0x90(%rbp), %r9
movzwl %ax, %r8d
callq 0x9c2b0
movl %eax, -0x8c(%rbp)
cmpl $-0x1, -0x90(%rbp)
je 0x33178
movq -0x88(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0x48(%rbp), %rax
addq %rax, %rdi
movq -0x50(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0x58(%rbp), %rax
movl %eax, %ecx
movq -0x58(%rbp), %rax
movslq -0x8c(%rbp), %r8
addq %r8, %rax
movl %eax, %r8d
movl -0x90(%rbp), %r9d
movl -0x134(%rbp), %r11d
movl -0x138(%rbp), %r10d
movl -0x144(%rbp), %eax
xorl %ebx, %ebx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movl $0x177, 0x18(%rsp)      # imm = 0x177
movq $0x0, 0x20(%rsp)
callq 0x22d00
jmp 0x3317a
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x32dcc
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)