// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movss %xmm0, 0x14(%rsp)
movq %r9, 0x20(%rsp)
movq %r8, %r14
movq %rcx, %r15
movq %rdx, 0x28(%rsp)
movq %rsi, %r13
movq %rdi, %r12
movl 0xe8(%rsp), %ebp
movq 0xb0(%rsp), %rdi
leaq (,%rbp,8), %rdx
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x20e0
movq 0xb8(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x20e0
movq 0xd8(%rsp), %rax
movq %rbx, (%rax)
movq 0xd0(%rsp), %rax
movq %rbx, (%rax)
movq 0xc0(%rsp), %rax
movq %rbx, (%rax)
movq 0xf0(%rsp), %rax
movl 0xe0(%rsp), %ecx
movl (%rax,%rcx,8), %edx
movq %rbx, 0x38(%r15)
movq 0x18(%r12), %rdi
leaq 0x58(%rsp), %rax
leaq 0x60(%rsp), %r10
leaq 0x54(%rsp), %rcx
leaq 0x70(%rsp), %r8
leaq 0x68(%rsp), %r9
movq %r12, 0x30(%rsp)
movq %r12, %rsi
movq %r15, 0x18(%rsp)
pushq %r15
pushq $0x1
pushq %rax
pushq %r10
callq 0x1053a7
movq 0xf0(%rsp), %r11
addq $0x20, %rsp
movq 0xf0(%rsp), %rax
movl 0xe0(%rsp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
cmpq %rax, 0x8(%r11)
jae 0xecac0
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 0xd0(%rsp), %r11
movq %rax, 0x10(%r11)
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
testq %rax, %rax
je 0xecd3f
xorl %edi, %edi
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %rcx
movl (%rcx,%rdi,4), %ecx
movl %ecx, (%rsp)
shrl %ecx
movq 0x30(%rsp), %rdx
movq 0x10(%rdx), %rdx
leaq (%rcx,%rcx,4), %rsi
movl 0x10(%rdx,%rsi,8), %ecx
testl %ecx, %ecx
je 0xecd34
movq %rdi, 0x8(%rsp)
leaq (%rdx,%rsi,8), %rbx
xorl %r15d, %r15d
movl %r15d, %eax
notl %eax
addl %ecx, %eax
testb $0x1, (%rsp)
movq 0x18(%rbx), %rcx
cmoveq %r15, %rax
movq (%rcx,%rax,8), %rbp
shrq $0x21, %rbp
leal (,%rbp,2), %r12d
movq 0x20(%r13), %rax
cmpb $0x2, 0x4(%rax,%rbp,8)
jne 0xecb88
movq (%r11), %rcx
movq 0x10(%r11), %rax
cmpq 0x8(%r11), %rcx
jne 0xecb74
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r11)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xd0(%rsp), %r11
movq %rax, 0x10(%r11)
movq (%r11), %rcx
orl $0x1, %r12d
leaq 0x1(%rcx), %rdx
movq %rdx, (%r11)
movl %r12d, (%rax,%rcx,4)
jmp 0xecd17
movq (%r11), %rcx
movq 0x10(%r11), %rax
cmpq 0x8(%r11), %rcx
jne 0xecbc4
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r11)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xd0(%rsp), %r11
movq %rax, 0x10(%r11)
movq (%r11), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r11)
movl %r12d, (%rax,%rcx,4)
leaq (,%rbp,2), %rax
addq %rbp, %rax
movq 0x28(%rsp), %rbp
cmpl $0x0, 0xc(%rbp,%rax,8)
movq 0xb8(%rsp), %r12
je 0xecd17
leaq (,%rax,8), %rax
addq %rbp, %rax
movl $0xc, %edx
xorl %esi, %esi
movq (%rax), %rcx
movl (%rcx,%rdx), %ecx
movq 0x20(%r13), %r8
cmpl $0x0, (%r8,%rcx,8)
movq (%r14), %rdi
js 0xecc5e
cmpq %rcx, %rdi
jbe 0xecc77
movq 0x8(%r14), %rdi
movl (%rdi,%rcx,4), %ecx
cmpl $-0x2, %ecx
jg 0xecc77
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpb $0x0, (%r12,%rcx)
jne 0xecc77
movb $0x1, (%r12,%rcx)
movq 0xb0(%rsp), %rdi
movq (%rdi,%rcx,8), %rdi
cmpq $-0x1, %rdi
je 0xecc77
incq %rdi
movq 0xb0(%rsp), %r8
movq %rdi, (%r8,%rcx,8)
jmp 0xecc77
cmpq %rcx, %rdi
jbe 0xecc77
movq 0x8(%r14), %r9
movslq (%r9,%rcx,4), %rcx
testq %rcx, %rcx
js 0xecc77
cmpl $0x0, (%r8,%rcx,8)
jns 0xecc18
incq %rsi
movl 0xc(%rax), %ecx
addq $0x28, %rdx
cmpq %rcx, %rsi
jb 0xecc04
leal (%rcx,%rcx), %edx
movl 0xe8(%rsp), %esi
cmpl %esi, %edx
jbe 0xeccaf
movq %rsi, %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0xd0(%rsp), %r11
jmp 0xecd17
testl %ecx, %ecx
je 0xecd17
movl $0xc, %edx
xorl %esi, %esi
movq (%rax), %rdi
movl (%rdi,%rdx), %edi
movq 0x20(%r13), %r9
cmpl $0x0, (%r9,%rdi,8)
movq (%r14), %r8
js 0xeccf0
cmpq %rdi, %r8
jbe 0xecd09
movq 0x8(%r14), %r8
movl (%r8,%rdi,4), %edi
cmpl $-0x2, %edi
jg 0xecd09
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movb $0x0, (%r12,%rdi)
movl 0xc(%rax), %ecx
jmp 0xecd09
cmpq %rdi, %r8
jbe 0xecd09
movq 0x8(%r14), %r10
movslq (%r10,%rdi,4), %rdi
testq %rdi, %rdi
js 0xecd09
cmpl $0x0, (%r9,%rdi,8)
jns 0xeccce
incq %rsi
movl %ecx, %edi
addq $0x28, %rdx
cmpq %rdi, %rsi
jb 0xeccba
incq %r15
movl 0x10(%rbx), %ecx
cmpq %rcx, %r15
jb 0xecb0a
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rsp), %rdi
incl %edi
cmpq %rdi, %rax
ja 0xecad4
movq 0xc0(%rsp), %rdi
movq $0x0, (%rdi)
movl 0xe8(%rsp), %eax
testl %eax, %eax
je 0xed3a9
xorl %ebx, %ebx
movl $0x2, %r15d
movl 0xe0(%rsp), %esi
cmpq %rbx, %rsi
je 0xecdd9
movq 0xb0(%rsp), %rcx
movq (%rcx,%rbx,8), %r12
testq %r12, %r12
je 0xecdd9
movq (%rdi), %rcx
movq 0x10(%rdi), %rax
cmpq 0x8(%rdi), %rcx
jne 0xecdc0
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %r15, %rsi
movq %rsi, 0x8(%rdi)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xc0(%rsp), %rdi
movl 0xe0(%rsp), %esi
movq %rax, 0x10(%rdi)
movq (%rdi), %rcx
shlq $0x20, %r12
addq %rbx, %r12
leaq 0x1(%rcx), %rdx
movq %rdx, (%rdi)
movq %r12, (%rax,%rcx,8)
movl 0xe8(%rsp), %eax
incq %rbx
cmpq %rbx, %rax
jne 0xecd6c
cmpq $0x0, (%rdi)
je 0xed3a9
movl $0x1, %esi
callq 0xa041c
movq 0xc0(%rsp), %rcx
cmpq $0x0, (%rcx)
je 0xed3a9
movl 0xe0(%rsp), %eax
shlq $0x20, %rax
movq %rax, 0x38(%rsp)
xorl %ebx, %ebx
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movq 0x10(%rcx), %rax
movq (%rax,%rbx,8), %r9
movq 0x30(%rsp), %rdi
movq %r13, %rsi
movq 0xd8(%rsp), %rdx
movq 0xf0(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %r9, (%rsp)
callq 0xebe29
movq 0xc0(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax,%rbx,8), %ebx
movl 0xe0(%rsp), %eax
cmpl $0x35, %eax
jne 0xece77
cmpl $0x0, 0x1a95a7(%rip)    # 0x296418
jne 0xed380
movq %rbx, 0x48(%rsp)
movq 0xc8(%rsp), %rdi
movq $0x0, (%rdi)
movq 0xd0(%rsp), %r9
movq (%r9), %rax
testq %rax, %rax
movq 0x20(%rsp), %r8
movq 0x28(%rsp), %r10
je 0xed165
xorl %r12d, %r12d
movq 0x10(%r9), %rdx
movl (%rdx,%r12,4), %ecx
shrl %ecx
movq 0x20(%r13), %rsi
cmpb $0x2, 0x4(%rsi,%rcx,8)
je 0xed159
testl %r12d, %r12d
je 0xeceee
leal -0x1(%r12), %r11d
movl (%rdx,%r11,4), %edx
shrl %edx
cmpb $0x2, 0x4(%rsi,%rdx,8)
leaq (%rdx,%rdx,2), %rdx
leaq (%r10,%rdx,8), %rdx
movl $0x0, %r11d
cmovneq %rdx, %r11
jmp 0xecef1
xorl %r11d, %r11d
leaq (%rcx,%rcx,2), %rcx
leaq (%r10,%rcx,8), %rbx
cmpl $0x0, 0xc(%rbx)
je 0xed159
xorl %ebp, %ebp
movq (%rsp), %r10
movq %r11, 0x8(%rsp)
movq (%rbx), %rax
leaq (,%rbp,4), %rcx
addq %rbp, %rcx
movl 0xc(%rax,%rcx,8), %eax
movq 0x20(%r13), %rsi
cmpl $0x0, (%rsi,%rax,8)
movq (%r14), %rdx
movq %rax, %rcx
js 0xecf90
cmpq %rcx, %rdx
jbe 0xed0d5
movq 0x8(%r14), %rdx
movl (%rdx,%rcx,4), %edx
cmpl $-0x1, %edx
je 0xed0d5
testl %edx, %edx
jns 0xed0d5
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmpl %r10d, %edx
jne 0xed0d5
movl (%r8,%rcx,4), %r15d
testq %r11, %r11
je 0xecfc8
movl 0xc(%r11), %edx
testq %rdx, %rdx
je 0xecfc8
movq (%r11), %rcx
shlq $0x3, %rdx
leaq (%rdx,%rdx,4), %rdx
xorl %esi, %esi
cmpl %eax, 0xc(%rcx,%rsi)
je 0xecfb5
addq $0x28, %rsi
cmpq %rsi, %rdx
jne 0xecf7f
jmp 0xecfc8
cmpq %rax, %rdx
jbe 0xed0d5
movq 0x8(%r14), %rcx
movslq (%rcx,%rax,4), %rcx
testq %rcx, %rcx
js 0xed0d5
cmpl $0x0, (%rsi,%rcx,8)
jns 0xecf30
jmp 0xed0d5
movabsq $0x27ffffffd8, %rax     # imm = 0x27FFFFFFD8
cmpq %rax, %rsi
jne 0xed0e6
movq (%rdi), %rcx
testq %rcx, %rcx
je 0xed063
testl %ecx, %ecx
jle 0xed01a
movl %ecx, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq 0x1(%rax), %rdx
shlq $0x4, %rax
cmpl $-0x1, %r12d
je 0xecff8
movq 0x10(%rdi), %rsi
cmpl %r12d, -0x10(%rsi,%rax)
jne 0xed065
cmpl $-0x1, %r15d
je 0xed00d
movq 0x10(%rdi), %rsi
cmpl %r15d, -0xc(%rsi,%rax)
je 0xed146
decq %rdx
addq $-0x10, %rax
cmpq $0x1, %rdx
ja 0xecfe7
cmpl $-0x1, %r12d
jne 0xed065
movq 0x1a7fb9(%rip), %rax    # 0x294fe0
movq (%rax), %rcx
movl $0x16, %esi
movl $0x1, %edx
leaq 0x14c34e(%rip), %rdi    # 0x239389
callq 0x2410
movq 0x8(%rsp), %r11
movq (%rsp), %r10
movq 0xc8(%rsp), %rdi
movq 0xd0(%rsp), %r9
movq 0x20(%rsp), %r8
movq (%rdi), %rcx
jmp 0xed065
xorl %ecx, %ecx
movq 0x10(%rdi), %rax
cmpq 0x8(%rdi), %rcx
jne 0xed0b4
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rdi)
shlq $0x4, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x8(%rsp), %r11
movq (%rsp), %r10
movq 0xc8(%rsp), %rdi
movq 0xd0(%rsp), %r9
movq 0x20(%rsp), %r8
movq %rax, 0x10(%rdi)
movq (%rdi), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rdi)
shlq $0x4, %rcx
movl %r12d, (%rax,%rcx)
movl %r15d, 0x4(%rax,%rcx)
movl %r10d, 0x8(%rax,%rcx)
movl $0x1, 0xc(%rax,%rcx)
incq %rbp
movl 0xc(%rbx), %eax
cmpq %rax, %rbp
jb 0xecf0e
jmp 0xed151
movq (%rdi), %rax
testq %rax, %rax
je 0xed0d5
testl %eax, %eax
jle 0xed121
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq 0x1(%rax), %rcx
shlq $0x4, %rax
addq $-0x4, %rax
cmpl $-0x1, %r15d
je 0xed114
movq 0x10(%rdi), %rdx
cmpl %r15d, -0x8(%rdx,%rax)
je 0xed14c
decq %rcx
addq $-0x10, %rax
cmpq $0x1, %rcx
ja 0xed103
callq 0x113a9
movq 0x8(%rsp), %r11
movq (%rsp), %r10
movq 0xc8(%rsp), %rdi
movq 0xd0(%rsp), %r9
movq 0x20(%rsp), %r8
jmp 0xed0d5
incl -0x4(%rsi,%rax)
jmp 0xed0d5
incl (%rdx,%rax)
jmp 0xed0d5
movq (%r9), %rax
movq 0x28(%rsp), %r10
incl %r12d
cmpq %r12, %rax
ja 0xeceac
callq 0x106218
movq 0xc8(%rsp), %rbx
movq 0xd0(%rsp), %r8
movq (%rbx), %rax
testq %rax, %rax
movss 0x14(%rsp), %xmm0
movq (%rsp), %rcx
je 0xed363
leal -0x1(%rax), %r15d
shlq $0x4, %r15
movq %rax, 0x8(%rsp)
movq 0x10(%rbx), %rdi
addq %r15, %rdi
xorl %esi, %esi
movl 0xe0(%rsp), %r12d
movq %r12, %rdx
movq 0xd8(%rsp), %r9
movq 0x48(%rsp), %r12
pushq %r12
pushq %r14
pushq %r13
movq 0x40(%rsp), %rbp
pushq %rbp
callq 0xec19c
addq $0x20, %rsp
testl %eax, %eax
je 0xed242
movq 0x10(%rbx), %rdi
addq %r15, %rdi
movl $0x1, %esi
movl 0xe0(%rsp), %edx
movq (%rsp), %rcx
movq 0xd0(%rsp), %r8
movq 0xd8(%rsp), %r9
movss 0x14(%rsp), %xmm0
pushq %r12
pushq %r14
pushq %r13
pushq %rbp
callq 0xec19c
addq $0x20, %rsp
testl %eax, %eax
je 0xed242
movq 0x8(%rsp), %rax
decl %eax
addq $-0x10, %r15
testl %eax, %eax
movss 0x14(%rsp), %xmm0
movq 0xd0(%rsp), %r8
movq (%rsp), %rcx
jne 0xed198
jmp 0xed363
cmpl $0x0, 0x8(%rsp)
movq (%rsp), %rdi
je 0xed363
movq 0xf8(%rsp), %rbx
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl (%rbx), %ecx
jne 0xed29d
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%rbx)
movq 0x8(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq (%rsp), %rdi
movq %rax, 0x8(%rbx)
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0xed2a1
movq 0x8(%rbx), %rax
leal 0x1(%rdx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%rbx)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movl $0x0, 0xc(%rax,%rcx,8)
movq 0x38(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
movl %edi, 0x8(%rax,%rcx,8)
cmpl $0x0, 0x100(%rsp)
je 0xed363
movq 0xf8(%rsp), %rbx
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl (%rbx), %ecx
jne 0xed32a
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%rbx)
movq 0x8(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq (%rsp), %rdi
movq %rax, 0x8(%rbx)
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0xed32e
movq 0x8(%rbx), %rax
leal 0x1(%rdx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%rbx)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movl $0x0, 0xc(%rax,%rcx,8)
shlq $0x20, %rdi
movq %rdi, (%rax,%rcx,8)
movl 0xe0(%rsp), %edx
movl %edx, 0x8(%rax,%rcx,8)
movq 0x40(%rsp), %rax
incl %eax
movq %rax, %rbx
movq 0xc0(%rsp), %rcx
cmpq %rax, (%rcx)
ja 0xece1b
jmp 0xed3a9
movq 0x1a7c59(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x14b051(%rip), %rsi    # 0x2383e2
movl $0x35, %edx
movq (%rsp), %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x22b0
jmp 0xece77
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq