// File: chhylp123[P]hifiasm/Correct.cpp
// Function: gen_commen_sketch(All_reads*, ul_idx_t const*, overlap_region_alloc*, unsigned long*, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long*, unsigned long, char*, char*, kv_ul_ov_t*, asg64_v*, long, double, long)
uint64_t gen_commen_sketch(All_reads *rref, const ul_idx_t *uref, overlap_region_alloc* ol, uint64_t *id_a, uint64_t id_n, uint64_t s, uint64_t e, uint64_t ql, uint64_t wl,
uint64_t *buf, uint64_t dp, char *str0, char *str1, kv_ul_ov_t *aln, asg64_v *trace,
int64_t max_lgap, double sgap_rate, int64_t sgap)///[s, e)
{
    if(!id_n) return id_n;
    uint64_t i, m, k, rm_n = 0, buf_n = 0, qs, qe, wid, co, occ; char *qstring, *tstring;
    overlap_region *z; uint64_t ws, we; int64_t r_y[2], r_err, p_y[2], p_err, rxl, ryl, pxl;
    ///shrink [qs, qe)
    qs = (s/wl)*wl; if(qs < s) qs += wl; if(qs >= ql) return id_n;
    qe = (e/wl)*wl; if(qe >= ql) qe = ql;
    if(qs >= qe) return id_n;
    //idx_a[] is sorted by aln[].qs
    for (k = 0; k < id_n; k++) {
        if(aln->a[id_a[k]].qs<=qs && aln->a[id_a[k]].qe>=qe) {
            buf[buf_n] = ol->list[aln->a[id_a[k]].qn].align_length; buf[buf_n] <<= 32; buf[buf_n] |= id_a[k];
            buf_n++;
        }
        if(aln->a[id_a[k]].qe < e) rm_n++;
    }
    assert(buf_n == dp && buf_n > 1);

    if(buf_n > 0) {
        ///fs = fe = (uint64_t)-1;
        co = 1; trace->n = occ = 0;
        for (k = qs; k < qe; k += wl) {
            ws = k; we = ws + wl; if(we > qe) we = qe;//[ws, we)
            ///first overlap
            z = &(ol->list[aln->a[(uint32_t)buf[0]].qn]);
            wid = get_win_id_by_s(z, ws, wl, NULL);
            if(!get_win_aln(z, wid, &(r_y[0]), &(r_y[1]), &r_err)) continue;
            if(!ovlp_win_check(z, z->align_length, wid, max_lgap, sgap_rate, sgap)) continue;///not co-linear
            rxl = z->w_list.a[wid].x_end+1-z->w_list.a[wid].x_start;
            ryl = r_y[1]-r_y[0];
            // fprintf(stderr, "+[M::%s::] buf_n::%lu, q::[%lu, %lu), w::[%lu, %lu), rxl::%ld, ryl::%ld, x::[%d, %d), y::[%ld, %ld)\n", 
            //         __func__, buf_n, qs, qe, ws, we, rxl, ryl, z->w_list.a[wid].x_start, z->w_list.a[wid].x_end+1, r_y[0], r_y[1]);
            if(rxl > 1 && ryl > 1) continue;///length of window should be longer than 1
            // if(rxl <= 1 || ryl <= 1) continue;///length of window should be longer than 1
            // fprintf(stderr, "-[M::%s::] buf_n::%lu, q::[%lu, %lu), w::[%lu, %lu), rxl::%ld, ryl::%ld, x::[%d, %d), y::[%ld, %ld)\n", 
            //         __func__, buf_n, qs, qe, ws, we, rxl, ryl, z->w_list.a[wid].x_start, z->w_list.a[wid].x_end+1, r_y[0], r_y[1]);
            qstring = tstring = NULL;
            for (i = 1; i < buf_n; i++) {
                z = &(ol->list[aln->a[(uint32_t)buf[i]].qn]);
                wid = get_win_id_by_s(z, ws, wl, NULL);
                if(!get_win_aln(z, wid, &(p_y[0]), &(p_y[1]), &p_err)) break;
                if(!ovlp_win_check(z, z->align_length, wid, max_lgap, sgap_rate, sgap)) break;///not co-linear
                pxl = z->w_list.a[wid].x_end+1-z->w_list.a[wid].x_start;
                if(pxl != rxl) break;
                if(((r_y[1]-r_y[0]) != (p_y[1]-p_y[0])) || (r_err != p_err)) break;
                if(r_err == 0) continue;
                if(!qstring) {
                    qstring = retrive_str_piece_exz(rref, uref, str0, r_y[0], r_y[1]-r_y[0], 
                                                ol->list[aln->a[(uint32_t)buf[0]].qn].y_pos_strand, ol->list[aln->a[(uint32_t)buf[0]].qn].y_id);
                }
                tstring = retrive_str_piece_exz(rref, uref, str1, p_y[0], p_y[1]-p_y[0], z->y_pos_strand, z->y_id);
                if(memcmp(qstring, tstring, (p_y[1]-p_y[0]))) {
                    // fprintf(stderr, "[M::%s::] qs::%ld, qe::%lu, ts::%ld, te::%lu, err::%ld, rts::%ld, rte::%lu, err::%ld\n", 
                    // __func__, ws, we, p_y[0], p_y[1], r_err, r_y[0], r_y[1], p_err);
                    // fprintf(stderr, "str0::%.*s\n", (int32_t)(r_y[1]-r_y[0]), str0);
                    // fprintf(stderr, "str1::%.*s\n", (int32_t)(p_y[1]-p_y[0]), str1);
                    break;
                }
            }
            if(i < buf_n) continue;
            if(co) {
                for (i = 0; i < buf_n; i++) {
                    z = &(ol->list[aln->a[(uint32_t)buf[i]].qn]);
                    wid = get_win_id_by_s(z, ws, wl, NULL);
                    co = ovlp_win_check(z, buf[i]>>32, wid, max_lgap, sgap_rate, sgap);
                    m = wid; m <<= 32; m |= (uint32_t)buf[i]; buf[i] = m;
                }
                if(co) occ++;
            }
            kv_push(uint64_t, *trace, ws);
        }

        if(trace->n) {
            if(!co) kv_resize(uint64_t, *trace, trace->n<<1);
            trace->n = dp_commen_sketch(aln, ol, buf, buf_n, trace->a, trace->n, trace->a + trace->n, occ, wl, dp, max_lgap, sgap_rate, sgap);
        }
    }
    if(rm_n) {
        for (i = m = 0; i < id_n; i++) {
            if(aln->a[id_a[i]].qe < e) continue;
            id_a[m++] = id_a[i];
        }
        id_n = m;
    }
    return id_n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
movq %r8, -0x48(%rbp)
movq %r9, -0x50(%rbp)
movsd %xmm0, -0x58(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x88a6d
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x894ce
movq $0x0, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x50(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x20(%rbp)
imulq 0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x88ab4
movq 0x20(%rbp), %rax
addq -0x88(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq 0x18(%rbp), %rax
jb 0x88ace
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x894ce
movq 0x10(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x20(%rbp)
imulq 0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq 0x18(%rbp), %rax
jb 0x88afe
movq 0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
jb 0x88b1b
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x894ce
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x88c31
movq 0x48(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movq -0x70(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpq -0x88(%rbp), %rax
ja 0x88bf2
movq 0x48(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movq -0x70(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0x90(%rbp), %rax
jb 0x88bf2
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rbp), %rcx
movq (%rcx), %rcx
movq -0x40(%rbp), %rdx
movq -0x70(%rbp), %rsi
imulq $0x1c, (%rdx,%rsi,8), %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %eax
movl %eax, %edx
movq 0x28(%rbp), %rax
movq -0x80(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x28(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x28(%rbp), %rax
movq -0x80(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
movq 0x48(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movq -0x70(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq 0x10(%rbp), %rax
jae 0x88c1e
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x88c20
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x88b23
movq -0x80(%rbp), %rcx
xorl %eax, %eax
cmpq 0x30(%rbp), %rcx
movb %al, -0x121(%rbp)
jne 0x88c51
cmpq $0x1, -0x80(%rbp)
seta %al
movb %al, -0x121(%rbp)
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x88c5d
jmp 0x88c5f
jmp 0x88c7e
leaq 0x2fcc05(%rip), %rdi    # 0x38586b
leaq 0x2f96ae(%rip), %rsi    # 0x38231b
movl $0x571d, %edx           # imm = 0x571D
leaq 0x2fcc0b(%rip), %rcx    # 0x385884
callq 0x2130
cmpq $0x0, -0x80(%rbp)
jbe 0x8944a
movq $0x1, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
movq 0x50(%rbp), %rax
movq $0x0, (%rax)
movq -0x88(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x90(%rbp), %rax
jae 0x892c1
movq -0x70(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
addq 0x20(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
cmpq -0x90(%rbp), %rax
jbe 0x88d01
movq -0x90(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rbp), %rcx
movq (%rcx), %rcx
movq 0x28(%rbp), %rdx
movq (%rdx), %rdx
movl %edx, %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq 0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x9e2e0
movq %rax, -0x98(%rbp)
movq -0xc0(%rbp), %rdi
movq -0x98(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
leaq -0xe0(%rbp), %rcx
addq $0x8, %rcx
leaq -0xe8(%rbp), %r8
callq 0xc1de0
cmpq $0x0, %rax
jne 0x88d8b
jmp 0x892b0
movq -0xc0(%rbp), %rdi
movq -0xc0(%rbp), %rax
movl 0x28(%rax), %esi
movq -0x98(%rbp), %rax
movl %eax, %edx
movq 0x58(%rbp), %rcx
movsd -0x58(%rbp), %xmm0
movq 0x60(%rbp), %r8
callq 0xc1b90
cmpl $0x0, %eax
jne 0x88dc1
jmp 0x892b0
movq -0xc0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x98(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0xc0(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x98(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
cltq
movq %rax, -0x110(%rbp)
movq -0xd8(%rbp), %rax
subq -0xe0(%rbp), %rax
movq %rax, -0x118(%rbp)
cmpq $0x1, -0x110(%rbp)
jle 0x88e32
cmpq $0x1, -0x118(%rbp)
jle 0x88e32
jmp 0x892b0
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x1, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x80(%rbp), %rax
jae 0x890e3
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rbp), %rcx
movq (%rcx), %rcx
movq 0x28(%rbp), %rdx
movq -0x60(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movl %edx, %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq 0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x9e2e0
movq %rax, -0x98(%rbp)
movq -0xc0(%rbp), %rdi
movq -0x98(%rbp), %rsi
leaq -0x100(%rbp), %rdx
leaq -0x100(%rbp), %rcx
addq $0x8, %rcx
leaq -0x108(%rbp), %r8
callq 0xc1de0
cmpq $0x0, %rax
jne 0x88eed
jmp 0x890e3
movq -0xc0(%rbp), %rdi
movq -0xc0(%rbp), %rax
movl 0x28(%rax), %esi
movq -0x98(%rbp), %rax
movl %eax, %edx
movq 0x58(%rbp), %rcx
movsd -0x58(%rbp), %xmm0
movq 0x60(%rbp), %r8
callq 0xc1b90
cmpl $0x0, %eax
jne 0x88f23
jmp 0x890e3
movq -0xc0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x98(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0xc0(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x98(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
cltq
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rax
cmpq -0x110(%rbp), %rax
je 0x88f7b
jmp 0x890e3
movq -0xd8(%rbp), %rax
subq -0xe0(%rbp), %rax
movq -0xf8(%rbp), %rcx
subq -0x100(%rbp), %rcx
cmpq %rcx, %rax
jne 0x88fac
movq -0xe8(%rbp), %rax
cmpq -0x108(%rbp), %rax
je 0x88fb1
jmp 0x890e3
cmpq $0x0, -0xe8(%rbp)
jne 0x88fc0
jmp 0x890d2
cmpq $0x0, -0xb0(%rbp)
jne 0x89060
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq 0x38(%rbp), %rdx
movq -0xe0(%rbp), %rcx
movq -0xd8(%rbp), %r8
subq -0xe0(%rbp), %r8
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rbp), %r9
movq (%r9), %r9
movq 0x28(%rbp), %r10
movq (%r10), %r10
movl %r10d, %r10d
imulq $0x1c, %r10, %r10
addq %r10, %r9
movl (%r9), %r9d
imulq $0xa8, %r9, %r9
addq %r9, %rax
movl 0x1c(%rax), %eax
movl %eax, %r9d
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rbp), %r10
movq (%r10), %r10
movq 0x28(%rbp), %r11
movq (%r11), %r11
movl %r11d, %r11d
imulq $0x1c, %r11, %r11
addq %r11, %r10
movl (%r10), %r10d
imulq $0xa8, %r10, %r10
addq %r10, %rax
movl 0x10(%rax), %eax
movq %rax, (%rsp)
callq 0x5add0
movq %rax, -0xb0(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq 0x40(%rbp), %rdx
movq -0x100(%rbp), %rcx
movq -0xf8(%rbp), %r8
subq -0x100(%rbp), %r8
movq -0xc0(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, %r9d
movq -0xc0(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, (%rsp)
callq 0x5add0
movq %rax, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq -0xf8(%rbp), %rdx
subq -0x100(%rbp), %rdx
callq 0x20b0
cmpl $0x0, %eax
je 0x890d0
jmp 0x890e3
jmp 0x890d2
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x88e50
movq -0x60(%rbp), %rax
cmpq -0x80(%rbp), %rax
jae 0x890f2
jmp 0x892b0
cmpq $0x0, -0xa0(%rbp)
je 0x89217
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x80(%rbp), %rax
jae 0x891f9
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rbp), %rcx
movq (%rcx), %rcx
movq 0x28(%rbp), %rdx
movq -0x60(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movl %edx, %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq 0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x9e2e0
movq %rax, -0x98(%rbp)
movq -0xc0(%rbp), %rdi
movq 0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, %esi
movq -0x98(%rbp), %rax
movl %eax, %edx
movq 0x58(%rbp), %rcx
movsd -0x58(%rbp), %xmm0
movq 0x60(%rbp), %r8
callq 0xc1b90
movl %eax, %eax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x68(%rbp)
movq 0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
orq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdx
movq 0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x89108
cmpq $0x0, -0xa0(%rbp)
je 0x89215
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x89217
jmp 0x89219
movq 0x50(%rbp), %rax
movq (%rax), %rax
movq 0x50(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x8928a
movq 0x50(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x89249
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x130(%rbp)
jmp 0x89257
movl $0x2, %eax
movq %rax, -0x130(%rbp)
jmp 0x89257
movq -0x130(%rbp), %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xc8(%rbp), %rdx
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x50(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x892b0
movq 0x20(%rbp), %rax
addq -0x70(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x88cb5
movq 0x50(%rbp), %rax
cmpq $0x0, (%rax)
je 0x89448
cmpq $0x0, -0xa0(%rbp)
jne 0x893cb
jmp 0x892df
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rbp), %rcx
movq (%rcx), %rcx
shlq %rcx
cmpq %rcx, %rax
jae 0x893c7
movq 0x50(%rbp), %rax
movq (%rax), %rcx
shlq %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x893c9
jmp 0x893cb
movq 0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq 0x28(%rbp), %rdx
movq -0x80(%rbp), %rcx
movq 0x50(%rbp), %rax
movq 0x10(%rax), %r8
movq 0x50(%rbp), %rax
movq (%rax), %r9
movq 0x50(%rbp), %rax
movq 0x10(%rax), %r15
movq 0x50(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %r15
movq -0xa8(%rbp), %r14
movq 0x20(%rbp), %rbx
movq 0x30(%rbp), %r11
movq 0x58(%rbp), %r10
movsd -0x58(%rbp), %xmm0
movq 0x60(%rbp), %rax
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x88470
movq %rax, %rcx
movq 0x50(%rbp), %rax
movq %rcx, (%rax)
jmp 0x8944a
cmpq $0x0, -0x78(%rbp)
je 0x894c6
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x894be
movq 0x48(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movq -0x60(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq 0x10(%rbp), %rax
jae 0x8948d
jmp 0x894b0
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x89461
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
popq %r15
popq %rbp
retq