// File: chhylp123[P]hifiasm/hic.cpp
// Function: get_phase_path(ma_ug_t*, unsigned int, unsigned int, bub_p_t_warp*, H_partition*, unsigned int)
uint64_t get_phase_path(ma_ug_t *ug, uint32_t s, uint32_t d, bub_p_t_warp *b, H_partition* hap, uint32_t max_hap_label)
{
    asg_t *g = ug->g;
    if(g->seq[s>>1].del) return 0; // already deleted
    if(get_real_length(g, s, NULL)<2) return 0;
    uint32_t i, n_pending, is_first, to_replace, cur_nc, cur_uc, cur_ac, n_tips, tip_end, n_pop;
    double cur_nh, cur_w0, cur_w1, cur_rate, max_rate, cur_weight, max_weight;
    ///S saves nodes with all incoming edges visited
    b->S.n = b->T.n = b->b.n = b->e.n = 0;
    ///for each node, b->a saves all related information
    b->a[s].d = b->a[s].nc = b->a[s].ac = b->a[s].uc = 0; b->a[s].nh = b->a[s].w[0] = b->a[s].w[1] = 0;
    ///b->S is the nodes with all incoming edges visited
    kv_push(uint32_t, b->S, s);
    n_pop = n_tips = n_pending = 0;
    tip_end = (uint32_t)-1;
    is_first = 1;

    do {
        ///v is a node that all incoming edges have been visited
        ///d is the distance from v0 to v
        uint32_t v = kv_pop(b->S);
        uint32_t d = b->a[v].d, nc = b->a[v].nc, uc = b->a[v].uc, ac = b->a[v].ac; 
        double nh = b->a[v].nh;
        double nw_0 = b->a[v].w[0], nw_1 = b->a[v].w[1];

        uint32_t nv = asg_arc_n(g, v);
        asg_arc_t *av = asg_arc_a(g, v);
        for (i = 0; i < nv; ++i) {
            uint32_t w = av[i].v, l = (uint32_t)av[i].ul; // v->w with length l, not overlap length
            bub_p_t *t = &b->a[w];
            //got a circle
            if ((w>>1) == (s>>1)) goto pop_reset;
            //important when poping at long untig graph
            if(is_first) l = 0;
            if (av[i].del) continue;
            ///push the edge
            kv_push(uint32_t, b->e, (g->idx[v]>>32) + i);

            if (t->s == 0) 
            { // this vertex has never been visited
                kv_push(uint32_t, b->b, w); // save it for revert
                ///t->p is the parent node of 
                ///t->s = 1 means w has been visited
                ///d is len(v0->v), l is len(v->w), so t->d is len(v0->w)
                t->p = v, t->s = 1, t->d = d + l, t->nc = nc + ug->u.a[(w>>1)].n;
                t->r = get_real_length(g, w^1, NULL);
                /**need fix**/
                t->nh = nh + get_path_weight(w, v, s, b, hap->link);

                get_related_weight(w>>1, hap, &(t->w[0]), &(t->w[1]), &max_hap_label);
                t->w[0] += nw_0; t->w[1] += nw_1; 

                t->ac = ac + ((!is_hap_set_label(w>>1, *hap, max_hap_label))?ug->u.a[(w>>1)].n : 0);
                t->uc = uc + ((is_hap_set_label(w>>1, *hap, max_hap_label))?ug->u.a[(w>>1)].n : 0);
                
                ++n_pending;
            }
            else {
                to_replace = 0;

                cur_nc = nc + ug->u.a[(w>>1)].n;
                /**need fix**/
                cur_nh = nh + get_path_weight(w, v, s, b, hap->link);
                get_related_weight(w>>1, hap, &cur_w0, &cur_w1, &max_hap_label);
                cur_w0 += nw_0; cur_w1 += nw_1;
                cur_weight = cur_nh + MAX(cur_w0, cur_w1) - MIN(cur_w0, cur_w1);
                max_weight = t->nh + MAX(t->w[0], t->w[1]) - MIN(t->w[0], t->w[1]);

                cur_ac = ac + ((!is_hap_set_label(w>>1, *hap, max_hap_label))?ug->u.a[(w>>1)].n : 0);;
                cur_uc = uc + ((is_hap_set_label(w>>1, *hap, max_hap_label))?ug->u.a[(w>>1)].n : 0);
                cur_rate = ((double)(cur_ac)/(double)(cur_ac+cur_uc));
                max_rate = ((double)(t->ac)/(double)(t->ac+t->uc));

                if(cur_rate > max_rate)
                {
                    to_replace = 1;
                }
                else if(cur_rate == max_rate)
                {
                    ///if(cur_nh > t->nh)
                    if(cur_weight > max_weight)
                    {
                        to_replace = 1;
                    }
                    else if(cur_weight == max_weight)///(cur_nh == t->nh)
                    {
                        if(cur_nc > t->nc)
                        {
                            to_replace = 1;
                        }
                        else if(cur_nc == t->nc)
                        {
                            if(d + l > t->d)
                            {
                                to_replace = 1;
                            }
                        }
                    }
                }


                if(to_replace)
                {
                    t->p = v;
                    t->nc = cur_nc;
                    t->nh = cur_nh;
                    t->ac = cur_ac;
                    t->uc = cur_uc;
                    t->w[0] = cur_w0;
                    t->w[1] = cur_w1;
                }


                if (d + l < t->d) t->d = d + l; // update dist
            }

            if (--(t->r) == 0) {
                uint32_t x = get_real_length(g, w, NULL);
                if(x > 0)
                {
                    kv_push(uint32_t, b->S, w);
                }
                else
                {
                    ///at most one tip
                    if(n_tips != 0) goto pop_reset;
                    n_tips++;
                    tip_end = w;
                }
                --n_pending;
            }
        }
        is_first = 0;


        if(n_tips == 1)
        {
            if(tip_end != (uint32_t)-1 && n_pending == 0 && b->S.n == 0)
            {
                ///sink is b.S.a[0]
                kv_push(uint32_t, b->S, tip_end);
                break;
            }
            else
            {
                goto pop_reset;
            }
        }

        if (i < nv || b->S.n == 0) goto pop_reset;
    }while (b->S.n > 1 || n_pending);


    n_pop = 1;
    /**need fix**/
    set_path_hap(b, s, hap, max_hap_label);
    pop_reset:

    for (i = 0; i < b->b.n; ++i) { // clear the states of visited vertices
        bub_p_t *t = &b->a[b->b.a[i]];
        t->p = t->d = t->nc = t->ac = t->uc = t->r = t->s = 0;
        t->nh = t->w[0] = t->w[1] = 0;
    }

    return n_pop;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x1ebda4
movq $0x0, -0x8(%rbp)
jmp 0x1ecdb1
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x2, %eax
jge 0x1ebdc6
movq $0x0, -0x8(%rbp)
jmp 0x1ecdb1
movq -0x20(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x2c(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x1ebf13
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1ebed2
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x100(%rbp)
jmp 0x1ebee0
movl $0x2, %eax
movq %rax, -0x100(%rbp)
jmp 0x1ebee0
movq -0x100(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x8(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x8(%rsi)
movl %edx, (%rax,%rcx,4)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x58(%rbp)
movl $0x0, -0x60(%rbp)
movl $0xffffffff, -0x5c(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x44(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $-0x1, %rsi
movq %rsi, 0x8(%rdx)
movl -0x4(%rax,%rcx,4), %eax
movl %eax, -0x9c(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0xa0(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0xa4(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %eax
movl %eax, -0xa8(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x2c(%rax), %eax
movl %eax, -0xac(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0xb8(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, -0xc0(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x9c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xcc(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x9c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0xcc(%rbp), %eax
jae 0x1ecb94
movq -0xd8(%rbp), %rax
movl -0x3c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0xdc(%rbp)
movq -0xd8(%rbp), %rax
movl -0x3c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0xe0(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0xdc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
movl -0xdc(%rbp), %eax
shrl %eax
movl -0x14(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x1ec112
jmp 0x1eccc3
cmpl $0x0, -0x44(%rbp)
je 0x1ec122
movl $0x0, -0xe0(%rbp)
movq -0xd8(%rbp), %rax
movl -0x3c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x1ec143
jmp 0x1ecb86
jmp 0x1ec145
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0x1ec1b7
movq -0x20(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x1ec176
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rax
shlq %rax
movq %rax, -0x108(%rbp)
jmp 0x1ec184
movl $0x2, %eax
movq %rax, -0x108(%rbp)
jmp 0x1ec184
movq -0x108(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x9c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl -0x3c(%rbp), %ecx
addq %rcx, %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x50(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x50(%rsi)
movl %edx, (%rax,%rcx,4)
movq -0xe8(%rbp), %rax
movl 0x30(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x1ec55e
jmp 0x1ec20b
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jne 0x1ec27d
movq -0x20(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x1ec23c
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
shlq %rax
movq %rax, -0x110(%rbp)
jmp 0x1ec24a
movl $0x2, %eax
movq %rax, -0x110(%rbp)
jmp 0x1ec24a
movq -0x110(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0xdc(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x38(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x38(%rsi)
movl %edx, (%rax,%rcx,4)
movl -0x9c(%rbp), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, (%rax)
movq -0xe8(%rbp), %rax
movl 0x30(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x30(%rax)
movl -0xa0(%rbp), %ecx
addl -0xe0(%rbp), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0xa4(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %edx
shrl %edx
movl %edx, %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
addl 0x10(%rax), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rdi
movl -0xdc(%rbp), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
movl %eax, %edx
movq -0xe8(%rbp), %rax
movl 0x30(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0x30(%rax)
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x120(%rbp)
movl -0xdc(%rbp), %edi
movl -0x9c(%rbp), %esi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq 0x30(%rax), %r8
callq 0x1eb8a0
movaps %xmm0, %xmm1
movsd -0x120(%rbp), %xmm0
addsd %xmm1, %xmm0
movq -0xe8(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movl -0xdc(%rbp), %edi
shrl %edi
movq -0x28(%rbp), %rsi
movq -0xe8(%rbp), %rdx
addq $0x18, %rdx
movq -0xe8(%rbp), %rcx
addq $0x18, %rcx
addq $0x8, %rcx
leaq -0x2c(%rbp), %r8
callq 0x1eb960
movsd -0xc0(%rbp), %xmm0
movq -0xe8(%rbp), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movsd -0xc8(%rbp), %xmm0
movq -0xe8(%rbp), %rax
addsd 0x20(%rax), %xmm0
movsd %xmm0, 0x20(%rax)
movl -0xac(%rbp), %eax
movl %eax, -0x114(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x28(%rbp), %rdx
orl 0x1c(%rdx), %ecx
movq -0x28(%rbp), %rdx
orl 0x20(%rdx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x1ec457
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movl 0x2c(%rcx), %ecx
shrl %cl, %eax
movl -0x2c(%rbp), %edx
movq -0x28(%rbp), %rcx
movl 0x2c(%rcx), %ecx
shrl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
je 0x1ec47b
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x124(%rbp)
jmp 0x1ec485
xorl %eax, %eax
movl %eax, -0x124(%rbp)
jmp 0x1ec485
movl -0x114(%rbp), %ecx
movl -0x124(%rbp), %eax
addl %eax, %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x2c(%rax)
movl -0xa8(%rbp), %eax
movl %eax, -0x128(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x28(%rbp), %rdx
orl 0x1c(%rdx), %ecx
movq -0x28(%rbp), %rdx
orl 0x20(%rdx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x1ec52e
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movl 0x2c(%rcx), %ecx
shrl %cl, %eax
movl -0x2c(%rbp), %edx
movq -0x28(%rbp), %rcx
movl 0x2c(%rcx), %ecx
shrl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jne 0x1ec52e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x12c(%rbp)
jmp 0x1ec538
xorl %eax, %eax
movl %eax, -0x12c(%rbp)
jmp 0x1ec538
movl -0x128(%rbp), %ecx
movl -0x12c(%rbp), %eax
addl %eax, %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x1eca70
movl $0x0, -0x48(%rbp)
movl -0xa4(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0xdc(%rbp), %edx
shrl %edx
movl %edx, %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
addl 0x10(%rcx), %eax
movl %eax, -0x4c(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x140(%rbp)
movl -0xdc(%rbp), %edi
movl -0x9c(%rbp), %esi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq 0x30(%rax), %r8
callq 0x1eb8a0
movaps %xmm0, %xmm1
movsd -0x140(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0xdc(%rbp), %edi
shrl %edi
movq -0x28(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0x78(%rbp), %rcx
leaq -0x2c(%rbp), %r8
callq 0x1eb960
movsd -0xc0(%rbp), %xmm0
addsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0xc8(%rbp), %xmm0
addsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x138(%rbp)
movsd -0x70(%rbp), %xmm0
ucomisd -0x78(%rbp), %xmm0
jb 0x1ec637
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x148(%rbp)
jmp 0x1ec644
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x148(%rbp)
movsd -0x138(%rbp), %xmm0
movsd -0x148(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x150(%rbp)
movsd -0x70(%rbp), %xmm1
movsd -0x78(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x1ec67f
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
jmp 0x1ec68c
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
movsd -0x150(%rbp), %xmm0
movsd -0x158(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0xe8(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x160(%rbp)
movq -0xe8(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0xe8(%rbp), %rax
ucomisd 0x20(%rax), %xmm0
jb 0x1ec6ec
movq -0xe8(%rbp), %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, -0x168(%rbp)
jmp 0x1ec700
movq -0xe8(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x168(%rbp)
movsd -0x160(%rbp), %xmm0
movsd -0x168(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x170(%rbp)
movq -0xe8(%rbp), %rax
movsd 0x18(%rax), %xmm1
movq -0xe8(%rbp), %rax
movsd 0x20(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x1ec750
movq -0xe8(%rbp), %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, -0x178(%rbp)
jmp 0x1ec764
movq -0xe8(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x178(%rbp)
movsd -0x170(%rbp), %xmm0
movsd -0x178(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0x17c(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x28(%rbp), %rdx
orl 0x1c(%rdx), %ecx
movq -0x28(%rbp), %rdx
orl 0x20(%rdx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x1ec7ed
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movl 0x2c(%rcx), %ecx
shrl %cl, %eax
movl -0x2c(%rbp), %edx
movq -0x28(%rbp), %rcx
movl 0x2c(%rcx), %ecx
shrl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
je 0x1ec811
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x180(%rbp)
jmp 0x1ec81b
xorl %eax, %eax
movl %eax, -0x180(%rbp)
jmp 0x1ec81b
movl -0x17c(%rbp), %eax
movl -0x180(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x54(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x184(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x28(%rbp), %rdx
orl 0x1c(%rdx), %ecx
movq -0x28(%rbp), %rdx
orl 0x20(%rdx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x1ec8bd
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movl 0x2c(%rcx), %ecx
shrl %cl, %eax
movl -0x2c(%rbp), %edx
movq -0x28(%rbp), %rcx
movl 0x2c(%rcx), %ecx
shrl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jne 0x1ec8bd
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x188(%rbp)
jmp 0x1ec8c7
xorl %eax, %eax
movl %eax, -0x188(%rbp)
jmp 0x1ec8c7
movl -0x184(%rbp), %eax
movl -0x188(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x50(%rbp)
movl -0x54(%rbp), %eax
movl %eax, %ecx
movl %ecx, %eax
cvtsi2sd %rcx, %xmm0
movl -0x50(%rbp), %ecx
addl %ecx, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0xe8(%rbp), %rax
movl 0x28(%rax), %ecx
movl 0x2c(%rax), %eax
movl %eax, %edx
movl %edx, %eax
cvtsi2sd %rdx, %xmm0
addl %ecx, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x80(%rbp), %xmm0
ucomisd -0x88(%rbp), %xmm0
jbe 0x1ec93b
movl $0x1, -0x48(%rbp)
jmp 0x1ec9d1
movsd -0x80(%rbp), %xmm0
ucomisd -0x88(%rbp), %xmm0
jne 0x1ec9cf
jp 0x1ec9cf
movsd -0x90(%rbp), %xmm0
ucomisd -0x98(%rbp), %xmm0
jbe 0x1ec96b
movl $0x1, -0x48(%rbp)
jmp 0x1ec9cd
movsd -0x90(%rbp), %xmm0
ucomisd -0x98(%rbp), %xmm0
jne 0x1ec9cb
jp 0x1ec9cb
movl -0x4c(%rbp), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jbe 0x1ec997
movl $0x1, -0x48(%rbp)
jmp 0x1ec9c9
movl -0x4c(%rbp), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x1ec9c7
movl -0xa0(%rbp), %eax
addl -0xe0(%rbp), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x1ec9c5
movl $0x1, -0x48(%rbp)
jmp 0x1ec9c7
jmp 0x1ec9c9
jmp 0x1ec9cb
jmp 0x1ec9cd
jmp 0x1ec9cf
jmp 0x1ec9d1
cmpl $0x0, -0x48(%rbp)
je 0x1eca40
movl -0x9c(%rbp), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, (%rax)
movl -0x4c(%rbp), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x8(%rax)
movsd -0x68(%rbp), %xmm0
movq -0xe8(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movl -0x54(%rbp), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x2c(%rax)
movl -0x50(%rbp), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x28(%rax)
movsd -0x70(%rbp), %xmm0
movq -0xe8(%rbp), %rax
movsd %xmm0, 0x18(%rax)
movsd -0x78(%rbp), %xmm0
movq -0xe8(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movl -0xa0(%rbp), %eax
addl -0xe0(%rbp), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x1eca6e
movl -0xa0(%rbp), %ecx
addl -0xe0(%rbp), %ecx
movq -0xe8(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x1eca70
movq -0xe8(%rbp), %rcx
movl 0x30(%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl $-0x1, %eax
movl 0x30(%rcx), %edx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %eax, %edx
movl %edx, 0x30(%rcx)
cmpl $0x0, %eax
jne 0x1ecb84
movq -0x38(%rbp), %rdi
movl -0xdc(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
movl %eax, -0xec(%rbp)
cmpl $0x0, -0xec(%rbp)
jbe 0x1ecb5e
jmp 0x1ecac6
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x1ecb38
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1ecaf7
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x190(%rbp)
jmp 0x1ecb05
movl $0x2, %eax
movq %rax, -0x190(%rbp)
jmp 0x1ecb05
movq -0x190(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0xdc(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x8(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x8(%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x1ecb7b
cmpl $0x0, -0x58(%rbp)
je 0x1ecb69
jmp 0x1eccc3
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
movl -0xdc(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x1ecb86
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x1ec09e
movl $0x0, -0x44(%rbp)
cmpl $0x1, -0x58(%rbp)
jne 0x1ecc61
cmpl $-0x1, -0x5c(%rbp)
je 0x1ecc5f
cmpl $0x0, -0x40(%rbp)
jne 0x1ecc5f
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1ecc5f
jmp 0x1ecbca
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x1ecc3c
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1ecbfb
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x198(%rbp)
jmp 0x1ecc09
movl $0x2, %eax
movq %rax, -0x198(%rbp)
jmp 0x1ecc09
movq -0x198(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x5c(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rsi
movq 0x8(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x8(%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x1ecca9
jmp 0x1eccc3
movl -0x3c(%rbp), %eax
cmpl -0xcc(%rbp), %eax
jb 0x1ecc77
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1ecc79
jmp 0x1eccc3
jmp 0x1ecc7b
movq -0x20(%rbp), %rcx
movb $0x1, %al
cmpq $0x1, 0x8(%rcx)
movb %al, -0x199(%rbp)
ja 0x1ecc9b
cmpl $0x0, -0x40(%rbp)
setne %al
movb %al, -0x199(%rbp)
movb -0x199(%rbp), %al
testb $0x1, %al
jne 0x1ebf57
movl $0x1, -0x60(%rbp)
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %ecx
callq 0x1ebb80
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jae 0x1ecdaa
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x48(%rcx), %rcx
movl -0x3c(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movl 0x30(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x30(%rax)
movq -0xf8(%rbp), %rax
movl 0x30(%rax), %ecx
andl $0x80000000, %ecx       # imm = 0x80000000
orl $0x0, %ecx
movl %ecx, 0x30(%rax)
movq -0xf8(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0xf8(%rbp), %rax
movl $0x0, 0x2c(%rax)
movq -0xf8(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0xf8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0xf8(%rbp), %rax
movl $0x0, (%rax)
movq -0xf8(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rax)
movq -0xf8(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rax)
movq -0xf8(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x1eccca
movl -0x60(%rbp), %eax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nop