// File: chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: purge_merge(asg_t*, ma_ug_t*, hap_overlaps_list*, buf_t*, R_to_U*, ma_hit_t_alloc*, ma_sub_t*, asg_t*, unsigned long*, kvec_asg_arc_t_offset*, kvec_t_i32_warp*, kvec_t_i32_warp*, int, int, kvec_asg_arc_t_warp*, unsigned char*, hap_cov_t*)
void purge_merge(asg_t *purge_g, ma_ug_t *ug, hap_overlaps_list* all_ovlp, buf_t* b_0,
R_to_U* ruIndex, ma_hit_t_alloc* reverse_sources, ma_sub_t *coverage_cut, asg_t *read_g, 
uint64_t* position_index, kvec_asg_arc_t_offset* u_buffer, kvec_t_i32_warp* tailIndex, 
kvec_t_i32_warp* prevIndex, int max_hang, int min_ovlp, kvec_asg_arc_t_warp* edge, uint8_t* visit,
hap_cov_t *cov)
{
    uint32_t i, nv, k, v, w, x_beg_index, x_end_index, y_beg_index, y_end_index, cut_beg, cut_end, begIndex, endIndex, keepUid;
    hap_overlaps *x = NULL/**, *y = NULL**/;
    ma_utg_t *xReads = NULL, *yReads = NULL;
    asg_arc_t t_forward, t_backward;
    asg_arc_t *av = NULL;
    kvec_t(uint64_t) buffer;
    uint64_t totalLen;
    int index = 0;
    i = 0;
    while (i < b_0->b.n)
    {
        cut_beg = 0; cut_end = (uint32_t)-1;
        kv_init(buffer);
        /********************for the first node********************/
        v = b_0->b.a[i];
        keepUid = v>>1;
        xReads = &(ug->u.a[v>>1]);
        if(v&1)
        {
            for (k = 0; k < xReads->n; k++)
            {
                kv_push(uint64_t, buffer, (xReads->a[xReads->n - k - 1])^(uint64_t)(0x100000000));
            }
        }
        else
        {
            for (k = 0; k < xReads->n; k++)
            {
                kv_push(uint64_t, buffer, xReads->a[k]);
            }
        }
        cut_beg = 0; cut_end = xReads->n - 1;
        i++;
        /********************for the first node********************/

        
        for (; i < b_0->b.n; i++)
        {
            ///x = y = NULL;
            x = NULL;

            v = b_0->b.a[i-1];
            w = b_0->b.a[i];
            

            index = get_specific_hap_overlap(&(all_ovlp->x[v>>1]), v>>1, w>>1);
            x = &(all_ovlp->x[v>>1].a.a[index]);


        
            xReads = &(ug->u.a[v>>1]);
            yReads = &(ug->u.a[w>>1]);

            begIndex = x->x_beg_id;
            if(cut_beg > begIndex) begIndex = cut_beg;

            endIndex = x->x_end_id-1;
            if(cut_end < endIndex) endIndex = cut_end;

            get_node_boundary_advance(ruIndex, reverse_sources, coverage_cut, read_g, position_index, max_hang, 
            min_ovlp, xReads, yReads, v>>1, w>>1, begIndex, endIndex, x->y_beg_id, x->y_end_id-1, v&1, 
            x->rev, u_buffer, tailIndex, prevIndex, &t_forward, &t_backward);

            if(t_forward.del || t_backward.del) break;
            
            kv_push(asg_arc_t, edge->a, t_forward);
            kv_push(asg_arc_t, edge->a, t_backward);

            x_beg_index = 0; x_end_index = xReads->n - 1;
            y_beg_index = 0; y_end_index = yReads->n - 1;
            
            if((v&1) == 0)
            {
                x_end_index = (uint32_t)position_index[t_forward.ul>>33];
                buffer.n = buffer.n - (cut_end - x_end_index);
            }
            else
            {
                x_beg_index = (uint32_t)position_index[t_forward.ul>>33];
                buffer.n = buffer.n - (x_beg_index - cut_beg);
            }

            if((w&1) == 1)
            {
                y_end_index = (uint32_t)position_index[t_forward.v>>1];
            }
            else
            {
                y_beg_index = (uint32_t)position_index[t_forward.v>>1];
            }

            cut_beg = y_beg_index;
            cut_end = y_end_index;

            if((w&1) == 1)
            {
                for (k = y_end_index; k >= y_beg_index; k--)
                {
                    kv_push(uint64_t, buffer, (yReads->a[k])^(uint64_t)(0x100000000));
                    if(k==0) break;
                }
            }
            else
            {
                for (k = y_beg_index; k <= y_end_index; k++)
                {
                    kv_push(uint64_t, buffer, yReads->a[k]);
                }
            }

            purge_g->seq[w>>1].c = ALTER_LABLE;
            if(cov) collect_trans_purge_joint_cov(cov, ug, x);

            // if(buffer.n > 1)
            // {
            //     for (k = 0; k < buffer.n - 1; k++)
            //     {
            //         if((buffer.a[k]>>32) == 854769 && (buffer.a[k+1]>>32) == 64486)
            //         {
            //             fprintf(stderr, "+++++++v: %u, w: %u, xReads->n: %u, yReads->n: %u\n", 
            //                         v, w, xReads->n, yReads->n);
            //             fprintf(stderr, "x->rev: %u, x->x_beg_id: %u, x->x_end_id: %u, x->y_beg_id: %u, x->y_end_id: %u\n", 
            //                         x->rev, x->x_beg_id, x->x_end_id, x->y_beg_id, x->y_end_id);
            //             fprintf(stderr, "t_forward.ul>>32: %u, t_forward.v: %u, y_beg_index: %u, y_end_index: %u\n", 
            //                         t_forward.ul>>32, t_forward.v, y_beg_index, y_end_index);
            //             fprintf(stderr, "type: %u, x->x_beg_pos: %u, x->x_end_pos: %u, xReads->len: %u\n", 
            //                         x->type, x->x_beg_pos, x->x_end_pos, xReads->len);
            //             fprintf(stderr, "x->y_beg_pos: %u, x->y_end_pos: %u, yReads->len: %u\n", 
            //                         x->y_beg_pos, x->y_end_pos, yReads->len);
            //         }
            //     }
            // }
        }

        // fprintf(stderr, "+keepUid: %u, i: %u, b_0->b.n: %u, buffer.n: %u\n", 
        //                             keepUid, i, (uint32_t)b_0->b.n, (uint32_t)buffer.n);
        fill_unitig(buffer.a, buffer.n, read_g, edge, 0, &totalLen);
        ///fprintf(stderr, "-keepUid: %u\n", keepUid);

        xReads = &(ug->u.a[keepUid]);
        free(xReads->a);
        xReads->a = buffer.a;
        xReads->n = buffer.n;
        xReads->m = buffer.m;
        xReads->len = totalLen;
        xReads->circ = 0;
        if(xReads->start != (xReads->a[0]>>32))
        {
            xReads->start = xReads->a[0]>>32;
            v = (keepUid<<1)+1;
            av = asg_arc_a(ug->g, v);
            nv = asg_arc_n(ug->g, v);
            for (k = 0; k < nv; k++)
            {
                if(av[k].del) continue;
                asg_arc_del(ug->g, av[k].ul>>32, av[k].v, 1);
                asg_arc_del(ug->g, av[k].v^1, av[k].ul>>32^1, 1);
            }
        }
        
        if(xReads->end != ((xReads->a[xReads->n-1]>>32)^1))
        {
            xReads->end = ((xReads->a[xReads->n-1]>>32)^1);
            v = (keepUid<<1);
            av = asg_arc_a(ug->g, v);
            nv = asg_arc_n(ug->g, v);
            for (k = 0; k < nv; k++)
            {
                if(av[k].del) continue;
                asg_arc_del(ug->g, av[k].ul>>32, av[k].v, 1);
                asg_arc_del(ug->g, av[k].v^1, av[k].ul>>32^1, 1);
            }
        }
    }

    for (i = 0; i < b_0->b.n; i++)
    {
        v = b_0->b.a[i];
        visit[v>>1] = 1;
        if(purge_g->seq[v>1].c != ALTER_LABLE) continue;
        asg_seq_drop(purge_g, v>1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movl 0x48(%rbp), %eax
movl 0x40(%rbp), %eax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movq $0x0, -0x98(%rbp)
movq $0x0, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
movq $0x0, -0xe0(%rbp)
movl $0x0, -0x104(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jae 0x17fe67
movl $0x0, -0x80(%rbp)
movl $0xffffffff, -0x84(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0xf0(%rbp)
movq $0x0, -0xf8(%rbp)
movq $0x0, -0xe8(%rbp)
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x5c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
shrl %eax
movl %eax, -0x90(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x68(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movl -0x68(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x17f311
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0xa0(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x17f30c
jmp 0x17f24a
movq -0xf8(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jne 0x17f2b1
cmpq $0x0, -0xf0(%rbp)
je 0x17f277
movq -0xf0(%rbp), %rax
shlq %rax
movq %rax, -0x110(%rbp)
jmp 0x17f285
movl $0x2, %eax
movq %rax, -0x110(%rbp)
jmp 0x17f285
movq -0x110(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xe8(%rbp)
movq -0xa0(%rbp), %rax
movq 0x18(%rax), %rax
movq -0xa0(%rbp), %rcx
movl 0x10(%rcx), %ecx
subl -0x64(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorq (%rax,%rcx,8), %rdx
movq -0xe8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xf8(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x17f2fe
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x17f235
jmp 0x17f3d8
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0xa0(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x17f3d6
jmp 0x17f32d
movq -0xf8(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jne 0x17f394
cmpq $0x0, -0xf0(%rbp)
je 0x17f35a
movq -0xf0(%rbp), %rax
shlq %rax
movq %rax, -0x118(%rbp)
jmp 0x17f368
movl $0x2, %eax
movq %rax, -0x118(%rbp)
jmp 0x17f368
movq -0x118(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xe8(%rbp)
movq -0xa0(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x64(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
movq -0xe8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xf8(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x17f3c8
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x17f318
jmp 0x17f3d8
movl $0x0, -0x80(%rbp)
movq -0xa0(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jae 0x17fab6
movq $0x0, -0x98(%rbp)
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x5c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68(%rbp)
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x5c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x6c(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movl -0x68(%rbp), %eax
shrl %eax
movl %eax, %eax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movl -0x68(%rbp), %esi
shrl %esi
movl -0x6c(%rbp), %edx
shrl %edx
callq 0x17a150
movl %eax, -0x104(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl -0x68(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x104(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x68(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0x98(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x88(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x88(%rbp), %eax
jbe 0x17f4f4
movl -0x80(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0x98(%rbp), %rax
movl 0x18(%rax), %eax
subl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jae 0x17f521
movl -0x84(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movl 0x40(%rbp), %r9d
movl 0x48(%rbp), %eax
movl %eax, -0x154(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x148(%rbp)
movl -0x68(%rbp), %eax
shrl %eax
movl %eax, -0x140(%rbp)
movl -0x6c(%rbp), %eax
shrl %eax
movl %eax, -0x13c(%rbp)
movl -0x88(%rbp), %eax
movq %rax, -0x138(%rbp)
movl -0x8c(%rbp), %eax
movq %rax, -0x130(%rbp)
movq -0x98(%rbp), %rax
movl 0x1c(%rax), %eax
movq %rax, -0x128(%rbp)
movq -0x98(%rbp), %rax
movl 0x20(%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %r13d
movl -0x68(%rbp), %r12d
andl $0x1, %r12d
movq -0x98(%rbp), %rax
movzbl (%rax), %r15d
movq 0x28(%rbp), %r14
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r11
leaq -0xc0(%rbp), %r10
leaq -0xd8(%rbp), %rax
movq %rax, -0x120(%rbp)
movl -0x154(%rbp), %eax
movl %eax, (%rsp)
movq -0x150(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x148(%rbp), %rax
movq %rax, 0x10(%rsp)
movl -0x140(%rbp), %eax
movl %eax, 0x18(%rsp)
movl -0x13c(%rbp), %eax
movl %eax, 0x20(%rsp)
movq -0x138(%rbp), %rax
movq %rax, 0x28(%rsp)
movq -0x130(%rbp), %rax
movq %rax, 0x30(%rsp)
movq -0x128(%rbp), %rax
movq %rax, 0x38(%rsp)
movq -0x120(%rbp), %rax
movq %r13, 0x40(%rsp)
movl %r12d, 0x48(%rsp)
movl %r15d, 0x50(%rsp)
movq %r14, 0x58(%rsp)
movq %rbx, 0x60(%rsp)
movq %r11, 0x68(%rsp)
movq %r10, 0x70(%rsp)
movq %rax, 0x78(%rsp)
callq 0x17da20
movl -0xb4(%rbp), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x17f68e
movl -0xcc(%rbp), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x17f693
jmp 0x17fab6
jmp 0x17f695
movq 0x50(%rbp), %rax
movq (%rax), %rax
movq 0x50(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x17f703
movq 0x50(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x17f6c5
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x160(%rbp)
jmp 0x17f6d3
movl $0x2, %eax
movq %rax, -0x160(%rbp)
jmp 0x17f6d3
movq -0x160(%rbp), %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x50(%rbp), %rax
imulq $0x18, 0x8(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x50(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0xc0(%rbp), %rcx
movq %rcx, (%rax)
movq -0xb8(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xb0(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x17f745
movq 0x50(%rbp), %rax
movq (%rax), %rax
movq 0x50(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x17f7b3
movq 0x50(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x17f775
movq 0x50(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x168(%rbp)
jmp 0x17f783
movl $0x2, %eax
movq %rax, -0x168(%rbp)
jmp 0x17f783
movq -0x168(%rbp), %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x50(%rbp), %rax
imulq $0x18, 0x8(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq 0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x50(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0xd8(%rbp), %rcx
movq %rcx, (%rax)
movq -0xd0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xc8(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl $0x0, -0x70(%rbp)
movq -0xa0(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
movq -0xa8(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x68(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x17f860
movq 0x20(%rbp), %rax
movq -0xc0(%rbp), %rcx
shrq $0x21, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x74(%rbp)
movq -0xf8(%rbp), %rax
movl -0x84(%rbp), %ecx
subl -0x74(%rbp), %ecx
movl %ecx, %ecx
subq %rcx, %rax
movq %rax, -0xf8(%rbp)
jmp 0x17f88f
movq 0x20(%rbp), %rax
movq -0xc0(%rbp), %rcx
shrq $0x21, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x70(%rbp)
movq -0xf8(%rbp), %rax
movl -0x70(%rbp), %ecx
subl -0x80(%rbp), %ecx
movl %ecx, %ecx
subq %rcx, %rax
movq %rax, -0xf8(%rbp)
movl -0x6c(%rbp), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x17f8b1
movq 0x20(%rbp), %rax
movl -0xb8(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x7c(%rbp)
jmp 0x17f8c6
movq 0x20(%rbp), %rax
movl -0xb8(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x6c(%rbp), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x17f9b8
movl -0x7c(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x78(%rbp), %eax
jb 0x17f9b3
jmp 0x17f8f8
movq -0xf8(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jne 0x17f95f
cmpq $0x0, -0xf0(%rbp)
je 0x17f925
movq -0xf0(%rbp), %rax
shlq %rax
movq %rax, -0x170(%rbp)
jmp 0x17f933
movl $0x2, %eax
movq %rax, -0x170(%rbp)
jmp 0x17f933
movq -0x170(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xe8(%rbp)
movq -0xa8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x64(%rbp), %ecx
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorq (%rax,%rcx,8), %rdx
movq -0xe8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xf8(%rbp)
movq %rdx, (%rax,%rcx,8)
cmpl $0x0, -0x64(%rbp)
jne 0x17f9a3
jmp 0x17f9b3
jmp 0x17f9a5
movl -0x64(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x17f8ea
jmp 0x17fa77
movl -0x78(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x7c(%rbp), %eax
ja 0x17fa75
jmp 0x17f9cc
movq -0xf8(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jne 0x17fa33
cmpq $0x0, -0xf0(%rbp)
je 0x17f9f9
movq -0xf0(%rbp), %rax
shlq %rax
movq %rax, -0x178(%rbp)
jmp 0x17fa07
movl $0x2, %eax
movq %rax, -0x178(%rbp)
jmp 0x17fa07
movq -0x178(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0xe8(%rbp)
movq -0xa8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x64(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
movq -0xe8(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xf8(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x17fa67
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x17f9be
jmp 0x17fa77
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x6c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movb $0x1, 0x4(%rax,%rcx,8)
cmpq $0x0, 0x60(%rbp)
je 0x17faa6
movq 0x60(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x98(%rbp), %rdx
callq 0x17ee00
jmp 0x17faa8
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x17f3fb
movq -0xe8(%rbp), %rdi
movq -0xf8(%rbp), %rax
movl %eax, %esi
movq 0x18(%rbp), %rdx
movq 0x50(%rbp), %rcx
xorl %r8d, %r8d
leaq -0x100(%rbp), %r9
callq 0x17e620
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2210
movq -0xe8(%rbp), %rcx
movq -0xa0(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0xf8(%rbp), %rax
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xf0(%rbp), %rax
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x100(%rbp), %rax
movl %eax, %edx
movq -0xa0(%rbp), %rax
movl (%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, (%rax)
movq -0xa0(%rbp), %rax
movl (%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, (%rax)
movq -0xa0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xa0(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
je 0x17fcda
movq -0xa0(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x90(%rbp), %eax
shll %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x28(%rcx), %rcx
movl -0x68(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movl -0x68(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x17fcd8
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x17fc43
jmp 0x17fcca
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %esi
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movl $0x1, %ecx
callq 0x17d8f0
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0x17d8f0
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x17fc16
jmp 0x17fcda
movq -0xa0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xa0(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq -0xa0(%rbp), %rdx
movl 0x10(%rdx), %edx
subl $0x1, %edx
movl %edx, %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
xorq $0x1, %rcx
cmpq %rcx, %rax
je 0x17fe62
movq -0xa0(%rbp), %rax
movq 0x18(%rax), %rax
movq -0xa0(%rbp), %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x90(%rbp), %eax
shll %eax
movl %eax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x28(%rcx), %rcx
movl -0x68(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movl -0x68(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x17fe60
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x17fdcb
jmp 0x17fe52
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %esi
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movl $0x1, %ecx
callq 0x17d8f0
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0xe0(%rbp), %rax
movl -0x64(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0x17d8f0
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x17fd9e
jmp 0x17fe62
jmp 0x17f1a3
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jae 0x17fedc
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x5c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68(%rbp)
movq 0x58(%rbp), %rax
movl -0x68(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movb $0x1, (%rax,%rcx)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0x1, -0x68(%rbp)
seta %cl
andb $0x1, %cl
movzbl %cl, %ecx
movzbl 0x4(%rax,%rcx,8), %eax
cmpl $0x1, %eax
je 0x17febc
jmp 0x17fed1
movq -0x30(%rbp), %rdi
cmpl $0x1, -0x68(%rbp)
seta %al
andb $0x1, %al
movzbl %al, %esi
callq 0x17fef0
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x17fe6e
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop