// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: gen_unique_g_adv(ul_resolve_t*, usg_t*, unsigned long*, unsigned long, unsigned long*, unsigned int)
uint64_t gen_unique_g_adv(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); 
    uint64_t *i_idx, n_clus; CALLOC(i_idx, ng->n<<1);
    
    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);
                pz = (b64.n>0)? &(b64.a[b64.n-1]):(NULL);
                if((!pz) || (((*pz)>>32) != pi)) {//keep the shortest 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;//keep the shortest 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);
    radix_sort_srt64(b64.a, b64.a + b64.n);///keeps the coordinates within int_a[]

    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[]
        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);//wrong

    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 $0xd8, %rsp
movl %r9d, 0x8c(%rsp)
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r13
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x90(%rsp)
movq 0x8(%rsi), %rbx
addq %rbx, %rbx
movl $0x1, %esi
movq %rbx, %rdi
callq 0x2120
movq %rax, 0xa8(%rsp)
movl %ebx, %edi
movl $0x4, %esi
callq 0x2120
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rsp)
movl $0x8, %esi
movq %rbx, %rdi
movq %rax, %rbx
callq 0x2120
movq %rax, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movq $0x0, 0xd0(%rsp)
movq %r15, 0x50(%rsp)
testq %r15, %r15
je 0x21cdc4
leaq 0x8(%r14), %rax
xorl %ecx, %ecx
movq (%r13,%rcx,8), %rsi
movl %esi, %edx
cmpq $0x2, %rdx
jb 0x21d5b2
shrq $0x20, %rsi
cmpl $0x2, %edx
je 0x21cda5
leaq -0x2(%rdx), %rdi
leaq (%rax,%rsi,8), %r8
xorl %r9d, %r9d
movq (%r8,%r9,8), %r10
incl (%rbx,%r10,4)
xorq $0x1, %r10
incl (%rbx,%r10,4)
incq %r9
cmpq %r9, %rdi
jne 0x21cd8d
leaq (%r14,%rsi,8), %rsi
movq (%rsi), %rdi
incl (%rbx,%rdi,4)
movq -0x8(%rsi,%rdx,8), %rdx
xorq $0x1, %rdx
incl (%rbx,%rdx,4)
incl %ecx
cmpq 0x50(%rsp), %rcx
jb 0x21cd68
movq 0x90(%rsp), %rdi
callq 0x21a43d
movq (%rax), %rcx
testq %rcx, %rcx
movq %rbx, 0x30(%rsp)
je 0x21ceb9
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 0x21ce2a
movq 0x18(%r10), %r11
xorl %r9d, %r9d
movl 0x4(%r11,%r9,8), %ebx
shlq $0x2, %rbx
xorq $0x4, %rbx
movq 0x30(%rsp), %r15
movl (%r15,%rbx), %ebx
andl %edi, %ebx
cmpl $0x1, %ebx
je 0x21ce30
incq %r9
cmpq %r9, %r8
jne 0x21ce05
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
testl %r8d, %r8d
jle 0x21ce89
movq 0x18(%r10), %r11
movl -0x4(%r11,%r8,8), %ebx
decq %r8
movq 0x30(%rsp), %r15
movl (%r15,%rbx,4), %ebx
andl %edi, %ebx
cmpl $0x1, %ebx
jne 0x21ce30
cmpl $-0x1, %r9d
movq 0x30(%rsp), %rbx
je 0x21ce61
cmpl %r8d, %r9d
ja 0x21ceaa
cmpl $-0x1, %r9d
je 0x21ce7f
movl %r9d, %r9d
movl 0x4(%r11,%r9,8), %r9d
shlq $0x2, %r9
xorq $0x4, %r9
orl $0x80000000, (%rbx,%r9) # imm = 0x80000000
movl %r8d, %r8d
movl 0x4(%r11,%r8,8), %r8d
jmp 0x21cea4
cmpl $-0x1, %r9d
movq 0x30(%rsp), %rbx
je 0x21ceaa
movq 0x18(%r10), %r8
movl %r9d, %r9d
movl 0x4(%r8,%r9,8), %r8d
xorq $0x1, %r8
orb $-0x80, 0x3(%rbx,%r8,4)
incq %rsi
movl %esi, %r8d
cmpq %r8, %rcx
ja 0x21cded
movq %r12, 0x98(%rsp)
movq %r14, 0x80(%rsp)
movq %rax, %rdi
callq 0xa0761
xorl %ecx, %ecx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
movq $0x0, 0x38(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x21d16c
xorl %r12d, %r12d
xorl %edi, %edi
xorl %r10d, %r10d
movq $0x0, 0x60(%rsp)
xorl %r8d, %r8d
movq %r13, 0xb0(%rsp)
movq (%r13,%rcx,8), %r9
movq %r9, %r13
shrq $0x20, %r13
addl %r13d, %r9d
leal 0x1(%r13), %eax
cmpl %eax, %r9d
jbe 0x21d5d1
movq %rcx, 0x28(%rsp)
cmpl %r13d, %r9d
movq %r9, 0x78(%rsp)
jbe 0x21d026
movl %r9d, %r11d
movq $-0x1, %r15
movq %r13, %r14
movq %r10, %r9
movq %r8, 0x70(%rsp)
movq %r10, 0x68(%rsp)
movq %r11, 0xb8(%rsp)
movq 0x80(%rsp), %rax
movl (%rax,%r14,8), %eax
movl (%rbx,%rax,4), %ebp
testl %ebp, %ebp
js 0x21cf83
movq %rax, %rcx
xorq $0x1, %rcx
cmpl $0x0, (%rbx,%rcx,4)
jns 0x21d018
cmpq $-0x1, %r15
je 0x21d012
xorq $0x1, %rax
cmpl $0x0, (%rbx,%rax,4)
jns 0x21d012
testq %r9, %r9
je 0x21cfb1
leaq (%rdi,%r9,8), %rax
addq $-0x8, %rax
testq %rax, %rax
je 0x21cfb1
movl 0x4(%rax), %eax
cmpq %r15, %rax
je 0x21d012
cmpq %r12, %r9
jne 0x21cffc
leaq (%r9,%r9), %r12
testq %r9, %r9
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq %r9, 0x58(%rsp)
callq 0x2370
movq 0xb8(%rsp), %r11
movq 0x68(%rsp), %r10
movq 0x58(%rsp), %r9
movq 0x70(%rsp), %r8
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
movq %rax, %rdi
movq %r15, %rax
shlq $0x20, %rax
addq %r14, %rax
movq %rax, (%rdi,%r9,8)
incq %r9
incq 0x60(%rsp)
testl %ebp, %ebp
cmovsq %r14, %r15
incq %r14
cmpq %r14, %r11
jne 0x21cf5f
jmp 0x21d029
movq %r10, %r9
movq %r9, 0x38(%rsp)
movq %rdi, 0x48(%rsp)
movq %r12, 0x40(%rsp)
cmpl %r9d, %r10d
jae 0x21d0b5
movl %r10d, %r14d
movl %r9d, %r15d
movq (%rdi,%r14,8), %rax
movq %rax, %rbx
shrq $0x20, %rbx
cmpq %rbx, %r13
jae 0x21d0aa
cmpq %r12, %r9
jne 0x21d092
leaq (%r9,%r9), %r12
testq %r9, %r9
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq %r8, %rbp
movq %r9, 0x58(%rsp)
callq 0x2370
movq 0x58(%rsp), %r9
movq %rbp, %r8
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
movq %rax, %rdi
incq %r8
shlq $0x20, %r13
orq %r13, %rbx
orq %rdx, %rbx
movq %rbx, (%rdi,%r9,8)
incq %r9
movl (%rdi,%r14,8), %eax
movl %eax, %r13d
incq %r14
cmpq %r14, %r15
jne 0x21d043
movq %rdi, 0x48(%rsp)
movq %r9, 0x38(%rsp)
movq %r12, 0x40(%rsp)
movq 0x78(%rsp), %r10
decl %r10d
cmpl %r10d, %r13d
jae 0x21d148
cmpq %r12, %r9
jne 0x21d11f
leaq (%r12,%r12), %rbx
testq %r12, %r12
movl $0x2, %eax
cmoveq %rax, %rbx
movq %rbx, 0x40(%rsp)
leaq (,%rbx,8), %rsi
movq %r10, %r12
movq %r8, %r14
movq %r9, %r15
callq 0x2370
movq %r15, %r9
movq %r14, %r8
movq %r12, %r10
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
movq %rax, %rdi
movq %rax, 0x48(%rsp)
movq %rbx, %r12
movq 0x28(%rsp), %rcx
leaq 0x1(%r9), %rax
movq %rax, 0x38(%rsp)
incq %r8
shlq $0x20, %r13
orq %r10, %r13
orq %rdx, %r13
movq %r13, (%rdi,%r9,8)
movq %rax, %r9
movq 0x30(%rsp), %rbx
jmp 0x21d152
movq 0x30(%rsp), %rbx
movq 0x28(%rsp), %rcx
incl %ecx
movq %r9, %r10
cmpq 0x50(%rsp), %rcx
movq 0xb0(%rsp), %r13
jb 0x21cf0e
jmp 0x21d17d
xorl %edi, %edi
xorl %r9d, %r9d
xorl %r8d, %r8d
movq $0x0, 0x60(%rsp)
movq 0x60(%rsp), %rbx
leaq (%rbx,%r8), %rax
cmpq %r9, %rax
jne 0x21d66c
movq %r8, %rbp
leaq (%rdi,%r9,8), %rsi
movq %rdi, %r15
movq %r9, %r12
callq 0x1ee586
movl %ebx, %ecx
cmpq %rcx, %r12
movq 0x80(%rsp), %r14
movq 0x98(%rsp), %r13
jbe 0x21d24e
movl %ebx, %r9d
movq %r15, %rax
movabsq $-0x8000000000000000, %r10 # imm = 0x8000000000000000
movq %rbp, %r11
movq (%rax,%rcx,8), %rcx
testq %rcx, %rcx
jns 0x21d62e
movq %rcx, %rdx
shrq $0x20, %rdx
movl %edx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
cmpl %ecx, %esi
jae 0x21d64d
incl %esi
cmpl %ecx, %esi
jae 0x21d220
movl %edx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
incq %rsi
movl %ecx, %edi
movq (%r14,%rsi,8), %r8
orq %r10, (%r13,%r8,8)
xorq $0x1, %r8
orq %r10, (%r13,%r8,8)
incq %rsi
cmpq %rsi, %rdi
jne 0x21d206
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq (%r14,%rdx,8), %rdx
orq %r10, (%r13,%rdx,8)
movl %ecx, %ecx
movq (%r14,%rcx,8), %rcx
xorq $0x1, %rcx
orq %r10, (%r13,%rcx,8)
decq %r11
incl %r9d
movq %r9, %rcx
cmpq %r9, %r12
ja 0x21d1cf
jmp 0x21d254
movq %r15, %rax
movq %rbp, %r11
movq %rbx, 0x38(%rsp)
testq %r11, %r11
jne 0x21d68b
testq %rbx, %rbx
je 0x21d482
leaq 0x8(%r14), %rcx
movq %rcx, 0x68(%rsp)
xorl %edx, %edx
movq %rdx, 0x28(%rsp)
movq (%rax,%rdx,8), %r15
movq %r15, %r8
shrq $0x20, %r8
cmpl %r8d, %r15d
jbe 0x21d60f
testq %r15, %r15
js 0x21d5f0
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rbp
leal 0x1(%r8), %ecx
cmpl %r15d, %ecx
jae 0x21d3c4
movq 0x68(%rsp), %rcx
leaq (%rcx,%r8,8), %r9
movq %r8, 0x70(%rsp)
movl %r8d, %r12d
notl %r12d
movq %r15, 0x78(%rsp)
addl %r15d, %r12d
leaq (%rdi,%rdi), %r13
leaq (,%rdi,8), %rbx
xorl %r15d, %r15d
movq 0x28(%rsp), %r14
movq %rdi, 0x58(%rsp)
movq %r9, 0x50(%rsp)
leaq (%rdi,%r15), %rcx
cmpq %rbp, %rcx
jne 0x21d31b
testq %rcx, %rcx
movq %r13, %rbp
movl $0x2, %ecx
cmoveq %rcx, %rbp
leaq (,%rbp,8), %rsi
movq %rax, %rdi
callq 0x2370
movq 0x50(%rsp), %r9
movq 0x58(%rsp), %rdi
leaq (%rdi,%r15), %rsi
incq %rsi
leaq (%rax,%rbx), %rcx
movq (%r9,%r15,4), %rdx
shlq $0x20, %rdx
orq %r14, %rdx
movq %rdx, (%rcx,%r15,8)
cmpq %rbp, %rsi
jne 0x21d370
leaq (,%rbp,2), %r14
testq %rbp, %rbp
movl $0x2, %ecx
cmoveq %rcx, %r14
leaq (,%r14,8), %rsi
movq %rax, %rdi
callq 0x2370
movq 0x50(%rsp), %r9
movq 0x58(%rsp), %rdi
movq %r14, %rbp
movq 0x28(%rsp), %r14
leaq (%rax,%rbx), %rdx
movq (%r9,%r15,4), %rcx
shlq $0x20, %rcx
orq %r14, %rcx
movabsq $0x100000000, %rsi      # imm = 0x100000000
xorq %rsi, %rcx
movq %rcx, 0x8(%rdx,%r15,8)
addq $0x2, %r15
addq $0x4, %r13
decl %r12d
jne 0x21d2e9
addq %r15, %rdi
movq 0x80(%rsp), %r14
movq 0x98(%rsp), %r13
movq 0x60(%rsp), %rbx
movq 0x78(%rsp), %r15
movq 0x70(%rsp), %r8
movq %rbp, 0x40(%rsp)
cmpq %rbp, %rdi
jne 0x21d3ff
leaq (,%rbp,2), %rsi
testq %rbp, %rbp
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x40(%rsp)
shlq $0x3, %rsi
movq %r8, %rbp
movq %rdi, %r12
movq %rax, %rdi
callq 0x2370
movq %r12, %rdi
movq %rbp, %r8
leaq 0x1(%rdi), %rdx
movq (%r14,%r8,8), %rcx
shlq $0x20, %rcx
orq 0x28(%rsp), %rcx
movq %rcx, (%rax,%rdi,8)
cmpq 0x40(%rsp), %rdx
jne 0x21d442
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x40(%rsp)
shlq $0x3, %rsi
movq %rdi, %r12
movq %rax, %rdi
callq 0x2370
movq %r12, %rdi
leaq 0x2(%rdi), %rcx
movq %rcx, 0x38(%rsp)
movl %r15d, %ecx
movq (%r14,%rcx,8), %rcx
shlq $0x20, %rcx
movq 0x28(%rsp), %rdx
orq %rdx, %rcx
movabsq $0x100000000, %rsi      # imm = 0x100000000
xorq %rsi, %rcx
movq %rcx, 0x8(%rax,%rdi,8)
incl %edx
cmpq %rdx, %rbx
ja 0x21d276
movq 0x38(%rsp), %r12
jmp 0x21d485
xorl %r12d, %r12d
movq %rax, 0x48(%rsp)
leaq (%rax,%rbx,8), %rdi
movq %rax, %r15
leaq (%rax,%r12,8), %rsi
callq 0x1ee586
leal 0x1(%rbx), %eax
cmpq %rax, %r12
jb 0x21d4ec
leal 0x2(%rbx), %ecx
movl %ebx, %edx
movl %edx, %esi
movq %r12, %r9
cmpq %rax, %r12
jne 0x21d4b7
movq (%r15,%rsi,8), %rdi
jmp 0x21d4c8
movq (%r15,%rsi,8), %rdi
movq (%r15,%rax,8), %r8
xorq %rdi, %r8
shrq $0x20, %r8
je 0x21d4e0
leal -0x1(%rcx), %edx
shlq $0x20, %rsi
shrq $0x20, %rdi
orq (%r13,%rdi,8), %rsi
orq %rax, %rsi
movq %rsi, (%r13,%rdi,8)
movl %ecx, %eax
incl %ecx
movq %r9, %r12
cmpq %rax, %r9
jae 0x21d4a7
movq %rbx, %rbp
leaq 0x38(%rsp), %rbx
leaq 0xc0(%rsp), %r8
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x218d9b
leaq (,%rbp,2), %rax
cmpq %rax, (%rbx)
jne 0x21d6aa
movl 0x8c(%rsp), %eax
movl %eax, 0x20(%rsp)
movq 0x30(%rsp), %r12
movq %r12, 0x18(%rsp)
movq 0xa8(%rsp), %r15
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
leaq 0x38(%rsp), %rbx
leaq 0xc0(%rsp), %r14
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %rbp, %r8
callq 0x21beee
movq %r12, %rdi
callq 0x2220
movq %r13, %rdi
callq 0x2220
movq %r15, %rdi
callq 0x2220
movq 0x10(%rbx), %rdi
callq 0x2220
movq 0x10(%r14), %rdi
callq 0x2220
movq (%rbx), %rax
subq %rbp, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2b9dd(%rip), %rdi     # 0x248f96
leaq 0x28049(%rip), %rsi     # 0x245609
leaq 0x2bb43(%rip), %rcx     # 0x24910a
movl $0x34d2, %edx           # imm = 0x34D2
callq 0x2110
leaq 0x2b634(%rip), %rdi     # 0x248c0c
leaq 0x2802a(%rip), %rsi     # 0x245609
leaq 0x2bb24(%rip), %rcx     # 0x24910a
movl $0x34f5, %edx           # imm = 0x34F5
callq 0x2110
leaq 0x2bab0(%rip), %rdi     # 0x2490a7
leaq 0x2800b(%rip), %rsi     # 0x245609
leaq 0x2bb05(%rip), %rcx     # 0x24910a
movl $0x352b, %edx           # imm = 0x352B
callq 0x2110
leaq 0x2b1f9(%rip), %rdi     # 0x24880f
leaq 0x27fec(%rip), %rsi     # 0x245609
leaq 0x2bae6(%rip), %rcx     # 0x24910a
movl $0x352a, %edx           # imm = 0x352A
callq 0x2110
leaq 0x2b9e1(%rip), %rdi     # 0x249016
leaq 0x27fcd(%rip), %rsi     # 0x245609
leaq 0x2bac7(%rip), %rcx     # 0x24910a
movl $0x351d, %edx           # imm = 0x351D
callq 0x2110
leaq 0x2b1bb(%rip), %rdi     # 0x24880f
leaq 0x27fae(%rip), %rsi     # 0x245609
leaq 0x2baa8(%rip), %rcx     # 0x24910a
movl $0x351e, %edx           # imm = 0x351E
callq 0x2110
leaq 0x2b98f(%rip), %rdi     # 0x249002
leaq 0x27f8f(%rip), %rsi     # 0x245609
leaq 0x2ba89(%rip), %rcx     # 0x24910a
movl $0x3517, %edx           # imm = 0x3517
callq 0x2110
leaq 0x2b9ac(%rip), %rdi     # 0x24903e
leaq 0x27f70(%rip), %rsi     # 0x245609
leaq 0x2ba6a(%rip), %rcx     # 0x24910a
movl $0x3528, %edx           # imm = 0x3528
callq 0x2110
leaq 0x2ba47(%rip), %rdi     # 0x2490f8
leaq 0x27f51(%rip), %rsi     # 0x245609
leaq 0x2ba4b(%rip), %rcx     # 0x24910a
movl $0x354c, %edx           # imm = 0x354C
callq 0x2110