// File: 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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movl %r9d, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
shlq %rdi
movl $0x1, %esi
callq 0x2140
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl %eax, %edi
movl $0x4, %esi
callq 0x2140
movq %rax, -0xb8(%rbp)
movq $0x0, -0xc8(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0xe0(%rbp)
movq $0x0, -0xe8(%rbp)
movq $0x0, -0xd8(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
shlq %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, -0xf0(%rbp)
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
cmpq -0x30(%rbp), %rax
jae 0x35e13c
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movl -0x90(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
movl -0x90(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x80(%rbp)
cmpq $0x2, -0x80(%rbp)
jb 0x35e062
jmp 0x35e081
leaq 0x3bc1d(%rip), %rdi     # 0x399c86
leaq 0x38149(%rip), %rsi     # 0x3961b9
movl $0x34d2, %edx           # imm = 0x34D2
leaq 0x3bd7e(%rip), %rcx     # 0x399dfa
callq 0x2130
movl $0x1, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
cmpq -0x80(%rbp), %rax
jae 0x35e0ed
movq -0xb8(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x8c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0xb8(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x8c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x35e08b
movq -0xb8(%rbp), %rax
movq -0x78(%rbp), %rcx
movq (%rcx), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0xb8(%rbp), %rax
movq -0x78(%rbp), %rcx
movq -0x80(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x35e014
movq -0x20(%rbp), %rdi
callq 0x359c70
movq %rax, -0x100(%rbp)
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
movq -0x100(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x35e327
movq -0x100(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x108(%rbp)
movl $0xffffffff, -0xa4(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0xa0(%rbp) # imm = 0xFFFFFFFF
movq -0x108(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x110(%rbp)
movl $0x0, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
cmpl -0x110(%rbp), %eax
jge 0x35e21a
movq -0xb8(%rbp), %rax
movq -0x108(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x10c(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
xorq $0x1, %rcx
movl (%rax,%rcx,4), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x1, %eax
jne 0x35e207
movl -0x10c(%rbp), %eax
movl %eax, -0xa0(%rbp)
jmp 0x35e21a
jmp 0x35e209
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x35e1b9
movl -0x110(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x10c(%rbp)
cmpl $0x0, -0x10c(%rbp)
jl 0x35e281
movq -0xb8(%rbp), %rax
movq -0x108(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x10c(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
movl (%rax,%rcx,4), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x1, %eax
jne 0x35e26e
movl -0x10c(%rbp), %eax
movl %eax, -0xa4(%rbp)
jmp 0x35e281
jmp 0x35e270
movl -0x10c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x35e229
cmpl $-0x1, -0xa0(%rbp)
je 0x35e2a3
cmpl $-0x1, -0xa4(%rbp)
je 0x35e2a3
movl -0xa0(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jbe 0x35e2a3
jmp 0x35e313
cmpl $-0x1, -0xa0(%rbp)
je 0x35e2dc
movq -0xb8(%rbp), %rax
movq -0x108(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl -0xa0(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
xorq $0x1, %rcx
movl (%rax,%rcx,4), %edx
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rax,%rcx,4)
cmpl $-0x1, -0xa4(%rbp)
je 0x35e311
movq -0xb8(%rbp), %rax
movq -0x108(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl -0xa4(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
movl (%rax,%rcx,4), %edx
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rax,%rcx,4)
jmp 0x35e313
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x35e156
movq -0x100(%rbp), %rdi
callq 0xcd6f0
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0xd0(%rbp)
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpq -0x30(%rbp), %rax
jae 0x35e848
movq -0x28(%rbp), %rax
movl -0x8c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
movq -0x28(%rbp), %rcx
movl -0x8c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
addl %ecx, %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl -0x98(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jbe 0x35e3b1
jmp 0x35e3d0
leaq 0x3b544(%rip), %rdi     # 0x3998fc
leaq 0x37dfa(%rip), %rsi     # 0x3961b9
movl $0x34f5, %edx           # imm = 0x34F5
leaq 0x3ba2f(%rip), %rcx     # 0x399dfa
callq 0x2130
movl -0x98(%rbp), %eax
movl %eax, -0x90(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $-0x1, -0x48(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x35e5e2
movq -0x38(%rbp), %rax
movl -0x90(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xa8(%rbp)
movq -0xb8(%rbp), %rax
movl -0xa8(%rbp), %ecx
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
jne 0x35e453
movq -0xb8(%rbp), %rax
movl -0xa8(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
jne 0x35e453
jmp 0x35e5ce
cmpq $-0x1, -0x48(%rbp)
je 0x35e5a8
movq -0xb8(%rbp), %rax
movl -0xa8(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x35e5a8
cmpq $0x0, -0xd0(%rbp)
jbe 0x35e4ad
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
subq $0x1, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x118(%rbp)
jmp 0x35e4b8
xorl %eax, %eax
movq %rax, -0x118(%rbp)
jmp 0x35e4b8
movq -0x118(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x35e4df
movq -0x58(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
cmpq -0x48(%rbp), %rax
je 0x35e5a6
jmp 0x35e4e1
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0x35e548
cmpq $0x0, -0xc8(%rbp)
je 0x35e50e
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x120(%rbp)
jmp 0x35e51c
movl $0x2, %eax
movq %rax, -0x120(%rbp)
jmp 0x35e51c
movq -0x120(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x90(%rbp), %eax
movl %eax, %ecx
movq -0x58(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x35e5a8
movq -0xb8(%rbp), %rax
movl -0xa8(%rbp), %ecx
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x35e5cc
movl -0x90(%rbp), %eax
movq %rax, -0x48(%rbp)
jmp 0x35e5ce
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x35e3ef
movq -0xd0(%rbp), %rax
movl %eax, -0xac(%rbp)
movq -0x60(%rbp), %rax
movl %eax, -0x90(%rbp)
movl -0x98(%rbp), %eax
movq %rax, -0x48(%rbp)
movl -0x90(%rbp), %eax
cmpl -0xac(%rbp), %eax
jae 0x35e73e
movq -0xc0(%rbp), %rax
movl -0x90(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x35e713
jmp 0x35e63e
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0x35e6a5
cmpq $0x0, -0xc8(%rbp)
je 0x35e66b
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x128(%rbp)
jmp 0x35e679
movl $0x2, %eax
movq %rax, -0x128(%rbp)
jmp 0x35e679
movq -0x128(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0xc0(%rbp), %rax
movl -0x90(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x48(%rbp)
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x35e603
movl -0x9c(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x35e832
jmp 0x35e75d
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0x35e7c4
cmpq $0x0, -0xc8(%rbp)
je 0x35e78a
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x130(%rbp)
jmp 0x35e798
movl $0x2, %eax
movq %rax, -0x130(%rbp)
jmp 0x35e798
movq -0x130(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
orq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x35e834
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x35e358
movq -0x68(%rbp), %rax
addq -0x70(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jne 0x35e85b
jmp 0x35e87a
leaq 0x3b490(%rip), %rdi     # 0x399cf2
leaq 0x37950(%rip), %rsi     # 0x3961b9
movl $0x3517, %edx           # imm = 0x3517
leaq 0x3b585(%rip), %rcx     # 0x399dfa
callq 0x2130
movq -0xc0(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0xd0(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movq -0x68(%rbp), %rax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpq -0xd0(%rbp), %rax
jae 0x35ea52
movq -0xc0(%rbp), %rcx
movl -0x8c(%rbp), %eax
movl %eax, %edx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x35e8dd
jmp 0x35e8fc
leaq 0x3b422(%rip), %rdi     # 0x399d06
leaq 0x378ce(%rip), %rsi     # 0x3961b9
movl $0x351d, %edx           # imm = 0x351D
leaq 0x3b503(%rip), %rcx     # 0x399dfa
callq 0x2130
movq -0x70(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x70(%rbp)
movq -0xc0(%rbp), %rax
movl -0x8c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shlq %rax
shrq $0x21, %rax
movl %eax, -0x98(%rbp)
movq -0xc0(%rbp), %rax
movl -0x8c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x98(%rbp), %eax
jbe 0x35e94d
jmp 0x35e96c
leaq 0x3abab(%rip), %rdi     # 0x3994ff
leaq 0x3785e(%rip), %rsi     # 0x3961b9
movl $0x351e, %edx           # imm = 0x351E
leaq 0x3b493(%rip), %rcx     # 0x399dfa
callq 0x2130
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x35e9ec
movq -0xf0(%rbp), %rax
movq -0x38(%rbp), %rcx
movl -0x90(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0xf0(%rbp), %rax
movq -0x38(%rbp), %rcx
movl -0x90(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x35e97b
movq -0xf0(%rbp), %rax
movq -0x38(%rbp), %rcx
movl -0x98(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0xf0(%rbp), %rax
movq -0x38(%rbp), %rcx
movl -0x9c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x35e8a5
movq -0x68(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x35ea66
jmp 0x35ea85
leaq 0x3b2c1(%rip), %rdi     # 0x399d2e
leaq 0x37745(%rip), %rsi     # 0x3961b9
movl $0x3528, %edx           # imm = 0x3528
leaq 0x3b37a(%rip), %rcx     # 0x399dfa
callq 0x2130
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpq -0x68(%rbp), %rax
jae 0x35eeae
movq -0xc0(%rbp), %rax
movl -0x8c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x98(%rbp)
movq -0xc0(%rbp), %rax
movl -0x8c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x98(%rbp), %eax
jbe 0x35eae1
jmp 0x35eb00
leaq 0x3aa17(%rip), %rdi     # 0x3994ff
leaq 0x376ca(%rip), %rsi     # 0x3961b9
movl $0x352a, %edx           # imm = 0x352A
leaq 0x3b2ff(%rip), %rcx     # 0x399dfa
callq 0x2130
movq -0xc0(%rbp), %rcx
movl -0x8c(%rbp), %eax
movl %eax, %edx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x35eb2c
jmp 0x35eb2e
jmp 0x35eb4d
leaq 0x3b262(%rip), %rdi     # 0x399d97
leaq 0x3767d(%rip), %rsi     # 0x3961b9
movl $0x352b, %edx           # imm = 0x352B
leaq 0x3b2b2(%rip), %rcx     # 0x399dfa
callq 0x2130
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x35ed0e
jmp 0x35eb70
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0x35ebd7
cmpq $0x0, -0xc8(%rbp)
je 0x35eb9d
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x138(%rbp)
jmp 0x35ebab
movl $0x2, %eax
movq %rax, -0x138(%rbp)
jmp 0x35ebab
movq -0x138(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movl -0x90(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x8c(%rbp), %eax
movl %eax, %ecx
movq -0x58(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0x35ec9a
cmpq $0x0, -0xc8(%rbp)
je 0x35ec60
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x140(%rbp)
jmp 0x35ec6e
movl $0x2, %eax
movq %rax, -0x140(%rbp)
jmp 0x35ec6e
movq -0x140(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movl -0x90(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
xorq $0x1, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x8c(%rbp), %eax
movl %eax, %ecx
movq -0x58(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x35eb5c
jmp 0x35ed10
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0x35ed77
cmpq $0x0, -0xc8(%rbp)
je 0x35ed3d
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x148(%rbp)
jmp 0x35ed4b
movl $0x2, %eax
movq %rax, -0x148(%rbp)
jmp 0x35ed4b
movq -0x148(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movl -0x98(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x8c(%rbp), %eax
movl %eax, %ecx
movq -0x58(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0x35ee3a
cmpq $0x0, -0xc8(%rbp)
je 0x35ee00
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x150(%rbp)
jmp 0x35ee0e
movl $0x2, %eax
movq %rax, -0x150(%rbp)
jmp 0x35ee0e
movq -0x150(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movl -0x9c(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
xorq $0x1, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x8c(%rbp), %eax
movl %eax, %ecx
movq -0x58(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x35ea8f
movq -0xc0(%rbp), %rdi
movq -0x68(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0xc0(%rbp), %rsi
movq -0xd0(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movq -0x68(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x90(%rbp)
movq -0x68(%rbp), %rax
movl %eax, -0x8c(%rbp)
movl -0x90(%rbp), %eax
cmpq -0xd0(%rbp), %rax
ja 0x35ef9e
movl -0x90(%rbp), %eax
cmpq -0xd0(%rbp), %rax
je 0x35ef43
movq -0xc0(%rbp), %rax
movl -0x90(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq -0xc0(%rbp), %rcx
movl -0x8c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
je 0x35ef88
movl -0x8c(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
movl -0x90(%rbp), %eax
orq %rax, %rdx
movq -0xf0(%rbp), %rax
movq -0xc0(%rbp), %rcx
movl -0x8c(%rbp), %esi
movq (%rcx,%rsi,8), %rcx
shrq $0x20, %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x90(%rbp), %eax
movl %eax, -0x8c(%rbp)
jmp 0x35ef8a
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x35eef2
movq -0x68(%rbp), %rsi
movq -0xf0(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq -0xd0(%rbp), %rdi
leaq -0xe8(%rbp), %r8
callq 0x356dd0
movl %eax, %eax
movq %rax, -0xf8(%rbp)
movq -0xd0(%rbp), %rax
movq -0x68(%rbp), %rcx
shlq %rcx
cmpq %rcx, %rax
jne 0x35efde
jmp 0x35effd
leaq 0x3ae03(%rip), %rdi     # 0x399de8
leaq 0x371cd(%rip), %rsi     # 0x3961b9
movl $0x354c, %edx           # imm = 0x354C
leaq 0x3ae02(%rip), %rcx     # 0x399dfa
callq 0x2130
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x68(%rbp), %r8
movq -0xf8(%rbp), %r9
movq -0xf0(%rbp), %r14
movq -0x38(%rbp), %rbx
movq -0x88(%rbp), %r11
movq -0xb8(%rbp), %r10
movl -0x3c(%rbp), %eax
leaq -0xd0(%rbp), %rdx
leaq -0xe8(%rbp), %rcx
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x35c7f0
movq -0xb8(%rbp), %rdi
callq 0x2210
movq -0xf0(%rbp), %rdi
callq 0x2210
movq -0x88(%rbp), %rdi
callq 0x2210
movq -0xc0(%rbp), %rdi
callq 0x2210
movq -0xd8(%rbp), %rdi
callq 0x2210
movq -0xd0(%rbp), %rax
subq -0x68(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)