// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: print_rough_inconsistent_sites(ma_utg_t*, unsigned int, unsigned int, asg_t*, All_reads*, ma_hit_t_alloc*, ma_sub_t*, kvec_asg_arc_t_warp*, UC_Read*, UC_Read*, int, int, unsigned int, unsigned int, kvec_t_u32_warp*, kvec_t_u32_warp*, char const*, int, _IO_FILE*, bed_in*)
void print_rough_inconsistent_sites(ma_utg_t* collection, uint32_t cur_i, uint32_t next_i, 
asg_t* read_g, All_reads *RNF, ma_hit_t_alloc* sources, ma_sub_t *coverage_cut, 
kvec_asg_arc_t_warp* edge, UC_Read* r_read, UC_Read* q_read, int max_hang, int min_ovlp,
uint32_t c_beg, uint32_t rate_thre, kvec_t_u32_warp* exact_count, kvec_t_u32_warp* total_count, 
const char* prefix, int uID, FILE* fp, bed_in* interval)
{
    uint32_t v, w, i, rate;
    int v_beg, v_end, v_sub_beg, v_sub_end, w_beg, w_end, w_sub_beg, w_sub_end, i_beg, i_end, j;
    asg_arc_t t;
    bed_interval* p = NULL;
    v = (uint64_t)(collection->a[cur_i])>>32;
    ///last element
    if(cur_i == collection->n-1 && next_i == collection->n)
    {
        if(!collection->circ)
        {
            next_i = (uint32_t)-1;
        }
        else
        {
            next_i = 0;
        }
    }


    if(next_i != ((uint32_t)-1))
    {
        w = (uint64_t)(collection->a[next_i])>>32;

        get_specific_edge(sources, coverage_cut, NULL, edge, read_g, max_hang, min_ovlp, v, w, &t);
        v_beg = 0; v_end = asg_arc_len(t) - 1; 
        if(v&1)
        {
            v_beg = Get_READ_LENGTH((*RNF), (v>>1)) - v_beg - 1;
            v_end = Get_READ_LENGTH((*RNF), (v>>1)) - v_end - 1;
            w = v_beg; v_beg = v_end; v_end = w;
        }
    }
    else
    {
        v_beg = 0; v_end = Get_READ_LENGTH((*RNF), (v>>1)) - 1;
    }

    kv_resize(uint32_t, exact_count->a, (uint32_t)(v_end - v_beg + 1)); 
    memset(exact_count->a.a, 0, (v_end-v_beg+1)*sizeof(uint32_t));
    kv_resize(uint32_t, total_count->a, (uint32_t)(v_end - v_beg + 1)); 
    memset(total_count->a.a, 0, (v_end-v_beg+1)*sizeof(uint32_t));
    exact_count->a.n = total_count->a.n = (v_end-v_beg+1);
    
    recover_UC_sub_Read(r_read, v_beg, v_end - v_beg + 1, 0, RNF, v>>1);
    ma_hit_t_alloc* x = &(sources[v>>1]);
    ma_hit_t *h = NULL;
    ///[v_beg, v_end] must be the end of read, which means v_beg = 0 or v_end = Get_READ_LENGTH((*RNF), (v>>1)) - 1

    for (i = 0; i < x->length; i++)
    {
        h = &(x->buffer[i]);
        if(inter_interval(v_beg, v_end, Get_qs((*h)), Get_qe((*h)) - 1, 
                                                &v_sub_beg, &v_sub_end) == 0)
        {
            continue;
        }

        if(h->el)
        {
            for (j = v_sub_beg; j <= v_sub_end; j++)
            {
                exact_count->a.a[j-v_beg]++;
                total_count->a.a[j-v_beg]++;
            }            
            continue;
        }

        w_beg = Get_ts((*h)); w_end = Get_te((*h)) - 1;
        if(h->rev)
        {
            w_beg = Get_READ_LENGTH((*RNF), Get_tn((*h))) - w_beg - 1;
            w_end = Get_READ_LENGTH((*RNF), Get_tn((*h))) - w_end - 1;
            w = w_beg; w_beg = w_end; w_end = w;
        }



        w_sub_beg = w_beg + (v_sub_beg - Get_qs((*h)));
        if(w_sub_beg >= (int)(Get_READ_LENGTH((*RNF), Get_tn((*h)))))
        {
            w_sub_beg = Get_READ_LENGTH((*RNF), Get_tn((*h))) - 1;
        }


        w_sub_end = w_end - ((int)(Get_qe((*h))) - 1 - v_sub_end);
        if(w_sub_end < 0) w_sub_end = 0;
        if(w_sub_beg > w_sub_end || (v_sub_end-v_sub_beg) != (w_sub_end-w_sub_beg))
        {
            for (j = v_sub_beg; j <= v_sub_end; j++)
            {
                total_count->a.a[j-v_beg]++;
            }  
            continue;
        } 

        recover_UC_sub_Read(q_read, w_sub_beg, w_sub_end-w_sub_beg +1, h->rev, RNF, Get_tn((*h)));
        if(if_exact_match(r_read->seq, r_read->length, q_read->seq, q_read->length, 
        v_sub_beg-v_beg, v_sub_end-v_beg, 0, q_read->length-1))
        {
            for (j = v_sub_beg; j <= v_sub_end; j++)
            {
                exact_count->a.a[j-v_beg]++;
                total_count->a.a[j-v_beg]++;
            }  
        }
        else
        {
            for (j = v_sub_beg; j <= v_sub_end; j++)
            {
                total_count->a.a[j-v_beg]++;
            } 
        }
    }
    
    i_beg = i_end = -1;
    v = (uint64_t)(collection->a[cur_i])>>32;
    uint32_t inexact = 0, total = 0; 
    for (i = 0; i < total_count->a.n; i++)
    {
        if(total_count->a.a[i] == 0)
        {
            rate = 100;
        }
        else
        {
            rate = ((total_count->a.a[i] - exact_count->a.a[i])*100)/total_count->a.a[i];
        }
         
        if(rate >= rate_thre)   ///inexact rate
        {
            ///start a new interval
            if(i_beg == -1 && i_end == -1)
            {
                i_beg = i_end = i;
            }
            else///extend current interval
            {
                i_end++;
            }
            total = total + total_count->a.a[i];
            inexact = inexact + (total_count->a.a[i] - exact_count->a.a[i]);
        }
        else///end an interval
        {
            if(i_beg != -1 && i_end != -1)
            {
                ///i_beg and i_end are the offsets in comparsion to v_beg
                v_sub_beg = i_beg + v_beg;
                v_sub_end = i_end + v_beg;
                if(v&1)
                {
                    i_beg = (v_end - v_beg + 1) - i_beg - 1;
                    i_end = (v_end - v_beg + 1) - i_end - 1;
                    w = i_beg; i_beg = i_end; i_end = w;
                }
                i_end++;
                rate = (total == 0)? 100 : (inexact*100)/total;

                if(prefix != NULL && fp != NULL)
                {
                    fprintf(fp,"%s%.6d%c\t%u\t%u\t%u\t", prefix, uID, "lc"[collection->circ], 
                    (uint32_t)(i_beg + c_beg), (uint32_t)(i_end + c_beg), rate);
                    fprintf(fp,"%.*s", (int)Get_NAME_LENGTH((*RNF), (v>>1)), Get_NAME((*RNF), (v>>1)));
                    for (j = 0; j < (int)x->length; j++)
                    {
                        h = &(x->buffer[j]);
                        if(inter_interval(v_sub_beg, v_sub_end, Get_qs((*h)), Get_qe((*h)) - 1, 
                                                                &w_sub_beg, &w_sub_end) == 0)
                        {
                            continue;
                        }
                        fprintf(fp,",%.*s", (int)Get_NAME_LENGTH((*RNF), Get_tn((*h))), Get_NAME((*RNF), Get_tn((*h))));
                    }
                    fprintf(fp,"\n");
                }
                else if(interval != NULL)
                {
                    kv_pushp(bed_interval, *interval, &p);
                    p->beg = (uint32_t)(i_beg + c_beg);
                    p->end = (uint32_t)(i_end + c_beg);
                }
                
            }

            i_beg = i_end = -1;
            inexact = total = 0;
        }
    }

    if(i_beg != -1 && i_end != -1)
    {
        ///i_beg and i_end are the offsets in comparsion to v_beg
        v_sub_beg = i_beg + v_beg;
        v_sub_end = i_end + v_beg;
        if(v&1)
        {
            i_beg = (v_end - v_beg + 1) - i_beg - 1;
            i_end = (v_end - v_beg + 1) - i_end - 1;
            w = i_beg; i_beg = i_end; i_end = w;
        }
        i_end++;
        rate = (total == 0)? 100 : (inexact*100)/total;

        if(prefix != NULL && fp != NULL)
        {
            fprintf(fp,"%s%.6d%c\t%u\t%u\t%u\t", prefix, uID, "lc"[collection->circ], 
            (uint32_t)(i_beg + c_beg), (uint32_t)(i_end + c_beg), rate);
            fprintf(fp,"%.*s", (int)Get_NAME_LENGTH((*RNF), (v>>1)), Get_NAME((*RNF), (v>>1)));
            for (j = 0; j < (int)x->length; j++)
            {
                h = &(x->buffer[j]);
                if(inter_interval(v_sub_beg, v_sub_end, Get_qs((*h)), Get_qe((*h)) - 1, 
                                                        &w_sub_beg, &w_sub_end) == 0)
                {
                    continue;
                }
                fprintf(fp,",%.*s", (int)Get_NAME_LENGTH((*RNF), Get_tn((*h))), Get_NAME((*RNF), Get_tn((*h))));
            }
            fprintf(fp,"\n");
        }
        else if(interval != NULL)
        {
            kv_pushp(bed_interval, *interval, &p);
            p->beg = (uint32_t)(i_beg + c_beg);
            p->end = (uint32_t)(i_end + c_beg);
        }
    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xe8, %rsp
movq 0x78(%rbp), %rax
movq 0x70(%rbp), %rax
movl 0x68(%rbp), %eax
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movl 0x48(%rbp), %eax
movl 0x40(%rbp), %eax
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x34(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0xeb333
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jne 0xeb333
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0xeb32a
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
jmp 0xeb331
movl $0x0, -0x18(%rbp)
jmp 0xeb333
cmpl $-0x1, -0x18(%rbp)
je 0xeb409
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x18(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movl 0x30(%rbp), %r9d
movl 0x38(%rbp), %ebx
movl -0x34(%rbp), %r11d
movl -0x38(%rbp), %r10d
xorl %eax, %eax
movl %eax, %edx
leaq -0x88(%rbp), %rax
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0xea7d0
movl $0x0, -0x44(%rbp)
movq -0x88(%rbp), %rax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x34(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xeb407
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x34(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movslq -0x44(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x34(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movslq -0x48(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0xeb42a
movl $0x0, -0x44(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x34(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
subq $0x1, %rax
movl %eax, -0x48(%rbp)
jmp 0xeb42c
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x48(%rbp), %ecx
subl -0x44(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0xeb518
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movq 0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x50(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xeb51a
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2100
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x48(%rbp), %ecx
subl -0x44(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0xeb625
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movq 0x58(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x58(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x58(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x58(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x58(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x58(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x58(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x58(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x58(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xeb627
movq 0x58(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2100
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
movq 0x58(%rbp), %rax
movq %rcx, (%rax)
movq 0x50(%rbp), %rax
movq %rcx, (%rax)
movq 0x20(%rbp), %rdi
movslq -0x44(%rbp), %rsi
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
movq -0x28(%rbp), %r8
movl -0x34(%rbp), %eax
shrl %eax
movl %eax, %eax
movl %eax, %r9d
xorl %ecx, %ecx
callq 0x9f30
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq $0x0, -0xa0(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x98(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0xeb9f6
movq -0x98(%rbp), %rax
movq (%rax), %rax
movl -0x3c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movl -0x44(%rbp), %edi
movl -0x48(%rbp), %esi
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movl %eax, %edx
movq -0xa0(%rbp), %rax
movl 0x8(%rax), %ecx
subl $0x1, %ecx
leaq -0x4c(%rbp), %r8
leaq -0x50(%rbp), %r9
callq 0x1670e0
cmpl $0x0, %eax
jne 0xeb718
jmp 0xeb9e8
movq -0xa0(%rbp), %rax
cmpb $0x0, 0x20(%rax)
je 0xeb777
movl -0x4c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jg 0xeb772
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
subl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
subl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0xeb72b
jmp 0xeb9e8
movq -0xa0(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0xa0(%rbp), %rax
movl 0x14(%rax), %eax
subl $0x1, %eax
movl %eax, -0x58(%rbp)
movq -0xa0(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpl $0x0, %eax
je 0xeb806
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq -0xa0(%rbp), %rcx
movl 0xc(%rcx), %ecx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq -0xa0(%rbp), %rcx
movl 0xc(%rcx), %ecx
movq (%rax,%rcx,8), %rax
movslq -0x58(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %eax
movl -0x4c(%rbp), %ecx
movq -0xa0(%rbp), %rdx
movq (%rdx), %rdx
subl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x28(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq -0xa0(%rbp), %rdx
movl 0xc(%rdx), %edx
movq (%rcx,%rdx,8), %rcx
cmpl %ecx, %eax
jl 0xeb857
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq -0xa0(%rbp), %rcx
movl 0xc(%rcx), %ecx
movq (%rax,%rcx,8), %rax
subq $0x1, %rax
movl %eax, -0x5c(%rbp)
movl -0x58(%rbp), %eax
movq -0xa0(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
subl -0x50(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x60(%rbp)
cmpl $0x0, -0x60(%rbp)
jge 0xeb87c
movl $0x0, -0x60(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jg 0xeb894
movl -0x50(%rbp), %eax
subl -0x4c(%rbp), %eax
movl -0x60(%rbp), %ecx
subl -0x5c(%rbp), %ecx
cmpl %ecx, %eax
je 0xeb8cc
movl -0x4c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jg 0xeb8c7
movq 0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
subl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0xeb89a
jmp 0xeb9e8
movq 0x28(%rbp), %rdi
movslq -0x5c(%rbp), %rsi
movl -0x60(%rbp), %eax
subl -0x5c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
movq -0xa0(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
movq -0x28(%rbp), %r8
movq -0xa0(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl %ecx, %r9d
movzbl %al, %ecx
callq 0x9f30
movq 0x20(%rbp), %rax
movq (%rax), %rdi
movq 0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x28(%rbp), %rax
movq (%rax), %rdx
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movl -0x4c(%rbp), %eax
subl -0x44(%rbp), %eax
movslq %eax, %r8
movl -0x50(%rbp), %eax
subl -0x44(%rbp), %eax
movslq %eax, %r9
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
subq $0x1, %rax
xorl %r10d, %r10d
movq $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1c610
cmpl $0x0, %eax
je 0xeb9b1
movl -0x4c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jg 0xeb9af
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
subl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
subl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0xeb968
jmp 0xeb9e6
movl -0x4c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jg 0xeb9e4
movq 0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
subl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0xeb9b7
jmp 0xeb9e6
jmp 0xeb9e8
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xeb6b4
movl $0xffffffff, -0x68(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x64(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x34(%rbp)
movl $0x0, -0xa4(%rbp)
movl $0x0, -0xa8(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq 0x58(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xebe58
movq 0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x3c(%rbp), %ecx
cmpl $0x0, (%rax,%rcx,4)
jne 0xeba5f
movl $0x64, -0x40(%rbp)
jmp 0xeba93
movq 0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x3c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movq 0x50(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x3c(%rbp), %edx
subl (%rcx,%rdx,4), %eax
imull $0x64, %eax, %eax
movq 0x58(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x3c(%rbp), %edx
movl %edx, %esi
xorl %edx, %edx
divl (%rcx,%rsi,4)
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl 0x48(%rbp), %eax
jb 0xebb04
cmpl $-0x1, -0x64(%rbp)
jne 0xebab2
cmpl $-0x1, -0x68(%rbp)
jne 0xebab2
movl -0x3c(%rbp), %eax
movl %eax, -0x68(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xebabb
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
movl -0xa8(%rbp), %eax
movq 0x58(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x3c(%rbp), %edx
addl (%rcx,%rdx,4), %eax
movl %eax, -0xa8(%rbp)
movl -0xa4(%rbp), %eax
movq 0x58(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x3c(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movq 0x50(%rbp), %rdx
movq 0x10(%rdx), %rdx
movl -0x3c(%rbp), %esi
subl (%rdx,%rsi,4), %ecx
addl %ecx, %eax
movl %eax, -0xa4(%rbp)
jmp 0xebe48
cmpl $-0x1, -0x64(%rbp)
je 0xebe26
cmpl $-0x1, -0x68(%rbp)
je 0xebe26
movl -0x64(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x68(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x34(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xebb6b
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
subl -0x64(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
subl -0x68(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x68(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0xa8(%rbp)
jne 0xebb8a
movl $0x64, %eax
movl %eax, -0xac(%rbp)
jmp 0xebb9f
imull $0x64, -0xa4(%rbp), %eax
xorl %edx, %edx
divl -0xa8(%rbp)
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0x40(%rbp)
cmpq $0x0, 0x60(%rbp)
je 0xebd54
cmpq $0x0, 0x70(%rbp)
je 0xebd54
movq 0x70(%rbp), %rdi
movq 0x60(%rbp), %rdx
movl 0x68(%rbp), %ecx
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x299726(%rip), %rax    # 0x385303
movsbl (%rax,%rsi), %r8d
movl -0x64(%rbp), %r9d
addl 0x40(%rbp), %r9d
movl -0x68(%rbp), %r10d
addl 0x40(%rbp), %r10d
movl -0x40(%rbp), %eax
leaq 0x29b1f1(%rip), %rsi    # 0x386ded
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x22a0
movq 0x70(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x34(%rbp), %ecx
shrl %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq -0x28(%rbp), %rcx
movq 0x40(%rcx), %rcx
movl -0x34(%rbp), %edx
shrl %edx
movl %edx, %edx
subq (%rcx,%rdx,8), %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x34(%rbp), %esi
shrl %esi
movl %esi, %esi
addq (%rax,%rsi,8), %rcx
leaq 0x29b1a5(%rip), %rsi    # 0x386e01
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x98(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0xebd3d
movq -0x98(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movl -0x4c(%rbp), %edi
movl -0x50(%rbp), %esi
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movl %eax, %edx
movq -0xa0(%rbp), %rax
movl 0x8(%rax), %ecx
subl $0x1, %ecx
leaq -0x5c(%rbp), %r8
leaq -0x60(%rbp), %r9
callq 0x1670e0
cmpl $0x0, %eax
jne 0xebccc
jmp 0xebd2f
movq 0x70(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq -0xa0(%rbp), %rcx
movl 0xc(%rcx), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq -0x28(%rbp), %rcx
movq 0x40(%rcx), %rcx
movq -0xa0(%rbp), %rdx
movl 0xc(%rdx), %edx
subq (%rcx,%rdx,8), %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq -0xa0(%rbp), %rsi
movl 0xc(%rsi), %esi
addq (%rax,%rsi,8), %rcx
leaq 0x29b0d8(%rip), %rsi    # 0x386e00
movb $0x0, %al
callq 0x22a0
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0xebc6a
movq 0x70(%rbp), %rdi
leaq 0x29ace0(%rip), %rsi    # 0x386a28
movb $0x0, %al
callq 0x22a0
jmp 0xebe24
cmpq $0x0, 0x78(%rbp)
je 0xebe22
jmp 0xebd61
movq 0x78(%rbp), %rax
movq (%rax), %rax
movq 0x78(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0xebdd2
movq 0x78(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xebd91
movq 0x78(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xb8(%rbp)
jmp 0xebd9f
movl $0x2, %eax
movq %rax, -0xb8(%rbp)
jmp 0xebd9f
movq -0xb8(%rbp), %rcx
movq 0x78(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x78(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x4, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x78(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl -0x64(%rbp), %eax
addl 0x40(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x90(%rbp), %rax
movq %rcx, (%rax)
movl -0x68(%rbp), %eax
addl 0x40(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x90(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xebe24
jmp 0xebe26
movl $0xffffffff, -0x68(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x64(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0xa8(%rbp)
movl $0x0, -0xa4(%rbp)
jmp 0xebe4a
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xeba35
cmpl $-0x1, -0x64(%rbp)
je 0xec17a
cmpl $-0x1, -0x68(%rbp)
je 0xec17a
movl -0x64(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x68(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x34(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xebebf
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
subl -0x64(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
addl $0x1, %eax
subl -0x68(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x68(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0xa8(%rbp)
jne 0xebede
movl $0x64, %eax
movl %eax, -0xbc(%rbp)
jmp 0xebef3
imull $0x64, -0xa4(%rbp), %eax
xorl %edx, %edx
divl -0xa8(%rbp)
movl %eax, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x40(%rbp)
cmpq $0x0, 0x60(%rbp)
je 0xec0a8
cmpq $0x0, 0x70(%rbp)
je 0xec0a8
movq 0x70(%rbp), %rdi
movq 0x60(%rbp), %rdx
movl 0x68(%rbp), %ecx
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x2993d2(%rip), %rax    # 0x385303
movsbl (%rax,%rsi), %r8d
movl -0x64(%rbp), %r9d
addl 0x40(%rbp), %r9d
movl -0x68(%rbp), %r10d
addl 0x40(%rbp), %r10d
movl -0x40(%rbp), %eax
leaq 0x29ae9d(%rip), %rsi    # 0x386ded
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x22a0
movq 0x70(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x34(%rbp), %ecx
shrl %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq -0x28(%rbp), %rcx
movq 0x40(%rcx), %rcx
movl -0x34(%rbp), %edx
shrl %edx
movl %edx, %edx
subq (%rcx,%rdx,8), %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x34(%rbp), %esi
shrl %esi
movl %esi, %esi
addq (%rax,%rsi,8), %rcx
leaq 0x29ae51(%rip), %rsi    # 0x386e01
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x98(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0xec091
movq -0x98(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movl -0x4c(%rbp), %edi
movl -0x50(%rbp), %esi
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movl %eax, %edx
movq -0xa0(%rbp), %rax
movl 0x8(%rax), %ecx
subl $0x1, %ecx
leaq -0x5c(%rbp), %r8
leaq -0x60(%rbp), %r9
callq 0x1670e0
cmpl $0x0, %eax
jne 0xec020
jmp 0xec083
movq 0x70(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq -0xa0(%rbp), %rcx
movl 0xc(%rcx), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq -0x28(%rbp), %rcx
movq 0x40(%rcx), %rcx
movq -0xa0(%rbp), %rdx
movl 0xc(%rdx), %edx
subq (%rcx,%rdx,8), %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq -0xa0(%rbp), %rsi
movl 0xc(%rsi), %esi
addq (%rax,%rsi,8), %rcx
leaq 0x29ad84(%rip), %rsi    # 0x386e00
movb $0x0, %al
callq 0x22a0
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0xebfbe
movq 0x70(%rbp), %rdi
leaq 0x29a98c(%rip), %rsi    # 0x386a28
movb $0x0, %al
callq 0x22a0
jmp 0xec178
cmpq $0x0, 0x78(%rbp)
je 0xec176
jmp 0xec0b5
movq 0x78(%rbp), %rax
movq (%rax), %rax
movq 0x78(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0xec126
movq 0x78(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xec0e5
movq 0x78(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xc8(%rbp)
jmp 0xec0f3
movl $0x2, %eax
movq %rax, -0xc8(%rbp)
jmp 0xec0f3
movq -0xc8(%rbp), %rcx
movq 0x78(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x78(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x4, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x78(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl -0x64(%rbp), %eax
addl 0x40(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x90(%rbp), %rax
movq %rcx, (%rax)
movl -0x68(%rbp), %eax
addl 0x40(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x90(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xec178
jmp 0xec17a
addq $0xe8, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)