// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: ug_ext(ul_resolve_t*, usg_t*, unsigned long*, unsigned long, unsigned long*, unsigned int, unsigned char*, unsigned int*, unsigned long*, asg64_v*, asg64_v*)
uint32_t ug_ext(ul_resolve_t *uidx, usg_t *ng, uint64_t *int_idx, uint64_t int_idx_n, uint64_t *int_a, uint32_t max_ext, 
uint8_t *ff, uint32_t *ng_occ, uint64_t *i_idx, asg64_v *b64, asg64_v *ub64)
{
    uint32_t n_vtx = ng->n<<1, k, i; uint64_t pi, ei, *pz, v, b64_n;
    uint64_t *r_a, r_n, zs, ze, s, e, a_n, ua_n, bn, n_clus;
    memset(ff, 0, sizeof((*ff))*n_vtx);
    memset(ng_occ, 0, sizeof((*ng_occ))*n_vtx); 
    memset(i_idx, 0, sizeof((*i_idx))*n_vtx); 
    b64->n = ub64->n = 0;

    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); 
    int32_t ui, un; ma_utg_t *u = NULL;
    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))) {
                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
    return b64->n - a_n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
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), %rax
shlq %rax
movl %eax, -0x40(%rbp)
movq 0x10(%rbp), %rdi
movl -0x40(%rbp), %eax
movl %eax, %edx
shlq $0x0, %rdx
xorl %esi, %esi
callq 0x2100
movq 0x18(%rbp), %rdi
movl -0x40(%rbp), %eax
movl %eax, %edx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2100
movq 0x20(%rbp), %rdi
movl -0x40(%rbp), %eax
movl %eax, %edx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x2100
movq 0x30(%rbp), %rax
movq $0x0, (%rax)
movq 0x28(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpq -0x30(%rbp), %rax
jae 0x35ffec
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movl -0x44(%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 -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x80(%rbp)
cmpq $0x2, -0x80(%rbp)
jb 0x35ff36
jmp 0x35ff55
leaq 0x39d49(%rip), %rdi     # 0x399c86
leaq 0x36275(%rip), %rsi     # 0x3961b9
movl $0x35e9, %edx           # imm = 0x35E9
leaq 0x39fda(%rip), %rcx     # 0x399f2a
callq 0x2130
movl $0x1, -0x48(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
cmpq -0x80(%rbp), %rax
jae 0x35ffa9
movq 0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x48(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x48(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x35ff5c
movq 0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
movq (%rcx), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x18(%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 -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x35fef1
movq -0x20(%rbp), %rdi
callq 0x359c70
movq %rax, -0xc8(%rbp)
movq $0x0, -0xd8(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0xc8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x3601e7
movq -0xc8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x90(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x88(%rbp)
movq -0xd8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0xd0(%rbp)
movl $0x0, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
cmpl -0xd0(%rbp), %eax
jge 0x3600cf
movq 0x18(%rbp), %rax
movq -0xd8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0xcc(%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 0x3600bc
movslq -0xcc(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x3600cf
jmp 0x3600be
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x36006f
movl -0xd0(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xcc(%rbp)
cmpl $0x0, -0xcc(%rbp)
jl 0x360135
movq 0x18(%rbp), %rax
movq -0xd8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0xcc(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
movl (%rax,%rcx,4), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x1, %eax
jne 0x360122
movslq -0xcc(%rbp), %rax
movq %rax, -0x90(%rbp)
jmp 0x360135
jmp 0x360124
movl -0xcc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x3600de
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x88(%rbp)
je 0x360163
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x90(%rbp)
je 0x360163
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
jbe 0x360163
jmp 0x3601d9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x88(%rbp)
je 0x36019f
movq 0x18(%rbp), %rax
movq -0xd8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq -0x88(%rbp), %rdx
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)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x90(%rbp)
je 0x3601d7
movq 0x18(%rbp), %rax
movq -0xd8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq -0x90(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
movl (%rax,%rcx,4), %edx
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rax,%rcx,4)
jmp 0x3601d9
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x36000e
movq -0xc8(%rbp), %rdi
callq 0xcd6f0
movq $0x0, -0xa8(%rbp)
movq $0x0, -0xb0(%rbp)
movq 0x28(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpq -0x30(%rbp), %rax
jae 0x3606f6
movq -0x28(%rbp), %rax
movl -0x48(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movl -0x48(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jbe 0x360275
jmp 0x360294
leaq 0x39680(%rip), %rdi     # 0x3998fc
leaq 0x35f36(%rip), %rsi     # 0x3961b9
movl $0x360a, %edx           # imm = 0x360A
leaq 0x39c9b(%rip), %rcx     # 0x399f2a
callq 0x2130
movq -0x98(%rbp), %rax
movl %eax, -0x44(%rbp)
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
movq $-0x1, -0x50(%rbp)
movl -0x44(%rbp), %eax
cmpq -0xa0(%rbp), %rax
jae 0x36048c
movq -0x38(%rbp), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
movq 0x18(%rbp), %rax
movq -0x68(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
jne 0x360306
movq 0x18(%rbp), %rax
movq -0x68(%rbp), %rcx
xorq $0x1, %rcx
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
jne 0x360306
jmp 0x36047e
cmpq $-0x1, -0x50(%rbp)
je 0x360460
movq 0x18(%rbp), %rax
movq -0x68(%rbp), %rcx
xorq $0x1, %rcx
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x360460
movq 0x28(%rbp), %rax
cmpq $0x0, (%rax)
jbe 0x36035b
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
jmp 0x360366
xorl %eax, %eax
movq %rax, -0xe0(%rbp)
jmp 0x360366
movq -0xe0(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x36038d
movq -0x60(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
cmpq -0x50(%rbp), %rax
je 0x36045e
jmp 0x36038f
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x360400
movq 0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3603bf
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xe8(%rbp)
jmp 0x3603cd
movl $0x2, %eax
movq %rax, -0xe8(%rbp)
jmp 0x3603cd
movq -0xe8(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x44(%rbp), %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x360460
movq 0x18(%rbp), %rax
movq -0x68(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x36047c
movl -0x44(%rbp), %eax
movq %rax, -0x50(%rbp)
jmp 0x36047e
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3602b4
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0xb8(%rbp), %rax
movl %eax, -0x44(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x44(%rbp), %eax
cmpq -0x70(%rbp), %rax
jae 0x3605e5
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x3605c2
jmp 0x3604e0
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x360551
movq 0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x360510
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xf0(%rbp)
jmp 0x36051e
movl $0x2, %eax
movq %rax, -0xf0(%rbp)
jmp 0x36051e
movq -0xf0(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
movq -0x50(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3604ac
movq -0xa0(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x3606e6
jmp 0x360604
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x360675
movq 0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x360634
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xf8(%rbp)
jmp 0x360642
movl $0x2, %eax
movq %rax, -0xf8(%rbp)
jmp 0x360642
movq -0xf8(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
movq -0x50(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
orq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x3606e8
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x36021b
movq -0xa8(%rbp), %rax
addq -0xb0(%rbp), %rax
movq 0x28(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x36070f
jmp 0x36072e
leaq 0x398a2(%rip), %rdi     # 0x399fb8
leaq 0x35a9c(%rip), %rsi     # 0x3961b9
movl $0x362b, %edx           # imm = 0x362B
leaq 0x39801(%rip), %rcx     # 0x399f2a
callq 0x2130
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x28(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movq -0xa8(%rbp), %rax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq 0x28(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x3608ec
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rcx
movl -0x48(%rbp), %eax
movl %eax, %edx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x36078e
jmp 0x3607ad
leaq 0x39838(%rip), %rdi     # 0x399fcd
leaq 0x35a1d(%rip), %rsi     # 0x3961b9
movl $0x3632, %edx           # imm = 0x3632
leaq 0x39782(%rip), %rcx     # 0x399f2a
callq 0x2130
movq -0xb0(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xb0(%rbp)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x48(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shlq %rax
shrq $0x21, %rax
movq %rax, -0x98(%rbp)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x48(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0x98(%rbp), %rax
jbe 0x360806
jmp 0x360825
leaq 0x38cf2(%rip), %rdi     # 0x3994ff
leaq 0x359a5(%rip), %rsi     # 0x3961b9
movl $0x3633, %edx           # imm = 0x3633
leaq 0x3970a(%rip), %rcx     # 0x399f2a
callq 0x2130
movq -0x98(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpq -0xa0(%rbp), %rax
jae 0x360890
movq 0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movl -0x44(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movl -0x44(%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 -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x360833
movq 0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movq -0x98(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movq -0xa0(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
xorq $0x1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x36075b
movq -0xa8(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0xb0(%rbp)
jne 0x360906
jmp 0x360925
leaq 0x39421(%rip), %rdi     # 0x399d2e
leaq 0x358a5(%rip), %rsi     # 0x3961b9
movl $0x363d, %edx           # imm = 0x363D
leaq 0x3960a(%rip), %rcx     # 0x399f2a
callq 0x2130
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpq -0xa8(%rbp), %rax
jae 0x360d48
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x48(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x98(%rbp)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x48(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0x98(%rbp), %rax
jbe 0x360980
jmp 0x36099f
leaq 0x38b78(%rip), %rdi     # 0x3994ff
leaq 0x3582b(%rip), %rsi     # 0x3961b9
movl $0x363f, %edx           # imm = 0x363F
leaq 0x39590(%rip), %rcx     # 0x399f2a
callq 0x2130
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rcx
movl -0x48(%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 0x3609c9
jmp 0x3609cb
jmp 0x3609ea
leaq 0x39624(%rip), %rdi     # 0x399ff6
leaq 0x357e0(%rip), %rsi     # 0x3961b9
movl $0x3640, %edx           # imm = 0x3640
leaq 0x39545(%rip), %rcx     # 0x399f2a
callq 0x2130
movq -0x98(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpq -0xa0(%rbp), %rax
jae 0x360ba4
jmp 0x360a0a
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x360a7b
movq 0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x360a3a
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x100(%rbp)
jmp 0x360a48
movl $0x2, %eax
movq %rax, -0x100(%rbp)
jmp 0x360a48
movq -0x100(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x360b3f
movq 0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x360afe
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x108(%rbp)
jmp 0x360b0c
movl $0x2, %eax
movq %rax, -0x108(%rbp)
jmp 0x360b0c
movq -0x108(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
xorq $0x1, %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3609f8
jmp 0x360ba6
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x360c17
movq 0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x360bd6
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x110(%rbp)
jmp 0x360be4
movl $0x2, %eax
movq %rax, -0x110(%rbp)
jmp 0x360be4
movq -0x110(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq -0x98(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x360cdf
movq 0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x360c9e
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x118(%rbp)
jmp 0x360cac
movl $0x2, %eax
movq %rax, -0x118(%rbp)
jmp 0x360cac
movq -0x118(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
xorq $0x1, %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x36092c
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0xa8(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x28(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x44(%rbp)
movq -0xa8(%rbp), %rax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
movq 0x28(%rbp), %rcx
cmpq (%rcx), %rax
ja 0x360e18
movl -0x44(%rbp), %eax
movq 0x28(%rbp), %rcx
cmpq (%rcx), %rax
je 0x360dd4
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq 0x28(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x48(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
je 0x360e08
movl -0x48(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
movl -0x44(%rbp), %eax
orq %rax, %rdx
movq 0x20(%rbp), %rax
movq 0x28(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x48(%rbp), %esi
movq (%rcx,%rsi,8), %rcx
shrq $0x20, %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x360e0a
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x360d91
movq 0x28(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq 0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq 0x30(%rbp), %r8
callq 0x356dd0
movl %eax, %eax
movq %rax, -0xc0(%rbp)
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq -0xa8(%rbp), %rcx
shlq %rcx
cmpq %rcx, %rax
jne 0x360e55
jmp 0x360e74
leaq 0x38722(%rip), %rdi     # 0x39957e
leaq 0x35356(%rip), %rsi     # 0x3961b9
movl $0x3661, %edx           # imm = 0x3661
leaq 0x390bb(%rip), %rcx     # 0x399f2a
callq 0x2130
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq 0x28(%rbp), %rdx
movq 0x30(%rbp), %rcx
movq -0xa8(%rbp), %r8
movq -0xc0(%rbp), %r9
movq 0x20(%rbp), %r14
movq -0x38(%rbp), %rbx
movq 0x10(%rbp), %r11
movq 0x18(%rbp), %r10
movl -0x3c(%rbp), %eax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x35c7f0
movq 0x28(%rbp), %rax
movq (%rax), %rax
subq -0xa8(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax,%rax)