// File: /workspace/github_cpp_makefile_star2_O3/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 $0xd8, %rsp
movq 0x8(%r8), %rbx
testq %rbx, %rbx
jne 0x179496
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r8, %r15
movq %rsi, %rax
movq %rdi, %rbp
movq %rcx, 0xa0(%rsp)
movq %rdx, 0xb0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
xorl %ecx, %ecx
movq %rcx, 0xd0(%rsp)
movq $0x0, 0x20(%rsp)
movq %rcx, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq (%rdi), %rcx
movq %rcx, 0xb8(%rsp)
movl $0x1, %r12d
movl $0x1, %edi
movl $0x30, %esi
movq %rax, 0x58(%rsp)
callq 0x2120
movq %rax, 0xa8(%rsp)
movq (%r15), %rdi
leaq (%rbx,%rbx,2), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x173cff
movq 0x8(%r15), %rax
movl $0x0, %ecx
movq %rcx, 0x18(%rsp)
testq %rax, %rax
movq %rbp, 0x10(%rsp)
je 0x179a0c
movq $0x0, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x98(%rsp)
movq %r15, 0x68(%rsp)
movq (%r15), %rdi
cmpq %rax, %r12
je 0x17957d
leaq (%r12,%r12,2), %rax
movq (%rdi,%rax,8), %rax
leaq (%r14,%r14,2), %rcx
cmpq (%rdi,%rcx,8), %rax
je 0x1799f2
movq 0x38(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq (,%r14,8), %rax
leaq (%rax,%rax,2), %rbx
leaq (%r12,%r12,2), %rax
leaq (%rdi,%rax,8), %rsi
addq %rbx, %rdi
callq 0x173f52
movq 0x10(%rbp), %rax
movq (%r15), %rcx
movq %rbx, 0x60(%rsp)
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
movl 0x10(%rax,%rcx,8), %r13d
cmpq %r12, %r14
movq %r14, 0x88(%rsp)
jae 0x17977e
leaq (%r14,%r14,2), %rax
movq %rax, 0x70(%rsp)
leaq 0x8(,%rax,8), %rbx
movq $0x0, 0x50(%rsp)
xorl %ebp, %ebp
movq 0x58(%rsp), %rsi
movq %r12, 0x80(%rsp)
movq %rbp, %rcx
movq (%r15), %rax
movq (%rax,%rbx), %rbp
incq %rbp
movq %rbp, %rdx
subq %rcx, %rdx
jbe 0x17976c
cmpq %r13, %rdx
jae 0x17976c
movq 0x70(%rsp), %rdx
movq (%rax,%rdx,8), %rdx
movq $0x0, (%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %r8
leaq 0x90(%rsp), %r9
callq 0x177adb
testl %eax, %eax
je 0x17971e
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %r12
cmpq 0x40(%rsp), %r12
jne 0x179686
leaq (%r12,%r12), %rcx
testq %r12, %r12
movl $0x2, %edx
cmoveq %rdx, %rcx
movq %rcx, 0x40(%rsp)
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x30(%rsp)
leaq 0x1(%r12), %rcx
movq %rcx, 0x38(%rsp)
leaq (%r12,%r12,2), %rsi
movq 0x68(%rsp), %rcx
movq (%rcx), %rcx
movq 0x70(%rsp), %rdx
movq (%rcx,%rdx,8), %rdx
shlq $0x20, %rdx
movq 0x10(%rsp), %r12
movq (%r12), %rcx
leaq -0x1(%rcx), %rdi
orq %rdx, %rdi
movq %rdi, 0x10(%rax,%rsi,8)
movq 0x90(%rsp), %rdx
movq %rdx, (%rax,%rsi,8)
movq 0x10(%r12), %rdx
leaq (%rcx,%rcx,4), %rdi
movl -0x28(%rdx,%rdi,8), %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movq %rdi, 0x8(%rax,%rsi,8)
cmpq 0x28(%rsp), %r15
jne 0x179725
leaq (%r15,%r15), %rcx
testq %r15, %r15
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x28(%rsp)
leaq (,%rcx,8), %rsi
movq 0x18(%rsp), %rdi
callq 0x2370
movq (%r12), %rcx
movq 0x10(%r12), %rdx
movq %rax, %rdi
jmp 0x17972a
movq 0x58(%rsp), %rsi
jmp 0x17976c
movq 0x18(%rsp), %rdi
movq 0x58(%rsp), %rsi
incq 0x50(%rsp)
leaq (%rcx,%rcx,4), %rax
movl -0x28(%rdx,%rax,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
orq %rcx, %rax
movq %rdi, 0x18(%rsp)
movq %rax, (%rdi,%r15,8)
incq %r15
movq %r15, 0x20(%rsp)
movq 0x68(%rsp), %r15
movq 0x80(%rsp), %r12
incq %r14
addq $0x18, %rbx
cmpq %r14, %r12
jne 0x1795f6
jmp 0x17978e
xorl %ebp, %ebp
movq $0x0, 0x50(%rsp)
movq 0x58(%rsp), %rsi
movq %r13, %rax
subq %rbp, %rax
jbe 0x1798a6
cmpq %r13, %rax
jae 0x1798a6
movq (%r15), %rax
movq 0x88(%rsp), %rcx
leaq (%rcx,%rcx,2), %rbx
movq (%rax,%rbx,8), %rdx
movq $0x0, (%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rcx
movq %r13, %r8
leaq 0x90(%rsp), %r9
callq 0x177adb
testl %eax, %eax
je 0x1798a6
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %r14
cmpq 0x40(%rsp), %r14
jne 0x179819
leaq (%r14,%r14), %rcx
testq %r14, %r14
movl $0x2, %edx
cmoveq %rdx, %rcx
movq %rcx, 0x40(%rsp)
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rbp
leaq 0x1(%r14), %rcx
movq %rcx, 0x38(%rsp)
leaq (%r14,%r14,2), %rsi
movq (%r15), %rcx
movq (%rcx,%rbx,8), %rdx
shlq $0x20, %rdx
movq (%rbp), %rcx
leaq -0x1(%rcx), %rdi
orq %rdx, %rdi
movq %rdi, 0x10(%rax,%rsi,8)
movq 0x90(%rsp), %rdx
movq %rdx, (%rax,%rsi,8)
movq 0x10(%rbp), %rdx
leaq (%rcx,%rcx,4), %rdi
movl -0x28(%rdx,%rdi,8), %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movq %rdi, 0x8(%rax,%rsi,8)
movq 0x28(%rsp), %rax
cmpq %rax, 0x20(%rsp)
jne 0x1798b2
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq 0x18(%rsp), %rdi
callq 0x2370
movq (%rbp), %rcx
movq 0x10(%rbp), %rdx
movq %rbx, 0x28(%rsp)
jmp 0x1798b7
movq 0x10(%rsp), %rbp
movq 0x50(%rsp), %rsi
jmp 0x1798f0
movq 0x18(%rsp), %rax
movq 0x50(%rsp), %rsi
incq %rsi
leaq (%rcx,%rcx,4), %rcx
movl -0x28(%rdx,%rcx,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
orq %rcx, %rdx
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0x20(%rsp)
testq %rsi, %rsi
movq 0x28(%rsp), %rax
je 0x1799ef
cmpq %rax, 0x20(%rsp)
jne 0x17992e
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq 0x18(%rsp), %rdi
callq 0x2370
movq %rbx, 0x28(%rsp)
jmp 0x179933
movq 0x18(%rsp), %rax
movq 0x10(%rbp), %rdi
movq (%r15), %rcx
movq 0x60(%rsp), %rbx
movq (%rcx,%rbx), %rdx
leaq (%rdx,%rdx,4), %rdx
movl (%rdi,%rdx,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rsi
movq %rdx, (%rax,%rsi,8)
incq %rsi
movq %rsi, 0x20(%rsp)
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq (%rdi,%rcx,8), %rdi
movq 0x78(%rsp), %rax
leaq (%rax,%rax,2), %rdx
shlq $0x3, %rdx
addq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
subq %rax, %rcx
callq 0x178342
movq 0x10(%rbp), %rax
movq (%r15), %rcx
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
movq 0x18(%rax,%rcx,8), %rdi
callq 0x2220
movq 0x10(%rbp), %rax
movq (%r15), %rcx
movq (%rcx,%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
movq 0x20(%rax,%rcx,8), %rdi
callq 0x2220
movq 0x10(%rbp), %rax
movq (%r15), %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 0x98(%rsp)
movq %r12, %r14
incq %r12
movq 0x8(%r15), %rax
cmpq %rax, %r12
jbe 0x17955f
movq 0x38(%rsp), %r12
testq %r12, %r12
jne 0x179a16
movq 0x30(%rsp), %rdi
xorl %r12d, %r12d
jmp 0x179a39
movq 0x30(%rsp), %rax
movq %rax, %rdi
addq $0x10, %rax
movq %r12, %rcx
movq 0x98(%rsp), %rdx
subq %rdx, (%rax)
addq $0x18, %rax
decq %rcx
jne 0x179a2d
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %r14
movq (%rbp), %rax
testq %rax, %rax
movq %rcx, 0x18(%rsp)
jne 0x179a72
movq %r12, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq %rdi, %r13
movq %rdi, 0x30(%rsp)
jmp 0x179ba4
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rcx
cmpq $0x0, 0x18(%rcx,%r13)
je 0x179b2b
cmpq 0xb8(%rsp), %rbp
jae 0x179afe
cmpq %r14, %r12
jne 0x179acf
leaq (%r12,%r12), %r14
testq %r12, %r12
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq %rax, %r8
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rcx
jmp 0x179ad2
movq %rdi, %r8
leaq (%r12,%r12,2), %rax
incq %r12
movq %r15, %rdx
orq %rbx, %rdx
movq %rdx, 0x10(%r8,%rax,8)
movq $0x0, (%r8,%rax,8)
movl (%rcx,%r13), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %r8, %rdi
movq %rdx, 0x8(%r8,%rax,8)
leaq (%rbx,%rbx,4), %rax
movq 0x20(%rcx,%r13), %rdx
movq %rdx, 0x20(%rcx,%rax,8)
movups (%rcx,%r13), %xmm0
movups 0x10(%rcx,%r13), %xmm1
movups %xmm1, 0x10(%rcx,%rax,8)
movups %xmm0, (%rcx,%rax,8)
incq %rbx
movq 0x10(%rsp), %rax
movq (%rax), %rax
incq %rbp
addq $0x28, %r13
movabsq $0x100000000, %rcx      # imm = 0x100000000
addq %rcx, %r15
cmpq %rax, %rbp
jb 0x179a7c
movq %r12, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq %rdi, %r13
movq %rdi, 0x30(%rsp)
cmpq %rax, %rbx
jae 0x179b9f
leaq (,%rbx,8), %rax
leaq (%rax,%rax,4), %rax
xorps %xmm0, %xmm0
movq %rbx, %rcx
movq 0x10(%rsp), %rbp
movq 0x10(%rbp), %rdx
movups %xmm0, 0x10(%rdx,%rax)
movups %xmm0, (%rdx,%rax)
movq $0x0, 0x20(%rdx,%rax)
incq %rcx
addq $0x28, %rax
cmpq (%rbp), %rcx
jb 0x179b76
movq %rbx, (%rbp)
jmp 0x179ba4
movq 0x10(%rsp), %rbp
movq %r12, 0x78(%rsp)
leaq (%r12,%r12,2), %rax
leaq (,%rax,8), %rsi
addq %r13, %rsi
movq %r13, %rdi
callq 0x174194
movq (%rbp), %rdi
movl $0x8, %esi
callq 0x2120
movq %rax, %r14
callq 0xa0485
movq %rax, %rbx
movq 0x18(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, (%rbx)
movl $0x80000000, %ecx       # imm = 0x80000000
andl 0x4(%rbx), %ecx
orl %eax, %ecx
movl %ecx, 0x4(%rbx)
shlq $0x3, %rax
leaq (%rax,%rax,2), %r15
movq %r15, %rdi
callq 0x2280
movq %rax, 0x8(%rbx)
movq 0x18(%rbp), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x2160
movq 0x78(%rsp), %rdx
testq %rdx, %rdx
movq %r14, 0x60(%rsp)
je 0x179fb3
leaq -0x8(%r13), %rax
movq %rax, 0x88(%rsp)
movl $0x1, %r15d
xorl %esi, %esi
movq %r13, 0x68(%rsp)
cmpq %rdx, %r15
jne 0x179c57
leaq (%rsi,%rsi,2), %rax
movq 0x10(%r13,%rax,8), %rdi
jmp 0x179c76
leaq (%r15,%r15,2), %rax
leaq (%rsi,%rsi,2), %rcx
movq 0x10(%r13,%rcx,8), %rdi
movq 0x10(%r13,%rax,8), %rax
xorq %rdi, %rax
shrq $0x20, %rax
je 0x179fa7
shrq $0x20, %rdi
movq %rsi, %rax
shlq $0x20, %rax
movq %r15, %rcx
subq %rsi, %rcx
orq %rax, %rcx
movq %rdi, 0x70(%rsp)
movq %rcx, (%r14,%rdi,8)
movq %rsi, 0x80(%rsp)
cmpq %rsi, %r15
jbe 0x179f57
movq 0x80(%rsp), %r14
movq %r15, 0x50(%rsp)
leaq (%r14,%r14,2), %r12
movq 0x10(%r13,%r12,8), %rsi
movl %esi, %eax
movq 0x10(%rbp), %rcx
leaq (%rax,%rax,4), %rax
movl (%rcx,%rax,8), %edx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %edx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa0887
movq 0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x70(%rsp), %rcx
movb 0x4(%rax,%rcx,8), %cl
movq 0x20(%rbx), %rdx
movl 0x10(%r13,%r12,8), %eax
movb %cl, 0x4(%rdx,%rax,8)
incq %r14
cmpq %r15, %r14
jae 0x179f4e
movq 0x10(%rbp), %rcx
leaq (%rax,%rax,4), %rax
movq 0x18(%rcx,%rax,8), %rdx
movl 0x10(%rcx,%rax,8), %eax
decl %eax
movq (%rdx,%rax,8), %r15
shrq $0x20, %r15
leaq (%r14,%r14,2), %r8
movl 0x10(%r13,%r8,8), %eax
leaq (%rax,%rax,4), %rax
movq 0x18(%rcx,%rax,8), %rax
movl 0x4(%rax), %r13d
movq 0x58(%rsp), %r10
movq 0x28(%r10), %rax
movq (%rax,%r15,8), %rcx
movq %rcx, %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rax
je 0x179d72
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %rbp
shlq $0x3, %rbp
addq 0x8(%r10), %rbp
cmpl $0x0, 0xc(%rbp)
js 0x179d69
cmpl 0x8(%rbp), %r13d
je 0x179d74
addq $0x18, %rbp
decq %rax
jne 0x179d5d
xorl %ebp, %ebp
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl (%rbx), %ecx
jne 0x179dcf
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%rbx)
movq 0x8(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
movq %r14, 0x28(%rsp)
movq %rbx, %r14
movq %r8, %rbx
callq 0x2370
movq %rbx, %r8
movq %r14, %rbx
movq 0x28(%rsp), %r14
movq 0x58(%rsp), %r10
movq %rax, 0x8(%rbx)
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0x179dd3
movq 0x8(%rbx), %rax
movq 0x68(%rsp), %rsi
leaq (%rsi,%r12,8), %rdi
addq $0x10, %rdi
leaq (%rsi,%r8,8), %r12
addq $0x10, %r12
leal 0x1(%rdx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%rbx)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movq %rdi, 0x28(%rsp)
movq (%rdi), %rdx
movl %edx, %esi
movl (%r12), %edi
movl 0xc(%rbp), %r8d
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
andq %r11, %r8
movl %r8d, 0xc(%rax,%rcx,8)
movq 0x10(%rsp), %rbp
movq 0x10(%rbp), %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, %r13
movq 0x28(%r10), %rax
movq (%rax,%r13,8), %rcx
movq %rcx, %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rax
je 0x179e8f
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %r13
shlq $0x3, %r13
addq 0x8(%r10), %r13
cmpl $0x0, 0xc(%r13)
js 0x179e86
movl 0x8(%r13), %ecx
xorl %r15d, %ecx
cmpl $0x1, %ecx
je 0x179e92
addq $0x18, %r13
decq %rax
jne 0x179e73
xorl %r13d, %r13d
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl (%rbx), %ecx
movq 0x50(%rsp), %r15
jne 0x179ed7
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%rbx)
movq 0x8(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq %rax, 0x8(%rbx)
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0x179edb
movq 0x8(%rbx), %rax
movq 0x28(%rsp), %rdi
leal 0x1(%rdx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%rbx)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movq (%r12), %rdx
movl %edx, %esi
movl (%rdi), %edi
movl 0xc(%r13), %r8d
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
andq %r10, %r8
movl %r8d, 0xc(%rax,%rcx,8)
shlq $0x21, %rdx
movq 0x10(%rbp), %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 0x68(%rsp), %r13
cmpq %r15, %r14
jne 0x179cb1
movq 0x80(%rsp), %rax
leaq (%rax,%rax,2), %rax
leaq 0x10(,%rax,8), %rax
addq %r13, %rax
movq 0x18(%rbp), %rdi
movq 0x8(%rbx), %rsi
leaq (%r15,%r15,2), %rcx
movq 0x88(%rsp), %rdx
movl (%rdx,%rcx,8), %ecx
addl %ecx, %ecx
movl (%rax), %r8d
addl %r8d, %r8d
incq %r8
movq 0x70(%rsp), %rdx
callq 0x178a88
movq %r15, %rsi
movq 0x78(%rsp), %rdx
movq 0x60(%rsp), %r14
incq %r15
cmpq %rdx, %r15
jbe 0x179c47
movq %rbx, %rdi
callq 0xa0a7d
movq 0x18(%rbp), %rdi
callq 0xa0494
movq %rbx, 0x18(%rbp)
movq 0xa0(%rsp), %rax
cmpq $0x0, (%rax)
movq 0xa8(%rsp), %r13
je 0x17a01d
movq %r14, %rbx
xorl %r14d, %r14d
leaq 0xc0(%rsp), %r15
xorl %r12d, %r12d
movq 0x10(%rax), %rdi
addq %r14, %rdi
leaq 0x30(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
movq %r13, %r8
callq 0x178ed8
movq 0xa0(%rsp), %rax
incq %r12
addq $0x30, %r14
cmpq (%rax), %r12
jb 0x179fef
movq 0x10(%rax), %rdi
movq %rax, %rbx
callq 0x2220
movq 0x28(%rbx), %rdi
callq 0x2220
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movq $0x0, 0x28(%rbx)
movq 0x10(%r13), %rax
movq %rax, 0x10(%rbx)
movups (%r13), %xmm0
movups %xmm0, (%rbx)
movq %r13, %rdi
callq 0x2220
movq %rbx, %rdi
movq %rbp, %rsi
movq 0x58(%rsp), %rdx
callq 0xc49f6
movq (%rbp), %rax
movl $0x1, %ebx
movl $0x1, %edx
movl %ebx, %ecx
shll %cl, %edx
movslq %edx, %rcx
incq %rbx
cmpq %rcx, %rax
ja 0x17a072
movq $-0x1, %rax
movl %ebx, %ecx
shrq %cl, %rax
movq %rax, 0x10(%rsp)
decq %rbx
movq 0xb0(%rsp), %r14
cmpq $0x0, (%r14)
jne 0x17a0ad
xorl %r13d, %r13d
jmp 0x17a100
xorl %ebp, %ebp
leaq 0x30(%rsp), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %r14, %rdi
movq %r12, %rsi
movq 0x60(%rsp), %rdx
movq %r15, %rcx
movq %rbx, %r8
callq 0x179260
testl %eax, %eax
je 0x17a0f4
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
jb 0x17a0ba
movq %r13, (%r14)
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x14fc8
movq %rbx, 0x48(%r14)
movq 0x10(%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 0x18(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x1fbfa
movq 0x30(%rsp), %rdi
callq 0x2220
movq 0xd0(%rsp), %rdi
callq 0x2220
movq 0x60(%rsp), %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2220
jmp 0x179484