// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: non_trim_error_rate(overlap_region*, All_reads*, ul_idx_t const*, kvec_t_u64_warp const*, Correct_dumy*, UC_Read*, double, long)
inline double non_trim_error_rate(overlap_region *z, All_reads* rref, const ul_idx_t *uref, const kvec_t_u64_warp* v_idx, Correct_dumy* dumy, UC_Read* g_read, double e_rate, int64_t block_s)
{
    int64_t nw, aw = z->w_list.n, k, m, w_id, wn_id, w_s, w_e, idx_e, tErr = 0, tLen = 0, y_s, ex_beg, ex_end, err_thre, p_err_thre;
    int64_t x_len, Window_Len, y_beg_left, y_beg_right;
    unsigned int r_error_left, r_error_right; int32_t r_x_end_left, r_y_end_left, aligned_xLen_left, r_x_end_right, r_y_end_right, aligned_xLen_right;
    nw = get_num_wins(z->x_pos_s, z->x_pos_e+1, block_s);
    assert(nw >= aw && aw > 0);

    for (k = aw-1, idx_e = nw; k >= 0; k--) {
        w_id = get_win_id_by_e(z, z->w_list.a[k].x_end, block_s, &w_s);
        assert(w_s == z->w_list.a[k].x_start && w_id < idx_e && k <= w_id);
        tLen += z->w_list.a[k].x_end + 1 - z->w_list.a[k].x_start;
        tErr += z->w_list.a[k].error;///matched window
        // if(z->y_id == 1) {
        //     fprintf(stderr, "+[M::%s] ws->%d, we->%d, tot_l->%ld, tot_e->%ld\n", 
        //                         __func__, z->w_list.a[k].x_start, z->w_list.a[k].x_end, tLen, tErr);
        // }
        // if(k != w_id) z->w_list.a[w_id] = z->w_list.a[k];
        ///from mapped window w_list.a[k] to the following unmapped windows
        for (m = w_id+1, w_e = z->w_list.a[k].x_end; m < idx_e; m++) {
            w_s = w_e + 1;
            wn_id = get_win_id_by_s(z, w_s, block_s, &w_e);
            assert(wn_id == m); x_len = w_e + 1 - w_s; tLen += x_len;
            ///check if there are some windows that cannot be algined by any overlaps/unitigs
            ///if no, it is likely that the UL read itself has issues
            if(uref && v_idx && z->is_match == 4) {
                if(check_coverage_gap(v_idx->a.a, w_s, w_e, block_s)) {
                    tErr += THRESHOLD_MAX_SIZE;
                    // if(z->y_id == 1) {
                    //     fprintf(stderr, "-[M::%s] ws->%ld, we->%ld, tot_l->%ld, tot_e->%ld\n", __func__, w_s, w_e, tLen, tErr);
                    // }
                    continue;
                } 
            }
            if(!get_init_paras(rref, uref, z, w_s, w_e, e_rate, block_s, &y_s, &ex_beg, &ex_end, &err_thre)) {
                tErr += x_len;
                // if(z->y_id == 1) {
                //     fprintf(stderr, "-[M::%s] ws->%ld, we->%ld, tot_l->%ld, tot_e->%ld\n", __func__, w_s, w_e, tLen, tErr);
                // }
                continue;
            }
            p_err_thre = err_thre;

            if(rref) {
                err_thre = double_error_threshold(err_thre, x_len);
            } else {
                err_thre = double_ul_error_threshold(err_thre, x_len);
            }
            Window_Len = x_len + (err_thre << 1); 
            r_error_left = r_error_right = 0;
            aligned_xLen_left = aligned_xLen_right = 0;
            y_beg_left = y_beg_right = -1;

            if(m == w_id+1) { ///if the previous window is mapped
                y_beg_left = z->w_list.a[k].y_end + 1;///incorrect
            }

            if(m+1 == idx_e && k+1 < aw) { ///if the next window is mapped
                y_beg_right = z->w_list.a[k+1].y_start-x_len;///incorrect
            }

            if(y_beg_left == -1 && y_beg_right == -1) {
                y_beg_left = y_s;
                if(ex_beg >= 0) y_beg_left = y_beg_left + p_err_thre - ex_beg;
                y_beg_right = y_beg_left;
            }

            if(y_beg_left == -1 && y_beg_right != -1) y_beg_left = y_beg_right;
            if(y_beg_right == -1 && y_beg_left != -1) y_beg_right = y_beg_left;

            if(y_beg_left != -1) {///note: this function will change tstr/qstr
                if(rref) {
                    verify_sub_window(rref, dumy, g_read, w_s, x_len, y_beg_left, Window_Len, 
                    z->y_id, z->y_pos_strand, err_thre, 0, &r_error_left, &r_y_end_left, &r_x_end_left, &aligned_xLen_left);
                } else {
                    verify_ul_sub_window(uref, dumy, g_read, w_s, x_len, y_beg_left, Window_Len, 
                    z->y_id, z->y_pos_strand, err_thre, 0, &r_error_left, &r_y_end_left, &r_x_end_left, &aligned_xLen_left);
                }
            }

            if(y_beg_right != -1) {
                if(rref) {
                    verify_sub_window(rref, dumy, g_read, w_s, x_len, y_beg_right, Window_Len, z->y_id, z->y_pos_strand,
                    err_thre, 1, &r_error_right, &r_y_end_right, &r_x_end_right, &aligned_xLen_right);
                } else {
                    verify_ul_sub_window(uref, dumy, g_read, w_s, x_len, y_beg_right, Window_Len, z->y_id, z->y_pos_strand,
                    err_thre, 1, &r_error_right, &r_y_end_right, &r_x_end_right, &aligned_xLen_right);
                }
            }

            ///aligned in both directions
            if(aligned_xLen_left != 0 && aligned_xLen_right != 0) {
                if(aligned_xLen_left + aligned_xLen_right <= x_len) {
                    tErr += r_error_left + r_error_right + (x_len - aligned_xLen_left - aligned_xLen_right);
                } else {
                    float E_rate = (float)(x_len)/(float)(aligned_xLen_left + aligned_xLen_right);
                    tErr += (r_error_left + r_error_right)*E_rate;
                }
            }///not aligned in both directions
            else if(aligned_xLen_left == 0 && aligned_xLen_right == 0) {
                tErr += x_len;
            }///only aligned in left
            else if(aligned_xLen_left != 0) {
                tErr += r_error_left + (x_len - aligned_xLen_left);
            }///only aligned in right
            else if(aligned_xLen_right != 0) {
                tErr += r_error_right + (x_len - aligned_xLen_right);
            }
            // if(z->y_id == 1) {
            //     fprintf(stderr, "*[M::%s] qs->%ld, ts->%ld, tb[0]->%ld, tb[1]->%ld, di[0]->%u, di[1]->%u, al[0]->%d, al[1]->%d, err_thre->%ld\n", __func__, 
            //     w_s, y_s, y_beg_left, y_beg_right, r_error_left, r_error_right, aligned_xLen_left, aligned_xLen_right, err_thre);
            // }
            // if(z->y_id == 1) {
            //     fprintf(stderr, "-[M::%s] ws->%ld, we->%ld, tot_l->%ld, tot_e->%ld\n", __func__, w_s, w_e, tLen, tErr);
            // }
        }
        idx_e = w_id;
    }

    if(idx_e > 0) {
        for (m = 0, w_e = (int64_t)z->x_pos_s-1; m < idx_e; m++) {
            w_s = w_e + 1;
            wn_id = get_win_id_by_s(z, w_s, block_s, &w_e);
            assert(wn_id == m); x_len = w_e + 1 - w_s; tLen += x_len;
            ///check if there are some windows that cannot be algined by any overlaps/unitigs
            ///if no, it is likely that the UL read itself has issues
            if(uref && v_idx && z->is_match == 4) {
                if(check_coverage_gap(v_idx->a.a, w_s, w_e, block_s)) {
                    tErr += THRESHOLD_MAX_SIZE;
                    // if(z->y_id == 1) {
                    //     fprintf(stderr, "-[M::%s] ws->%ld, we->%ld, tot_l->%ld, tot_e->%ld\n", __func__, w_s, w_e, tLen, tErr);
                    // }
                    continue;
                } 
                // else {
                //     if(z->y_id == 575) {
                //         fprintf(stderr, "---[M::%s::] z::y_id->%u, w_s->%ld, w_e->%ld\n", __func__, z->y_id, w_s, w_e);
                //     } 
                // }
            }
            if(!get_init_paras(rref, uref, z, w_s, w_e, e_rate, block_s, &y_s, &ex_beg, &ex_end, &err_thre)) {
                tErr += x_len;
                // if(z->y_id == 1) {
                //     fprintf(stderr, "-[M::%s] ws->%ld, we->%ld, tot_l->%ld, tot_e->%ld\n", __func__, w_s, w_e, tLen, tErr);
                // }
                continue;
            }
            p_err_thre = err_thre;
            if(rref) {
                err_thre = double_error_threshold(err_thre, x_len);
            } else {
                err_thre = double_ul_error_threshold(err_thre, x_len);
            }
            Window_Len = x_len + (err_thre << 1); 
            r_error_left = r_error_right = 0;
            aligned_xLen_left = aligned_xLen_right = 0;
            y_beg_left = y_beg_right = -1;

            ///impossible that the previous window is mapped
            // if(m == w_id+1) { ///if the previous window is mapped
            //     y_beg_left = z->w_list.a[k].y_end + 1;
            // }

            if(m+1 == idx_e && k+1 < aw) { ///if the next window is mapped
                y_beg_right = z->w_list.a[k+1].y_start-x_len;
            }

            if(y_beg_left == -1 && y_beg_right == -1) {
                y_beg_left = y_s;
                if(ex_beg >= 0) y_beg_left = y_beg_left + p_err_thre - ex_beg;
                y_beg_right = y_beg_left;
            }

            if(y_beg_left == -1 && y_beg_right != -1) y_beg_left = y_beg_right;
            if(y_beg_right == -1 && y_beg_left != -1) y_beg_right = y_beg_left;

            if(y_beg_left != -1) {
                if(rref) {
                    verify_sub_window(rref, dumy, g_read, w_s, x_len, y_beg_left, Window_Len, 
                    z->y_id, z->y_pos_strand, err_thre, 0, &r_error_left, &r_y_end_left, &r_x_end_left, &aligned_xLen_left);
                } else {
                    verify_ul_sub_window(uref, dumy, g_read, w_s, x_len, y_beg_left, Window_Len, 
                    z->y_id, z->y_pos_strand, err_thre, 0, &r_error_left, &r_y_end_left, &r_x_end_left, &aligned_xLen_left);
                }
            }

            if(y_beg_right != -1) {
                if(rref) {
                    verify_sub_window(rref, dumy, g_read, w_s, x_len, y_beg_right, Window_Len, z->y_id, z->y_pos_strand,
                    err_thre, 1, &r_error_right, &r_y_end_right, &r_x_end_right, &aligned_xLen_right);
                } else {
                    verify_ul_sub_window(uref, dumy, g_read, w_s, x_len, y_beg_right, Window_Len, z->y_id, z->y_pos_strand,
                    err_thre, 1, &r_error_right, &r_y_end_right, &r_x_end_right, &aligned_xLen_right);
                }
            }

            ///aligned in both directions
            if(aligned_xLen_left != 0 && aligned_xLen_right != 0) {
                if(aligned_xLen_left + aligned_xLen_right <= x_len) {
                    tErr += r_error_left + r_error_right + (x_len - aligned_xLen_left - aligned_xLen_right);
                } else {
                    float E_rate = (float)(x_len)/(float)(aligned_xLen_left + aligned_xLen_right);
                    tErr += (r_error_left + r_error_right)*E_rate;
                }
            }///not aligned in both directions
            else if(aligned_xLen_left == 0 && aligned_xLen_right == 0) {
                tErr += x_len;
            }///only aligned in left
            else if(aligned_xLen_left != 0) {
                tErr += r_error_left + (x_len - aligned_xLen_left);
            }///only aligned in right
            else if(aligned_xLen_right != 0) {
                tErr += r_error_right + (x_len - aligned_xLen_right);
            }
            // if(z->y_id == 1) {
            //     fprintf(stderr, "-[M::%s] ws->%ld, we->%ld, tot_l->%ld, tot_e->%ld\n", __func__, w_s, w_e, tLen, tErr);
            // }
        }
    }
    
    assert(tLen == z->x_pos_e + 1 - z->x_pos_s);
    return (double)(tErr)/(double)(tLen);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movsd %xmm0, 0xa8(%rsp)
movq %r9, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq %rcx, 0x78(%rsp)
movq %rdx, 0x48(%rsp)
movq %rdi, %rbp
movq 0x110(%rsp), %r8
movq 0x48(%rdi), %r9
movl 0x4(%rdi), %ecx
movl 0x8(%rdi), %edi
incl %edi
movq %rcx, %rax
xorl %edx, %edx
idivq %r8
subq %rcx, %rdx
addq %rdx, %rdi
movq %rdi, %rax
cqto
idivq %r8
movq %rax, %r10
xorl %eax, %eax
testq %rdx, %rdx
setg %cl
testq %r9, %r9
jle 0x646dd
movb %cl, %al
addq %rax, %r10
cmpq %r9, %r10
jl 0x646dd
cmpq $0x0, 0x48(%rsp)
setne %al
cmpq $0x0, 0x78(%rsp)
setne %cl
andb %al, %cl
movb %cl, 0xf(%rsp)
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %r9, 0xc0(%rsp)
movq %rbp, 0x18(%rsp)
movq %rsi, 0x40(%rsp)
testq %r9, %r9
movq %r10, 0x38(%rsp)
jle 0x64253
movq %r9, 0xc8(%rsp)
leaq -0x1(%r9), %r11
movq 0x58(%rbp), %rdi
movq %r11, %rax
shlq $0x5, %rax
movq %rax, 0x80(%rsp)
movslq 0x4(%rdi,%rax), %rsi
movl 0x4(%rbp), %ecx
movq %rcx, %rax
xorl %edx, %edx
movq 0x110(%rsp), %r9
idivq %r9
movq %rcx, %r8
subq %rdx, %r8
movq %rsi, %rax
subq %r8, %rax
cqto
idivq %r9
movq %rax, %rbx
movq %rax, %rdx
imulq %r9, %rdx
addq %r8, %rdx
cmpq %rcx, %rdx
cmovleq %rcx, %rdx
subq %r10, %rax
movq %rax, 0xa0(%rsp)
jge 0x6469f
movq 0x80(%rsp), %rax
movl (%rdi,%rax), %eax
movslq %eax, %rcx
cmpq %rcx, %rdx
jne 0x6469f
cmpq %rbx, %r11
jg 0x6469f
movq %r11, 0xb8(%rsp)
addq 0x80(%rsp), %rdi
movl %esi, %ecx
subl %eax, %ecx
incl %ecx
movslq %ecx, %rax
addq %rax, %r15
movswq 0x14(%rdi), %rax
addq %rax, %r14
movq %rbx, 0xb0(%rsp)
movq %rbx, %rax
incq %rax
movq %rsi, 0x50(%rsp)
addq $0x2, 0xa0(%rsp)
xorl %ebx, %ebx
cmpq %r10, %rax
jge 0x6423e
movq 0x50(%rsp), %r12
leaq 0x1(%r12), %r13
movq %rbp, %rdi
movq %r13, %rsi
movq 0x110(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq %rax, 0x70(%rsp)
callq 0x51f8b
cmpq %rax, 0x70(%rsp)
jne 0x64680
movq %r15, 0x88(%rsp)
movq %r14, 0x20(%rsp)
movq 0x50(%rsp), %r14
movq %r14, %r15
subq %r12, %r15
cmpb $0x0, 0xf(%rsp)
je 0x63e91
cmpb $0x4, 0x2c(%rbp)
jne 0x63e91
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r13, %rsi
movq %r14, %rdx
movq 0x110(%rsp), %rcx
callq 0x1cef3
testq %rax, %rax
je 0x63e91
movq 0x20(%rsp), %r14
addq $0x1f, %r14
jmp 0x63f04
movq 0x40(%rsp), %r12
movq %r12, %rdi
movq 0x48(%rsp), %rsi
movq %rbp, %rdx
movq %r13, %rcx
movq %r14, %r8
movsd 0xa8(%rsp), %xmm0
movq 0x110(%rsp), %r9
leaq 0x68(%rsp), %rax
pushq %rax
leaq 0xd8(%rsp), %rax
pushq %rax
leaq 0xa0(%rsp), %rax
pushq %rax
leaq 0xb0(%rsp), %rax
pushq %rax
callq 0x1cdb7
addq $0x20, %rsp
testl %eax, %eax
je 0x63efc
movq 0x68(%rsp), %rbp
movl %ebp, %edi
movl %r15d, %esi
testq %r12, %r12
je 0x63f0e
callq 0x51fcd
jmp 0x63f13
movq 0x20(%rsp), %r14
addq %r15, %r14
movq 0x38(%rsp), %r10
jmp 0x64220
callq 0x526f4
movl %eax, %r12d
andl $0x0, 0x4(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, 0x10(%rsp)
andl $0x0, 0x14(%rsp)
cltq
movq %rax, 0x68(%rsp)
pushq $-0x1
popq %rsi
movq %rsi, %r14
movq %rbx, %r8
testq %rbx, %rbx
movq 0xc8(%rsp), %rdi
jne 0x63f60
movq 0x18(%rsp), %rcx
movq 0x58(%rcx), %rcx
movq 0x80(%rsp), %rdx
movslq 0xc(%rcx,%rdx), %r14
incq %r14
cmpq 0xc0(%rsp), %rdi
setl %cl
cmpq %r8, 0xa0(%rsp)
sete %dl
andb %cl, %dl
movq %rsi, %rcx
cmpb $0x1, %dl
jne 0x63f98
movq 0x18(%rsp), %rcx
movq 0x58(%rcx), %rcx
movq %rdi, %rdx
shlq $0x5, %rdx
movslq 0x8(%rcx,%rdx), %rcx
subq %r15, %rcx
cmpq $-0x1, %r14
jne 0x63fc7
cmpq $-0x1, %rcx
jne 0x63fc7
movq 0x98(%rsp), %rcx
movq 0x90(%rsp), %rdx
addq %rcx, %rbp
subq %rdx, %rbp
testq %rdx, %rdx
cmovsq %rcx, %rbp
movq %rbp, %r14
movq %rbp, %rcx
cmpq $-0x1, %rcx
movq %r14, %r9
cmovneq %rcx, %r9
cmpq $-0x1, %r14
cmovneq %r14, %r9
leaq (%r15,%rax,2), %rbp
cmpq $-0x1, %r9
cmoveq %rcx, %r14
cmpq $-0x1, %rcx
cmovneq %rcx, %r14
cmpq $-0x1, %r9
je 0x6405a
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %eax
movl 0x1c(%rcx), %r10d
movq 0x40(%rsp), %rdi
subq $0x8, %rsp
testq %rdi, %rdi
je 0x640c6
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
leaq 0x1c(%rsp), %r11
pushq %r11
leaq 0x74(%rsp), %r11
pushq %r11
leaq 0x78(%rsp), %r11
pushq %r11
leaq 0x28(%rsp), %r11
pushq %r11
pushq $0x0
pushq %r12
pushq %r10
pushq %rax
pushq %rbp
callq 0x6471b
addq $0x50, %rsp
cmpq $-0x1, %r14
jne 0x64070
jmp 0x64163
cmpq $-0x1, %rcx
je 0x64163
cmpq $0x0, 0x40(%rsp)
je 0x6410e
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %eax
movl 0x1c(%rcx), %r10d
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
movq %r14, %r9
leaq 0x18(%rsp), %r11
pushq %r11
leaq 0x6c(%rsp), %r11
pushq %r11
leaq 0x70(%rsp), %r11
pushq %r11
leaq 0x24(%rsp), %r11
pushq %r11
pushq $0x1
pushq %r12
pushq %r10
pushq %rax
pushq %rbp
callq 0x6471b
jmp 0x6415f
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
leaq 0x1c(%rsp), %r11
pushq %r11
leaq 0x74(%rsp), %r11
pushq %r11
leaq 0x78(%rsp), %r11
pushq %r11
leaq 0x28(%rsp), %r11
pushq %r11
pushq $0x0
pushq %r12
pushq %r10
pushq %rax
pushq %rbp
callq 0x6488c
addq $0x50, %rsp
cmpq $-0x1, %r14
je 0x64163
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %eax
movl 0x1c(%rcx), %r10d
subq $0x8, %rsp
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
movq %r14, %r9
leaq 0x18(%rsp), %r11
pushq %r11
leaq 0x6c(%rsp), %r11
pushq %r11
leaq 0x70(%rsp), %r11
pushq %r11
leaq 0x24(%rsp), %r11
pushq %r11
pushq $0x1
pushq %r12
pushq %r10
pushq %rax
pushq %rbp
callq 0x6488c
addq $0x50, %rsp
movslq 0x14(%rsp), %rax
testq %rax, %rax
setne %sil
movl 0x10(%rsp), %edx
movslq %edx, %rcx
testl %edx, %edx
setne %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x641cc
addl %eax, %edx
movslq %edx, %rsi
cmpq %rsi, %r15
movq 0x18(%rsp), %rbp
movq 0x38(%rsp), %r10
movq 0x20(%rsp), %r14
jge 0x641e6
cvtsi2ss %r15, %xmm0
cvtsi2ss %edx, %xmm1
movl 0x4(%rsp), %eax
addl 0x8(%rsp), %eax
cvtsi2ss %rax, %xmm2
divss %xmm1, %xmm0
cvtsi2ss %r14, %xmm1
mulss %xmm0, %xmm2
addss %xmm2, %xmm1
cvttss2si %xmm1, %r14
jmp 0x64220
movl %eax, %edx
orl %ecx, %edx
movq 0x18(%rsp), %rbp
movq 0x38(%rsp), %r10
movq 0x20(%rsp), %r14
jne 0x641fc
addq %r15, %r14
jmp 0x64220
movl 0x4(%rsp), %edx
addl 0x8(%rsp), %edx
addq %r15, %r14
addq %rcx, %rax
subq %rax, %r14
addq %rdx, %r14
jmp 0x64220
testl %eax, %eax
je 0x6420f
movl 0x8(%rsp), %ecx
addq %r15, %r14
subq %rax, %r14
addq %rcx, %r14
jmp 0x64220
testl %ecx, %ecx
je 0x64220
movl 0x4(%rsp), %eax
addq %r15, %r14
subq %rcx, %r14
addq %rax, %r14
movq 0x88(%rsp), %rax
addq %r15, %rax
movq %rax, %r15
movq 0x70(%rsp), %rax
incq %rax
decq %rbx
jmp 0x63e05
movq 0xb0(%rsp), %r10
movq 0xb8(%rsp), %r9
jmp 0x63d28
movl 0x4(%rbp), %eax
testq %r10, %r10
jle 0x64650
decq %rax
leaq 0x50(%rsp), %rcx
movq %rax, (%rcx)
leaq -0x1(%r10), %rax
movq %rax, 0x70(%rsp)
xorl %ebx, %ebx
cmpq %rbx, %r10
je 0x6464d
movq %r15, 0x88(%rsp)
movq %r14, 0x20(%rsp)
movq 0x50(%rsp), %r12
leaq 0x1(%r12), %r13
movq %rbp, %rdi
movq %r13, %rsi
movq 0x110(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0x51f8b
cmpq %rax, %rbx
jne 0x646be
movq 0x50(%rsp), %r14
movq %r14, %r15
subq %r12, %r15
cmpb $0x0, 0xf(%rsp)
je 0x642fa
cmpb $0x4, 0x2c(%rbp)
jne 0x642fa
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r13, %rsi
movq %r14, %rdx
movq 0x110(%rsp), %rcx
callq 0x1cef3
testq %rax, %rax
je 0x642fa
movq 0x20(%rsp), %r14
addq $0x1f, %r14
jmp 0x6436d
movq 0x40(%rsp), %r12
movq %r12, %rdi
movq 0x48(%rsp), %rsi
movq %rbp, %rdx
movq %r13, %rcx
movq %r14, %r8
movsd 0xa8(%rsp), %xmm0
movq 0x110(%rsp), %r9
leaq 0x68(%rsp), %rax
pushq %rax
leaq 0xd8(%rsp), %rax
pushq %rax
leaq 0xa0(%rsp), %rax
pushq %rax
leaq 0xb0(%rsp), %rax
pushq %rax
callq 0x1cdb7
addq $0x20, %rsp
testl %eax, %eax
je 0x64365
movq 0x68(%rsp), %rbp
movl %ebp, %edi
movl %r15d, %esi
testq %r12, %r12
je 0x64377
callq 0x51fcd
jmp 0x6437c
movq 0x20(%rsp), %r14
addq %r15, %r14
movq 0x38(%rsp), %r10
jmp 0x64637
callq 0x526f4
movl %eax, %r12d
andl $0x0, 0x4(%rsp)
cltq
andl $0x0, 0x8(%rsp)
movq %rax, 0x68(%rsp)
andl $0x0, 0x10(%rsp)
andl $0x0, 0x14(%rsp)
cmpq %rbx, 0x70(%rsp)
jne 0x643bb
movq 0x18(%rsp), %rcx
movq 0x58(%rcx), %rcx
movslq 0x8(%rcx), %rcx
subq %r15, %rcx
pushq $-0x1
popq %r14
cmpq $-0x1, %rcx
jne 0x643de
movq 0x98(%rsp), %rcx
movq 0x90(%rsp), %rdx
addq %rcx, %rbp
subq %rdx, %rbp
testq %rdx, %rdx
cmovsq %rcx, %rbp
movq %rbp, %r14
movq %rbp, %rcx
cmpq $-0x1, %rcx
movq %r14, %r9
cmovneq %rcx, %r9
cmpq $-0x1, %r14
cmovneq %r14, %r9
leaq (%r15,%rax,2), %rbp
cmpq $-0x1, %r9
cmoveq %rcx, %r14
cmpq $-0x1, %rcx
cmovneq %rcx, %r14
cmpq $-0x1, %r9
je 0x64471
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %eax
movl 0x1c(%rcx), %r10d
movq 0x40(%rsp), %rdi
subq $0x8, %rsp
testq %rdi, %rdi
je 0x644dd
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
leaq 0x1c(%rsp), %r11
pushq %r11
leaq 0x74(%rsp), %r11
pushq %r11
leaq 0x78(%rsp), %r11
pushq %r11
leaq 0x28(%rsp), %r11
pushq %r11
pushq $0x0
pushq %r12
pushq %r10
pushq %rax
pushq %rbp
callq 0x6471b
addq $0x50, %rsp
cmpq $-0x1, %r14
jne 0x64487
jmp 0x6457a
cmpq $-0x1, %rcx
je 0x6457a
cmpq $0x0, 0x40(%rsp)
je 0x64525
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %eax
movl 0x1c(%rcx), %r10d
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
movq %r14, %r9
leaq 0x18(%rsp), %r11
pushq %r11
leaq 0x6c(%rsp), %r11
pushq %r11
leaq 0x70(%rsp), %r11
pushq %r11
leaq 0x24(%rsp), %r11
pushq %r11
pushq $0x1
pushq %r12
pushq %r10
pushq %rax
pushq %rbp
callq 0x6471b
jmp 0x64576
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
leaq 0x1c(%rsp), %r11
pushq %r11
leaq 0x74(%rsp), %r11
pushq %r11
leaq 0x78(%rsp), %r11
pushq %r11
leaq 0x28(%rsp), %r11
pushq %r11
pushq $0x0
pushq %r12
pushq %r10
pushq %rax
pushq %rbp
callq 0x6488c
addq $0x50, %rsp
cmpq $-0x1, %r14
je 0x6457a
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %eax
movl 0x1c(%rcx), %r10d
subq $0x8, %rsp
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
movq %r14, %r9
leaq 0x18(%rsp), %r11
pushq %r11
leaq 0x6c(%rsp), %r11
pushq %r11
leaq 0x70(%rsp), %r11
pushq %r11
leaq 0x24(%rsp), %r11
pushq %r11
pushq $0x1
pushq %r12
pushq %r10
pushq %rax
pushq %rbp
callq 0x6488c
addq $0x50, %rsp
movslq 0x14(%rsp), %rax
testq %rax, %rax
setne %sil
movl 0x10(%rsp), %edx
movslq %edx, %rcx
testl %edx, %edx
setne %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x645e3
addl %eax, %edx
movslq %edx, %rsi
cmpq %rsi, %r15
movq 0x18(%rsp), %rbp
movq 0x38(%rsp), %r10
movq 0x20(%rsp), %r14
jge 0x645fd
cvtsi2ss %r15, %xmm0
cvtsi2ss %edx, %xmm1
movl 0x4(%rsp), %eax
addl 0x8(%rsp), %eax
cvtsi2ss %rax, %xmm2
divss %xmm1, %xmm0
cvtsi2ss %r14, %xmm1
mulss %xmm0, %xmm2
addss %xmm2, %xmm1
cvttss2si %xmm1, %r14
jmp 0x64637
movl %eax, %edx
orl %ecx, %edx
movq 0x18(%rsp), %rbp
movq 0x38(%rsp), %r10
movq 0x20(%rsp), %r14
jne 0x64613
addq %r15, %r14
jmp 0x64637
movl 0x4(%rsp), %edx
addl 0x8(%rsp), %edx
addq %r15, %r14
addq %rcx, %rax
subq %rax, %r14
addq %rdx, %r14
jmp 0x64637
testl %eax, %eax
je 0x64626
movl 0x8(%rsp), %ecx
addq %r15, %r14
subq %rax, %r14
addq %rcx, %r14
jmp 0x64637
testl %ecx, %ecx
je 0x64637
movl 0x4(%rsp), %eax
addq %r15, %r14
subq %rcx, %r14
addq %rax, %r14
movq 0x88(%rsp), %rax
addq %r15, %rax
movq %rax, %r15
incq %rbx
jmp 0x64275
movl 0x4(%rbp), %eax
movl 0x8(%rbp), %ecx
subl %eax, %ecx
incl %ecx
cmpq %rcx, %r15
jne 0x646fc
cvtsi2sd %r14, %xmm0
cvtsi2sd %r15, %xmm1
divsd %xmm1, %xmm0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17f11a(%rip), %rdi    # 0x1e37a1
leaq 0x17f015(%rip), %rsi    # 0x1e36a3
leaq 0x1832c0(%rip), %rcx    # 0x1e7955
movl $0x44c, %edx            # imm = 0x44C
callq 0x2110
leaq 0x17f0c0(%rip), %rdi    # 0x1e3766
leaq 0x17eff6(%rip), %rsi    # 0x1e36a3
leaq 0x1832a1(%rip), %rcx    # 0x1e7955
movl $0x440, %edx            # imm = 0x440
callq 0x2110
leaq 0x17f0dc(%rip), %rdi    # 0x1e37a1
leaq 0x17efd7(%rip), %rsi    # 0x1e36a3
leaq 0x183282(%rip), %rcx    # 0x1e7955
movl $0x4b1, %edx            # imm = 0x4B1
callq 0x2110
leaq 0x17f039(%rip), %rdi    # 0x1e371d
leaq 0x17efb8(%rip), %rsi    # 0x1e36a3
leaq 0x183263(%rip), %rcx    # 0x1e7955
movl $0x43c, %edx            # imm = 0x43C
callq 0x2110
leaq 0x1832e3(%rip), %rdi    # 0x1e79e6
leaq 0x17ef99(%rip), %rsi    # 0x1e36a3
leaq 0x183244(%rip), %rcx    # 0x1e7955
movl $0x512, %edx            # imm = 0x512
callq 0x2110