// File: 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
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x23b21f
jmp 0x23c4c4
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
movq $0x0, -0xc8(%rbp)
movq $0x0, -0x108(%rbp)
movq $0x0, -0x110(%rbp)
movl $0x1, %edi
movl $0x30, %esi
callq 0x2140
movq %rax, -0x110(%rbp)
movq $0x0, -0x120(%rbp)
movq $0x0, -0x128(%rbp)
movq $0x0, -0x118(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
imulq $0x18, 0x8(%rax), %rax
addq %rax, %rsi
callq 0x230280
movq $0x1, -0x80(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x80(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
ja 0x23ba29
movq -0x80(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
je 0x23b354
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x80(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x88(%rbp), %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
je 0x23ba16
movq $0x0, -0xb0(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
imulq $0x18, -0x88(%rbp), %rax
addq %rax, %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
imulq $0x18, -0x80(%rbp), %rax
addq %rax, %rsi
callq 0x2307a0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x88(%rbp), %rdx
addq %rdx, %rcx
imulq $0x28, (%rcx), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq %rax, -0xb8(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x90(%rbp), %rax
cmpq -0x80(%rbp), %rax
jae 0x23b647
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x90(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0xa8(%rbp), %rax
jbe 0x23b622
movq -0x98(%rbp), %rax
subq -0xa8(%rbp), %rax
cmpq -0xb8(%rbp), %rax
jae 0x23b622
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x88(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0xa8(%rbp), %rcx
movq -0x98(%rbp), %r8
leaq -0xe0(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0x238160
cmpl $0x0, %eax
je 0x23b620
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jne 0x23b4dd
cmpq $0x0, -0x68(%rbp)
je 0x23b4b2
movq -0x68(%rbp), %rax
shlq %rax
movq %rax, -0x140(%rbp)
jmp 0x23b4c0
movl $0x2, %eax
movq %rax, -0x140(%rbp)
jmp 0x23b4c0
movq -0x140(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x78(%rbp), %rdi
imulq $0x18, -0x68(%rbp), %rsi
callq 0x2360
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x70(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x88(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
orq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xe0(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x128(%rbp), %rax
cmpq -0x120(%rbp), %rax
jne 0x23b5cc
cmpq $0x0, -0x120(%rbp)
je 0x23b592
movq -0x120(%rbp), %rax
shlq %rax
movq %rax, -0x148(%rbp)
jmp 0x23b5a0
movl $0x2, %eax
movq %rax, -0x148(%rbp)
jmp 0x23b5a0
movq -0x148(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rdi
movq -0x120(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0x118(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
addq %rax, %rdx
movq -0x118(%rbp), %rax
movq -0x128(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x128(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x23b620
jmp 0x23b622
movq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x23b3d4
movq -0xb8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0xa8(%rbp), %rax
jbe 0x23b871
movq -0x98(%rbp), %rax
subq -0xa8(%rbp), %rax
cmpq -0xb8(%rbp), %rax
jae 0x23b871
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x88(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0xa8(%rbp), %rcx
movq -0x98(%rbp), %r8
leaq -0xe0(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0x238160
cmpl $0x0, %eax
je 0x23b86f
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jne 0x23b72c
cmpq $0x0, -0x68(%rbp)
je 0x23b701
movq -0x68(%rbp), %rax
shlq %rax
movq %rax, -0x150(%rbp)
jmp 0x23b70f
movl $0x2, %eax
movq %rax, -0x150(%rbp)
jmp 0x23b70f
movq -0x150(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x78(%rbp), %rdi
imulq $0x18, -0x68(%rbp), %rsi
callq 0x2360
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x70(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x88(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
orq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xe0(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x128(%rbp), %rax
cmpq -0x120(%rbp), %rax
jne 0x23b81b
cmpq $0x0, -0x120(%rbp)
je 0x23b7e1
movq -0x120(%rbp), %rax
shlq %rax
movq %rax, -0x158(%rbp)
jmp 0x23b7ef
movl $0x2, %eax
movq %rax, -0x158(%rbp)
jmp 0x23b7ef
movq -0x158(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rdi
movq -0x120(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0x118(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
addq %rax, %rdx
movq -0x118(%rbp), %rax
movq -0x128(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x128(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x23b86f
jmp 0x23b871
cmpq $0x0, -0xb0(%rbp)
je 0x23ba0b
jmp 0x23b881
movq -0x128(%rbp), %rax
cmpq -0x120(%rbp), %rax
jne 0x23b8e8
cmpq $0x0, -0x120(%rbp)
je 0x23b8ae
movq -0x120(%rbp), %rax
shlq %rax
movq %rax, -0x160(%rbp)
jmp 0x23b8bc
movl $0x2, %eax
movq %rax, -0x160(%rbp)
jmp 0x23b8bc
movq -0x160(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rdi
movq -0x120(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0x118(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x88(%rbp), %rdx
addq %rdx, %rcx
imulq $0x28, (%rcx), %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
movq -0x118(%rbp), %rax
movq -0x128(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x128(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x88(%rbp), %rcx
addq %rcx, %rax
imulq $0x28, (%rax), %rax
addq %rax, %rdi
movq -0x8(%rbp), %rsi
movq -0x78(%rbp), %rdx
imulq $0x18, -0xd8(%rbp), %rax
addq %rax, %rdx
movq -0x70(%rbp), %rcx
subq -0xd8(%rbp), %rcx
callq 0x238e50
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x88(%rbp), %rdx
addq %rdx, %rcx
imulq $0x28, (%rcx), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
callq 0x2210
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x88(%rbp), %rdx
addq %rdx, %rcx
imulq $0x28, (%rcx), %rcx
addq %rcx, %rax
movq 0x20(%rax), %rdi
callq 0x2210
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x88(%rbp), %rcx
addq %rcx, %rax
imulq $0x28, (%rax), %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x2100
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x23ba18
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x23b307
movq $0x0, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0x23ba76
movq -0xc8(%rbp), %rdx
movq -0x78(%rbp), %rax
imulq $0x18, -0x90(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x23ba34
movq $0x0, -0xa0(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x23bbe3
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x90(%rbp), %rcx
addq %rcx, %rax
cmpq $0x0, 0x18(%rax)
jne 0x23babf
jmp 0x23bbcc
movq -0x90(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jae 0x23bb8a
jmp 0x23bad5
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jne 0x23bb21
cmpq $0x0, -0x68(%rbp)
je 0x23baf6
movq -0x68(%rbp), %rax
shlq %rax
movq %rax, -0x168(%rbp)
jmp 0x23bb04
movl $0x2, %eax
movq %rax, -0x168(%rbp)
jmp 0x23bb04
movq -0x168(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x78(%rbp), %rdi
imulq $0x18, -0x68(%rbp), %rsi
callq 0x2360
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x70(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x90(%rbp), %rcx
shlq $0x20, %rcx
orq -0xa0(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x60(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x90(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
imulq $0x28, -0x90(%rbp), %rax
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
imulq $0x28, -0xa0(%rbp), %rax
addq %rax, %rdi
movl $0x28, %edx
callq 0x2180
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x23ba8c
movq -0xa0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x23bc52
movq -0xa0(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x23bc44
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
imulq $0x28, -0x90(%rbp), %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x2100
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x23bc01
movq -0xa0(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x78(%rbp), %rdi
movq -0x78(%rbp), %rsi
imulq $0x18, -0x70(%rbp), %rax
addq %rax, %rsi
callq 0x230cc0
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, -0x108(%rbp)
callq 0xcd150
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq -0x58(%rbp), %rax
movl %edx, (%rax)
movq -0x58(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0x4(%rax)
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
imulq $0x18, %rax, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
imulq $0x18, %rax, %rdx
callq 0x2180
movq $0x1, -0x80(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x70(%rbp), %rax
ja 0x23c1f2
movq -0x80(%rbp), %rax
cmpq -0x70(%rbp), %rax
je 0x23bd63
movq -0x78(%rbp), %rax
imulq $0x18, -0x80(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
shrq $0x20, %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x88(%rbp), %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
je 0x23c1df
movq -0x78(%rbp), %rax
imulq $0x18, -0x88(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
shrq $0x20, %rax
movq %rax, -0xd0(%rbp)
movq -0x88(%rbp), %rdx
shlq $0x20, %rdx
movq -0x80(%rbp), %rax
subq -0x88(%rbp), %rax
orq %rax, %rdx
movq -0x108(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq -0x80(%rbp), %rax
jae 0x23c17e
movq -0x58(%rbp), %rdi
movq -0x78(%rbp), %rax
imulq $0x18, -0x90(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl %eax, %esi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x90(%rbp), %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
callq 0xcd8f0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0xd0(%rbp), %rcx
movb 0x4(%rax,%rcx,8), %dl
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x90(%rbp), %rsi
addq %rsi, %rcx
movq 0x10(%rcx), %rcx
movl %ecx, %ecx
movb %dl, 0x4(%rax,%rcx,8)
movq -0x90(%rbp), %rax
addq $0x1, %rax
cmpq -0x80(%rbp), %rax
jb 0x23be65
jmp 0x23c167
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x90(%rbp), %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x78(%rbp), %rdx
imulq $0x18, -0x90(%rbp), %rsi
addq %rsi, %rdx
movq 0x10(%rdx), %rdx
movl %edx, %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rcx
movq -0x90(%rbp), %rdx
addq $0x1, %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
shrq $0x20, %rax
movq %rax, -0xf0(%rbp)
movq -0x10(%rbp), %rdi
movq -0xe8(%rbp), %rsi
movq -0xf0(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x239c80
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rdi
callq 0x23c4d0
movq %rax, -0x50(%rbp)
movq -0x78(%rbp), %rax
imulq $0x18, -0x90(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl %eax, %eax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
shlq %rax
movq %rax, -0xf8(%rbp)
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
addq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl %eax, %eax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
shlq %rax
movq %rax, -0x100(%rbp)
movq -0x48(%rbp), %rax
movl 0xc(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq -0x50(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x50(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
movq -0xf8(%rbp), %rcx
shlq $0x20, %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xf8(%rbp), %rdx
shrq %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0x50(%rbp), %rdx
movl 0xc(%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
subl %edx, %eax
cltq
orq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x100(%rbp), %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0xf0(%rbp), %rsi
xorq $0x1, %rsi
movq -0xe8(%rbp), %rdx
xorq $0x1, %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x239c80
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rdi
callq 0x23c4d0
movq %rax, -0x50(%rbp)
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
addq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl %eax, %eax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
shlq %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xf8(%rbp)
movq -0x78(%rbp), %rax
imulq $0x18, -0x90(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl %eax, %eax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
shlq %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x100(%rbp)
movq -0x48(%rbp), %rax
movl 0xc(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq -0x50(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x50(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
movq -0xf8(%rbp), %rcx
shlq $0x20, %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xf8(%rbp), %rdx
shrq %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0x50(%rbp), %rdx
movl 0xc(%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
subl %edx, %eax
cltq
orq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x100(%rbp), %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x23bdba
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0xd0(%rbp), %rdx
movq -0x78(%rbp), %rax
movq -0x80(%rbp), %rcx
subq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
shll %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x78(%rbp), %rax
imulq $0x18, -0x88(%rbp), %r8
addq %r8, %rax
movq 0x10(%rax), %rax
shll %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %r8d
callq 0x239d80
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x23c1e1
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x23bd17
movq -0x58(%rbp), %rdi
callq 0xcdd10
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xcd170
movq -0x58(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x23c262
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
imulq $0x30, -0x80(%rbp), %rax
addq %rax, %rdi
movq -0x108(%rbp), %rdx
movq -0x110(%rbp), %r8
leaq -0x78(%rbp), %rsi
leaq -0x40(%rbp), %rcx
callq 0x23a650
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x23c21c
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2210
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2210
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2100
movq -0x110(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x110(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x110(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x110(%rbp), %rdi
callq 0x2210
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x103c60
movq $0x1, -0x130(%rbp)
movq -0x130(%rbp), %rax
movl %eax, %ecx
movl $0x1, %eax
shll %cl, %eax
cltq
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x23c31c
jmp 0x23c308
movq -0x130(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x130(%rbp)
jmp 0x23c2eb
movq -0x130(%rbp), %rcx
addq $0x1, %rcx
movq $-0x1, %rax
shrq %cl, %rax
movq %rax, -0x138(%rbp)
movq $0x0, -0xa0(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x23c3ec
movq -0x18(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x108(%rbp), %rdx
movq -0x130(%rbp), %r8
leaq -0x78(%rbp), %rcx
callq 0x23ab70
cmpl $0x0, %eax
je 0x23c3d9
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x80(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xa0(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x23c3db
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x23c34b
movq -0xa0(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1c4760
movq -0x130(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x138(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2210
movq -0x18(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x2210
movq -0x18(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x118(%rbp), %rdi
movq -0x128(%rbp), %rsi
callq 0x23b020
movq -0x78(%rbp), %rdi
callq 0x2210
movq -0x30(%rbp), %rdi
callq 0x2210
movq -0x108(%rbp), %rdi
callq 0x2210
movq -0x118(%rbp), %rdi
callq 0x2210
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopl (%rax)