// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/horder.cpp
// Function: break_phasing_utg(ma_ug_t*, asg_t*, kvec_pe_hit*, kv_u_trans_t*, h_covs*)
void break_phasing_utg(ma_ug_t *ug, asg_t *rg, kvec_pe_hit *hits, kv_u_trans_t *k_trans, h_covs *b_points)
{
    if(b_points->n == 0) return;
    kv_u_trans_hit_t kv; kv_init(kv);
    asg_arc_t *rt = NULL, *ut = NULL;
    asg_t *utg = NULL;
    h_cov_t *p = NULL;
    h_covs join; kv_init(join);
    uint64_t k, l, i, idx, m, pidx, de_u, u_n, oug_n = ug->u.n, dug_n = 0, puid, pn, rsi, prid, nrid, x, y, *index = NULL;
    kv_u_trans_t *n_trans = NULL; CALLOC(n_trans, 1);
    kvec_t(uint64_t) dbg_N50; kv_init(dbg_N50);
    /*******************************for debug************************************/
    // debug_phasing_t *dbp = init_debug_phasing(ug, hits, k_trans, b_points);
    /*******************************for debug************************************/
    radix_sort_h_cov_s(b_points->a, b_points->a+b_points->n);
    for (k = 1, l = 0; k <= b_points->n; ++k) 
    {
        if (k == b_points->n || b_points->a[k].s != b_points->a[l].s)
        {
            de_u = 0; pn = join.n;
            radix_sort_h_cov_e(b_points->a+l, b_points->a+k);
            u_n = ug->u.a[b_points->a[l].s].n;
            for (i = l, pidx = 0; i < k; i++)
            {
                idx = b_points->a[i].e + 1;
                if(idx > pidx && idx - pidx < u_n)
                {
                    // fprintf(stderr, "sa-utg%.6lul, pidx: %lu, idx: %lu\n", b_points->a[l].s+1, pidx, idx);
                    if(append_sub_utg(ug, rg, b_points->a[l].s, pidx, idx, &rsi, NULL))
                    {
                        de_u++;
                        kv_pushp(h_cov_t, join, &p);
                        p->dp = (b_points->a[l].s<<32)|(ug->u.n-1);
                        p->s = rsi; p->e = ug->u.a[ug->u.n-1].len;
                        kv_push(uint64_t, dbg_N50, (uint64_t)(ug->u.a[ug->u.n-1].len)+((uint64_t)(1)<<63));///new nodes
                    }
                }
                pidx = idx;
            }

            idx = u_n;
            if(idx > pidx && idx - pidx < u_n)
            {
                // fprintf(stderr, "sa-utg%.6lul, pidx: %lu, idx: %lu\n", b_points->a[l].s+1, pidx, idx);
                if(append_sub_utg(ug, rg, b_points->a[l].s, pidx, idx, &rsi, NULL))
                {
                    de_u++;
                    kv_pushp(h_cov_t, join, &p);
                    p->dp = (b_points->a[l].s<<32)|(ug->u.n-1);
                    p->s = rsi; p->e = ug->u.a[ug->u.n-1].len;
                    kv_push(uint64_t, dbg_N50, (uint64_t)(ug->u.a[ug->u.n-1].len)+((uint64_t)(1)<<63));///new nodes
                }
            }

            if(de_u)
            {
                kv_push(uint64_t, dbg_N50, ug->u.a[b_points->a[l].s].len);///old nodes
                update_nus(&(ug->u.a[b_points->a[l].s]), ug, join.a + pn, join.n - pn);
                free(ug->u.a[b_points->a[l].s].a); free(ug->u.a[b_points->a[l].s].s);
                memset(&(ug->u.a[b_points->a[l].s]), 0, sizeof(ug->u.a[b_points->a[l].s]));
                dug_n++;
            }

            l = k;
        }
    }
    // fprintf(stderr, "oug_n-%lu, dug_n-%lu\n", oug_n, dug_n);
    // for (i = 0; i < join.n; i++)
    // {
    //     fprintf(stderr, "+p-utg%.6lul, n-utg%.6ul\n", (join.a[i].dp>>32)+1, ((uint32_t)join.a[i].dp)+1);
    // }

    for (i = 0; i < join.n; i++)
    {
        join.a[i].dp -= dug_n;
    }
    for (i = m = 0; i < ug->u.n; i++)
    {
        if(!ug->u.a[i].a) continue;
        if(i < oug_n)
        {
            kv_pushp(h_cov_t, join, &p);
            p->dp = (i<<32)|(m);///current id | updated id
            p->s = 0; p->e = ug->u.a[i].len;
        }

        ug->u.a[m] = ug->u.a[i];
        m++;
    }
    if(m < ug->u.n)
    {
        for (i = m; i < ug->u.n; i++)
        {
            memset(&(ug->u.a[i]), 0, sizeof(ug->u.a[i]));
        }
        ug->u.n = m;
    }
    radix_sort_h_cov_dp(join.a, join.a+join.n);
    CALLOC(index, ug->u.n);
    // for (i = 0; i < join.n; i++)
    // {
    //     fprintf(stderr, "+p-utg%.6lul (len: %u), n-utg%.6ul, s-%lu, e-%lu\n", 
    //             (join.a[i].dp>>32)+1, ug->g->seq[(join.a[i].dp>>32)].len, ((uint32_t)join.a[i].dp)+1, join.a[i].s, join.a[i].e);
    // }
    utg = asg_init();
    utg->n_arc = utg->m_arc = ug->g->n_arc;
    MALLOC(utg->arc, utg->n_arc);
    memcpy(utg->arc, ug->g->arc, utg->n_arc*sizeof(asg_arc_t));
    for (k = 1, l = 0; k <= join.n; ++k) 
    {
        if (k == join.n || ((join.a[k].dp>>32) != (join.a[l].dp>>32))) 
        {
            puid = (join.a[l].dp>>32);
            index[puid] = (l<<32) | (k-l);

            for (i = l; i < k; i++)
            {
                asg_seq_set(utg, (uint32_t)join.a[i].dp, ug->u.a[(uint32_t)join.a[i].dp].len, 0);
                utg->seq[(uint32_t)join.a[i].dp].c = ug->g->seq[puid].c;

                if(i + 1 >= k) continue;
                prid = ug->u.a[(uint32_t)join.a[i].dp].a[ug->u.a[(uint32_t)join.a[i].dp].n-1]>>32;
                nrid = ug->u.a[(uint32_t)join.a[i+1].dp].a[0]>>32;

                rt = get_r_edge(rg, prid, nrid, NULL);
                ut = asg_arc_pushp(utg); 
                x = (uint32_t)join.a[i].dp; x <<= 1;
                y = (uint32_t)join.a[i+1].dp; y <<= 1;
			    ut->ol = rt->ol, ut->del = 0;
			    ut->ul = (uint64_t)x<<32 | (ug->u.a[x>>1].len - ut->ol);
			    ut->v = y;

                rt = get_r_edge(rg, nrid^1, prid^1, NULL);
                ut = asg_arc_pushp(utg); 
                x = (uint32_t)join.a[i+1].dp; x <<= 1; x++;
                y = (uint32_t)join.a[i].dp; y <<= 1; y++;
                ut->ol = rt->ol, ut->del = 0;
                ut->ul = (uint64_t)x<<32 | (ug->u.a[x>>1].len - ut->ol);
			    ut->v = y;
            }
            update_unitig_ends(ug->g, utg->arc, puid, ((uint32_t)join.a[k-1].dp)<<1, (((uint32_t)join.a[l].dp)<<1)+1);
            l = k;
        }
    }
    asg_cleanup(utg);
    asg_destroy(ug->g);
    ug->g = utg;

    for (k = 0; k < k_trans->n; k++)
    {
        extract_novlp(&(k_trans->a[k]), &join, index, &kv, n_trans);
    }
    free(k_trans->a); free(k_trans->idx.a); memset(k_trans, 0, sizeof(*k_trans));
    k_trans->a = n_trans->a; k_trans->n = n_trans->n; k_trans->m = n_trans->m; 
    free(n_trans);

    clean_u_trans_t_idx_adv(k_trans, ug, rg);
    // clean_u_trans_t_idx(k_trans, ug, rg);

    
    uint64_t uID_bits, pos_mode;
    for (uID_bits=1; (uint64_t)(1<<uID_bits)<(uint64_t)ug->u.n; uID_bits++);
    pos_mode = ((uint64_t)-1)>>(uID_bits+1);
    
    for (k = m = 0; k < hits->a.n; k++)
    {
        if(get_new_offset(hits, k, index, &join, uID_bits))
        {
            hits->a.a[m] = hits->a.a[k];
            m++;
        }
    }
    // fprintf(stderr, "hits->a.n: %u, m: %lu\n", (uint32_t)hits->a.n, m);
    hits->a.n = m;  

    dedup_hits(hits, 0); 
    hits->uID_bits = uID_bits; hits->pos_mode = pos_mode;
    free(hits->idx.a); hits->idx.a = NULL; hits->idx.n = hits->idx.m = 0;
    free(hits->occ.a); hits->occ.a = NULL; hits->occ.n = hits->occ.m = 0;

    /*******************************for debug************************************/
    // debug_debug_phasing_t(dbp, ug, hits, k_trans, &join, index);
    // destory_debug_phasing_t(&dbp);
    /*******************************for debug************************************/
    verbose_misjoin(dbg_N50.a, dbg_N50.n);
    kv_destroy(join); kv_destroy(kv); free(index); kv_destroy(dbg_N50);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq 0x8(%r8), %rbx
testq %rbx, %rbx
jne 0x17290d
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, %r15
movq %rsi, %rax
movq %rdi, %r12
movq %rdx, 0xa8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
xorl %ecx, %ecx
movq %rcx, 0xc0(%rsp)
movq $0x0, 0x68(%rsp)
movq %rcx, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq (%rdi), %rcx
movq %rcx, 0x90(%rsp)
movl $0x1, %edi
movl $0x30, %esi
movq %rax, 0x38(%rsp)
movq %r8, 0x10(%rsp)
callq 0x2120
movq %rax, 0x98(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rdi
leaq (%rbx,%rbx,2), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x16d2c9
movl $0x1, %r9d
movq 0x10(%rsp), %r8
movq 0x8(%r8), %rax
movl $0x0, %r14d
movl $0x0, %ecx
movq %rcx, 0x20(%rsp)
testq %rax, %rax
movq %r12, 0x70(%rsp)
movq %r15, 0xa0(%rsp)
je 0x172eca
movq $0x0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
movq $0x0, 0x68(%rsp)
cmpq %rax, %r9
je 0x172a02
movq (%r8), %rax
leaq (%r9,%r9,2), %rcx
movq (%rax,%rcx,8), %rcx
leaq (,%r13,2), %rdx
addq %r13, %rdx
cmpq (%rax,%rdx,8), %rcx
je 0x172eba
movq %r14, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x80(%rsp)
movq (%r8), %rdi
leaq (,%r13,8), %rax
leaq (%rax,%rax,2), %rbx
leaq (%r9,%r9,2), %rax
leaq (%rdi,%rax,8), %rsi
addq %rbx, %rdi
movq %r9, 0x18(%rsp)
callq 0x16d51c
movq 0x18(%rsp), %r9
movq 0x10(%rsp), %r8
movq 0x10(%r12), %rax
movq (%r8), %rcx
movq %rbx, 0x60(%rsp)
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
movl 0x10(%rax,%rcx,8), %r15d
cmpq %r9, %r13
movq %r13, 0x78(%rsp)
jae 0x172c1a
movq %r13, %r14
leaq (%r13,%r13,2), %r13
leaq 0x8(,%r13,8), %rbp
movq $0x0, 0x58(%rsp)
xorl %ebx, %ebx
movq 0x38(%rsp), %rsi
movq %rbx, %rcx
movq (%r8), %rax
movq (%rax,%rbp), %rbx
incq %rbx
movq %rbx, %rdx
subq %rcx, %rdx
jbe 0x172c08
cmpq %r15, %rdx
jae 0x172c08
movq (%rax,%r13,8), %rdx
movq $0x0, (%rsp)
movq %r12, %rdi
movq %rbx, %r8
leaq 0x88(%rsp), %r9
callq 0x170ee4
testl %eax, %eax
je 0x172ba9
movq 0x48(%rsp), %r12
movq 0x50(%rsp), %rax
cmpq %rax, %r12
jne 0x172b0e
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x50(%rsp)
movq 0x40(%rsp), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
leaq 0x1(%r12), %rcx
movq %rcx, 0x48(%rsp)
leaq (%r12,%r12,2), %rcx
movq 0x10(%rsp), %r8
movq (%r8), %rdx
movq (%rdx,%r13,8), %rdx
shlq $0x20, %rdx
movq 0x70(%rsp), %r12
movq (%r12), %rsi
leaq -0x1(%rsi), %rdi
orq %rdx, %rdi
movq %rdi, 0x10(%rax,%rcx,8)
movq 0x88(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x10(%r12), %rdx
leaq (%rsi,%rsi,4), %rsi
movl -0x28(%rdx,%rsi,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rdx, 0x8(%rax,%rcx,8)
movq 0x30(%rsp), %rax
cmpq %rax, 0x20(%rsp)
jne 0x172bba
leaq (%rax,%rax), %r12
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x2370
movq 0x10(%rsp), %r8
movq %r12, 0x30(%rsp)
movq 0x70(%rsp), %r12
jmp 0x172bbf
movq 0x38(%rsp), %rsi
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
jmp 0x172c08
movq 0x28(%rsp), %rax
movq 0x38(%rsp), %rsi
movq 0x18(%rsp), %r9
incq 0x58(%rsp)
movq (%r12), %rdx
movq 0x10(%r12), %rcx
leaq (%rdx,%rdx,4), %rdx
movl -0x28(%rcx,%rdx,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
orq %rcx, %rdx
movq 0x20(%rsp), %rcx
movq %rax, 0x28(%rsp)
movq %rdx, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0x20(%rsp)
incq %r14
addq $0x18, %rbp
cmpq %r14, %r9
jne 0x172a8a
jmp 0x172c2a
xorl %ebx, %ebx
movq $0x0, 0x58(%rsp)
movq 0x38(%rsp), %rsi
movq %r15, %rax
subq %rbx, %rax
jbe 0x172d43
cmpq %r15, %rax
jae 0x172d43
movq (%r8), %rax
movq 0x78(%rsp), %rcx
leaq (%rcx,%rcx,2), %r14
movq (%rax,%r14,8), %rdx
movq $0x0, (%rsp)
movq %r12, %rdi
movq %rbx, %rcx
movq %r15, %r8
leaq 0x88(%rsp), %r9
callq 0x170ee4
testl %eax, %eax
je 0x172d4a
movq 0x48(%rsp), %rbx
movq 0x50(%rsp), %rax
cmpq %rax, %rbx
jne 0x172cb0
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x50(%rsp)
movq 0x40(%rsp), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
leaq 0x1(%rbx), %rcx
movq %rcx, 0x48(%rsp)
leaq (%rbx,%rbx,2), %rcx
movq 0x10(%rsp), %r8
movq (%r8), %rdx
movq (%rdx,%r14,8), %rdx
shlq $0x20, %rdx
movq (%r12), %rsi
leaq -0x1(%rsi), %rdi
orq %rdx, %rdi
movq %rdi, 0x10(%rax,%rcx,8)
movq 0x88(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x10(%r12), %rdx
leaq (%rsi,%rsi,4), %rsi
movl -0x28(%rdx,%rsi,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rdx, 0x8(%rax,%rcx,8)
movq 0x30(%rsp), %rax
cmpq %rax, 0x20(%rsp)
jne 0x172d60
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x2370
movq 0x10(%rsp), %r8
movq %rax, %r14
movq %rbx, 0x30(%rsp)
jmp 0x172d65
movq 0x28(%rsp), %r14
jmp 0x172d59
movq 0x28(%rsp), %r14
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
movq 0x58(%rsp), %rdx
jmp 0x172da6
movq 0x28(%rsp), %r14
movq 0x18(%rsp), %r9
movq 0x58(%rsp), %rdx
incq %rdx
movq (%r12), %rax
movq 0x10(%r12), %rcx
leaq (%rax,%rax,4), %rax
movl -0x28(%rcx,%rax,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
orq %rcx, %rax
movq 0x20(%rsp), %rcx
movq %rax, (%r14,%rcx,8)
incq %rcx
movq %rcx, 0x20(%rsp)
testq %rdx, %rdx
je 0x172eb7
movq 0x30(%rsp), %rax
cmpq %rax, 0x20(%rsp)
jne 0x172de8
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq %r14, %rdi
callq 0x2370
movq 0x10(%rsp), %r8
movq %rax, %r14
movq %rbx, 0x30(%rsp)
movq 0x10(%r12), %rax
movq (%r8), %rcx
movq 0x60(%rsp), %rbx
movq (%rcx,%rbx), %rdx
leaq (%rdx,%rdx,4), %rdx
movl (%rax,%rdx,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq 0x20(%rsp), %rsi
movq %rdx, (%r14,%rsi,8)
incq %rsi
movq %rsi, 0x20(%rsp)
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x80(%rsp), %rax
leaq (%rax,%rax,2), %rdx
shlq $0x3, %rdx
addq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
subq %rax, %rcx
callq 0x171767
movq 0x10(%r12), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
movq 0x18(%rax,%rcx,8), %rdi
callq 0x2220
movq 0x10(%r12), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
movq 0x20(%rax,%rcx,8), %rdi
callq 0x2220
movq 0x10(%rsp), %r8
movq 0x10(%r12), %rax
movq (%r8), %rcx
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax,%rcx,8)
movups %xmm0, (%rax,%rcx,8)
movq $0x0, 0x20(%rax,%rcx,8)
incq 0x68(%rsp)
movq 0x18(%rsp), %r9
movq %r9, %r13
incq %r9
movq 0x8(%r8), %rax
cmpq %rax, %r9
jbe 0x1729dd
movq %r14, 0x28(%rsp)
movq 0x48(%rsp), %rax
testq %rax, %rax
movq 0x68(%rsp), %rdx
je 0x172ef3
movq 0x40(%rsp), %rcx
addq $0x10, %rcx
subq %rdx, (%rcx)
addq $0x18, %rcx
decq %rax
jne 0x172ee7
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %r14
movq 0x50(%rsp), %rcx
movq (%r12), %rdx
testq %rdx, %rdx
movq 0x90(%rsp), %r8
jne 0x172f1a
xorl %ebx, %ebx
jmp 0x172fec
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x10(%r12), %rdx
cmpq $0x0, 0x18(%rdx,%r13)
je 0x172fcb
cmpq %r8, %rbp
jae 0x172fa1
cmpq %rcx, %r14
jne 0x172f73
leaq (%rcx,%rcx), %r12
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %r12
leaq (,%r12,8), %rcx
leaq (%rcx,%rcx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq 0x90(%rsp), %r8
movq %r12, %rcx
movq 0x70(%rsp), %r12
leaq (%r14,%r14,2), %rdx
incq %r14
movq %r15, %rsi
orq %rbx, %rsi
movq %rsi, 0x10(%rax,%rdx,8)
movq $0x0, (%rax,%rdx,8)
movq 0x10(%r12), %rsi
movl (%rsi,%r13), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %rsi, 0x8(%rax,%rdx,8)
movq 0x10(%r12), %rdx
leaq (%rbx,%rbx,4), %rsi
movq 0x20(%rdx,%r13), %rdi
movq %rdi, 0x20(%rdx,%rsi,8)
movups (%rdx,%r13), %xmm0
movups 0x10(%rdx,%r13), %xmm1
movups %xmm1, 0x10(%rdx,%rsi,8)
movups %xmm0, (%rdx,%rsi,8)
incq %rbx
incq %rbp
movq (%r12), %rdx
addq $0x28, %r13
movabsq $0x100000000, %rsi      # imm = 0x100000000
addq %rsi, %r15
cmpq %rdx, %rbp
jb 0x172f24
movq %r14, 0x48(%rsp)
movq %rcx, 0x50(%rsp)
movq %rax, 0x40(%rsp)
cmpq %rdx, %rbx
jae 0x173040
cmpq (%r12), %rbx
jae 0x17303c
leaq (,%rbx,8), %rax
leaq (%rax,%rax,4), %rax
xorps %xmm0, %xmm0
movq %rbx, %rcx
movq 0x10(%r12), %rdx
movups %xmm0, 0x10(%rdx,%rax)
movups %xmm0, (%rdx,%rax)
movq $0x0, 0x20(%rdx,%rax)
incq %rcx
addq $0x28, %rax
cmpq (%r12), %rcx
jb 0x173018
movq %rbx, (%r12)
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %r14
leaq (%r14,%r14,2), %rax
leaq (%rbx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x16d762
movq (%r12), %rdi
movl $0x8, %esi
callq 0x2120
movq %rax, 0x60(%rsp)
callq 0x9fccc
movq %rax, %rbp
movq 0x18(%r12), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, (%rbp)
movl $0x80000000, %ecx       # imm = 0x80000000
andl 0x4(%rbp), %ecx
orl %eax, %ecx
movl %ecx, 0x4(%rbp)
shlq $0x3, %rax
leaq (%rax,%rax,2), %r15
movq %r15, %rdi
callq 0x2280
movq %rax, 0x8(%rbp)
movq 0x18(%r12), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x2160
testq %r14, %r14
je 0x17344a
leaq -0x8(%rbx), %rax
movq %rax, 0x68(%rsp)
movl $0x1, %edx
xorl %r13d, %r13d
movq %rbx, 0x18(%rsp)
movq %r14, 0x78(%rsp)
cmpq %r14, %rdx
je 0x173106
leaq (%rdx,%rdx,2), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
movq 0x10(%rbx,%rcx,8), %rcx
xorq 0x10(%rbx,%rax,8), %rcx
shrq $0x20, %rcx
je 0x17343e
leaq (,%r13,2), %rax
addq %r13, %rax
movq %rax, 0x80(%rsp)
movq 0x10(%rbx,%rax,8), %rsi
shrq $0x20, %rsi
movq %r13, %rax
shlq $0x20, %rax
movq %rdx, %rcx
subq %r13, %rcx
orq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rsi, 0x10(%rsp)
movq %rcx, (%rax,%rsi,8)
cmpq %r13, %rdx
movq %rdx, %r14
jbe 0x1733f9
movq %r14, 0x58(%rsp)
leaq (,%r13,2), %r15
addq %r13, %r15
movq 0x10(%rbx,%r15,8), %rsi
movl %esi, %eax
movq 0x10(%r12), %rcx
leaq (%rax,%rax,4), %rax
movl (%rcx,%rax,8), %edx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %edx
movq %rbp, %rdi
xorl %ecx, %ecx
callq 0xa0115
movq 0x18(%r12), %rax
movq 0x20(%rax), %rax
movq 0x10(%rsp), %rcx
movb 0x4(%rax,%rcx,8), %cl
movq 0x20(%rbp), %rdx
movl 0x10(%rbx,%r15,8), %eax
movb %cl, 0x4(%rdx,%rax,8)
incq %r13
cmpq %r14, %r13
jae 0x1733f0
movq 0x10(%r12), %rcx
leaq (%rax,%rax,4), %rax
movq 0x18(%rcx,%rax,8), %rdx
movl 0x10(%rcx,%rax,8), %eax
decl %eax
movq (%rdx,%rax,8), %r14
shrq $0x20, %r14
leaq (,%r13,2), %rsi
addq %r13, %rsi
movl 0x10(%rbx,%rsi,8), %eax
leaq (%rax,%rax,4), %rax
movq 0x18(%rcx,%rax,8), %rax
movl 0x4(%rax), %ebx
movq 0x38(%rsp), %r10
movq 0x28(%r10), %rax
movq (%rax,%r14,8), %rcx
movq %rcx, %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rax
je 0x173224
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %r12
shlq $0x3, %r12
addq 0x8(%r10), %r12
cmpl $0x0, 0xc(%r12)
js 0x17321b
cmpl 0x8(%r12), %ebx
je 0x173227
addq $0x18, %r12
decq %rax
jne 0x17320c
xorl %r12d, %r12d
movl 0x4(%rbp), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %ecx
movl (%rbp), %eax
cmpl %eax, %ecx
jne 0x173272
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x10, %eax
cmovel %eax, %ecx
movl %ecx, (%rbp)
movq 0x8(%rbp), %rdi
shlq $0x3, %rcx
movq %r13, 0x30(%rsp)
movq %rsi, %r13
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %r13, %rsi
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %r10
movq %rax, 0x8(%rbp)
movq 0x18(%rsp), %rax
leaq (%rax,%r15,8), %rdi
addq $0x10, %rdi
leaq 0x10(%rax,%rsi,8), %r15
movq 0x8(%rbp), %rax
movl 0x4(%rbp), %ecx
movq %rcx, %rdx
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
andq %r11, %rdx
leal 0x1(%rcx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %esi, %ecx
movl %ecx, 0x4(%rbp)
leaq (%rdx,%rdx,2), %rcx
movq %rdi, 0x30(%rsp)
movq (%rdi), %rdx
movl %edx, %esi
movl (%r15), %edi
movl 0xc(%r12), %r8d
andq %r11, %r8
movl %r8d, 0xc(%rax,%rcx,8)
movq 0x70(%rsp), %r12
movq 0x10(%r12), %r9
leaq (%rsi,%rsi,4), %rsi
movl (%r9,%rsi,8), %esi
andq %r11, %rsi
subq %r8, %rsi
shlq $0x21, %rdx
orq %rdx, %rsi
movq %rsi, (%rax,%rcx,8)
addl %edi, %edi
movl %edi, 0x8(%rax,%rcx,8)
xorq $0x1, %rbx
movq 0x28(%r10), %rax
movq (%rax,%rbx,8), %rcx
movq %rcx, %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rax
je 0x173335
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %rbx
shlq $0x3, %rbx
addq 0x8(%r10), %rbx
cmpl $0x0, 0xc(%rbx)
js 0x17332c
movl 0x8(%rbx), %ecx
xorl %r14d, %ecx
cmpl $0x1, %ecx
je 0x173337
addq $0x18, %rbx
decq %rax
jne 0x17331b
xorl %ebx, %ebx
movl 0x4(%rbp), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %ecx
movl (%rbp), %eax
cmpl %eax, %ecx
movq 0x58(%rsp), %r14
jne 0x173372
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x10, %eax
cmovel %eax, %ecx
movl %ecx, (%rbp)
movq 0x8(%rbp), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x8(%rbp)
movq 0x8(%rbp), %rax
movl 0x4(%rbp), %ecx
movq %rcx, %rdx
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
andq %r10, %rdx
leal 0x1(%rcx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %esi, %ecx
movl %ecx, 0x4(%rbp)
leaq (%rdx,%rdx,2), %rcx
movq (%r15), %rdx
movl %edx, %esi
movq 0x30(%rsp), %rdi
movl (%rdi), %edi
movl 0xc(%rbx), %r8d
andq %r10, %r8
movl %r8d, 0xc(%rax,%rcx,8)
shlq $0x21, %rdx
movq 0x10(%r12), %r9
leaq (%rsi,%rsi,4), %rsi
movl (%r9,%rsi,8), %esi
andq %r10, %rsi
subq %r8, %rsi
movabsq $0x100000000, %r8       # imm = 0x100000000
orq %r8, %rdx
orq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
leal 0x1(,%rdi,2), %edx
movl %edx, 0x8(%rax,%rcx,8)
movq 0x18(%rsp), %rbx
cmpq %r14, %r13
jne 0x173151
movq 0x80(%rsp), %rax
leaq (%rbx,%rax,8), %rax
addq $0x10, %rax
movq 0x18(%r12), %rdi
movq 0x8(%rbp), %rsi
leaq (%r14,%r14,2), %rcx
movq 0x68(%rsp), %rdx
movl (%rdx,%rcx,8), %ecx
addl %ecx, %ecx
movl (%rax), %r8d
addl %r8d, %r8d
incq %r8
movq 0x10(%rsp), %rdx
callq 0x171ebd
movq %r14, %r13
movq %r14, %rdx
movq 0x78(%rsp), %r14
incq %rdx
cmpq %r14, %rdx
jbe 0x1730de
movq %rbp, %rdi
callq 0xa02fa
movq 0x18(%r12), %rdi
callq 0x9fcdb
movq %rbp, 0x18(%r12)
movq 0xa0(%rsp), %r13
cmpq $0x0, (%r13)
movq 0x98(%rsp), %rbp
movq 0x60(%rsp), %rbx
je 0x1734b2
xorl %r14d, %r14d
leaq 0xb0(%rsp), %r15
xorl %r12d, %r12d
movq 0x10(%r13), %rdi
addq %r14, %rdi
leaq 0x40(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
movq %rbp, %r8
callq 0x172325
incq %r12
addq $0x30, %r14
cmpq (%r13), %r12
jb 0x17348b
movq 0x10(%r13), %rdi
callq 0x2220
movq 0x28(%r13), %rdi
callq 0x2220
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r13)
movups %xmm0, 0x10(%r13)
movups %xmm0, (%r13)
movq 0x10(%rbp), %rax
movq %rax, 0x10(%r13)
movq (%rbp), %rax
movq %rax, (%r13)
movq 0x8(%rbp), %rax
movq %rax, 0x8(%r13)
movq %rbp, %rdi
callq 0x2220
movq %r13, %rdi
movq 0x70(%rsp), %rbx
movq %rbx, %rsi
movq 0x38(%rsp), %rdx
callq 0xc3b24
movq (%rbx), %rax
movl $0x1, %ebx
movl $0x1, %edx
movl %ebx, %ecx
shll %cl, %edx
movslq %edx, %rcx
incq %rbx
cmpq %rcx, %rax
ja 0x173513
movq $-0x1, %rax
movl %ebx, %ecx
shrq %cl, %rax
movq %rax, 0x38(%rsp)
decq %rbx
movq 0xa8(%rsp), %r14
cmpq $0x0, (%r14)
jne 0x173553
xorl %r13d, %r13d
movq 0x60(%rsp), %rdx
jmp 0x1735ab
xorl %ebp, %ebp
leaq 0x40(%rsp), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x60(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rcx
movq %rbx, %r8
callq 0x1726a2
testl %eax, %eax
je 0x17359a
movq 0x10(%r14), %rax
movq %r13, %rcx
shlq $0x5, %rcx
movups (%rax,%rbp), %xmm0
movups 0x10(%rax,%rbp), %xmm1
movups %xmm1, 0x10(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
incq %r13
incq %r12
addq $0x20, %rbp
cmpq (%r14), %r12
movq 0x60(%rsp), %rdx
jb 0x173565
movq %r13, (%r14)
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
movq %rdx, %r12
callq 0x15892
movq %rbx, 0x48(%r14)
movq 0x38(%rsp), %rax
movq %rax, 0x50(%r14)
movq 0x28(%r14), %rdi
callq 0x2220
movq %r15, 0x28(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r14)
movq 0x40(%r14), %rdi
callq 0x2220
movq %r15, 0x40(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r14)
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x207ef
movq 0x40(%rsp), %rdi
callq 0x2220
movq 0xc0(%rsp), %rdi
callq 0x2220
movq %r12, %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2220
jmp 0x1728fb