// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: get_hap_alignment(ma_ug_t*, asg_t*, ma_hit_t_alloc*, buf_t*, R_to_U*, unsigned int*, unsigned long*, unsigned char*, kvec_t_u64_warp*, Hap_Align_warp*, kvec_t_u32_warp*, kvec_t_u32_warp*, unsigned int, unsigned int, unsigned long*, float, asg_t*, unsigned int)
void get_hap_alignment(ma_ug_t *ug, asg_t *read_g, ma_hit_t_alloc* reverse_sources, 
buf_t* b_0, R_to_U* ruIndex, uint32_t* position_index, uint64_t* vote_counting, uint8_t* visit, 
kvec_t_u64_warp* u_vecs, Hap_Align_warp* u_buffer, kvec_t_u32_warp* x_vecs, kvec_t_u32_warp* y_vecs,
uint32_t cId, uint32_t contigNum, uint64_t* cBeg, float Hap_rate, asg_t *bi_g, uint32_t is_bi_edge)
{
    ma_utg_t* reads = NULL;
    uint32_t beg, end, i, j, k, rId, Hap_cId, y_cId, y_offset, qn, self_offset, uId, uOri, is_Unitig, xLen, seedOcc;
    uint64_t tmp;
    long long nodeLen, baseLen, max_stop_nodeLen, max_stop_baseLen;
    memset(vote_counting, 0, sizeof(uint64_t)*contigNum);
    memset(visit, 0, contigNum);
    u_vecs->a.n = x_vecs->a.n = y_vecs->a.n = 0;

    beg = (uint32_t)(cBeg[cId]);
    b_0->b.n = 0;
    get_unitig(ug->g, ug, beg, &end, &nodeLen, &baseLen, &max_stop_nodeLen, &max_stop_baseLen, 1, b_0);
    xLen = cBeg[cId]>>33;
    kv_resize(uint32_t, x_vecs->a, xLen);

    for (i = 0, self_offset = 0; i < b_0->b.n; i++)
    {
        uId = b_0->b.a[i]>>1;
        uOri = b_0->b.a[i]&(uint32_t)1;
        reads = &(ug->u.a[uId]);
        for (j = 0; j < reads->n; j++, self_offset++)
        {
            if(uOri == 1)
            {
                rId = reads->a[reads->n - j - 1]>>33;
            }
            else
            {
                rId = reads->a[j]>>33;
            }


            tmp = rId<<1;
            if(read_g->seq[rId].c == HAP_LABLE)
            {
                tmp = tmp | 1;
                kv_push(uint32_t, x_vecs->a, tmp);
                continue;
            }
            kv_push(uint32_t, x_vecs->a, tmp); 


            /**********************for debug*************************/
            ///debug_visit_flag(visit, contigNum);
            /**********************for debug*************************/

            qn = rId;
            for (k = 0; k < reverse_sources[qn].length; k++)
            {
                rId = Get_tn(reverse_sources[qn].buffer[k]);
            
                if(read_g->seq[rId].del == 1)
                {
                    ///get the id of read that contains it 
                    get_R_to_U(ruIndex, rId, &rId, &is_Unitig);
                    if(rId == (uint32_t)-1 || is_Unitig == 1 || read_g->seq[rId].del == 1) continue;
                }

                ///there are two cases: 
                ///1. read at primary contigs, get_R_to_U() return its corresponding contig Id  
                ///2. read at alternative contigs, get_R_to_U() return (uint32_t)-1
                get_R_to_U(ruIndex, rId, &Hap_cId, &is_Unitig);
                if(is_Unitig == 0 || Hap_cId == (uint32_t)-1) continue;
                ///here rId is the id of the read coming from the different haplotype
                ///Hap_cId is the id of the corresponding contig (note here is the contig, instead of untig)
                if(visit[Hap_cId]!=0) continue;
                visit[Hap_cId] = 1;
                if(vote_counting[Hap_cId] < UINT64_MAX) vote_counting[Hap_cId]++;
            }

            reset_visit_flag(visit, read_g, ruIndex, contigNum, &(reverse_sources[qn]));
        }
    }


    u_vecs->a.n = 0;
    for (i = 0; i < contigNum; i++)
    {
        if(i == cId) continue;
        if(vote_counting[i] == 0) continue;
        tmp = vote_counting[i]; tmp = tmp << 32; tmp = tmp | (uint64_t)i;
        kv_push(uint64_t, u_vecs->a, tmp);
    }

    if(u_vecs->a.n == 0) return;

    sort_kvec_t_u64_warp(u_vecs, 1);


    ma_hit_t_alloc *x = NULL, *pre_x = NULL;
    Hap_Align* p = NULL;
    asg_arc_t *e = NULL;
    ///scan from the weightest candidate 
    for (i = 0; i < u_vecs->a.n; i++)
    {
        Hap_cId = (uint32_t)u_vecs->a.a[i];
        get_readSeq(ug, read_g, y_vecs, cBeg, b_0, Hap_cId);
        y_cId = Hap_cId;
        seedOcc = u_vecs->a.a[i]>>32;

        if(debug_purge_dup)
        {
            if(cId == 53)
            {
                fprintf(stderr, "cId: %u, y_cId: %u, seedOcc: %u\n", cId, y_cId, seedOcc);
            }
        }

        u_buffer->x.n = 0;
        for (k = 0; k < x_vecs->a.n; k++)
        {
            x = pre_x = NULL;
            rId = x_vecs->a.a[k]>>1;
            if(read_g->seq[rId].c == HAP_LABLE) continue;
            x = &(reverse_sources[rId]);

            if(k >= 1)
            {
                rId = x_vecs->a.a[k-1]>>1;
                if(read_g->seq[rId].c != HAP_LABLE)
                {
                    pre_x = &(reverse_sources[rId]);
                }
            }




            for (j = 0; j < x->length; j++)
            {
                rId = Get_tn(x->buffer[j]);
                if(read_g->seq[rId].del == 1)
                {
                    ///get the id of read that contains it 
                    get_R_to_U(ruIndex, rId, &rId, &is_Unitig);
                    if(rId == (uint32_t)-1 || is_Unitig == 1 || read_g->seq[rId].del == 1) continue;
                }

                ///there are two cases: 
                ///1. read at primary contigs, get_R_to_U() return its corresponding contig Id  
                ///2. read at alternative contigs, get_R_to_U() return (uint32_t)-1
                get_R_to_U(ruIndex, rId, &Hap_cId, &is_Unitig);
                if(is_Unitig == 0 || Hap_cId == (uint32_t)-1) continue;
                if(Hap_cId != y_cId) continue;

                y_offset = position_index[rId];
                ///if(retrieve_skip_overlaps(pre_x, rId) != (uint32_t)-1)
                if(retrieve_skip_overlaps(pre_x, Get_tn(x->buffer[j])) != (uint32_t)-1)
                {
                    check_duplicate(u_buffer, (uint32_t)-1, y_offset);
                    continue;
                } 
                if(check_duplicate(u_buffer, k, y_offset)) continue;

                kv_pushp(Hap_Align, u_buffer->x, &p);
                p->q_pos = k;
                p->t_pos = y_offset;
                p->t_id = y_cId;
                p->is_color = 1;
            }
        }

        merge_hap_hits(u_buffer);
        if(u_buffer->x.n == 0) continue;

        ///for (k = 0; k < u_buffer->x.n; k++)
        for (k = u_buffer->x.n-1; k >= 0; k--)
        {
            if(calculate_hap_similarity(&(u_buffer->x.a[k]), 0, cId, y_cId, x_vecs, y_vecs, 
            reverse_sources, read_g, ruIndex, Hap_rate, seedOcc)==PLOID)
            {
                break;
            }
            else if(calculate_hap_similarity(&(u_buffer->x.a[k]), 1, cId, y_cId, x_vecs, y_vecs, 
            reverse_sources, read_g, ruIndex, Hap_rate, seedOcc)==PLOID)
            {
                break;
            }
            if(k == 0)
            {
                k = (uint32_t)-1;
                break;
            }
        }

        ///if(k < u_buffer->x.n)
        if(k != (uint32_t)-1)
        {
            e = asg_arc_pushp(bi_g);
            e->del = 0;
            e->ol = 0;
            e->ul = cId; e->ul = e->ul << 32; e->ul = e->ul | (uint64_t)(0);
            e->v = y_cId;

            if(is_bi_edge)
            {
                e = asg_arc_pushp(bi_g);
                e->del = 0;
                e->ol = 0;
                e->ul = y_cId; e->ul = e->ul << 32; e->ul = e->ul | (uint64_t)(0);
                e->v = cId;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movss %xmm0, 0x1c(%rsp)
movq %r9, 0x30(%rsp)
movq %r8, %r14
movq %rcx, %r15
movq %rdx, 0x38(%rsp)
movq %rsi, (%rsp)
movq %rdi, %r12
movl 0xf8(%rsp), %r13d
movq 0xc8(%rsp), %rbp
movq 0xc0(%rsp), %rdi
leaq (,%r13,8), %rdx
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x20e0
movq %rbp, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20e0
movq 0xe8(%rsp), %rax
movq %rbx, (%rax)
movq 0xe0(%rsp), %rax
movq %rbx, (%rax)
movq 0xd0(%rsp), %rax
movq %rbx, (%rax)
movq 0x100(%rsp), %rax
movl 0xf0(%rsp), %ecx
movl (%rax,%rcx,8), %edx
movq %rbx, 0x38(%r15)
movq 0x18(%r12), %rdi
leaq 0x68(%rsp), %rax
leaq 0x70(%rsp), %r10
leaq 0x64(%rsp), %rcx
leaq 0x80(%rsp), %r8
leaq 0x78(%rsp), %r9
movq %r12, 0x48(%rsp)
movq %r12, %rsi
pushq %r15
pushq $0x1
pushq %rax
pushq %r10
callq 0x10109f
movq 0x100(%rsp), %r11
addq $0x20, %rsp
movq 0x100(%rsp), %rax
movl 0xf0(%rsp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
cmpq %rax, 0x8(%r11)
jae 0xeb0a4
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%r11)
movq 0x10(%r11), %rdi
leaq 0x4(,%rcx,4), %rsi
callq 0x2370
movq 0xe0(%rsp), %r11
movq %rax, 0x10(%r11)
cmpq $0x0, 0x38(%r15)
movq %r15, 0x50(%rsp)
movq (%rsp), %r10
je 0xeb3ba
xorl %ecx, %ecx
movq 0x48(%r15), %rax
movq %rcx, 0x8(%rsp)
movl (%rax,%rcx,4), %eax
movl %eax, 0x10(%rsp)
shrl %eax
movq 0x48(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,4), %rdx
movl 0x10(%rcx,%rdx,8), %eax
testl %eax, %eax
je 0xeb3a4
leaq (%rcx,%rdx,8), %r12
xorl %ebx, %ebx
testb $0x1, 0x10(%rsp)
jne 0xeb0fc
leaq (,%rbx,8), %rax
jmp 0xeb106
movl %ebx, %ecx
notl %ecx
addl %ecx, %eax
shlq $0x3, %rax
addq 0x18(%r12), %rax
movq (%rax), %r13
shrq $0x21, %r13
leal (,%r13,2), %r15d
movq 0x20(%r10), %rax
cmpb $0x2, 0x4(%rax,%r13,8)
jne 0xeb17b
movq 0x8(%r11), %rax
cmpq %rax, (%r11)
jne 0xeb160
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r11)
movq 0x10(%r11), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0xe0(%rsp), %r11
movq (%rsp), %r10
movq %rax, 0x10(%r11)
orl $0x1, %r15d
movq (%r11), %rax
movq 0x10(%r11), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r11)
movl %r15d, (%rcx,%rax,4)
jmp 0xeb393
movq 0x8(%r11), %rax
cmpq %rax, (%r11)
jne 0xeb1b5
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r11)
movq 0x10(%r11), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0xe0(%rsp), %r11
movq (%rsp), %r10
movq %rax, 0x10(%r11)
movq (%r11), %rax
movq 0x10(%r11), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r11)
movl %r15d, (%rcx,%rax,4)
leaq (%r13,%r13,2), %rax
movq 0x38(%rsp), %rcx
leaq (%rcx,%rax,8), %rax
movl 0xc(%rax), %esi
testl %esi, %esi
movq 0xc0(%rsp), %r15
je 0xeb2b3
movl $0xc, %ecx
xorl %edx, %edx
movq (%rax), %rsi
movl (%rsi,%rcx), %r8d
movq 0x20(%r10), %rdi
cmpl $0x0, (%rdi,%r8,8)
movl %r8d, %esi
js 0xeb25c
movl %esi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmpq %rdi, (%r14)
jbe 0xeb22d
movq 0x8(%r14), %r8
movl (%r8,%rdi,4), %edi
cmpl $-0x1, %edi
je 0xeb22d
movl %edi, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
testl %edi, %edi
setns %dil
jmp 0xeb22f
xorl %edi, %edi
cmpl $-0x1, %esi
sete %r8b
orb %dil, %r8b
jne 0xeb2a0
movl %esi, %esi
cmpb $0x0, (%rbp,%rsi)
jne 0xeb2a0
movb $0x1, (%rbp,%rsi)
movq (%r15,%rsi,8), %rdi
cmpq $-0x1, %rdi
je 0xeb2a0
incq %rdi
movq %rdi, (%r15,%rsi,8)
jmp 0xeb2a0
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmpq %r8, (%r14)
jbe 0xeb283
movq 0x8(%r14), %r9
movl (%r9,%r8,4), %r8d
cmpl $-0x1, %r8d
je 0xeb283
movl %r8d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
shrl $0x1f, %r8d
jmp 0xeb286
xorl %r8d, %r8d
cmpl $-0x1, %esi
sete %r9b
orb %r8b, %r9b
jne 0xeb2a0
movl %esi, %r8d
cmpl $0x0, (%rdi,%r8,8)
jns 0xeb204
incq %rdx
movl 0xc(%rax), %esi
addq $0x28, %rcx
cmpq %rsi, %rdx
jb 0xeb1ef
leal (%rsi,%rsi), %ecx
movl 0xf8(%rsp), %edx
cmpl %edx, %ecx
jbe 0xeb2dc
movq %rbp, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0xe0(%rsp), %r11
movq (%rsp), %r10
jmp 0xeb393
testl %esi, %esi
je 0xeb393
movl $0xc, %ecx
xorl %edx, %edx
movq (%rax), %rsi
movl (%rsi,%rcx), %r8d
movq 0x20(%r10), %rdi
cmpl $0x0, (%rdi,%r8,8)
movl %r8d, %esi
js 0xeb340
movl %esi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmpq %rdi, (%r14)
jbe 0xeb329
movq 0x8(%r14), %r8
movl (%r8,%rdi,4), %edi
cmpl $-0x1, %edi
je 0xeb329
movl %edi, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
testl %edi, %edi
setns %dil
jmp 0xeb32b
xorl %edi, %edi
cmpl $-0x1, %esi
sete %r8b
orb %dil, %r8b
jne 0xeb380
movl %esi, %esi
movb $0x0, (%rbp,%rsi)
jmp 0xeb380
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmpq %r8, (%r14)
jbe 0xeb367
movq 0x8(%r14), %r9
movl (%r9,%r8,4), %r8d
cmpl $-0x1, %r8d
je 0xeb367
movl %r8d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
shrl $0x1f, %r8d
jmp 0xeb36a
xorl %r8d, %r8d
cmpl $-0x1, %esi
sete %r9b
orb %r8b, %r9b
jne 0xeb380
movl %esi, %r8d
cmpl $0x0, (%rdi,%r8,8)
jns 0xeb300
incq %rdx
movl 0xc(%rax), %esi
addq $0x28, %rcx
cmpq %rsi, %rdx
jb 0xeb2eb
incq %rbx
movl 0x10(%r12), %eax
cmpq %rax, %rbx
jb 0xeb0eb
movq 0x8(%rsp), %rcx
incl %ecx
movq 0x50(%rsp), %r15
cmpq %rcx, 0x38(%r15)
ja 0xeb0ba
movq 0xd0(%rsp), %rdi
movq $0x0, (%rdi)
movl 0xf8(%rsp), %ecx
testl %ecx, %ecx
je 0xeb465
movl 0xf0(%rsp), %eax
movl %eax, %ebx
movl %ecx, %r15d
xorl %r12d, %r12d
movl $0x2, %r13d
cmpq %r12, %rbx
je 0xeb45d
movq 0xc0(%rsp), %rax
movq (%rax,%r12,8), %rbp
testq %rbp, %rbp
je 0xeb45d
movq 0x8(%rdi), %rax
cmpq %rax, (%rdi)
jne 0xeb434
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r13, %rsi
movq %rsi, 0x8(%rdi)
movq 0x10(%rdi), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0xd0(%rsp), %rdi
movq %rax, 0x10(%rdi)
shlq $0x20, %rbp
addq %r12, %rbp
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
leaq 0x1(%rax), %rdx
movq 0xd0(%rsp), %rsi
movq %rdx, (%rsi)
movq 0xd0(%rsp), %rdi
movq %rbp, (%rcx,%rax,8)
incq %r12
cmpq %r12, %r15
jne 0xeb3ed
cmpq $0x0, (%rdi)
movq 0xe8(%rsp), %r13
je 0xebab7
movl $0x1, %esi
callq 0x9fc63
movq 0xd0(%rsp), %rcx
movq (%rsp), %r10
cmpq $0x0, (%rcx)
je 0xebab7
movq 0xd8(%rsp), %rbp
movl 0xf0(%rsp), %eax
shlq $0x20, %rax
movq %rax, 0x58(%rsp)
xorl %ebx, %ebx
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq 0x10(%rcx), %rax
movq (%rax,%rbx,8), %r9
movq 0x48(%rsp), %rdi
movq %r10, %rsi
movq %r13, %rdx
movq 0x100(%rsp), %rcx
movq 0x50(%rsp), %r8
movq %r9, 0x8(%rsp)
callq 0xea427
movq 0xd0(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax,%rbx,8), %ebx
movl 0xf0(%rsp), %eax
cmpl $0x35, %eax
jne 0xeb50b
cmpl $0x0, 0x19ff13(%rip)    # 0x28b418
jne 0xeba8d
movq %rbx, 0x28(%rsp)
movq $0x0, (%rbp)
movq 0xe0(%rsp), %r10
cmpq $0x0, (%r10)
movq 0x30(%rsp), %r8
movq (%rsp), %r9
movq 0x8(%rsp), %r11
je 0xeb80c
xorl %ebx, %ebx
movq 0x10(%r10), %rcx
movl (%rcx,%rbx,4), %eax
shrl %eax
movq 0x20(%r9), %rdx
cmpb $0x2, 0x4(%rdx,%rax,8)
je 0xeb801
testl %ebx, %ebx
je 0xeb580
leal -0x1(%rbx), %esi
movl (%rcx,%rsi,4), %ecx
shrl %ecx
cmpb $0x2, 0x4(%rdx,%rcx,8)
leaq (%rcx,%rcx,2), %rcx
movq 0x38(%rsp), %rdx
leaq (%rdx,%rcx,8), %rcx
movl $0x0, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x10(%rsp)
jmp 0xeb58e
movq $0x0, 0x10(%rsp)
movq 0x38(%rsp), %rdx
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %r12
cmpl $0x0, 0xc(%r12)
je 0xeb801
xorl %r15d, %r15d
movq (%r12), %rax
leaq (%r15,%r15,4), %rcx
movl 0xc(%rax,%rcx,8), %eax
movq 0x20(%r9), %rdx
cmpl $0x0, (%rdx,%rax,8)
movl %eax, %ecx
js 0xeb6b7
movl %ecx, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rcx, (%r14)
jbe 0xeb5e9
movq 0x8(%r14), %rsi
movl (%rsi,%rcx,4), %esi
cmpl $-0x1, %esi
je 0xeb5e9
movl %esi, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
testl %esi, %esi
setns %sil
jmp 0xeb5eb
xorl %esi, %esi
cmpl %r11d, %edx
jne 0xeb7ce
testb %sil, %sil
jne 0xeb7ce
cmpl $-0x1, %edx
je 0xeb7ce
movl (%r8,%rcx,4), %r13d
cmpq $0x0, 0x10(%rsp)
je 0xeb6e5
movq 0x10(%rsp), %rcx
movl 0xc(%rcx), %ecx
testq %rcx, %rcx
je 0xeb6e5
movq 0x10(%rsp), %rdx
movq (%rdx), %rsi
addq $0xc, %rsi
xorl %edx, %edx
cmpl %eax, (%rsi)
je 0xeb64a
incq %rdx
addq $0x28, %rsi
cmpq %rdx, %rcx
jne 0xeb635
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl $-0x1, %edx
je 0xeb6e5
movq (%rbp), %rax
testq %rax, %rax
je 0xeb7ce
testl %eax, %eax
jle 0xeb697
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq 0x1(%rax), %rcx
shlq $0x4, %rax
addq $-0x4, %rax
cmpl $-0x1, %r13d
je 0xeb68a
movq 0x10(%rbp), %rdx
cmpl %r13d, -0x8(%rdx,%rax)
je 0xeb7c5
decq %rcx
addq $-0x10, %rax
cmpq $0x1, %rcx
jg 0xeb675
callq 0x11656
movq 0x8(%rsp), %r11
movq 0xe0(%rsp), %r10
movq (%rsp), %r9
movq 0x30(%rsp), %r8
jmp 0xeb7ce
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rax, (%r14)
jbe 0xeb7a9
movq 0x8(%r14), %rsi
movl (%rsi,%rax,4), %esi
cmpl $-0x1, %esi
je 0xeb7a9
movl %esi, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shrl $0x1f, %esi
jmp 0xeb7ab
movq (%rbp), %rax
testq %rax, %rax
je 0xeb739
testl %eax, %eax
jle 0xeb730
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq 0x1(%rax), %rcx
shlq $0x4, %rax
cmpl $-0x1, %ebx
je 0xeb70e
movq 0x10(%rbp), %rdx
cmpl %ebx, -0x10(%rdx,%rax)
jne 0xeb739
cmpl $-0x1, %r13d
je 0xeb723
movq 0x10(%rbp), %rdx
cmpl %r13d, -0xc(%rdx,%rax)
je 0xeb7ca
decq %rcx
addq $-0x10, %rax
cmpq $0x1, %rcx
jg 0xeb6ff
cmpl $-0x1, %ebx
je 0xeb7e1
movq 0x8(%rbp), %rax
cmpq %rax, (%rbp)
jne 0xeb77e
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rbp)
movq 0x10(%rbp), %rdi
shlq $0x4, %rsi
callq 0x2370
movq 0x8(%rsp), %r11
movq 0xe0(%rsp), %r10
movq (%rsp), %r9
movq 0x30(%rsp), %r8
movq %rax, 0x10(%rbp)
movq (%rbp), %rax
movq 0x10(%rbp), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbp)
shlq $0x4, %rax
movl %ebx, (%rcx,%rax)
movl %r13d, 0x4(%rcx,%rax)
movl %r11d, 0x8(%rcx,%rax)
movl $0x1, 0xc(%rcx,%rax)
jmp 0xeb7ce
xorl %esi, %esi
cmpl $-0x1, %ecx
sete %dil
orb %sil, %dil
jne 0xeb7ce
movl %ecx, %esi
cmpl $0x0, (%rdx,%rsi,8)
jns 0xeb5c1
jmp 0xeb7ce
incl (%rdx,%rax)
jmp 0xeb7ce
incl -0x4(%rdx,%rax)
incq %r15
movl 0xc(%r12), %eax
cmpq %rax, %r15
jb 0xeb5a5
jmp 0xeb801
callq 0x11678
movq 0x8(%rsp), %r11
movq 0xe0(%rsp), %r10
movq (%rsp), %r9
movq 0x30(%rsp), %r8
jmp 0xeb739
incl %ebx
cmpq %rbx, (%r10)
ja 0xeb53a
movq %rbp, %rdi
callq 0x101edd
movq 0x8(%rsp), %r11
movq (%rsp), %r10
movq (%rbp), %rcx
testq %rcx, %rcx
movss 0x1c(%rsp), %xmm0
movq 0xe8(%rsp), %r13
movq 0x20(%rsp), %rax
je 0xeba75
movq %rcx, 0x40(%rsp)
leal -0x1(%rcx), %eax
movq %rax, %rcx
shlq $0x4, %rcx
movq 0x28(%rsp), %r12
movq %rax, 0x28(%rsp)
movq 0x10(%rbp), %rdi
movq %rcx, 0x10(%rsp)
addq %rcx, %rdi
xorl %esi, %esi
movl 0xf0(%rsp), %eax
movq %rax, %rdx
movl %r11d, %ecx
movq 0xe0(%rsp), %r8
movq %r13, %r9
pushq %r12
pushq %r14
pushq %r10
movq %r13, %r15
movq 0x50(%rsp), %r13
pushq %r13
movq %r11, %rbx
callq 0xea79d
addq $0x20, %rsp
testl %eax, %eax
je 0xeb920
movq 0x40(%rsp), %rax
decl %eax
movq %rax, 0x40(%rsp)
movq 0x10(%rbp), %rdi
addq 0x10(%rsp), %rdi
movl $0x1, %esi
movl 0xf0(%rsp), %edx
movl %ebx, %ecx
movq 0xe0(%rsp), %r8
movq %r15, %r9
movss 0x1c(%rsp), %xmm0
pushq %r12
pushq %r14
pushq 0x10(%rsp)
pushq %r13
callq 0xea79d
addq $0x20, %rsp
testl %eax, %eax
je 0xeb931
movq 0x10(%rsp), %rcx
addq $-0x10, %rcx
movq 0x28(%rsp), %rax
addl $-0x1, %eax
movss 0x1c(%rsp), %xmm0
movq (%rsp), %r10
movq 0xe8(%rsp), %r13
movq 0x8(%rsp), %r11
jb 0xeb851
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xeb947
movq (%rsp), %r10
movq %r15, %r13
movq %rbx, %r11
movq 0x28(%rsp), %rax
jmp 0xeb947
movq 0x40(%rsp), %rax
movq (%rsp), %r10
movq 0xe8(%rsp), %r13
movq 0x8(%rsp), %r11
cmpl $-0x1, %eax
movq 0x20(%rsp), %rax
je 0xeba75
movq 0x108(%rsp), %rbx
movl 0x4(%rbx), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %ecx
movl (%rbx), %eax
cmpl %eax, %ecx
jne 0xeb99a
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x10, %eax
cmovel %eax, %ecx
movl %ecx, (%rbx)
movq 0x8(%rbx), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq 0x8(%rsp), %r11
movq (%rsp), %r10
movq %rax, 0x8(%rbx)
movl 0x4(%rbx), %eax
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leal 0x1(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %edx, %eax
movq 0x8(%rbx), %rdx
movl %eax, 0x4(%rbx)
leaq (%rcx,%rcx,2), %rax
movl $0x0, 0xc(%rdx,%rax,8)
movq 0x58(%rsp), %rcx
movq %rcx, (%rdx,%rax,8)
movl %r11d, 0x8(%rdx,%rax,8)
cmpl $0x0, 0x110(%rsp)
movq 0x20(%rsp), %rax
je 0xeba75
movq 0x108(%rsp), %rbx
movl 0x4(%rbx), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %ecx
movl (%rbx), %eax
cmpl %eax, %ecx
jne 0xeba2e
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x10, %eax
cmovel %eax, %ecx
movl %ecx, (%rbx)
movq 0x8(%rbx), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq 0x8(%rsp), %r11
movq (%rsp), %r10
movq %rax, 0x8(%rbx)
movq 0x8(%rbx), %rax
movl 0x4(%rbx), %ecx
movl %ecx, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
leal 0x1(%rcx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %esi, %ecx
movl %ecx, 0x4(%rbx)
leaq (%rdx,%rdx,2), %rcx
movl $0x0, 0xc(%rax,%rcx,8)
shlq $0x20, %r11
movq %r11, (%rax,%rcx,8)
movl 0xf0(%rsp), %edx
movl %edx, 0x8(%rax,%rcx,8)
movq 0x20(%rsp), %rax
incl %eax
movq %rax, %rbx
movq 0xd0(%rsp), %rcx
cmpq %rax, (%rcx)
ja 0xeb4b3
jmp 0xebab7
movq 0x19e54c(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x140754(%rip), %rsi    # 0x22c1f2
movl $0x35, %edx
movq 0x8(%rsp), %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x22b0
jmp 0xeb50b
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq