// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Hash_Table.cpp
// Function: lchain_qdp_fix(k_mer_hit*, long, Chain_Data*, long, long, long, double, double, double, long, long, long, long, long)
uint64_t lchain_qdp_fix(k_mer_hit* a, int64_t a_n, Chain_Data* dp, int64_t max_skip, 
                int64_t max_iter, int64_t max_dis, double chn_pen_gap, double chn_pen_skip, 
                double bw_rate, int64_t xl, int64_t yl, int64_t quick_check, 
                int64_t left_fix, int64_t right_fix)
{
    int64_t *p, *t, max_f, n_skip, st, max_j, end_j, sc, msc, msc_i, bw, max_ii, ovl, movl; 
    int32_t *f, max, tmp; int64_t i, j, ret, cL = 0, must_p = 1, is_reorder = 0; k_mer_hit z;
    resize_Chain_Data(dp, a_n, NULL);
    t = dp->tmp; f = dp->score; p = dp->pre;
    bw = ((xl < yl)?xl:yl); bw *= bw_rate;
    msc = msc_i = -1; movl = INT32_MAX;

    if(quick_check) {
        ret = lchain_qcheck(a, a_n, dp, bw_rate);
        if (ret > 0) {
            a_n = ret; msc_i = a_n-1; msc = f[msc_i];
            goto skip_ldp;
        }
    }

    memset(t, 0, (a_n*sizeof((*t))));
    if((right_fix) && (!left_fix)) {
        // fprintf(stderr, "\n[M::%s::] a_n::%ld\n", __func__, a_n);
        // for (i = 0; i < a_n; ++i) {
        //     fprintf(stderr, "+[M::%s::] x::[%u, %u), y::[%u, %u)\n", __func__, 
        //     a[i].self_offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].self_offset+1,
        //     a[i].offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].offset+1);
        // }
        n_skip = a_n>>1;
        for (i=0; i<n_skip; ++i) {
            z = a[i]; a[i] = a[a_n-i-1]; a[a_n-i-1] = z; 
            rev_khit(a[i], xl, yl); rev_khit(a[a_n-i-1], xl, yl);
        }
        if(a_n&1) rev_khit(a[i], xl, yl);
        // for (i = 0; i < a_n; ++i) {
        //     fprintf(stderr, "-[M::%s::] x::[%u, %u), y::[%u, %u)\n", __func__, 
        //     a[i].self_offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].self_offset+1,
        //     a[i].offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].offset+1);
        // }
        is_reorder = 1;
    } 

    if((!right_fix) && (!left_fix)) must_p = 0;

    for (i = st = 0, max_ii = -1; i < a_n; ++i) {
        max_f = a[i].cnt&(0xffu); if(must_p) max_f = INT32_MIN;
        n_skip = 0; max_j = end_j = -1;
        if ((i-st) > max_iter) st = i-max_iter;
        // if(a[0].self_offset == 171728) {
        //     fprintf(stderr, "i::%ld[M::%s::] x::[%u, %u), y::[%u, %u)\n", i, __func__, 
        //         a[i].self_offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].self_offset+1,
        //         a[i].offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].offset+1);
        // }
        for (j = i - 1; j >= 0; --j) {
            sc = comput_sc_ff(&a[i], &a[j], bw_rate, chn_pen_gap, chn_pen_skip, xl, yl);
            // if(a[0].self_offset == 171728) {
            //     fprintf(stderr, "j::%ld[M::%s::sc->%ld] x::[%u, %u), y::[%u, %u)\n", j, __func__, sc,
            //     a[j].self_offset+1-(a[j].cnt&((uint32_t)(0xffu))), a[j].self_offset+1,
            //     a[j].offset+1-(a[j].cnt&((uint32_t)(0xffu))), a[j].offset+1);
            // }
            if (sc == INT32_MIN) continue;
            sc += f[j];
            if (sc > max_f) {
                max_f = sc, max_j = j;
                if (n_skip > 0) --n_skip;
            } else if (t[j] == (int32_t)i) {
                if ((++n_skip) > max_skip) {
                    if((max_j != -1) || (must_p == 0)) break;
                } 
            }
            if (p[j] >= 0) t[p[j]] = i;
            ///put it here will allow at least one prefix no matter max_dis
            ///this is special for gap filling, not for chaining
            if (a[i].self_offset > (max_dis + a[j].self_offset)) {
                if((max_j != -1)) break;
            }
            if (j < st) {
                if((max_j != -1) || (must_p == 0)) break;
            }
        }
        end_j = j;

        if (max_ii < 0 || ((int64_t)a[i].self_offset) - ((int64_t)a[max_ii].self_offset) > max_dis) {
            max = INT32_MIN; max_ii = -1;
            for (j = i - 1; (j >= st) && ((((int64_t)a[i].self_offset)-((int64_t)a[j].self_offset))<=max_dis); --j) {
                if (max < f[j]) {
                    max = f[j], max_ii = j;
                }
            }
        }

        if (max_ii >= 0 && max_ii < end_j) {///just have a try with a[i]<->a[max_ii]
            tmp = comput_sc_ff(&a[i], &a[max_ii], bw_rate, chn_pen_gap, chn_pen_skip, xl, yl);
            if (tmp != INT32_MIN && max_f < tmp + f[max_ii])
                max_f = tmp + f[max_ii], max_j = max_ii;
        }
        if(max_j == -1) {
            f[i] = 0; p[i] = max_j;
        } else {
            f[i] = max_f; p[i] = max_j;
        }
        
        if ((max_ii < 0) || (((((int64_t)a[i].self_offset)-((int64_t)a[max_ii].self_offset))<=max_dis) && (f[max_ii]<f[i]))) {
            max_ii = i;
        }
        // if(a[0].self_offset == 171728) {
        //     fprintf(stderr, "i::%ld[M::%s::] f::%d, p::%ld\n", i, __func__, f[i], p[i]);
        // }
        if(f[i] >= msc) {
            ovl = get_chainLen(a[i].self_offset, a[i].self_offset, xl, a[i].offset, a[i].offset, yl);
            if(f[i] > msc || ovl < movl) {
                msc = f[i]; msc_i = i; movl = ovl;
            }
        }
    }
    
    skip_ldp:
    if(right_fix && left_fix) msc_i = a_n-1;
    ///a[] has been sorted by self_offset
    i = msc_i; cL = 0; 
    while (i >= 0) {
        t[cL++] = i; msc_i = i; i = p[i];
    }
    // if((right_fix) && (!left_fix)) {
    //     fprintf(stderr, "[M::%s::] cL::%ld\n", __func__, cL);
    // }

    if(is_reorder) {
        n_skip = a_n>>1;
        for (i=0; i<n_skip; ++i) {
            z = a[i]; a[i] = a[a_n-i-1]; a[a_n-i-1] = z; 
            rev_khit(a[i], xl, yl); rev_khit(a[a_n-i-1], xl, yl);
        }
        if(a_n&1) rev_khit(a[i], xl, yl);
        for (i = 0; i < cL; i++) {
            t[i] = a_n - t[i] - 1;
            // fprintf(stderr, ">[M::%s::] t[%ld]::%ld\n", __func__, i, t[i]);
        }
        // for (i = 0; i < a_n; ++i) {
        //     fprintf(stderr, ">[M::%s::] x::[%u, %u), y::[%u, %u)\n", __func__, 
        //     a[i].self_offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].self_offset+1,
        //     a[i].offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].offset+1);
        // }
    } else {
        n_skip = cL>>1;
        for (i = 0; i < n_skip; i++) {
            msc_i = t[i]; t[i] = t[cL-i-1]; t[cL-i-1] = msc_i;
        }
    } 
    // if(cL != a_n) {
    //     fprintf(stderr, "\n[M::%s::] a_n::%ld, left_fix::%ld, right_fix::%ld\n", __func__, a_n, left_fix, right_fix);
    //     for (i = 0; i < a_n; ++i) {
    //         fprintf(stderr, "+[M::%s::] x::[%u, %u), y::[%u, %u)\n", __func__, 
    //         a[i].self_offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].self_offset+1,
    //         a[i].offset+1-(a[i].cnt&((uint32_t)(0xffu))), a[i].offset+1);
    //     }
    //     for (i = 0; i < cL; i++) {
    //         fprintf(stderr, ">[M::%s::] t[%ld]::%ld\n", __func__, i, t[i]);
    //     }
    // }
    return cL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movsd %xmm2, 0x8(%rsp)
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, (%rsp)
movq %r9, 0x30(%rsp)
movq %r8, 0xa8(%rsp)
movq %rcx, 0xb8(%rsp)
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, %rdi
xorl %edx, %edx
callq 0x3f828
movq 0x28(%rbp), %r15
movq (%rbp), %rax
movq %rax, 0x40(%rsp)
movq 0x8(%rbp), %r13
cmpq $0x0, 0x110(%rsp)
movq %rbx, 0x10(%rsp)
je 0x4393f
movq %rbx, %rdi
movl %r14d, %esi
movq %rbp, %rdx
movsd 0x8(%rsp), %xmm0
callq 0x40042
testl %eax, %eax
jle 0x4393f
movl %eax, %r14d
leaq -0x1(%r14), %rax
xorl %edx, %edx
jmp 0x44024
leaq (,%r14,8), %rdx
movq $0x0, 0x60(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x20e0
cmpq $0x0, 0x120(%rsp)
sete %al
cmpq $0x0, 0x118(%rsp)
setne %cl
orb %al, %cl
je 0x4398c
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm5
movsd (%rsp), %xmm6
jmp 0x43a9f
movq %r14, %rax
sarq %rax
testq %rax, %rax
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm5
movsd (%rsp), %xmm6
jle 0x43a54
movq 0x100(%rsp), %rcx
decl %ecx
movq 0x108(%rsp), %rdx
decl %edx
movq %r14, %rsi
shlq $0x4, %rsi
addq %rbx, %rsi
addq $-0x10, %rsi
movq %rbx, %rdi
movq %rax, %r8
movups (%rdi), %xmm0
movaps %xmm0, 0x90(%rsp)
movups (%rsi), %xmm0
movups %xmm0, (%rdi)
movapd 0x90(%rsp), %xmm0
movupd %xmm0, (%rsi)
movl 0x4(%rdi), %r9d
movl 0x8(%rdi), %r10d
notl %r10d
movzbl 0xc(%rdi), %r11d
addl %ecx, %r10d
addl %r11d, %r10d
movl %r10d, 0x8(%rdi)
notl %r9d
addl %edx, %r11d
addl %r9d, %r11d
movl %r11d, 0x4(%rdi)
movl 0x4(%rsi), %r9d
movl 0x8(%rsi), %r10d
notl %r10d
movzbl 0xc(%rsi), %r11d
addl %ecx, %r10d
addl %r11d, %r10d
movl %r10d, 0x8(%rsi)
notl %r9d
addl %edx, %r11d
addl %r9d, %r11d
movl %r11d, 0x4(%rsi)
addq $0x10, %rdi
addq $-0x10, %rsi
decq %r8
jne 0x439d4
movq 0x10(%rsp), %rbx
jmp 0x43a56
xorl %eax, %eax
movl $0x1, %ecx
movq %rcx, 0x60(%rsp)
testb $0x1, %r14b
je 0x43a9f
shlq $0x4, %rax
movl 0x4(%rbx,%rax), %ecx
movl 0x8(%rbx,%rax), %edx
movzbl 0xc(%rbx,%rax), %esi
subl %esi, %edx
incl %edx
notl %edx
movq 0x100(%rsp), %rdi
addl %edi, %edx
movl %edx, 0x8(%rbx,%rax)
subl %esi, %ecx
incl %ecx
notl %ecx
movq 0x108(%rsp), %rdx
addl %edx, %ecx
movl %ecx, 0x4(%rbx,%rax)
movq 0x30(%rsp), %rdi
testq %r14, %r14
jle 0x44018
movq 0x120(%rsp), %rax
orq 0x118(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x100(%rsp), %rax
decq %rax
movq %rax, 0xa0(%rsp)
leaq -0x8(%rbx), %r9
movq $-0x1, %rsi
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x80(%rsp)
xorl %r10d, %r10d
movq $0x0, 0x8(%rsp)
movq $-0x1, 0x78(%rsp)
movq $-0x1, %r8
movq %r14, 0x28(%rsp)
movq %r8, 0x50(%rsp)
movq 0x8(%rsp), %rax
movq %r10, %rcx
shlq $0x4, %rcx
leaq (%rbx,%rcx), %r11
cmpq $0x0, 0x70(%rsp)
movl 0xc(%rbx,%rcx), %r12d
movzbl %r12b, %edx
movq %rdx, 0x58(%rsp)
movq $-0x80000000, %rcx      # imm = 0x80000000
cmovneq %rcx, %rdx
movq %rdx, 0x18(%rsp)
movq %r10, %rcx
subq %rax, %rcx
movq %r10, %r8
movq 0xa8(%rsp), %rdx
subq %rdx, %r8
cmpq %rdx, %rcx
cmovleq %rax, %r8
movq %r8, 0x8(%rsp)
movq %r10, %r8
subq $0x1, %r8
movq %r10, 0x38(%rsp)
movq %r11, 0x20(%rsp)
movq %r12, 0xb0(%rsp)
movq %r9, 0x68(%rsp)
jae 0x43b97
movq %r8, %r10
movq $-0x1, (%rsp)
jmp 0x43d86
movl 0x8(%r11), %edx
movl %r12d, %eax
shrl $0x8, %eax
movl %eax, 0x4c(%rsp)
movslq %r10d, %rax
movq %rax, 0xc0(%rsp)
movq $-0x1, (%rsp)
movq %r9, %r14
movq %r8, %r10
xorl %r9d, %r9d
movq %r11, %rbx
movq %rdx, 0x88(%rsp)
movl (%r14), %ebp
movl %edx, %r12d
subl %ebp, %r12d
movl $0x80000000, %eax       # imm = 0x80000000
js 0x43c8d
movl 0x4(%rbx), %r11d
subl -0x4(%r14), %r11d
js 0x43c8d
movq %r13, %rbx
movq %r15, %rdi
movl %r11d, %eax
subl %r12d, %eax
movl %r12d, %r15d
cmovll %r11d, %r15d
movl %eax, %r13d
negl %r13d
cmovsl %eax, %r13d
movq 0x58(%rsp), %rax
cmpl %r15d, %eax
movl %r15d, %ecx
cmovll %eax, %ecx
movl $0x1, %eax
cmpl 0x4c(%rsp), %ecx
jl 0x43c34
movl %ecx, %eax
xorl %edx, %edx
divl 0x4c(%rsp)
movq 0x88(%rsp), %rdx
cmpl %r12d, %r11d
jne 0x43c40
cmpl %r15d, 0x58(%rsp)
jge 0x43c7d
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movapd %xmm0, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
mulsd %xmm6, %xmm1
xorps %xmm3, %xmm3
cvtsi2sd %r15d, %xmm3
divsd %xmm3, %xmm0
divsd %xmm4, %xmm0
mulsd %xmm2, %xmm0
minsd %xmm1, %xmm0
mulsd %xmm5, %xmm3
addsd %xmm0, %xmm3
cvttsd2si %xmm3, %ecx
subl %ecx, %eax
movq %rdi, %r15
movq %rbx, %r13
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rbx
movl %eax, %ecx
negl %ecx
jno 0x43c9b
movq %r9, %rax
jmp 0x43d58
cltq
movq 0x40(%rsp), %rcx
movslq (%rcx,%r10,4), %rdx
addq %rax, %rdx
cmpq 0x18(%rsp), %rdx
jle 0x43cc8
xorl %eax, %eax
testq %r9, %r9
setg %al
subq %rax, %r9
movq %r10, %rcx
movq %r9, %rax
movq %rdx, 0x18(%rsp)
jmp 0x43d0c
movq 0xc0(%rsp), %rax
cmpq %rax, (%r15,%r10,8)
jne 0x43cea
leaq 0x1(%r9), %rax
cmpq 0xb8(%rsp), %r9
jge 0x43cf3
movq (%rsp), %rcx
jmp 0x43d0c
movq (%rsp), %rcx
movq %r9, %rax
jmp 0x43d0c
cmpq $0x0, 0x70(%rsp)
movq (%rsp), %rdx
je 0x43d7c
movq $-0x1, %rcx
cmpq $-0x1, %rdx
jne 0x43d7c
movq (%r13,%r10,8), %rdx
testq %rdx, %rdx
js 0x43d1f
movq 0x38(%rsp), %r9
movq %r9, (%r15,%rdx,8)
addq %rdi, %rbp
movq 0x88(%rsp), %rdx
cmpq %rdx, %rbp
jge 0x43d35
cmpq $-0x1, %rcx
jne 0x43d78
cmpq 0x8(%rsp), %r10
jge 0x43d54
cmpq $0x0, 0x70(%rsp)
je 0x43d78
movq $-0x1, (%rsp)
cmpq $-0x1, %rcx
je 0x43d58
jmp 0x43d78
movq %rcx, (%rsp)
leaq -0x1(%r10), %rcx
addq $-0x10, %r14
movq %rax, %r9
testq %r10, %r10
movq %rcx, %r10
jg 0x43bcc
movq $-0x1, %r10
jmp 0x43d7c
movq %rcx, (%rsp)
movq 0x28(%rsp), %r14
movq 0x10(%rsp), %rbx
testq %rsi, %rsi
js 0x43da6
movq 0x20(%rsp), %rax
movl 0x8(%rax), %eax
movq %rsi, %rcx
shlq $0x4, %rcx
movl 0x8(%rbx,%rcx), %ecx
subq %rcx, %rax
cmpq %rdi, %rax
jle 0x43dff
movq $-0x1, %rsi
movq 0x8(%rsp), %rax
cmpq %rax, 0x38(%rsp)
jle 0x43dff
movq 0x20(%rsp), %rax
movl 0x8(%rax), %eax
movl $0x80000000, %ecx       # imm = 0x80000000
movq 0x68(%rsp), %rdx
movl (%rdx), %r9d
movq %rax, %r11
subq %r9, %r11
cmpq %rdi, %r11
jg 0x43dff
movq 0x40(%rsp), %r9
movl (%r9,%r8,4), %r9d
cmpl %r9d, %ecx
cmovlq %r8, %rsi
cmovlel %r9d, %ecx
leaq -0x1(%r8), %r9
addq $-0x10, %rdx
cmpq 0x8(%rsp), %r8
movq %r9, %r8
jg 0x43dcb
testq %rsi, %rsi
sets %al
cmpq %r10, %rsi
setge %cl
orb %al, %cl
jne 0x43f03
movq %rsi, %rcx
shlq $0x4, %rcx
movq 0x20(%rsp), %rdx
movl 0x8(%rdx), %r8d
subl 0x8(%rbx,%rcx), %r8d
movl $0x80000000, %eax       # imm = 0x80000000
movq (%rsp), %r9
js 0x43ece
addq %rbx, %rcx
movl 0x4(%rdx), %r10d
subl 0x4(%rcx), %r10d
js 0x43ece
movl %r10d, %eax
subl %r8d, %eax
movl %r8d, %r9d
cmovll %r10d, %r9d
movl %eax, %r11d
negl %r11d
cmovsl %eax, %r11d
movq 0x58(%rsp), %rax
cmpl %r9d, %eax
movl %r9d, %ecx
cmovll %eax, %ecx
movq 0xb0(%rsp), %rdx
shrl $0x8, %edx
movl $0x1, %eax
cmpl %edx, %ecx
jl 0x43e8a
movl %ecx, %eax
movq %rdx, %rcx
xorl %edx, %edx
divl %ecx
cmpl %r8d, %r10d
jne 0x43e96
cmpl %r9d, 0x58(%rsp)
jge 0x43eca
cvtsi2sd %r11d, %xmm0
movapd %xmm0, %xmm1
cvtsi2sd %eax, %xmm2
mulsd %xmm6, %xmm1
cvtsi2sd %r9d, %xmm3
divsd %xmm3, %xmm0
divsd %xmm4, %xmm0
mulsd %xmm2, %xmm0
minsd %xmm1, %xmm0
mulsd %xmm5, %xmm3
addsd %xmm0, %xmm3
cvttsd2si %xmm3, %ecx
subl %ecx, %eax
movq (%rsp), %r9
movl %eax, %ecx
negl %ecx
jo 0x43ef7
movq 0x40(%rsp), %rcx
movslq (%rcx,%rsi,4), %rcx
cltq
addq %rcx, %rax
movq 0x18(%rsp), %rcx
cmpq %rax, %rcx
cmovlq %rsi, %r9
cmovleq %rax, %rcx
movq %rcx, 0x18(%rsp)
movq 0x38(%rsp), %r10
movq 0x50(%rsp), %r8
jmp 0x43f11
movq 0x38(%rsp), %r10
movq 0x50(%rsp), %r8
movq (%rsp), %r9
cmpq $-0x1, %r9
movl $0x0, %eax
movq 0x18(%rsp), %rcx
cmovel %eax, %ecx
movq 0x40(%rsp), %rax
movl %ecx, (%rax,%r10,4)
movq %r9, (%r13,%r10,8)
testq %rsi, %rsi
js 0x43f5e
movq 0x20(%rsp), %rax
movl 0x8(%rax), %eax
movq %rsi, %rcx
shlq $0x4, %rcx
movl 0x8(%rbx,%rcx), %ecx
subq %rcx, %rax
cmpq %rdi, %rax
jg 0x43f61
movq 0x40(%rsp), %rcx
movl (%rcx,%rsi,4), %eax
cmpl (%rcx,%r10,4), %eax
jge 0x43f61
movq %r10, %rsi
movq 0x40(%rsp), %rax
movslq (%rax,%r10,4), %rax
cmpq %rax, %r8
jle 0x43f79
movq 0x68(%rsp), %r9
jmp 0x43ffc
movq 0x20(%rsp), %rcx
movl 0x4(%rcx), %edx
movl 0x8(%rcx), %edi
movq %rdx, %rcx
subq %rdi, %rcx
incq %rcx
movq %rdi, %r8
notq %r8
addq 0x100(%rsp), %r8
movq %rdx, %r9
notq %r9
addq 0x108(%rsp), %r9
movq %rdi, %r10
addq %r9, %r10
cmpq %r9, %r8
movq 0x50(%rsp), %r8
cmovleq 0xa0(%rsp), %r10
cmpl %edx, %edi
movq 0x30(%rsp), %rdi
movl $0x1, %edx
cmovbeq %rdx, %rcx
addq %r10, %rcx
movq 0x38(%rsp), %r10
cmpq %rax, %r8
movq 0x68(%rsp), %r9
jl 0x43fec
cmpq 0x80(%rsp), %rcx
jge 0x43ffc
movq %rax, %r8
movq %r10, 0x78(%rsp)
movq %rcx, 0x80(%rsp)
incq %r10
addq $0x10, %r9
cmpq %r14, %r10
jne 0x43b0e
movq 0x60(%rsp), %rdx
movq 0x78(%rsp), %rax
jmp 0x44024
movq $-0x1, %rax
movq 0x60(%rsp), %rdx
leaq -0x1(%r14), %rcx
cmpq $0x0, 0x120(%rsp)
cmoveq %rax, %rcx
cmpq $0x0, 0x118(%rsp)
cmoveq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
js 0x44057
movq %rcx, (%r15,%rax,8)
incq %rax
movq (%r13,%rcx,8), %rcx
jmp 0x44044
testq %rdx, %rdx
je 0x44115
movq %r14, %rcx
sarq %rcx
testq %rcx, %rcx
jle 0x4414e
movq 0x100(%rsp), %rdx
decl %edx
movq 0x108(%rsp), %rsi
decl %esi
movq %r14, %rdi
shlq $0x4, %rdi
addq %rbx, %rdi
addq $-0x10, %rdi
movq %rbx, %r8
movq %rcx, %r9
movups (%r8), %xmm0
movaps %xmm0, 0x90(%rsp)
movups (%rdi), %xmm0
movups %xmm0, (%r8)
movapd 0x90(%rsp), %xmm0
movupd %xmm0, (%rdi)
movl 0x4(%r8), %r10d
movl 0x8(%r8), %r11d
notl %r11d
movzbl 0xc(%r8), %ebx
addl %edx, %r11d
addl %ebx, %r11d
movl %r11d, 0x8(%r8)
notl %r10d
addl %esi, %ebx
addl %r10d, %ebx
movl %ebx, 0x4(%r8)
movl 0x4(%rdi), %r10d
movl 0x8(%rdi), %r11d
notl %r11d
movzbl 0xc(%rdi), %ebx
addl %edx, %r11d
addl %ebx, %r11d
movl %r11d, 0x8(%rdi)
notl %r10d
addl %esi, %ebx
addl %r10d, %ebx
movl %ebx, 0x4(%rdi)
addq $0x10, %r8
addq $-0x10, %rdi
decq %r9
jne 0x44097
movq 0x10(%rsp), %rbx
jmp 0x44150
cmpq $0x2, %rax
jb 0x441ae
movq %rax, %rcx
shrq %rcx
negq %rcx
leaq (%r15,%rax,8), %rdx
addq $-0x8, %rdx
xorl %esi, %esi
movq (%r15), %rdi
movq (%rdx,%rsi,8), %r8
movq %r8, (%r15)
movq %rdi, (%rdx,%rsi,8)
decq %rsi
addq $0x8, %r15
cmpq %rsi, %rcx
jne 0x44132
jmp 0x441ae
xorl %ecx, %ecx
testb $0x1, %r14b
je 0x44191
shlq $0x4, %rcx
movl 0x4(%rbx,%rcx), %edx
movl 0x8(%rbx,%rcx), %esi
movzbl 0xc(%rbx,%rcx), %edi
subl %edi, %esi
incl %esi
notl %esi
movq 0x100(%rsp), %r8
addl %esi, %r8d
movl %r8d, 0x8(%rbx,%rcx)
subl %edi, %edx
incl %edx
notl %edx
movq 0x108(%rsp), %rsi
addl %edx, %esi
movl %esi, 0x4(%rbx,%rcx)
testq %rax, %rax
je 0x441ae
xorl %ecx, %ecx
movq (%r15,%rcx,8), %rdx
notq %rdx
addq %r14, %rdx
movq %rdx, (%r15,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x44198
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq