// File: /workspace/github_cpp_makefile_star2_O2/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 $0x98, %rsp
movq %r9, %rbx
movq %r8, 0x58(%rsp)
movq %rcx, 0x88(%rsp)
movq %rdx, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdi, %r13
callq 0x1d828f
movq 0x230(%r13), %rax
movq %rax, 0x70(%rsp)
movq 0x18(%r13), %r14
pushq $0x1
popq %rdi
pushq $0x30
popq %rsi
callq 0x2120
movq %rax, %r15
movq %r14, 0x18(%rsp)
movq 0x18(%r14), %rax
movl 0x14(%rax), %r14d
movl %r14d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x20(%r15)
movq %rax, 0x18(%r15)
imulq $0x18, %rax, %rdi
callq 0x2280
movq %r15, 0x10(%rsp)
movq %rax, 0x28(%r15)
xorl %r15d, %r15d
pushq $0x2
popq %rbp
movq %r13, 0x48(%rsp)
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
cmpq %r14, %r15
jae 0x1d7b94
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x1c5ba9
movq %rax, %r14
movl %r15d, (%rax)
andq $0x0, 0x28(%rax)
andq $0x0, 0x10(%rax)
movq 0x18(%rsp), %rdx
movq 0x10(%rdx), %rdi
imulq $0x28, %r15, %rax
movl 0x10(%rdi,%rax), %ecx
movl %ecx, 0x4(%r14)
movq 0x58(%r14), %rcx
movq %rcx, 0x40(%r14)
movq 0x18(%rdx), %r12
movq 0x20(%r12), %rcx
movl (%rcx,%r15,8), %edx
shrl $0x1f, %edx
movb %dl, 0x70(%r14)
movl (%rcx,%r15,8), %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %ecx
movl %ecx, 0x8(%r14)
movb $0x0, 0x71(%r14)
movq (%r13), %rcx
movq 0x70(%rcx), %rsi
testq %rsi, %rsi
je 0x1d79d5
addq %rax, %rdi
callq 0x1d7892
movb %al, 0x71(%r14)
movq 0x8(%r12), %rax
movq 0x28(%r12), %rcx
leaq (%r15,%r15), %rdx
movq %rdx, 0x20(%rsp)
movq %r15, 0x8(%rsp)
shlq $0x4, %r15
movq (%rcx,%r15), %rcx
movl %ecx, %edx
shrq $0x20, %rcx
imulq $0x18, %rdx, %r13
imulq $0x18, %rcx, %rcx
leaq (%rax,%rcx), %r12
addq $0xc, %r12
xorl %ebp, %ebp
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
cmpq %rbp, %r13
je 0x1d7a92
cmpl $0x0, (%r12,%rbp)
js 0x1d7a8c
movq 0x10(%r14), %rcx
movq 0x20(%r14), %rax
cmpq 0x18(%r14), %rcx
jne 0x1d7a53
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x18(%r14)
shlq $0x5, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x20(%r14)
movq 0x10(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r14)
shlq $0x5, %rcx
andb $0x7f, 0xf(%rax,%rcx)
andl $0x0, 0x10(%rax,%rcx)
movl -0x4(%r12,%rbp), %edx
movl %edx, 0x8(%rax,%rcx)
movl (%r12,%rbp), %edx
andl %r15d, %edx
movl %edx, 0xc(%rax,%rcx)
movq -0xc(%r12,%rbp), %rdx
movq %rdx, (%rax,%rcx)
andq $0x0, 0x18(%rax,%rcx)
addq $0x18, %rbp
jmp 0x1d7a13
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rcx
movq 0x28(%rax), %rax
movq 0x20(%rsp), %rdx
movq 0x8(%rax,%rdx,8), %rax
movl %eax, %edx
shrq $0x20, %rax
imulq $0x18, %rdx, %r12
imulq $0x18, %rax, %rax
leaq (%rcx,%rax), %r13
addq $0xc, %r13
xorl %ebp, %ebp
cmpq %rbp, %r12
je 0x1d7b49
cmpl $0x0, (%r13,%rbp)
js 0x1d7b40
movq 0x28(%r14), %rcx
movq 0x38(%r14), %rax
cmpq 0x30(%r14), %rcx
jne 0x1d7b06
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x30(%r14)
shlq $0x5, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x38(%r14)
movq 0x28(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x28(%r14)
shlq $0x5, %rcx
andb $0x7f, 0xf(%rax,%rcx)
andl $0x0, 0x10(%rax,%rcx)
movl -0x4(%r13,%rbp), %edx
movl %edx, 0x8(%rax,%rcx)
movl (%r13,%rbp), %edx
andl %r15d, %edx
movl %edx, 0xc(%rax,%rcx)
movq -0xc(%r13,%rbp), %rdx
movq %rdx, (%rax,%rcx)
andq $0x0, 0x18(%rax,%rcx)
addq $0x18, %rbp
jmp 0x1d7ac5
movq 0x10(%rsp), %rax
movq 0x28(%rax), %r14
movq 0x8(%rsp), %r15
imulq $0x18, %r15, %r12
pushq $0x1
popq %rax
movq %rax, 0x10(%r14,%r12)
movq %rax, 0x8(%r14,%r12)
pushq $0x4
popq %rdi
callq 0x2280
movq %rax, (%r14,%r12)
movl %r15d, (%rax)
incq %r15
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %r14d
movq 0x48(%rsp), %r13
pushq $0x2
popq %rbp
jmp 0x1d794a
movq 0x58(%rsp), %rax
andq $0x0, (%rax)
xorl %ecx, %ecx
movq 0x10(%rsp), %r14
movq %rbx, 0x90(%rsp)
movq 0x70(%rsp), %rax
cmpq (%rax), %rcx
jae 0x1d8229
movq 0x260(%r13), %r8
movq %rcx, 0x28(%rsp)
imulq $0x18, %rcx, %rax
movq (%r8,%rax), %rcx
cmpq $0x2, %rcx
jae 0x1d7be3
movq 0x28(%rsp), %rcx
incq %rcx
movq 0x10(%rsp), %r14
jmp 0x1d7bac
addq %rax, %r8
movq %r8, 0x298(%r13)
movq 0x68(%rsp), %rax
movq %rax, 0x2a0(%r13)
movq 0x1e0(%r13), %rdi
movl $0x300, %eax            # imm = 0x300
movq %rdi, %rdx
subq $0x1, %rdx
jb 0x1d7c22
movq 0x1d8(%r13), %rsi
andq $0x0, (%rsi,%rax)
addq $0x328, %rax            # imm = 0x328
jmp 0x1d7c08
movq %r8, 0x8(%rsp)
decq %rcx
leaq 0x6ff(%rip), %rsi       # 0x1d8330
movq %r13, %rdx
callq 0xc67c0
andq $0x0, (%rbx)
xorl %r14d, %r14d
cmpq 0x1e0(%r13), %r14
jae 0x1d7cbb
movq 0x1d8(%r13), %rcx
imulq $0x328, %r14, %r15      # imm = 0x328
xorl %r12d, %r12d
cmpq 0x300(%rcx,%r15), %r12
jae 0x1d7cb6
movq (%rbx), %rdx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rdx
jne 0x1d7c9a
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
cmoveq %rbp, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq 0x1d8(%r13), %rcx
movq (%rbx), %rdx
movq 0x310(%rcx,%r15), %rsi
movq (%rsi,%r12,8), %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, (%rbx)
movq %rsi, (%rax,%rdx,8)
incq %r12
jmp 0x1d7c5a
incq %r14
jmp 0x1d7c40
xorl %r14d, %r14d
movq (%rbx), %rax
movq 0x10(%rbx), %rdi
cmpq %rax, %r14
jae 0x1d7d9f
movq (%rdi,%r14,8), %rbp
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rbp, %r15
shlq $0x4, %r15
movl (%rax,%r15), %esi
leaq 0x1(%rbp), %r12
shlq $0x4, %r12
movl (%rax,%r12), %edx
movq 0x10(%rsp), %rdi
callq 0x1dee3b
testq %rax, %rax
je 0x1d7d97
movq %rbp, %r8
movq %r14, 0x20(%rsp)
cmpl $0x0, 0x10(%rax)
jne 0x1d7d1a
movl $0x1, 0x10(%rax)
movq 0x8(%rsp), %r14
movq 0x10(%r14), %rax
movl (%rax,%r15), %esi
movl (%rax,%r12), %edx
movq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq 0x28(%rsp), %rcx
movq %r8, 0x50(%rsp)
callq 0x1c5c49
movq 0x10(%r14), %rax
movl (%rax,%r12), %esi
xorl $0x1, %esi
movl (%rax,%r15), %edx
xorl $0x1, %edx
movq %rbp, %rdi
callq 0x1dee3b
cmpl $0x0, 0x10(%rax)
jne 0x1d7d69
movl $0x1, 0x10(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl (%rax,%r12), %esi
xorl $0x1, %esi
movl (%rax,%r15), %edx
xorl $0x1, %edx
movq %rbp, %rdi
movq 0x28(%rsp), %rcx
movq 0x50(%rsp), %r8
callq 0x1c5c49
movq 0x20(%rsp), %r14
incq %r14
jmp 0x1d7cbe
leaq (%rdi,%rax,8), %rsi
callq 0x1a3def
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
testq %rcx, %rcx
je 0x1d7dc6
movq 0x8(%rsp), %rdx
movq (%rdx), %rdx
decq %rdx
cmpq %rdx, -0x8(%rax,%rcx,8)
jae 0x1d7e09
cmpq 0x8(%rbx), %rcx
pushq $0x2
popq %rbp
jne 0x1d7df1
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %rbp, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq 0x8(%rsp), %rdx
movq (%rdx), %rdx
decq %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rbx)
movq %rdx, (%rax,%rcx,8)
jmp 0x1d7e0c
pushq $0x2
popq %rbp
xorl %r12d, %r12d
xorl %ecx, %ecx
cmpq (%rbx), %rcx
jae 0x1d7bd4
movq (%rax,%rcx,8), %rsi
cmpq %rsi, %r12
jae 0x1d821b
movq %rcx, 0x80(%rsp)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rsi, %rcx
shlq $0x4, %rcx
movl 0xc(%rax,%rcx), %r15d
movq %r12, %rbp
shlq $0x4, %rbp
addq %rbp, %rax
addq $0xc, %rax
movq %r12, %rcx
cmpq %rsi, %rcx
jae 0x1d7e68
movl (%rax), %edx
addq %rdx, %r15
incq %rcx
addq $0x10, %rax
jmp 0x1d7e55
addq $0x10, %rbp
xorl %r13d, %r13d
movq %rsi, 0x20(%rsp)
movq %r15, 0x50(%rsp)
cmpq %rsi, %r12
jae 0x1d8203
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl -0x4(%rax,%rbp), %ecx
addq %rcx, %r13
subq %r13, %r15
cmpq %r13, %r15
cmovgeq %r13, %r15
testq %r15, %r15
jle 0x1d8270
leaq 0x1(,%r15,2), %r14
movl -0x10(%rax,%rbp), %esi
movl (%rax,%rbp), %edx
movq 0x10(%rsp), %rdi
callq 0x1dee3b
testq %rax, %rax
je 0x1d7f6f
addq %r15, %r15
movl 0x10(%rax), %ecx
cmpq %rcx, %r15
jb 0x1d7ed6
movl %r14d, 0x10(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rax,%rbp), %edx
movl (%rax,%rbp), %esi
xorl $0x1, %esi
xorl $0x1, %edx
movq 0x10(%rsp), %rdi
callq 0x1dee3b
movl 0x10(%rax), %ecx
cmpq %rcx, %r15
jb 0x1d7f02
movl %r14d, 0x10(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rax,%rbp), %esi
movl (%rax,%rbp), %edx
movq 0x10(%rsp), %r15
movq %r15, %rdi
movq 0x28(%rsp), %r14
movl %r14d, %ecx
movq %r12, %rbx
movl %ebx, %r8d
callq 0x1c5c49
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rax,%rbp), %edx
movl (%rax,%rbp), %esi
xorl $0x1, %esi
xorl $0x1, %edx
movq %r15, %rdi
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x1c5c49
movq 0x90(%rsp), %rbx
addq $0x10, %rbp
incq %r12
movq 0x20(%rsp), %rsi
movq 0x50(%rsp), %r15
jmp 0x1d7e79
cmpq $0x0, 0x88(%rsp)
je 0x1d7f59
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl -0x10(%rsi,%rbp), %r9d
movl %r9d, %ecx
shrl %ecx
movq %r9, %rax
movq 0x18(%rsp), %rdx
movq 0x10(%rdx), %rdx
andq $0x1, %rax
je 0x1d7faa
imulq $0x28, %rcx, %rcx
movq 0x18(%rdx,%rcx), %rcx
jmp 0x1d7fbd
imulq $0x28, %rcx, %rdi
movl 0x10(%rdx,%rdi), %ecx
decl %ecx
shlq $0x3, %rcx
addq 0x18(%rdx,%rdi), %rcx
movl (%rsi,%rbp), %r15d
movl %r15d, %esi
shrl %esi
testb $0x1, %r15b
jne 0x1d7fd7
imulq $0x28, %rsi, %rsi
movq 0x18(%rdx,%rsi), %rsi
jmp 0x1d7fea
imulq $0x28, %rsi, %rdi
movl 0x10(%rdx,%rdi), %esi
decl %esi
shlq $0x3, %rsi
addq 0x18(%rdx,%rdi), %rsi
movl %r15d, %edx
xorl %r9d, %edx
cmpl $0x1, %edx
je 0x1d7f59
movq (%rcx), %rdx
shrq $0x21, %rdx
movq 0x48(%rsp), %rcx
movq (%rcx), %rdi
movq 0x20(%rcx), %rcx
movq 0x20(%rcx), %rcx
movl (%rcx,%rdx,8), %r8d
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %r8d
movl 0x44(%rdi), %edx
cmpl %edx, %r8d
jle 0x1d7f59
movq (%rsi), %rsi
shrq $0x21, %rsi
movl (%rcx,%rsi,8), %ecx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl %esi, %ecx
cmpl %edx, %ecx
jle 0x1d7f59
movq 0x10(%rsp), %rbx
movq (%rbx), %rcx
movl %r9d, %edi
shrl %edi
imulq $0x78, %rdi, %rsi
leaq (%rcx,%rsi), %rdx
imulq $0x18, %rax, %r8
movq 0x10(%r8,%rdx), %rax
cmpq 0x18(%r8,%rdx), %rax
jne 0x1d80c4
movq %rsi, 0x30(%rsp)
leaq (%rax,%rax), %rsi
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rsi
leaq 0x10(%r8,%rdx), %rax
movq %rsi, 0x8(%rax)
movq %rdi, 0x40(%rsp)
movq 0x10(%rax), %rdi
shlq $0x5, %rsi
movq %r9, 0x38(%rsp)
movq %r8, %rbx
callq 0x2370
movq 0x30(%rsp), %rsi
movq %rbx, %r8
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %r9
movq 0x10(%rsp), %rbx
movq (%rbx), %rcx
leaq (%rcx,%rsi), %rdx
movq %rax, 0x20(%r8,%rdx)
movq 0x10(%r8,%rdx), %rax
addq %rsi, %rcx
movq 0x20(%r8,%rcx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x10(%r8,%rcx)
shlq $0x5, %rax
movl %r14d, 0x10(%rdx,%rax)
movl %r15d, 0x8(%rdx,%rax)
andl $0x0, 0xc(%rdx,%rax)
andq $0x0, 0x18(%rdx,%rax)
shlq $0x20, %r9
movq 0x18(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x20(%rcx), %rcx
movl (%rcx,%rdi,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orq %r9, %rcx
movq %rcx, (%rdx,%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rax,%rbp), %r9d
movl (%rax,%rbp), %r8d
movq %r8, %rdi
xorq $0x1, %rdi
movq (%rbx), %rcx
shrl %r8d
movl %edi, %eax
andl $0x1, %eax
imulq $0x78, %r8, %rsi
leaq (%rcx,%rsi), %rdx
imulq $0x18, %rax, %r15
movq 0x10(%r15,%rdx), %rax
cmpq 0x18(%r15,%rdx), %rax
jne 0x1d81ae
movq %rsi, 0x78(%rsp)
leaq (%rax,%rax), %rsi
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rsi
leaq 0x10(%r15,%rdx), %rax
movq %rsi, 0x8(%rax)
movq %r14, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
movq 0x10(%rax), %rdi
shlq $0x5, %rsi
movq %r8, %r14
movl %r9d, 0x30(%rsp)
callq 0x2370
movq 0x78(%rsp), %rsi
movl 0x30(%rsp), %r9d
movq %r14, %r8
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %r14
movq (%rbx), %rcx
leaq (%rcx,%rsi), %rdx
movq %rax, 0x20(%r15,%rdx)
movq 0x10(%r15,%rdx), %rax
xorl $0x1, %r9d
addq %rsi, %rcx
movq 0x20(%r15,%rcx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x10(%r15,%rcx)
shlq $0x5, %rax
movl %r14d, 0x10(%rdx,%rax)
movl %r9d, 0x8(%rdx,%rax)
andl $0x0, 0xc(%rdx,%rax)
andq $0x0, 0x18(%rdx,%rax)
shlq $0x20, %rdi
movq 0x18(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x20(%rcx), %rcx
movl (%rcx,%r8,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orq %rdi, %rcx
movq %rcx, (%rdx,%rax)
jmp 0x1d7f02
movq 0x10(%rbx), %rax
movq 0x80(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movq 0x48(%rsp), %r13
pushq $0x2
popq %rbp
incq %rsi
incq %rcx
movq %rsi, %r12
jmp 0x1d7e11
movq %r14, %rdi
callq 0x1c5ce9
leaq 0x23d74(%rip), %rsi     # 0x1fbfac
movq %r14, %rdi
callq 0x1cb1f3
movq %r14, 0x240(%r13)
movq %r13, %rdi
movq 0x60(%rsp), %rsi
movq %r14, %rdx
movq 0x58(%rsp), %rcx
movq %rbx, %r8
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d744e
leaq 0x23cd4(%rip), %rdi     # 0x1fbf4b
leaq 0x1f25b(%rip), %rsi     # 0x1f74d9
leaq 0x23ccd(%rip), %rcx     # 0x1fbf52
movl $0x3f5c, %edx           # imm = 0x3F5C
callq 0x2110