// File: chhylp123[P]hifiasm/Correct.cpp
// Function: gen_region_phase(overlap_region*, unsigned long*, unsigned long, unsigned long, unsigned long, unsigned long, ul_ov_t*, asg64_v*, asg64_v*)
uint64_t gen_region_phase(overlap_region* ol, uint64_t *id_a, uint64_t id_n, uint64_t s, uint64_t e, uint64_t dp, ul_ov_t *c_idx, asg64_v *buf, asg64_v *ovidx)
{
    if(!id_n) return id_n;
    uint64_t k, m, mn, q[2], buf_n, rm_n, oid; int64_t err, msc, msc_k, msc_n;
    overlap_region *z; ul_ov_t *p; buf->n = 0; kv_resize(uint64_t, *buf, dp);
    for (k = buf_n = rm_n = 0; k < id_n; k++) {
        p = &(c_idx[id_a[k]]);
        q[0] = ol[ovlp_id(*p)].w_list.a[ovlp_min_wid(*p)].x_start;
        q[1] = ol[ovlp_id(*p)].w_list.a[ovlp_max_wid(*p)].x_end+1;
        if(q[0]<=s && q[1]>=e) {
            kv_push(uint64_t, *buf, id_a[k]);
            // buf[buf_n++] = id_a[k];
        }
        if(q[1] < e) rm_n++;
    }
    buf_n = buf->n;
    assert(buf_n == dp);//not right

    if(buf_n > 0) {
        for (k = 0, msc = INT32_MAX, msc_k = -1, msc_n = 0; k < buf_n; k++) {
            p = &(c_idx[(uint32_t)buf->a[k]]); z = &(ol[ovlp_id(*p)]); 
            // fprintf(stderr, "+++[M::%s::utg%.6dl] wid::%u, xoff::%u, coff::%u\n", __func__, 
            //     (int32_t)ol[ovlp_id(*p)].y_id+1, ovlp_cur_wid(*p), ovlp_cur_xoff(*p), ovlp_cur_coff(*p));
            err = extract_sub_cigar_err(z, s, e, p);
            // int64_t debug_err = extract_sub_cigar_err_debug(z, s, e);
            // assert(err == debug_err);
            // fprintf(stderr, "[M::%s::] err::%ld, debug_err::%ld\n", __func__, err, debug_err);

            // fprintf(stderr, "---[M::%s::utg%.6dl] wid::%u, xoff::%u, coff::%u, err::%ld\n", __func__, 
            //     (int32_t)ol[ovlp_id(*p)].y_id+1, ovlp_cur_wid(*p), ovlp_cur_xoff(*p), ovlp_cur_coff(*p), err);
            fprintf(stderr, "---[M::%s::utg%.6dl] xoff::[%lu, %lu), err::%ld\n", __func__, 
                (int32_t)ol[ovlp_id(*p)].y_id+1, s, e, err);
            assert(err >= 0);  
            if(err < msc) {
                msc = err; msc_k = k; msc_n = 1;
            } else if(err == msc) {
                msc_n++;
            }
            buf->a[k] |= (((uint64_t)err)<<32);       
        }

        if(msc_n == 1) {
            p = &(c_idx[(uint32_t)buf->a[msc_k]]);
            z = &(ol[ovlp_id(*p)]); mn = 1;
            if(msc_k != 0) {
                m = buf->a[msc_k]; 
                buf->a[msc_k] = buf->a[0]; 
                buf->a[0] = m;
            }
        } else {
            for (k = mn = 0; k < buf_n && (int64_t)mn < msc_n; k++) {
                p = &(c_idx[(uint32_t)buf->a[k]]); 
                z = &(ol[ovlp_id(*p)]); 
                if((buf->a[k]>>32) == (uint64_t)msc) {
                    if(mn != k) {
                        m = buf->a[k]; 
                        buf->a[k] = buf->a[mn]; 
                        buf->a[mn] = m;
                    }
                    mn++;
                }
            }
        }
        // fprintf(stderr, "[M::%s] buf_n::%ld, msc_n::%ld, mn::%lu\n", __func__, buf_n, msc_n, mn);
        for (k = 0; k < buf_n; k++) {
            oid = ovlp_id((c_idx[(uint32_t)buf->a[k]]));
            buf->a[k] >>= 32; buf->a[k] <<= 32; buf->a[k] |= oid;
            ol[oid].overlapLen = k;
            // if(s == 158482) fprintf(stderr, "k->%ld::oid->%ld[M::%s::utg%.6dl] pos::[%lu, %lu)\n", k, oid, __func__,  
            //                         (int32_t)ol[oid].y_id+1, s, e);
        }

        for (k = 0; k < mn; k++) {///best alignment
            z = &(ol[id_get(buf->a[k])]); 
            reassign_sec_err(ol, ovidx, buf, k);
            push_sec_aln(z, s, e, 0);
        }

        for (k = mn; k < buf_n; k++) {
            z = &(ol[id_get(buf->a[k])]); 
            push_sec_aln(z, s, e, ((buf->a[k]&id_set)?(0):(err_get(buf->a[k])-msc)));
        }

        for (k = 0; k < buf_n; k++) {
            ol[id_get(buf->a[k])].overlapLen = (uint32_t)-1;
        }
    }


    if(rm_n) {
        for (k = m = 0; k < id_n; k++) {
            p = &(c_idx[id_a[k]]);
            q[1] = ol[ovlp_id(*p)].w_list.a[ovlp_max_wid(*p)].x_end+1;
            if(q[1] < e) continue;
            id_a[m++] = id_a[k];
        }
        id_n = m;
    }
    return id_n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
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)
cmpq $0x0, -0x20(%rbp)
jne 0x6c603
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6cf2d
movq 0x18(%rbp), %rax
movq $0x0, (%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x38(%rbp), %rax
jae 0x6c6e7
movq -0x38(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x6c6e9
movq $0x0, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x6c87a
movq 0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xa8(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xa8(%rbp), %rcx
movl 0x14(%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x58(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x28(%rbp), %rax
ja 0x6c851
movq -0x58(%rbp), %rax
cmpq -0x30(%rbp), %rax
jb 0x6c851
jmp 0x6c7b5
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x6c826
movq 0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x6c7e5
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xb0(%rbp)
jmp 0x6c7f3
movl $0x2, %eax
movq %rax, -0xb0(%rbp)
jmp 0x6c7f3
movq -0xb0(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x6c851
movq -0x58(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x6c867
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x6c869
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6c701
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x6c891
jmp 0x6c8b0
leaq 0x317ee9(%rip), %rdi    # 0x384781
leaq 0x315a7c(%rip), %rsi    # 0x38231b
movl $0x4755, %edx           # imm = 0x4755
leaq 0x317ee2(%rip), %rcx    # 0x38478d
callq 0x2130
cmpq $0x0, -0x68(%rbp)
jbe 0x6ce60
movq $0x0, -0x40(%rbp)
movq $0x7fffffff, -0x88(%rbp) # imm = 0x7FFFFFFF
movq $-0x1, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x6ca47
movq 0x10(%rbp), %rax
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x40(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0xa8(%rbp), %rcx
callq 0x6b720
movq %rax, -0x80(%rbp)
movq 0x357685(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x80(%rbp), %rax
leaq 0x317e7f(%rip), %rsi    # 0x38480e
leaq 0x317ea9(%rip), %rdx    # 0x38483f
movq %rax, (%rsp)
movb $0x0, %al
callq 0x22a0
cmpq $0x0, -0x80(%rbp)
jl 0x6c9aa
jmp 0x6c9c9
leaq 0x317e9f(%rip), %rdi    # 0x384850
leaq 0x315963(%rip), %rsi    # 0x38231b
movl $0x4765, %edx           # imm = 0x4765
leaq 0x317dc9(%rip), %rcx    # 0x38478d
callq 0x2130
movq -0x80(%rbp), %rax
cmpq -0x88(%rbp), %rax
jge 0x6c9f9
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x90(%rbp)
movq $0x1, -0x98(%rbp)
jmp 0x6ca1a
movq -0x80(%rbp), %rax
cmpq -0x88(%rbp), %rax
jne 0x6ca18
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x6ca1a
movq -0x80(%rbp), %rdx
shlq $0x20, %rdx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6c8e4
cmpq $0x1, -0x98(%rbp)
jne 0x6caf6
movq 0x10(%rbp), %rax
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x90(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq $0x1, -0x50(%rbp)
cmpq $0x0, -0x90(%rbp)
je 0x6caf1
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x90(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rcx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, (%rax)
jmp 0x6cc0e
movq $0x0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq -0x68(%rbp), %rcx
movb %al, -0xb1(%rbp)
jae 0x6cb2c
movq -0x50(%rbp), %rax
cmpq -0x98(%rbp), %rax
setl %al
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x6cb3b
jmp 0x6cc0c
movq 0x10(%rbp), %rax
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x40(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpq -0x88(%rbp), %rax
jne 0x6cbf9
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x6cbed
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rdx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x50(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x6cbfb
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6cb06
jmp 0x6cc0e
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x6ccb9
movq 0x10(%rbp), %rax
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x40(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq %rax, -0x78(%rbp)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x78(%rbp), %rdx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
imulq $0xa8, -0x78(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6cc16
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x6cd2d
movq -0x10(%rbp), %rax
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x40(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
movq 0x20(%rbp), %rsi
movq 0x18(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x6c310
movq -0xa0(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x6bfc0
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6ccc1
movq -0x50(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x6ce17
movq -0x10(%rbp), %rax
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x40(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x40(%rbp), %rdx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x6cdb9
xorl %eax, %eax
movq %rax, -0xd8(%rbp)
jmp 0x6cde5
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x40(%rbp), %rdx
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
andq (%rcx,%rdx,8), %rax
shrq $0x20, %rax
subq -0x88(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xc0(%rbp), %rdx
movq -0xc8(%rbp), %rsi
movq -0xd0(%rbp), %rdi
movq -0xd8(%rbp), %rcx
callq 0x6bfc0
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6cd35
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x6ce5e
movq -0x10(%rbp), %rax
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x40(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6ce1f
jmp 0x6ce60
cmpq $0x0, -0x70(%rbp)
je 0x6cf25
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x6cf1d
movq 0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xa8(%rbp), %rcx
movl 0x14(%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x6cee9
jmp 0x6cf0c
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x48(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6ce7b
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)