// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: gen_unique_g_adv_old(ul_resolve_t*, usg_t*, unsigned long*, unsigned long, unsigned long*, unsigned int)
uint64_t gen_unique_g_adv_old(ul_resolve_t *uidx, usg_t *ng, uint64_t *int_idx, uint64_t int_idx_n, uint64_t *int_a, uint32_t max_ext)
{
    uint64_t pi, ei, *pz, bn, a_n, ua_n, *r_a, r_n; uint8_t *ff; CALLOC(ff, ng->n<<1);
    uint32_t i, k, n_vtx = ng->n<<1, s, e, zs, ze, v, b64_n; 
    uint32_t *ng_occ; CALLOC(ng_occ, n_vtx); 
    asg64_v b64, ub64; kv_init(b64); kv_init(ub64); 
    
    for (k = 0; k < int_idx_n; k++) {///scan all integer contigs
        r_a = int_a + (int_idx[k]>>32); r_n = (uint32_t)int_idx[k];
        assert(r_n >= 2);
        for (i = 1; i + 1 < r_n; i++) {
            ng_occ[r_a[i]]++; ng_occ[r_a[i]^1]++;
        }
        ng_occ[r_a[0]]++; ng_occ[r_a[r_n-1]^1]++;
    }

    ma_ug_t *un_g = ma_ug_hybrid_gen(ng); ma_utg_t *u;
    // print_debug_gfa(uidx->sg, un_g, uidx->uopt->coverage_cut, "iig0", uidx->uopt->sources, 
    // uidx->uopt->ruIndex, uidx->uopt->max_hang, uidx->uopt->min_ovlp, 0, 0, 0);
    int32_t ui, un;
    for (k = 0; k < un_g->u.n; k++) {///all unitigs of raw utg 
        u = &(un_g->u.a[k]); 
        zs = ze = (uint32_t)-1; un = u->n;
        for (ui = 0; ui < un; ui++) {
            if(occ_m(ng_occ[(u->a[ui]>>32)^1]) == 1) {
                zs = ui; break;
            }
        }

        for (ui = ((int32_t)un)-1; ui >= 0; ui--) {
            if(occ_m(ng_occ[u->a[ui]>>32]) == 1) {
                ze = ui; break;
            }
        }
        if(zs != (uint32_t)-1 && ze != (uint32_t)-1 && zs > ze) continue;
        if(zs != (uint32_t)-1) ng_occ[(u->a[zs]>>32)^1] |= ((uint32_t)0x80000000);
        if(ze != (uint32_t)-1) ng_occ[(u->a[ze]>>32)] |= ((uint32_t)0x80000000);
    }
    ma_ug_destroy(un_g);
    
    // fprintf(stderr, ">>>>>>[M::%s::] int_idx[0]::%lu, int_idx[1]::%lu\n", __func__, int_idx[0], int_idx[1]);
    // prt_intg_info(int_idx, int_idx_n, int_a, "intg");
    for (i = b64.n = ua_n = a_n = 0; i < int_idx_n; i++) {///scan all integer contigs
        s = int_idx[i]>>32; e = s + ((uint32_t)int_idx[i]); 
        assert(e > s + 1);//the length is at least 2
        for (k = s, bn = b64.n, pi = (uint64_t)-1; k < e; k++) {
            v = int_a[k];
            if((!(ng_occ[v]&((uint32_t)0x80000000)))&&(!(ng_occ[v^1]&((uint32_t)0x80000000)))) {
                continue;///it must be a unique node
            }
            if((pi != (uint64_t)-1) && (ng_occ[v^1]&((uint32_t)0x80000000))) {
                // fprintf(stderr, "+++[M::%s::i->%u::s->%u::e->%u] pi::%lu, k::%u\n", __func__, i, s, e, pi, k);
                kv_pushp(uint64_t, b64, &pz); *pz = pi; (*pz) <<= 32; (*pz) |= k; a_n++;
            }
            if(ng_occ[v]&((uint32_t)0x80000000)) pi = k;
        }

        b64_n = b64.n;
        for (k = bn, pi = s; k < b64_n; k++) {
            ei = b64.a[k]>>32;
            if(pi < ei) {
                kv_pushp(uint64_t, b64, &pz); ua_n++;
                (*pz) = pi; (*pz) <<= 32; (*pz) |= ei; (*pz) |= ((uint64_t)0x8000000000000000);
            }
            pi = (uint32_t)b64.a[k];
        }

        ei = e - 1;
        if(pi < ei) {
            kv_pushp(uint64_t, b64, &pz); ua_n++;
            (*pz) = pi; (*pz) <<= 32; (*pz) |= ei; (*pz) |= ((uint64_t)0x8000000000000000);
        }
    }
    assert(a_n + ua_n == b64.n);
    // prt_thread_info(b64.a, a_n+ua_n, NULL, 0, "tt_minus");
    // fprintf(stderr, "**0**[M::%s::] a_n::%lu, ua_n::%lu\n", __func__, a_n, ua_n);

    uint64_t *i_idx, n_clus; CALLOC(i_idx, ng->n<<1);
    radix_sort_srt64(b64.a, b64.a + b64.n);///keeps the coordinates within int_a[]

    // prt_thread_info(b64.a, a_n, NULL, 0, "tt0");
    /*********debugging*********/
    // for (i = 0; i < a_n; i++) { ///available intervals
    //     s = b64.a[i]>>32; e = (uint32_t)b64.a[i];
    //     fprintf(stderr, "[M::%s::ava->%u] s::%u, e::%u\n", __func__, i, s, e);
    //     for (k = s; k <= e; k++) {
    //         fprintf(stderr, "utg%.6dl(%c)\n", ((int32_t)(int_a[k]>>1))+1, "+-"[int_a[k]&1]);
    //     }
    // }
    // for (i = a_n; i < b64.n; i++) {///unavailable intervals
    //     s = (b64.a[i]<<1)>>33; e = (uint32_t)b64.a[i];
    //     fprintf(stderr, "[M::%s::uava->%u] s::%u, e::%u\n", __func__, i - (uint32_t)a_n, s, e);
    //     for (k = s; k <= e; k++) {
    //         fprintf(stderr, "utg%.6dl(%c)\n", ((int32_t)(int_a[k]>>1))+1, "+-"[int_a[k]&1]);
    //     }
    // }
    /*********debugging*********/






    for (i = a_n; i < b64.n; i++) {///unavailable intervals; mask all unavailable nodes
        assert(b64.a[i]&((uint64_t)0x8000000000000000)); ua_n--;
        s = (b64.a[i]<<1)>>33; e = (uint32_t)b64.a[i]; assert(e > s);//[s, e]
        for (k = s + 1; k < e; k++) {///note: here is [s, e]
            i_idx[int_a[k]] |= ((uint64_t)0x8000000000000000);
            i_idx[int_a[k]^1] |= ((uint64_t)0x8000000000000000);
        }
        i_idx[int_a[s]] |= ((uint64_t)0x8000000000000000);
        i_idx[int_a[e]^1] |= ((uint64_t)0x8000000000000000);
    }
    // prt_thread_info(b64.a, a_n, NULL, 0, "tt1");
    ///unavailable intervals are useless
    b64.n = a_n; assert(ua_n == 0);
    for (i = 0; i < a_n; i++) { ///available intervals
        s = b64.a[i]>>32; e = (uint32_t)b64.a[i]; assert(e > s);///[s, e] -> coordinates within int_a[]
        if(i == 3201 || i == 3202) {
            fprintf(stderr, "[M::%s::] s::%u, e::%u, int_a[s]::%lu(occ::%u), int_a[e]^1::%lu(occ::%u)\n", 
            __func__, s, e, int_a[s], occ_m(ng_occ[int_a[s]]),
            int_a[e]^1, occ_m(ng_occ[int_a[e]^1]));
        }
        
        assert(!(b64.a[i]&((uint64_t)0x8000000000000000)));
        for (k = s + 1; k < e; k++) {///note: here is [s, e]; s && e are unique, but [s+1, e-1] are not unique
            kv_pushp(uint64_t, b64, &pz); //i_idx[int_a[k]]++;
            (*pz) = int_a[k]; (*pz) <<= 32; (*pz) |= i;///(raw unitig/non-unqiue node id)|(integer contig id)

            kv_pushp(uint64_t, b64, &pz); //i_idx[int_a[k]^1]++;
            (*pz) = int_a[k]^1; (*pz) <<= 32; (*pz) |= i;
        }
        kv_pushp(uint64_t, b64, &pz); //i_idx[int_a[s]]++;
        (*pz) = int_a[s]; (*pz) <<= 32; (*pz) |= i;

        kv_pushp(uint64_t, b64, &pz); //i_idx[int_a[e]^1]++;
        (*pz) = int_a[e]^1; (*pz) <<= 32; (*pz) |= i;
    }
    // prt_thread_info(b64.a, a_n, NULL, 0, "tt2");
    // fprintf(stderr, "**1**[M::%s::] a_n::%lu, ua_n::%lu\n", __func__, a_n, ua_n);
    ///index
    radix_sort_srt64(b64.a + a_n, b64.a + b64.n);///(raw unitig node id)|(integer contig id)
    for (k = a_n + 1, i = a_n; k <= b64.n; k++) {
        if(k == b64.n || (b64.a[k]>>32) != (b64.a[i]>>32)) {
            i_idx[b64.a[i]>>32] |= (((uint64_t)i)<<32)|((uint64_t)k);///b64.a[i]>>32 appear once (unique ends)/multipe times
            i = k;
        }
    }
    // prt_thread_info(b64.a, a_n, NULL, 0, "tt3");
    // fprintf(stderr, "**2**[M::%s::] a_n::%lu, ua_n::%lu\n", __func__, a_n, ua_n);
    ///b64.a[0, a_n]:: all resolvable paths with unique beg && end
    ///b64.a[a_n, b64.n]:: (raw unitig/non-unqiue node id)|(resolvable path id)
    // n_clus = usg_unique_arcs_cluster(&b64, a_n, i_idx, int_a);///this function might be wrong
    n_clus = usg_unique_arcs_cluster_adv(&b64, a_n, i_idx, int_a, &ub64);
    fprintf(stderr, "**3**[M::%s::] a_n::%lu, n_clus::%lu\n", __func__, a_n, n_clus);
    // prt_thread_info(b64.a, a_n, NULL, 0, "tt4");
    assert(b64.n == (a_n<<1));
    old_path_ext(uidx, ng, &b64, &ub64, a_n, n_clus, i_idx, int_a, ff, ng_occ, max_ext);
    // new_path_ext(uidx, ng, &b64, &ub64, a_n, n_clus, i_idx, int_a, ff, ng_occ, max_ext);

    free(ng_occ); free(i_idx); free(ff); kv_destroy(b64); kv_destroy(ub64); 
    return b64.n - a_n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %r9d, 0x9c(%rsp)
movq %r8, %r13
movq %rcx, %r15
movq %rdx, %rbp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x78(%rsp)
movq 0x8(%rsi), %r12
addq %r12, %r12
movl $0x1, %esi
movq %r12, %rdi
callq 0x2120
movq %rax, 0xa8(%rsp)
movl %r12d, %edi
movl $0x4, %esi
callq 0x2120
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rsp)
movaps %xmm0, 0xb0(%rsp)
movq $0x0, 0xc0(%rsp)
testq %r15, %r15
je 0x21c34e
leaq 0x8(%r13), %r11
xorl %ecx, %ecx
movq (%rbp,%rcx,8), %rsi
movl %esi, %edx
cmpq $0x2, %rdx
jb 0x21cbb5
shrq $0x20, %rsi
cmpl $0x2, %edx
je 0x21c32a
leaq -0x2(%rdx), %rdi
leaq (%r11,%rsi,8), %r8
xorl %r9d, %r9d
movq (%r8,%r9,8), %r10
incl (%rax,%r10,4)
xorq $0x1, %r10
incl (%rax,%r10,4)
incq %r9
cmpq %r9, %rdi
jne 0x21c312
leaq (,%rsi,8), %rsi
addq %r13, %rsi
movq (%rsi), %rdi
incl (%rax,%rdi,4)
movq -0x8(%rsi,%rdx,8), %rdx
xorq $0x1, %rdx
incl (%rax,%rdx,4)
incl %ecx
cmpq %r15, %rcx
jb 0x21c2ed
movq %rax, 0x28(%rsp)
movq 0x78(%rsp), %rdi
callq 0x21a43d
movq (%rax), %rcx
testq %rcx, %rcx
je 0x21c440
movq 0x10(%rax), %rdx
xorl %esi, %esi
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
leaq (%rsi,%rsi,4), %r8
leaq (%rdx,%r8,8), %r10
movl 0x10(%r10), %r8d
testl %r8d, %r8d
jle 0x21c3b1
movq 0x18(%r10), %r11
xorl %r9d, %r9d
movl 0x4(%r11,%r9,8), %ebx
shlq $0x2, %rbx
xorq $0x4, %rbx
movq 0x28(%rsp), %r14
movl (%r14,%rbx), %ebx
andl %edi, %ebx
cmpl $0x1, %ebx
je 0x21c3b7
incq %r9
cmpq %r9, %r8
jne 0x21c38c
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
testl %r8d, %r8d
jle 0x21c410
movq 0x18(%r10), %r11
movl -0x4(%r11,%r8,8), %ebx
decq %r8
movq 0x28(%rsp), %r14
movl (%r14,%rbx,4), %ebx
andl %edi, %ebx
cmpl $0x1, %ebx
jne 0x21c3b7
cmpl $-0x1, %r9d
je 0x21c3e3
cmpl %r8d, %r9d
ja 0x21c431
cmpl $-0x1, %r9d
je 0x21c406
movl %r9d, %r9d
movl 0x4(%r11,%r9,8), %r9d
shlq $0x2, %r9
xorq $0x4, %r9
movq 0x28(%rsp), %r10
orl $0x80000000, (%r10,%r9) # imm = 0x80000000
movl %r8d, %r8d
movl 0x4(%r11,%r8,8), %r8d
jmp 0x21c426
cmpl $-0x1, %r9d
je 0x21c431
movq 0x18(%r10), %r8
movl %r9d, %r9d
movl 0x4(%r8,%r9,8), %r8d
xorq $0x1, %r8
movq 0x28(%rsp), %r9
orb $-0x80, 0x3(%r9,%r8,4)
incq %rsi
movl %esi, %r8d
cmpq %r8, %rcx
ja 0x21c374
movq %rbp, 0x88(%rsp)
movq %rax, %rdi
callq 0xa0761
xorl %r14d, %r14d
movq $0x0, 0x38(%rsp)
movl $0x0, %edi
movl $0x0, %r8d
movl $0x0, %ebp
testq %r15, %r15
movq %r13, 0x70(%rsp)
je 0x21c6bf
xorl %ebp, %ebp
xorl %r8d, %r8d
xorl %edi, %edi
movq 0x28(%rsp), %rdx
movq %r15, 0x80(%rsp)
movq 0x88(%rsp), %rax
movq (%rax,%r14,8), %rcx
movq %rcx, %r15
shrq $0x20, %r15
addl %r15d, %ecx
leal 0x1(%r15), %eax
cmpl %eax, %ecx
jbe 0x21cbd4
movq %r14, 0x58(%rsp)
movq %rbp, 0x50(%rsp)
movq 0x38(%rsp), %r12
movq 0x40(%rsp), %r14
cmpl %r15d, %ecx
movq %rcx, 0x30(%rsp)
movq %r12, 0x60(%rsp)
jbe 0x21c57b
movl %ecx, %esi
movq $-0x1, %r13
movq %r15, %rbx
movq %r8, 0x68(%rsp)
movq %rsi, 0x90(%rsp)
movq 0x70(%rsp), %rax
movl (%rax,%rbx,8), %eax
movl (%rdx,%rax,4), %ebp
testl %ebp, %ebp
js 0x21c50c
movq %rax, %rcx
xorq $0x1, %rcx
cmpl $0x0, (%rdx,%rcx,4)
jns 0x21c56f
cmpq $-0x1, %r13
je 0x21c569
xorq $0x1, %rax
cmpl $0x0, (%rdx,%rax,4)
jns 0x21c569
cmpq %r14, %r12
jne 0x21c553
leaq (%r12,%r12), %r14
testq %r12, %r12
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
callq 0x2370
movq 0x90(%rsp), %rsi
movq 0x68(%rsp), %r8
movq 0x28(%rsp), %rdx
movq %rax, %rdi
movq %r13, %rax
shlq $0x20, %rax
addq %rbx, %rax
movq %rax, (%rdi,%r12,8)
incq %r12
incq 0x50(%rsp)
testl %ebp, %ebp
cmovsq %rbx, %r13
incq %rbx
cmpq %rbx, %rsi
jne 0x21c4f0
movq %r12, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq 0x60(%rsp), %rax
cmpl %r12d, %eax
jae 0x21c614
movl %eax, %ebx
movl %r12d, %ecx
movq (%rdi,%rbx,8), %rax
movq %rax, %rbp
shrq $0x20, %rbp
cmpq %rbp, %r15
jae 0x21c609
cmpq %r14, %r12
jne 0x21c5e8
leaq (%r12,%r12), %r14
testq %r12, %r12
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq %r8, %r13
movq %r12, 0x60(%rsp)
movq %rcx, %r12
callq 0x2370
movq %r12, %rcx
movq 0x60(%rsp), %r12
movq %r13, %r8
movq 0x28(%rsp), %rdx
movq %rax, %rdi
incq %r8
shlq $0x20, %r15
orq %r15, %rbp
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
orq %rax, %rbp
movq %rbp, (%rdi,%r12,8)
incq %r12
movl (%rdi,%rbx,8), %eax
movl %eax, %r15d
incq %rbx
cmpq %rbx, %rcx
jne 0x21c598
movq %r12, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq 0x30(%rsp), %rcx
decl %ecx
cmpl %ecx, %r15d
jae 0x21c697
cmpq %r14, %r12
movq 0x70(%rsp), %r13
movq 0x50(%rsp), %rbp
jne 0x21c66b
leaq (%r14,%r14), %rsi
testq %r14, %r14
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x40(%rsp)
shlq $0x3, %rsi
movq %rcx, %r14
movq %r8, %rbx
callq 0x2370
movq %rbx, %r8
movq %r14, %rcx
movq 0x28(%rsp), %rdx
movq %rax, %rdi
movq 0x58(%rsp), %r14
leaq 0x1(%r12), %rax
movq %rax, 0x38(%rsp)
incq %r8
shlq $0x20, %r15
orq %rcx, %r15
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
orq %rax, %r15
movq %r15, (%rdi,%r12,8)
jmp 0x21c6a6
movq 0x70(%rsp), %r13
movq 0x50(%rsp), %rbp
movq 0x58(%rsp), %r14
incl %r14d
movq 0x80(%rsp), %r15
cmpq %r15, %r14
jb 0x21c48e
movq 0x38(%rsp), %r14
leaq (%r8,%rbp), %rax
cmpq %r14, %rax
jne 0x21cc6f
movq %rdi, %rbx
movq %r8, %r12
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rdi
addq %rdi, %rdi
movl $0x8, %esi
callq 0x2120
movq %rax, %r15
movq %rbx, %rdi
leaq (%rbx,%r14,8), %rsi
callq 0x1ee586
movl %ebp, %edx
cmpq %rdx, %r14
jbe 0x21c792
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movl %ebp, %ecx
movq %rbx, %r10
movq %r12, %r11
movq (%r10,%rdx,8), %rdx
testq %rdx, %rdx
jns 0x21cbf3
movq %rdx, %rsi
shrq $0x20, %rsi
movl %esi, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
cmpl %edx, %edi
jae 0x21cc12
incl %edi
cmpl %edx, %edi
jae 0x21c765
movl %esi, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
incq %rdi
movl %edx, %r8d
movq (%r13,%rdi,8), %r9
orq %rax, (%r15,%r9,8)
xorq $0x1, %r9
orq %rax, (%r15,%r9,8)
incq %rdi
cmpq %rdi, %r8
jne 0x21c74c
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq (%r13,%rsi,8), %rsi
orq %rax, (%r15,%rsi,8)
movl %edx, %edx
movq (%r13,%rdx,8), %rdx
xorq $0x1, %rdx
orq %rax, (%r15,%rdx,8)
decq %r11
incl %ecx
movq %rcx, %rdx
cmpq %rcx, %r14
ja 0x21c714
jmp 0x21c798
movq %rbx, %r10
movq %r12, %r11
movq %rbp, 0x38(%rsp)
testq %r11, %r11
jne 0x21cc8e
xorl %ebx, %ebx
testq %rbp, %rbp
je 0x21ca6f
xorl %eax, %eax
xorl %r12d, %r12d
movq %rbp, 0x50(%rsp)
movq %r15, 0x80(%rsp)
movq %rax, 0x30(%rsp)
movq (%r10,%rax,8), %rbx
movq %rbx, %rcx
shrq $0x20, %rcx
cmpl %ecx, %ebx
jbe 0x21cc50
leal -0xc81(%r12), %edx
movq %rbx, %rax
cmpl $0x1, %edx
movq %rcx, 0x68(%rsp)
jbe 0x21c9f6
testq %rax, %rax
js 0x21cc31
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %r14
leal 0x1(%rcx), %eax
cmpl %ebx, %eax
jae 0x21c935
movq %r12, 0x90(%rsp)
movl %eax, %eax
leaq (,%rax,8), %rdi
addq %r13, %rdi
movq %rbx, %rax
movl %ecx, %ebx
notl %ebx
movq %rax, 0x88(%rsp)
addl %eax, %ebx
leaq (%rsi,%rsi), %r13
leaq (,%rsi,8), %rbp
xorl %r12d, %r12d
movq 0x30(%rsp), %r15
movq %rsi, 0x60(%rsp)
movq %rdi, 0x58(%rsp)
leaq (%rsi,%r12), %rax
cmpq %r14, %rax
jne 0x21c88b
testq %rax, %rax
movq %r13, %r14
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq %r10, %rdi
callq 0x2370
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq %rax, %r10
leaq (%rsi,%r12), %rax
incq %rax
leaq (%r10,%rbp), %rcx
movq (%rdi,%r12,4), %rdx
shlq $0x20, %rdx
orq %r15, %rdx
movq %rdx, (%rcx,%r12,8)
cmpq %r14, %rax
jne 0x21c8df
leaq (%r14,%r14), %r15
testq %r14, %r14
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r10, %rdi
callq 0x2370
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq %rax, %r10
movq %r15, %r14
movq 0x30(%rsp), %r15
leaq (%r10,%rbp), %rax
movq (%rdi,%r12,4), %rcx
shlq $0x20, %rcx
orq %r15, %rcx
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorq %rdx, %rcx
movq %rcx, 0x8(%rax,%r12,8)
addq $0x2, %r12
addq $0x4, %r13
decl %ebx
jne 0x21c856
addq %r12, %rsi
movq 0x70(%rsp), %r13
movq 0x50(%rsp), %rbp
movq 0x80(%rsp), %r15
movq 0x90(%rsp), %r12
movq 0x88(%rsp), %rbx
movq %r14, 0x40(%rsp)
cmpq %r14, %rsi
jne 0x21c96e
movq %rsi, %rbp
leaq (%r14,%r14), %rsi
testq %r14, %r14
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x40(%rsp)
shlq $0x3, %rsi
movq %r10, %rdi
callq 0x2370
movq %rbp, %rsi
movq 0x50(%rsp), %rbp
movq %rax, %r10
leaq 0x1(%rsi), %rax
movq 0x68(%rsp), %rcx
movq (%r13,%rcx,8), %rcx
shlq $0x20, %rcx
orq 0x30(%rsp), %rcx
movq %rcx, (%r10,%rsi,8)
cmpq 0x40(%rsp), %rax
jne 0x21c9ba
movq %rsi, %r14
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x40(%rsp)
shlq $0x3, %rsi
movq %r10, %rdi
callq 0x2370
movq %r14, %rsi
movq %rax, %r10
leaq 0x2(%rsi), %rax
movq %rax, 0x38(%rsp)
movl %ebx, %eax
movq (%r13,%rax,8), %rax
shlq $0x20, %rax
orq 0x30(%rsp), %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
xorq %rcx, %rax
movq %rax, 0x8(%r10,%rsi,8)
incl %r12d
movq %r12, %rax
cmpq %r12, %rbp
ja 0x21c7c3
jmp 0x21ca6a
movq 0x785e3(%rip), %rax     # 0x294fe0
movq (%rax), %rdi
movq (%r13,%rcx,8), %r9
movq 0x28(%rsp), %rdx
movl (%rdx,%r9,4), %eax
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl %esi, %eax
movl %ebx, %r8d
movq (%r13,%r8,8), %r8
xorq $0x1, %r8
movl (%rdx,%r8,4), %edx
andl %esi, %edx
movl %edx, 0x10(%rsp)
movq %r8, 0x8(%rsp)
movl %eax, (%rsp)
leaq 0x2c60e(%rip), %rsi     # 0x249048
leaq 0x2c651(%rip), %rdx     # 0x249092
movl %ebx, %r8d
xorl %eax, %eax
movq %rbx, %r14
movq %r10, %rbx
callq 0x22b0
movq %rbx, %r10
movq %r14, %rbx
movq 0x68(%rsp), %rcx
movq 0x30(%rsp), %rax
movq (%r10,%rax,8), %rax
jmp 0x21c7f4
movq 0x38(%rsp), %rbx
movq %r10, 0x48(%rsp)
leaq (%r10,%rbp,8), %rdi
movq %r10, %r14
leaq (%r10,%rbx,8), %rsi
callq 0x1ee586
leal 0x1(%rbp), %eax
cmpq %rax, %rbx
jb 0x21cad0
leal 0x2(%rbp), %ecx
movl %ebp, %edx
cmpq %rax, %rbx
jne 0x21ca9e
movl %edx, %esi
movq (%r14,%rsi,8), %rdi
jmp 0x21cab1
movl %edx, %esi
movq (%r14,%rsi,8), %rdi
movq (%r14,%rax,8), %r8
xorq %rdi, %r8
shrq $0x20, %r8
je 0x21cac7
leal -0x1(%rcx), %edx
shlq $0x20, %rsi
shrq $0x20, %rdi
orq (%r15,%rdi,8), %rsi
orq %rax, %rsi
movq %rsi, (%r15,%rdi,8)
movl %ecx, %eax
incl %ecx
cmpq %rax, %rbx
jae 0x21ca91
leaq 0x38(%rsp), %r14
leaq 0xb0(%rsp), %r8
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x218d9b
movl %eax, %r8d
movq 0x784e8(%rip), %rax     # 0x294fe0
movq (%rax), %rdi
leaq 0x2c5d0(%rip), %rsi     # 0x2490d2
leaq 0x2c589(%rip), %rdx     # 0x249092
movq %rbp, %rcx
xorl %eax, %eax
callq 0x22b0
leaq (,%rbp,2), %rax
cmpq %rax, (%r14)
jne 0x21ccad
movl 0x9c(%rsp), %eax
movl %eax, 0x20(%rsp)
movq 0x28(%rsp), %r12
movq %r12, 0x18(%rsp)
movq 0xa8(%rsp), %rbx
movq %rbx, 0x10(%rsp)
movq %r13, 0x8(%rsp)
leaq 0x38(%rsp), %r14
leaq 0xb0(%rsp), %r13
movq 0xa0(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq %r14, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x21beee
movq %r12, %rdi
callq 0x2220
movq %r15, %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2220
movq 0x10(%r14), %rdi
callq 0x2220
movq 0x10(%r13), %rdi
callq 0x2220
movq (%r14), %rax
subq %rbp, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2c3da(%rip), %rdi     # 0x248f96
leaq 0x28a46(%rip), %rsi     # 0x245609
leaq 0x2c3d5(%rip), %rcx     # 0x248f9f
movl $0x342d, %edx           # imm = 0x342D
callq 0x2110
leaq 0x2c031(%rip), %rdi     # 0x248c0c
leaq 0x28a27(%rip), %rsi     # 0x245609
leaq 0x2c3b6(%rip), %rcx     # 0x248f9f
movl $0x3450, %edx           # imm = 0x3450
callq 0x2110
leaq 0x2c41c(%rip), %rdi     # 0x249016
leaq 0x28a08(%rip), %rsi     # 0x245609
leaq 0x2c397(%rip), %rcx     # 0x248f9f
movl $0x348c, %edx           # imm = 0x348C
callq 0x2110
leaq 0x2bbf6(%rip), %rdi     # 0x24880f
leaq 0x289e9(%rip), %rsi     # 0x245609
leaq 0x2c378(%rip), %rcx     # 0x248f9f
movl $0x348d, %edx           # imm = 0x348D
callq 0x2110
leaq 0x2c46f(%rip), %rdi     # 0x2490a7
leaq 0x289ca(%rip), %rsi     # 0x245609
leaq 0x2c359(%rip), %rcx     # 0x248f9f
movl $0x34a0, %edx           # imm = 0x34A0
callq 0x2110
leaq 0x2bbb8(%rip), %rdi     # 0x24880f
leaq 0x289ab(%rip), %rsi     # 0x245609
leaq 0x2c33a(%rip), %rcx     # 0x248f9f
movl $0x3499, %edx           # imm = 0x3499
callq 0x2110
leaq 0x2c38c(%rip), %rdi     # 0x249002
leaq 0x2898c(%rip), %rsi     # 0x245609
leaq 0x2c31b(%rip), %rcx     # 0x248f9f
movl $0x346d, %edx           # imm = 0x346D
callq 0x2110
leaq 0x2c3a9(%rip), %rdi     # 0x24903e
leaq 0x2896d(%rip), %rsi     # 0x245609
leaq 0x2c2fc(%rip), %rcx     # 0x248f9f
movl $0x3497, %edx           # imm = 0x3497
callq 0x2110
leaq 0x2c444(%rip), %rdi     # 0x2490f8
leaq 0x2894e(%rip), %rsi     # 0x245609
leaq 0x2c2dd(%rip), %rcx     # 0x248f9f
movl $0x34c0, %edx           # imm = 0x34C0
callq 0x2110