// File: chhylp123[P]hifiasm/Correct.cpp
// Function: gen_single_khit(Candidates_list*, long, long, long, long, long, long, long, long, long, long)
int64_t gen_single_khit(Candidates_list *cl, int64_t ch_n, int64_t h_khit, int64_t mode, int64_t qs, int64_t qe, int64_t ts, int64_t te, int64_t max_skip, int64_t max_iter, int64_t rid)
{
    // if(ch_n != 3 || mode != 0 || qs != 171728 || qe != 172258) return 0;
    k_mer_hit *ch_a = cl->list + cl->length; int64_t k, i, j, occ, m, ncn, prefix, suffix, srt = 1;
    prefix = suffix = 0;
    if(mode == 0 || mode == 2) suffix = 1;
    if(mode == 0 || mode == 1) prefix = 1;
    // if(ch_n == 2 && mode == 2 && qe - qs == 2419 && te - ts == 2419) {
        // fprintf(stderr, "[M::%s::mode->%ld] ch_n::%ld, q::[%ld, %ld), t::[%ld, %ld)\n", 
        //     __func__, mode, ch_n, qs, qe, ts, te);
    // }
    
    for (k = occ = m = 0; k < ch_n; k++) {
        // if(ch_n == 2 && mode == 2 && qe - qs == 2419 && te - ts == 2419) {
        // fprintf(stderr, "+i::%ld[M::%s::] x::[%u, %u), y::[%u, %u), cnt::%u\n", k, __func__, 
        //     ch_a[k].self_offset+1-(ch_a[k].cnt&((uint32_t)(0xffu))), ch_a[k].self_offset+1,
        //     ch_a[k].offset+1-(ch_a[k].cnt&((uint32_t)(0xffu))), ch_a[k].offset+1, (ch_a[k].cnt&(0xffu)));
        // }
        if(!(ch_a[k].cnt&(0xffu))) continue;
        occ++;
        if((ch_a[k].cnt&(0xffu)) > 1) occ++;
        ch_a[m++] = ch_a[k];
    }
    ch_n = m; if(!ch_n) return ch_n;
    occ += prefix + suffix;
    // if(ch_n == 2 && mode == 2 && qe - qs == 2419 && te - ts == 2419) {
        // fprintf(stderr, "+[M::%s::] occ::%ld\n", __func__, occ);
    // }

    ncn = occ + cl->length;
    if(cl->size < ncn) {
        cl->size = ncn;
        REALLOC(cl->list, cl->size);
        // cl->list = (k_mer_hit*)realloc(cl->list, (sizeof((*(cl->list)))*cl->length));
    }
    ch_a = cl->list + cl->length; assert((cl->length+occ)<= cl->size);

    k_mer_hit cht;
    ///global or backward
    if(suffix) {
        cht.self_offset = qe;
        cht.offset = te;
        cht.cnt = 1; cht.readID = 1;//make it as primary chain
        cht.strand = 0;
        ch_a[--occ] = cht;
        // fprintf(stderr, "occ::%ld[M::%s::] x::%u, y::%u, cnt::%u, cov::%u\n", occ, __func__, 
        //     cht.self_offset, cht.offset, cht.cnt, cht.readID);
    }
    for (k = ch_n-1; k >= 0; k--) {
        if(!(ch_a[k].cnt&(0xffu))) continue;
        ///end
        cht.self_offset = ch_a[k].self_offset+1;
        cht.offset = ch_a[k].offset+1;
        cht.strand = 0;
        cht.cnt = cht.readID = (ch_a[k].cnt&(0xffu));
        //make it as non-primary chain
        if((ch_a[k].cnt&(0xffu)) < h_khit) cht.readID = cht.cnt + 1;
        ch_a[--occ] = cht;
        // fprintf(stderr, "occ::%ld[M::%s::] x::%u, y::%u, cnt::%u, cov::%u\n", occ, __func__, 
        //     cht.self_offset, cht.offset, cht.cnt, cht.readID);

        if((ch_a[k].cnt&(0xffu)) > 1) {
            ///start
            cht.self_offset = ch_a[k].self_offset+1-(ch_a[k].cnt&(0xffu));
            cht.offset = ch_a[k].offset+1-(ch_a[k].cnt&(0xffu));
            cht.strand = 0;
            cht.cnt = cht.readID = (ch_a[k].cnt&(0xffu));
            //make it as non-primary chain
            if((ch_a[k].cnt&(0xffu)) < h_khit) cht.readID = cht.cnt + 1;
            ch_a[--occ] = cht;
            // fprintf(stderr, "occ::%ld[M::%s::] x::%u, y::%u, cnt::%u, cov::%u\n", occ, __func__, 
            // cht.self_offset, cht.offset, cht.cnt, cht.readID);
        }
    }
    
    if(prefix) { ///global or forward
        cht.self_offset = qs;
        cht.offset = ts;
        cht.cnt = 1; cht.readID = 1;//make it as primary chain
        cht.strand = 0;
        ch_a[--occ] = cht;
        // fprintf(stderr, "occ::%ld[M::%s::] x::%u, y::%u, cnt::%u, cov::%u\n", occ, __func__, 
        //     cht.self_offset, cht.offset, cht.cnt, cht.readID);
    }
    // if(ch_n == 2 && mode == 2 && qe - qs == 2419 && te - ts == 2419) {
        // fprintf(stderr, "-[M::%s::] occ::%ld\n", __func__, occ);
    // }
    // if(!(occ == 0)) {
    //     fprintf(stderr, "[M::%s] rid::%ld, name::%.*s\n", __func__, rid,
    //      (int32_t)UL_INF.nid.a[rid].n, UL_INF.nid.a[rid].a);
    // }
    assert(occ == 0);
    ch_n = occ = ncn - cl->length;
    uint64_t q[2], t[2]; 
    q[0] = q[1] = t[0] = t[1] = (uint64_t)-1;
    if(prefix) {
        q[0] = qs; t[0] = ts;
    }
    if(suffix) {
        q[1] = qe; t[1] = te;
    }

    // for (k = 0; k < ch_n; k++) {
    //     fprintf(stderr, "<i::%ld[M::%s::] x::%u, y::%u, cnt::%u, cov::%u\n", k, __func__, 
    //         ch_a[k].self_offset, ch_a[k].offset, ch_a[k].cnt, ch_a[k].readID);
    // }
    for (k = m = occ = 0; k < ch_n; k++) {
        if((k>0) && (ch_a[k].self_offset==q[0]) && (ch_a[k].offset=t[0])) continue;
        if(((k+1)<ch_n) && (ch_a[k].self_offset==q[1]) && (ch_a[k].offset=t[1])) continue;
        if(m>0) {
            if((ch_a[k].self_offset>ch_a[m-1].self_offset) && (ch_a[k].offset>ch_a[m-1].offset)) {
                occ++;
            }
            if(ch_a[k].self_offset<=ch_a[m-1].self_offset) srt = 0;
        } else {
            occ++;
        }
        ch_a[m++] = ch_a[k];
    }
    ch_n = m;
    if(occ == ch_n) return ch_n;///already colinear
    if(!srt) {
        radix_sort_k_mer_hit_self(ch_a, ch_a + ch_n);
        for (i = 1, j = 0; i <= ch_n; i++) {
            if (i == ch_n || ch_a[i].self_offset != ch_a[j].self_offset) {
                if(i - j > 1) radix_sort_k_mer_hit_off(ch_a+j, ch_a+i);
                j = i;
            }
        }
    }

    // for (k = 0; k < ch_n; k++) {
    //     fprintf(stderr, ">i::%ld[M::%s::] x::%u, y::%u, cnt::%u, cov::%u\n", k, __func__, 
    //         ch_a[k].self_offset, ch_a[k].offset, ch_a[k].cnt, ch_a[k].readID);
    // }
    occ = ch_n;
    ch_n = lchain_simple(ch_a+prefix, ch_n-prefix-suffix, ch_a+prefix, &(cl->chainDP), max_skip, max_iter);
    ch_n += prefix + suffix; if(suffix) ch_a[ch_n-1] = ch_a[occ-1];
    // for (k = 0; k < ch_n; k++) {
    //     fprintf(stderr, "-i::%ld[M::%s::] x::%u, y::%u, cnt::%u, cov::%u\n", k, __func__, 
    //         ch_a[k].self_offset, ch_a[k].offset, ch_a[k].cnt, ch_a[k].readID);
    // }
    
    return ch_n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
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 -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq $0x1, -0x88(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x64c6a
cmpq $0x2, -0x28(%rbp)
jne 0x64c72
movq $0x1, -0x80(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x64c80
cmpq $0x1, -0x28(%rbp)
jne 0x64c88
movq $0x1, -0x78(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x64d48
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
cmpl $0x0, %eax
jne 0x64ccc
jmp 0x64d37
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
cmpl $0x1, %eax
jbe 0x64d00
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rcx
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x64ca0
movq -0x68(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x64d64
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x65546
movq -0x78(%rbp), %rax
addq -0x80(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
addq 0x8(%rcx), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x70(%rbp), %rax
jge 0x64dc0
movq -0x70(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x4, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
addq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jg 0x64df2
jmp 0x64e11
leaq 0x31ef99(%rip), %rdi    # 0x383d92
leaq 0x31d51b(%rip), %rsi    # 0x38231b
movl $0x4204, %edx           # imm = 0x4204
leaq 0x31efa2(%rip), %rcx    # 0x383dae
callq 0x2130
cmpq $0x0, -0x80(%rbp)
je 0x64e8a
movq -0x38(%rbp), %rax
movl %eax, -0x90(%rbp)
movq 0x18(%rbp), %rax
movl %eax, -0x94(%rbp)
movl $0x1, -0x8c(%rbp)
movl -0x98(%rbp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
orl $0x1, %eax
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl $0x0, %eax
movl %eax, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
addq $-0x1, %rcx
movq %rcx, -0x60(%rbp)
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jl 0x65103
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
cmpl $0x0, %eax
jne 0x64ec2
jmp 0x650f2
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
movl -0x98(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl $0x0, %eax
movl %eax, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movl -0x98(%rbp), %ecx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %eax, %ecx
movl %ecx, -0x98(%rbp)
movl %eax, -0x8c(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movl %eax, %eax
cmpq -0x20(%rbp), %rax
jge 0x64f83
movl -0x8c(%rbp), %ecx
addl $0x1, %ecx
movl -0x98(%rbp), %eax
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
addq $-0x1, %rcx
movq %rcx, -0x60(%rbp)
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
cmpl $0x1, %eax
jbe 0x650f0
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0xff, %ecx
subl %ecx, %eax
movl %eax, -0x90(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0xff, %ecx
subl %ecx, %eax
movl %eax, -0x94(%rbp)
movl -0x98(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl $0x0, %eax
movl %eax, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movl -0x98(%rbp), %ecx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %eax, %ecx
movl %ecx, -0x98(%rbp)
movl %eax, -0x8c(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movl %eax, %eax
cmpq -0x20(%rbp), %rax
jge 0x650c4
movl -0x8c(%rbp), %ecx
addl $0x1, %ecx
movl -0x98(%rbp), %eax
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
addq $-0x1, %rcx
movq %rcx, -0x60(%rbp)
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x650f2
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x64e96
cmpq $0x0, -0x78(%rbp)
je 0x6517c
movq -0x30(%rbp), %rax
movl %eax, -0x90(%rbp)
movq 0x10(%rbp), %rax
movl %eax, -0x94(%rbp)
movl $0x1, -0x8c(%rbp)
movl -0x98(%rbp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
orl $0x1, %eax
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl $0x0, %eax
movl %eax, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
addq $-0x1, %rcx
movq %rcx, -0x60(%rbp)
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
cmpq $0x0, -0x60(%rbp)
jne 0x65185
jmp 0x651a4
leaq 0x31eca7(%rip), %rdi    # 0x383e33
leaq 0x31d188(%rip), %rsi    # 0x38231b
movl $0x423c, %edx           # imm = 0x423C
leaq 0x31ec0f(%rip), %rcx    # 0x383dae
callq 0x2130
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
subq 0x8(%rcx), %rax
movq %rax, -0x60(%rbp)
movq %rax, -0x18(%rbp)
movq $-0x1, -0xb8(%rbp)
movq $-0x1, -0xc0(%rbp)
movq $-0x1, -0xa8(%rbp)
movq $-0x1, -0xb0(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x65201
movq -0x30(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x6521e
movq -0x38(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x18(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x653cb
cmpq $0x0, -0x48(%rbp)
jle 0x65289
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0xb0(%rbp), %rax
jne 0x65289
movq -0xc0(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movl %eax, 0x4(%rcx)
cmpl $0x0, %eax
je 0x65289
jmp 0x653ba
movq -0x48(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jge 0x652d5
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0xa8(%rbp), %rax
jne 0x652d5
movq -0xb8(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movl %eax, 0x4(%rcx)
cmpl $0x0, %eax
je 0x652d5
jmp 0x653ba
cmpq $0x0, -0x68(%rbp)
jle 0x65377
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x40(%rbp), %rcx
movq -0x68(%rbp), %rdx
subq $0x1, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
jbe 0x65340
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x40(%rbp), %rcx
movq -0x68(%rbp), %rdx
subq $0x1, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jbe 0x65340
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x40(%rbp), %rcx
movq -0x68(%rbp), %rdx
subq $0x1, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
ja 0x65375
movq $0x0, -0x88(%rbp)
jmp 0x65383
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rcx
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x65236
movq -0x68(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x653ea
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x65546
cmpq $0x0, -0x88(%rbp)
jne 0x654a8
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x18(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x2fd80
movq $0x1, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jg 0x654a6
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x6545a
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
je 0x65493
movq -0x50(%rbp), %rax
subq -0x58(%rbp), %rax
cmpq $0x1, %rax
jle 0x6548b
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x40(%rbp), %rsi
movq -0x50(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x30210
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x65495
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x65420
jmp 0x654a8
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rdi
movq -0x78(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
subq -0x78(%rbp), %rsi
subq -0x80(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x78(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdx
movq -0x10(%rbp), %rcx
addq $0x18, %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
callq 0x2a730
movq %rax, -0x18(%rbp)
movq -0x78(%rbp), %rax
addq -0x80(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x6553e
movq -0x40(%rbp), %rcx
movq -0x60(%rbp), %rax
subq $0x1, %rax
shlq $0x4, %rax
addq %rax, %rcx
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rdx
subq $0x1, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)