// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: u2g_threading(ul_resolve_t*, ulg_opt_t*, unsigned long, unsigned long, asg64_v*, asg64_v*)
void u2g_threading(ul_resolve_t *uidx, ulg_opt_t *ulopt, uint64_t cov_cutoff, uint64_t is_bridg, asg64_v *b, asg64_v *ub)
{
    renew_ul2_utg(uidx);
    ul2ul_idx_t *idx = &(uidx->uovl); ma_ug_t *iug = idx->i_ug; ma_ug_t *raw = uidx->l1_ug;
    uint64_t k, z, i, t_s, t_e; uinfo_srt_warp_t *seq; 
    usg_t *ng; CALLOC(ng, 1); usg_seq_t *s; usg_arc_warp *sv; usg_arc_t *p; 
    asg_arc_t *av; uint32_t nv, v, w, vx, wx; int64_t tt, tl, tm; 

    ng->mp.n = ng->mp.m = raw->g->n_seq; MALLOC(ng->mp.a, ng->mp.n);
    for (k = 0; k < raw->g->n_seq; k++) {
        s = push_usg_t_node(ng, k); 
        s->mm = k; s->arc[0].n = s->arc[1].n = 0; s->occ = raw->u.a[k].n;
        s->arc_mm[0].n = s->arc_mm[1].n;
        s->del = raw->g->seq[k].del; s->len = raw->g->seq[k].len;
        s->telo = 0; 
        if(uidx->uopt->te) {
            s->telo = gen_utg_telo(&(raw->u.a[k]), uidx->uopt->te);
        }

        av = asg_arc_a(raw->g, (k<<1)); nv = asg_arc_n(raw->g, (k<<1)); sv = &(s->arc[0]);
        for (z = 0; z < nv; z++) {
            if(av[z].del) continue;
            kv_pushp(usg_arc_t, *sv, &p); 
            p->del = 0; p->ou = 0; p->v = av[z].v; p->ol = av[z].ol; p->ul = av[z].ul; p->idx = 0;
        }

        av = asg_arc_a(raw->g, ((k<<1)+1)); nv = asg_arc_n(raw->g, ((k<<1)+1)); sv = &(s->arc[1]);
        for (z = 0; z < nv; z++) {
            if(av[z].del) continue;
            kv_pushp(usg_arc_t, *sv, &p); 
            p->del = 0; p->ou = 0; p->v = av[z].v; p->ol = av[z].ol; p->ul = av[z].ul; p->idx = 0;
        }
        ///map: ng id -> raw id
        ng->mp.a[k].n = ng->mp.a[k].m = 1; MALLOC(ng->mp.a[k].a, 1); ng->mp.a[k].a[0] = k;
    }

    for (k = b->n = 0; k < iug->u.n; k++) {
        seq = &(idx->cc.iug_a[k]);
        if(seq->n <= 1) continue;

        uidx->uovl.iug_seq = seq; uidx->uovl.iug_cov_thre = cov_cutoff;
        for (z = 0; z < uidx->str_b.n_thread; z++) {
            uidx->str_b.buf[z].res_dump.n = 0;
        }
        kt_for(uidx->str_b.n_thread, worker_update_ul_arc_drop, uidx, seq->n-1);///seq->n > 1
        for (z = ub->n = 0; z < uidx->str_b.n_thread; z++) {
            for (i = 0; i < uidx->str_b.buf[z].res_dump.n; i++) {
                kv_push(uint64_t, *ub, uidx->str_b.buf[z].res_dump.a[i]);
            }
        }

        for (z = 0; z < ub->n; z++) {///all unreliable arcs
            i = ub->a[z]; tm = 1; p = get_usg_arc(ng, seq->a[i].v, seq->a[i+1].v);
            if(p) {
                if(p->ou < (uint64_t)tm) p->ou = tm;///since the initial ou is 0, p->ou = 1
                pushp_usg_arc_mm(ng, seq->a[i].v, seq->a[i+1].v, k, i); 

                p = get_usg_arc(ng, seq->a[i+1].v^1, seq->a[i].v^1);
                if(p->ou < (uint64_t)tm) p->ou = tm;///since the initial ou is 0, p->ou = 1
                pushp_usg_arc_mm(ng, seq->a[i+1].v^1, seq->a[i].v^1, k, i); 
            } 
            ///give up unreliable arcs if they are not adjacent
        }

        radix_sort_srt64(ub->a, ub->a + ub->n); 
        if(ub->n == 0 || ub->a[ub->n-1] < seq->n-1) kv_push(uint64_t, *ub, seq->n-1);
        for (z = t_s = t_e = 0; z < ub->n; z++) {
            t_e = ub->a[z];
            if(t_s < t_e) {
                for (i = t_s, tt = seq->a[t_e].n; i < t_e; i++) {
                    tt += seq->a[i].n;///how many HiFi reads are covered
                }
                for (i = t_s, tl = 0; i < t_e; i++) {
                    tl += seq->a[i].n; 
                    tm = tt - tl; if(tm > tl) tm = tl; assert(tm > 0); tm <<= 1; tm += 1;
                    p = get_usg_arc(ng, seq->a[i].v, seq->a[i+1].v);
                    if(p) {
                        if(p->ou < (uint64_t)tm) p->ou = tm;
                        p = get_usg_arc(ng, seq->a[i+1].v^1, seq->a[i].v^1);
                        if(p->ou < (uint64_t)tm) p->ou = tm;
                    } else if(is_bridg) {
                        v = seq->a[i].v; w = seq->a[i+1].v; p = NULL;
                        vx = (v&1?((raw->u.a[v>>1].a[0]>>32)^1):(raw->u.a[v>>1].a[raw->u.a[v>>1].n-1]>>32));
                        wx = (w&1?((raw->u.a[w>>1].a[raw->u.a[w>>1].n-1]>>32)^1):(raw->u.a[w>>1].a[0]>>32));
                        ///(v>>1) != (w>>1) or v == w, need to handle (v>>1) == (w>>1) && (v&1) != (w&1) later
                        if(((v^w) != 1) && (uidx->sg->seq[vx>>1].len > uidx->uopt->min_ovlp) && 
                                (uidx->sg->seq[wx>>1].len > uidx->uopt->min_ovlp)) {
                            kv_pushp(usg_arc_t, (ng->a[v>>1].arc[v&1]), &p); 
                            p->del = 0; p->ou = tm; p->v = w; p->ol = 0; p->idx = 0;
                            p->ul = (((uint64_t)v)<<32)|(raw->g->seq[v>>1].len);

                            v = seq->a[i+1].v^1; w = seq->a[i].v^1; 
                            kv_pushp(usg_arc_t, (ng->a[v>>1].arc[v&1]), &p); 
                            p->del = 0; p->ou = tm; p->v = w; p->ol = 0; p->idx = 0;
                            p->ul = (((uint64_t)v)<<32)|(raw->g->seq[v>>1].len);
                        }
                    }
                    if(p) {
                        pushp_usg_arc_mm(ng, seq->a[i].v, seq->a[i+1].v, k, i); 
                        pushp_usg_arc_mm(ng, seq->a[i+1].v^1, seq->a[i].v^1, k, i); 
                    }
                }
            }
            t_s = ub->a[z] + 1;
        }
    }

    // for (v = 0; v < (ng->n<<1); v++) {
    //     p = usg_arc_a(ng, v); nv = usg_arc_n(ng, v);
    //     for (i = 0; i < nv; i++) {
    //         assert(get_usg_arc(ng, p[i].v^1, v^1));
    //     }
    // }

    usg_cleanup(ng);

    ///debug
    debug_sysm_usg_t(ng, __func__);

    idx->h_usg = ng;

    /******for debug******/
    // prt_usg_t(uidx, ng, "ng0");
    /******for debug******/



    u2g_hybrid_clean(uidx, ulopt, ng, b, ub);
    // idx->hybrid_ug = gen_hybrid_ug(uidx, ng);
    
    
    // idx->hybrid_ug = gen_debug_hybrid_ug(uidx, ng);
    // fprintf(stderr, "-[M::%s::] idx->hybrid_ug->g->n_seq::%u\n", __func__, (uint32_t)idx->hybrid_ug->g->n_seq);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r9, 0x18(%rsp)
movq %r8, 0x50(%rsp)
movq %rcx, 0x80(%rsp)
movq %rdx, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdi, %rbx
callq 0x2278c8
movq 0x230(%rbx), %rax
movq %rax, 0x58(%rsp)
movq %rbx, 0x8(%rsp)
movq 0x18(%rbx), %rbx
movl $0x1, %edi
movl $0x30, %esi
callq 0x2120
movq %rax, %r14
movq %rbx, 0x20(%rsp)
movq 0x18(%rbx), %rax
movl 0x14(%rax), %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movq %rbx, 0x20(%r14)
movq %rbx, 0x18(%r14)
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rdi
callq 0x2280
movq %r14, %r9
movq %rax, 0x28(%r14)
testq %rbx, %rbx
movq %r14, (%rsp)
je 0x226fff
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
xorl %r14d, %r14d
movq %r9, %rdi
movq %r14, %rsi
callq 0x213670
movq %rax, %r15
movl %r14d, (%rax)
xorl %eax, %eax
movq %rax, 0x28(%r15)
movq %rax, 0x10(%r15)
movq 0x20(%rsp), %rdi
movq 0x10(%rdi), %rcx
leaq (%r14,%r14,4), %rdx
movl 0x10(%rcx,%rdx,8), %eax
movl %eax, 0x4(%r15)
movq 0x58(%r15), %rsi
movq %rsi, 0x40(%r15)
movq 0x18(%rdi), %r12
movq 0x20(%r12), %rsi
movl (%rsi,%r14,8), %edi
shrl $0x1f, %edi
movb %dil, 0x70(%r15)
movl (%rsi,%r14,8), %esi
andl %ebp, %esi
movl %esi, 0x8(%r15)
movb $0x0, 0x71(%r15)
movq 0x8(%rsp), %rsi
movq (%rsi), %rsi
movq 0x70(%rsi), %rsi
testq %rsi, %rsi
je 0x226e07
testq %rax, %rax
je 0x226dfd
movq 0x10(%rsi), %rsi
movq 0x18(%rcx,%rdx,8), %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %rdi
shrq $0x21, %rdi
cmpb $0x0, (%rsi,%rdi)
jne 0x226e01
incq %rdx
cmpq %rdx, %rax
jne 0x226de7
xorl %eax, %eax
jmp 0x226e03
movb $0x1, %al
movb %al, 0x71(%r15)
movq 0x8(%r12), %rax
movq 0x28(%r12), %rcx
movq %r14, %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %rdx
movq %rdx, %rsi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
andq %rdi, %rsi
je 0x226eee
shrq $0x20, %rdx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %r12
leaq (%rdx,%rdx,2), %rcx
leaq (%rax,%rcx,8), %r13
addq $0xc, %r13
xorl %ebx, %ebx
movq (%rsp), %rsi
cmpl $0x0, (%r13,%rbx)
js 0x226ecc
movq 0x10(%r15), %rcx
movq 0x20(%r15), %rax
cmpq 0x18(%r15), %rcx
jne 0x226e8d
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x18(%r15)
shlq $0x5, %rsi
movq %rax, %rdi
callq 0x2370
movq (%rsp), %rsi
movq %rax, 0x20(%r15)
movq 0x10(%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r15)
shlq $0x5, %rcx
andb $0x7f, 0xf(%rax,%rcx)
movl $0x0, 0x10(%rax,%rcx)
movl -0x4(%r13,%rbx), %edx
movl %edx, 0x8(%rax,%rcx)
movl (%r13,%rbx), %edx
andl %ebp, %edx
movl %edx, 0xc(%rax,%rcx)
movq -0xc(%r13,%rbx), %rdx
movq %rdx, (%rax,%rcx)
movq $0x0, 0x18(%rax,%rcx)
addq $0x18, %rbx
cmpq %rbx, %r12
jne 0x226e4b
movq 0x20(%rsp), %rax
movq 0x18(%rax), %r12
movq 0x8(%r12), %rax
movq 0x28(%r12), %rcx
jmp 0x226ef2
movq (%rsp), %rsi
leaq (%r14,%r14), %rdx
movq 0x8(%rcx,%rdx,8), %rcx
movq %rcx, %rdx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
andq %rdi, %rdx
je 0x226fbd
shrq $0x20, %rcx
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %r12
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %r13
addq $0xc, %r13
xorl %ebx, %ebx
cmpl $0x0, (%r13,%rbx)
js 0x226fa7
movq 0x28(%r15), %rcx
movq 0x38(%r15), %rax
cmpq 0x30(%r15), %rcx
jne 0x226f68
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x30(%r15)
shlq $0x5, %rsi
movq %rax, %rdi
callq 0x2370
movq (%rsp), %rsi
movq %rax, 0x38(%r15)
movq 0x28(%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x28(%r15)
shlq $0x5, %rcx
andb $0x7f, 0xf(%rax,%rcx)
movl $0x0, 0x10(%rax,%rcx)
movl -0x4(%r13,%rbx), %edx
movl %edx, 0x8(%rax,%rcx)
movl (%r13,%rbx), %edx
andl %ebp, %edx
movl %edx, 0xc(%rax,%rcx)
movq -0xc(%r13,%rbx), %rdx
movq %rdx, (%rax,%rcx)
movq $0x0, 0x18(%rax,%rcx)
addq $0x18, %rbx
cmpq %rbx, %r12
jne 0x226f26
movq 0x20(%rsp), %rax
movq 0x18(%rax), %r12
movq 0x28(%rsi), %rbx
leaq (%r14,%r14,2), %r15
movl $0x1, %eax
movq %rax, 0x10(%rbx,%r15,8)
movq %rax, 0x8(%rbx,%r15,8)
movl $0x4, %edi
callq 0x2280
movq (%rsp), %r9
movq %rax, (%rbx,%r15,8)
movl %r14d, (%rax)
incq %r14
movl 0x14(%r12), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r14
jb 0x226d6b
movq 0x50(%rsp), %rax
movq $0x0, (%rax)
movq 0x58(%rsp), %rax
cmpq $0x0, (%rax)
movq 0x18(%rsp), %rbx
je 0x227848
xorl %ecx, %ecx
movq 0x8(%rsp), %rax
movq 0x260(%rax), %rax
movq %rcx, 0x28(%rsp)
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rcx
cmpq $0x2, %rcx
jb 0x227832
leaq (%rax,%rdx,8), %rdx
movq 0x8(%rsp), %rax
movq %rdx, 0x10(%rsp)
movq %rdx, 0x298(%rax)
movq 0x68(%rsp), %rdx
movq %rdx, 0x2a0(%rax)
movq 0x1e0(%rax), %rdi
testq %rdi, %rdi
je 0x22711f
leaq 0x1(%rdi), %rax
andq $-0x2, %rax
leaq -0x1(%rdi), %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movq 0x8(%rsp), %rdx
movq 0x1d8(%rdx), %rdx
movl $0x628, %esi            # imm = 0x628
addq %rsi, %rdx
pxor 0xa239(%rip), %xmm0     # 0x2312e0
movdqa 0xa221(%rip), %xmm1     # 0x2312d0
movdqa %xmm1, %xmm2
pxor 0xa225(%rip), %xmm2     # 0x2312e0
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
pcmpeqd %xmm0, %xmm2
pshufd $0xf5, %xmm2, %xmm4     # xmm4 = xmm2[1,1,3,3]
pand %xmm3, %xmm4
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
por %xmm4, %xmm2
movd %xmm2, %esi
notl %esi
testb $0x1, %sil
je 0x2270f0
movq $0x0, -0x328(%rdx)
pxor 0xa428(%rip), %xmm2     # 0x231520
pextrw $0x4, %xmm2, %esi
testb $0x1, %sil
je 0x22710a
movq $0x0, (%rdx)
paddq 0xa3ee(%rip), %xmm1     # 0x231500
addq $0x650, %rdx            # imm = 0x650
addq $-0x2, %rax
jne 0x2270af
decq %rcx
leaq 0x84c(%rip), %rsi       # 0x227975
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x108f2c
movq 0x18(%rsp), %r9
movq $0x0, (%r9)
movq 0x1e0(%rbx), %rax
testq %rax, %rax
je 0x227324
movq 0x1d8(%rbx), %rcx
xorl %ebx, %ebx
imulq $0x328, %rbx, %r14      # imm = 0x328
cmpq $0x0, 0x300(%rcx,%r14)
je 0x2271e5
movq 0x10(%r9), %rax
xorl %r15d, %r15d
movq (%r9), %rdx
cmpq 0x8(%r9), %rdx
jne 0x2271b5
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r9)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x18(%rsp), %r9
movq %rax, 0x10(%r9)
movq 0x8(%rsp), %rcx
movq 0x1d8(%rcx), %rcx
movq (%r9), %rdx
movq 0x310(%rcx,%r14), %rsi
movq (%rsi,%r15,8), %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, (%r9)
movq %rsi, (%rax,%rdx,8)
incq %r15
cmpq 0x300(%rcx,%r14), %r15
jb 0x227174
movq 0x8(%rsp), %rax
movq 0x1e0(%rax), %rax
incq %rbx
cmpq %rax, %rbx
jb 0x22715b
movq (%r9), %rax
testq %rax, %rax
je 0x227324
movq (%rsp), %rcx
movq (%rcx), %rbx
xorl %r14d, %r14d
movq 0x10(%r9), %rcx
movq (%rcx,%r14,8), %r15
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rdx
movq %r15, %r12
shlq $0x4, %r12
movl (%rdx,%r12), %esi
movl %esi, %ecx
shrl %ecx
movl %esi, %r8d
andl $0x1, %r8d
imulq $0x78, %rcx, %rdi
addq %rbx, %rdi
leaq (%r8,%r8,2), %r8
movl 0x10(%rdi,%r8,8), %ecx
testq %rcx, %rcx
je 0x227316
leaq 0x1(%r15), %r13
shlq $0x4, %r13
movl (%rdx,%r13), %edx
movq 0x20(%rdi,%r8,8), %rdi
shlq $0x5, %rcx
xorl %r8d, %r8d
cmpl %edx, 0x8(%rdi,%r8)
je 0x227274
addq $0x20, %r8
cmpq %r8, %rcx
jne 0x22725f
jmp 0x227316
cmpl $0x0, 0x10(%rdi,%r8)
jne 0x227285
movl $0x1, 0x10(%rdi,%r8)
movq (%rsp), %rdi
movq 0x28(%rsp), %rcx
movl %r15d, %r8d
callq 0x213710
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movl (%rax,%r13), %ecx
movq %rcx, %rsi
xorq $0x1, %rsi
movl (%rax,%r12), %edx
xorl $0x1, %edx
shrl %ecx
movl %esi, %eax
andl $0x1, %eax
imulq $0x78, %rcx, %rcx
addq %rbx, %rcx
leaq (%rax,%rax,2), %rax
movq 0x20(%rcx,%rax,8), %rax
cmpl %edx, 0x8(%rax)
jne 0x2272d1
xorl %ecx, %ecx
jmp 0x2272e5
leaq 0x28(%rax), %rdi
xorl %ecx, %ecx
incq %rcx
leaq 0x20(%rdi), %r8
cmpl %edx, (%rdi)
movq %r8, %rdi
jne 0x2272d7
shlq $0x5, %rcx
cmpl $0x0, 0x10(%rax,%rcx)
movq (%rsp), %rdi
jne 0x227301
addq %rcx, %rax
addq $0x10, %rax
movl $0x1, (%rax)
movq 0x28(%rsp), %rcx
movl %r15d, %r8d
callq 0x213710
movq 0x18(%rsp), %r9
movq (%r9), %rax
incq %r14
cmpq %rax, %r14
jb 0x227207
jmp 0x227326
xorl %eax, %eax
movq 0x10(%r9), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x1ee586
movq 0x18(%rsp), %rbx
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
testq %rcx, %rcx
je 0x227356
movq 0x10(%rsp), %rdx
movq (%rdx), %rdx
decq %rdx
cmpq %rdx, -0x8(%rax,%rcx,8)
jae 0x2273b5
cmpq 0x8(%rbx), %rcx
jne 0x227388
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x18(%rsp), %rbx
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq (%rsp), %r9
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rdx
movq (%rdx), %rdx
decq %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rbx)
movq %rdx, (%rax,%rcx,8)
movq (%rbx), %rcx
testq %rcx, %rcx
jne 0x2273bf
jmp 0x227832
movq (%rsp), %r9
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %r8d, %r8d
movq (%rax,%rdx,8), %rsi
cmpq %rsi, %r8
jae 0x227820
movq %rdx, 0x78(%rsp)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq %rsi, %rcx
shlq $0x4, %rcx
movl 0xc(%rax,%rcx), %edi
movq %r8, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
addq $0xc, %rax
movq %r8, %rcx
movl (%rax), %edx
addq %rdx, %rdi
incq %rcx
addq $0x10, %rax
cmpq %rcx, %rsi
jne 0x2273fb
xorl %ebx, %ebx
movq %rsi, 0x90(%rsp)
movq %rdi, 0x88(%rsp)
movq %rbx, %rcx
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq %r8, %r15
shlq $0x4, %r15
movl 0xc(%rax,%r15), %ebx
addq %rcx, %rbx
movq %rdi, %rdx
subq %rbx, %rdx
cmpq %rbx, %rdx
cmovgeq %rbx, %rdx
testq %rdx, %rdx
jle 0x2278a9
leaq 0x1(,%rdx,2), %rcx
movq %rcx, 0x38(%rsp)
movl (%rax,%r15), %ebp
movq %r8, 0x98(%rsp)
leaq 0x1(%r8), %rcx
movq %rcx, 0xa0(%rsp)
shlq $0x4, %rcx
movq %rcx, 0x48(%rsp)
movl (%rax,%rcx), %r12d
movq (%r9), %rax
movl %ebp, %r13d
shrl %r13d
movl %ebp, %esi
andl $0x1, %esi
imulq $0x78, %r13, %r14
movq %rax, 0x30(%rsp)
addq %rax, %r14
leaq (%rsi,%rsi,2), %rax
movq 0x10(%r14,%rax,8), %rcx
movq %rax, %r10
movq 0x20(%r14,%rax,8), %rax
movq %rcx, %rdi
andq %r11, %rdi
je 0x2274ce
addq %rdx, %rdx
shlq $0x5, %rdi
xorl %r8d, %r8d
cmpl %r12d, 0x8(%rax,%r8)
je 0x2274fc
addq $0x20, %r8
cmpq %r8, %rdi
jne 0x2274be
cmpq $0x0, 0x80(%rsp)
je 0x2277ea
movq 0x20(%rsp), %rdx
movq 0x10(%rdx), %rdi
leaq (,%r13,4), %r8
addq %r13, %r8
testl %esi, %esi
je 0x227547
movq 0x18(%rdi,%r8,8), %rdx
jmp 0x227557
movl 0x10(%rax,%r8), %ecx
cmpq %rcx, %rdx
jb 0x227510
movq 0x38(%rsp), %rcx
movl %ecx, 0x10(%rax,%r8)
movl %r12d, %eax
shrl %eax
movl %r12d, %ecx
notl %ecx
andl $0x1, %ecx
imulq $0x78, %rax, %rax
movq 0x30(%rsp), %rsi
addq %rax, %rsi
leaq (%rcx,%rcx,2), %rax
movq 0x20(%rsi,%rax,8), %rax
movl 0x8(%rax), %ecx
xorl %ebp, %ecx
cmpl $0x1, %ecx
jne 0x2276f6
xorl %ecx, %ecx
jmp 0x22770c
movl 0x10(%rdi,%r8,8), %edx
decl %edx
shlq $0x3, %rdx
addq 0x18(%rdi,%r8,8), %rdx
movl %r12d, %esi
shrl %esi
leaq (%rsi,%rsi,4), %r8
testb $0x1, %r12b
jne 0x22756d
movq 0x18(%rdi,%r8,8), %rsi
jmp 0x22757d
movl 0x10(%rdi,%r8,8), %esi
decl %esi
shlq $0x3, %rsi
addq 0x18(%rdi,%r8,8), %rsi
movl %ebp, %edi
xorl %r12d, %edi
cmpl $0x1, %edi
je 0x2277ea
movq (%rdx), %rdi
shrq $0x21, %rdi
movq 0x8(%rsp), %rdx
movq (%rdx), %r8
movq 0x20(%rdx), %rdx
movq 0x20(%rdx), %rdx
movl (%rdx,%rdi,8), %r9d
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl %edi, %r9d
movl 0x44(%r8), %edi
cmpl %edi, %r9d
movq (%rsp), %r9
jle 0x2277ea
movq (%rsi), %rsi
shrq $0x21, %rsi
movl (%rdx,%rsi,8), %edx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl %esi, %edx
cmpl %edi, %edx
jle 0x2277ea
leaq (%r14,%r10,8), %rsi
addq $0x10, %rsi
cmpq 0x8(%rsi), %rcx
jne 0x227623
movq %rsi, 0x40(%rsp)
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x18(%r14,%r10,8)
shlq $0x5, %rsi
movq %rax, %rdi
movq %r10, 0x70(%rsp)
callq 0x2370
movq 0x40(%rsp), %rsi
movq 0x70(%rsp), %rcx
movq %rax, 0x20(%r14,%rcx,8)
movq (%rsi), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rsi)
shlq $0x5, %rcx
movq 0x38(%rsp), %rdx
movl %edx, 0x10(%rax,%rcx)
movl %r12d, 0x8(%rax,%rcx)
movl $0x0, 0xc(%rax,%rcx)
movq $0x0, 0x18(%rax,%rcx)
shlq $0x20, %rbp
movq 0x20(%rsp), %rdx
movq 0x18(%rdx), %rdx
movq 0x20(%rdx), %rdx
movl (%rdx,%r13,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orq %rbp, %rdx
movq %rdx, (%rax,%rcx)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rcx
movl (%rax,%rcx), %r12d
movq %r12, %r14
xorq $0x1, %r14
movl (%rax,%r15), %esi
shrl %r12d
movl %r14d, %eax
andl $0x1, %eax
imulq $0x78, %r12, %rcx
movq 0x30(%rsp), %rdx
addq %rcx, %rdx
leaq (%rax,%rax,2), %rbp
leaq (%rdx,%rbp,8), %r13
addq $0x10, %r13
movq (%r13), %rcx
cmpq 0x8(%r13), %rcx
jne 0x227729
movl %esi, 0x40(%rsp)
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x18(%rdx,%rbp,8)
movq 0x10(%r13), %rdi
shlq $0x5, %rsi
movq %rdx, 0x30(%rsp)
callq 0x2370
movl 0x40(%rsp), %esi
movq 0x30(%rsp), %rcx
movq %rax, 0x20(%rcx,%rbp,8)
movq (%r13), %rcx
jmp 0x22772d
leaq 0x28(%rax), %rsi
xorl %ecx, %ecx
incq %rcx
movl (%rsi), %edi
xorl %ebp, %edi
addq $0x20, %rsi
cmpl $0x1, %edi
jne 0x2276fc
shlq $0x5, %rcx
movl 0x10(%rax,%rcx), %esi
cmpq %rsi, %rdx
jb 0x227796
addq %rcx, %rax
addq $0x10, %rax
movq 0x38(%rsp), %rcx
movl %ecx, (%rax)
jmp 0x227796
movq 0x10(%r13), %rax
movq (%rsp), %r9
xorl $0x1, %esi
leaq 0x1(%rcx), %rdx
movq %rdx, (%r13)
shlq $0x5, %rcx
movq 0x38(%rsp), %rdx
movl %edx, 0x10(%rax,%rcx)
movl %esi, 0x8(%rax,%rcx)
movl $0x0, 0xc(%rax,%rcx)
movq $0x0, 0x18(%rax,%rcx)
shlq $0x20, %r14
movq 0x20(%rsp), %rdx
movq 0x18(%rdx), %rdx
movq 0x20(%rdx), %rdx
movl (%rdx,%r12,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orq %r14, %rdx
movq %rdx, (%rax,%rcx)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movl (%rax,%r15), %ebp
movq 0x48(%rsp), %rcx
movl (%rax,%rcx), %r12d
movq %r9, %rdi
movl %ebp, %esi
movl %r12d, %edx
movq 0x28(%rsp), %r14
movl %r14d, %ecx
movq 0x98(%rsp), %r12
movl %r12d, %r8d
callq 0x213710
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rcx
movl (%rax,%rcx), %esi
xorl $0x1, %esi
movl (%rax,%r15), %edx
xorl $0x1, %edx
movq (%rsp), %rdi
movl %r14d, %ecx
movl %r12d, %r8d
callq 0x213710
movq (%rsp), %r9
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x90(%rsp), %rsi
movq 0xa0(%rsp), %r8
cmpq %rsi, %r8
movq 0x88(%rsp), %rdi
jne 0x22741e
movq 0x18(%rsp), %rbx
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
movq 0x78(%rsp), %rdx
movq (%rax,%rdx,8), %rsi
incq %rsi
incq %rdx
movq %rsi, %r8
cmpq %rcx, %rdx
jb 0x2273c4
movq 0x28(%rsp), %rcx
incq %rcx
movq 0x58(%rsp), %rax
cmpq (%rax), %rcx
jb 0x227021
leaq 0x6df09(%rip), %rax     # 0x295758
movl 0x7c(%rax), %edi
movq 0x8(%r9), %rcx
leaq -0x1407a(%rip), %rsi    # 0x2137e3
movq %r9, %rdx
movq %r9, %r14
callq 0x108f2c
leaq 0x2277e(%rip), %rsi     # 0x249fed
movq %r14, %rdi
callq 0x219965
movq 0x8(%rsp), %rdi
movq %r14, 0x240(%rdi)
movq 0x60(%rsp), %rsi
movq %r14, %rdx
movq 0x50(%rsp), %rcx
movq %rbx, %r8
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x226819
leaq 0x226dc(%rip), %rdi     # 0x249f8c
leaq 0x1dd52(%rip), %rsi     # 0x245609
leaq 0x226d5(%rip), %rcx     # 0x249f93
movl $0x3f5c, %edx           # imm = 0x3F5C
callq 0x2110