// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: resolve_tangles(ma_ug_t*, asg_t*, ma_hit_t_alloc*, long long, long long, float, float, R_to_U*, unsigned char*, unsigned int, float)
void resolve_tangles(ma_ug_t *src, asg_t *read_g, ma_hit_t_alloc* reverse_sources, long long minLongUntig, 
long long maxShortUntig, float l_untig_rate, float max_node_threshold, R_to_U* ruIndex, uint8_t* is_r_het, 
uint32_t trio_flag, float drop_ratio)
{
    buf_t b_0, b_1;
    memset(&b_0, 0, sizeof(buf_t));
    memset(&b_1, 0, sizeof(buf_t));
    uint32_t i, v, w, sv, n_vtx, beg, end, next_uID = (uint32_t)-1;
    kvec_t_u32_warp u_vecs;
    kv_init(u_vecs.a);

    kvec_t_u64_warp e_vecs;
    kv_init(e_vecs.a);

    ///note: we must reset start for each unitig
    n_vtx = src->g->n_seq;
    for (v = 0; v < n_vtx; ++v) 
    {
        if(src->g->seq[v].del) continue;
        if(src->u.a[v].m==0) continue;
        EvaluateLen(src->u, v) = src->u.a[v].n;
    }

    ma_ug_t *ug = NULL;
    ug = copy_untig_graph(src);

    asg_t* nsg = ug->g;
    n_vtx = nsg->n_seq;
    for (v = 0; v < n_vtx; ++v) 
    {
        ///nsg->seq[v].c = PRIMARY_LABLE;
        EvaluateLen(ug->u, v) = ug->u.a[v].n;
        IsMerge(ug->u, v) = 0;
    }

    uint8_t* visit = NULL;
    visit = (uint8_t*)malloc(sizeof(uint8_t) * nsg->n_seq);
    uint32_t n_reduce, flag, dbg_round = 0;
    n_vtx = nsg->n_seq * 2;
    while (1)
    {
        n_reduce = 0;
        for (v = 0; v < n_vtx; ++v) 
        {
            //as for return value: 0: do nothing, 1: unroll, 2: convex
            //we just need 1
            sv = v;
            flag = 0;
            while (1)
            {
                flag = walk_through(read_g, ug, reverse_sources, minLongUntig, 
                    maxShortUntig, l_untig_rate, max_node_threshold, &b_0, &b_1, 
                    &u_vecs, visit, sv, &beg, &end, &next_uID, ruIndex, is_r_het);
                n_reduce += flag;
                if(flag != UNROLL_M)
                {
                    break;
                }
            }
        }
        if(n_reduce == 0) break;
        dbg_round++;
    }
    asg_cleanup(nsg);
	asg_symm(nsg);

    uint32_t uId, rId, is_Unitig, m, pre;
    ma_utg_t* nsu = NULL;
    for (v = 0; v < src->g->n_seq; v++)
    {
        uId = v;
        nsu = &(src->u.a[v]);
        if(nsu->m == 0) continue;
        if(src->g->seq[v].del) continue;
        for (i = 0; i < nsu->n; i++)
        {
            rId = nsu->a[i]>>33;
            ///ori = nsu->a[k]>>32&1;
            set_R_to_U(ruIndex, rId, uId, 1, &(read_g->seq[rId].c));
        }
    }

    n_vtx = nsg->n_seq;
    for (v = 0; v < n_vtx; ++v) 
    {
        if(nsg->seq[v].del) continue;
        nsu = &(ug->u.a[v]);
        m = 0;
        pre = (uint32_t)(-1);
        for (i = 0; i < nsu->n; i++)
        {
            rId = nsu->a[i]>>33;
            get_R_to_U(ruIndex, rId, &uId, &is_Unitig);
            if(is_Unitig != 1 || uId == ((uint32_t)(-1))) continue;
            if(i > 0 && pre == uId) continue;
            pre = uId;
            nsu->a[m] = uId;
            m++;
        }
        nsu->n = m;
    }
    n_vtx = nsg->n_seq;
    for (i = 0; i < n_vtx; ++i) 
    {
        v = i;
        nsu = &(ug->u.a[v]);
        if(nsg->seq[v].del) continue;
        if(IsMerge(ug->u, v) == 0) continue;
        if(nsg->seq[v].c == ALTER_LABLE) continue;

        v = v<<1;
        if(get_real_length(nsg, v, NULL) != 1) continue;
        get_real_length(nsg, v, &w);
        if(get_real_length(nsg, w^1, NULL) != 1) continue;
        if(IsMerge(ug->u, w>>1) != 0) continue;
        beg = w^1;


        v = v^1;
        if(get_real_length(nsg, v, NULL) != 1) continue;
        get_real_length(nsg, v, &w);
        if(get_real_length(nsg, w^1, NULL) != 1) continue;
        if(IsMerge(ug->u, w>>1) != 0) continue;
        end = w;
        ///we have three types of merged nodes
        ///1) CONVEX_M: one direction has two out-nodes, another direction has one out-node
        ///2) UNROLL_E: one direction has one out-node, another direction doesn't has out-node
        ///3) UNROLL_M: both directions have one out-node
        ///here we just need UNROLL_M
        ///beg and end must be unchanged in src
        unroll_tangle(src, ug, nsu->a, nsu->n, beg, end, &e_vecs, trio_flag, &b_0, visit, drop_ratio);
    }

    for (v = 0; v < ruIndex->len; v++)
    {
        get_R_to_U(ruIndex, v, &uId, &is_Unitig);
        if(is_Unitig == 1) ruIndex->index[v] = (uint32_t)-1;
    }
    kv_destroy(u_vecs.a);
    kv_destroy(e_vecs.a);
    
    ma_ug_destroy(ug);
    free(visit);
    free(b_0.b.a);
    free(b_1.b.a);


    ///note: we must reset start for each unitig
    n_vtx = src->g->n_seq;
    for (v = 0; v < n_vtx; ++v) 
    {
        if(src->g->seq[v].del) continue;
        if(src->u.a[v].m==0) continue;
        EvaluateLen(src->u, v) = src->u.a[v].n;
    }
    ///print_untig_by_read(src, "m64076_200203_181219/82511682/ccs", 2429597, NULL, NULL, "end-1");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movss %xmm0, -0x54(%rbp)
movss %xmm1, -0x58(%rbp)
movq %r9, -0x60(%rbp)
movss %xmm2, -0x64(%rbp)
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x2100
leaq -0x138(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x2100
movl $0xffffffff, -0x158(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x170(%rbp)
movq $0x0, -0x178(%rbp)
movq $0x0, -0x168(%rbp)
movq $0x0, -0x190(%rbp)
movq $0x0, -0x198(%rbp)
movq $0x0, -0x188(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x14c(%rbp)
movl $0x0, -0x140(%rbp)
movl -0x140(%rbp), %eax
cmpl -0x14c(%rbp), %eax
jae 0x11ce06
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl -0x140(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11cda5
jmp 0x11cdf2
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
jne 0x11cdc2
jmp 0x11cdf2
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x140(%rbp)
jmp 0x11cd74
movq $0x0, -0x1a0(%rbp)
movq -0x30(%rbp), %rdi
callq 0x10ba70
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x14c(%rbp)
movl $0x0, -0x140(%rbp)
movl -0x140(%rbp), %eax
cmpl -0x14c(%rbp), %eax
jae 0x11cec6
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x140(%rbp)
jmp 0x11ce52
movq $0x0, -0x1b0(%rbp)
movq -0x1a8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edi
shlq $0x0, %rdi
callq 0x2270
movq %rax, -0x1b0(%rbp)
movl $0x0, -0x1bc(%rbp)
movq -0x1a8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x14c(%rbp)
movl $0x0, -0x1b4(%rbp)
movl $0x0, -0x140(%rbp)
movl -0x140(%rbp), %eax
cmpl -0x14c(%rbp), %eax
jae 0x11d02f
movl -0x140(%rbp), %eax
movl %eax, -0x148(%rbp)
movl $0x0, -0x1b8(%rbp)
movq -0x38(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x50(%rbp), %r8
movss -0x54(%rbp), %xmm0
movss -0x58(%rbp), %xmm1
movq -0x1b0(%rbp), %r12
movl -0x148(%rbp), %r15d
movq -0x60(%rbp), %r10
movq 0x10(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0xd0(%rbp), %r9
leaq -0x138(%rbp), %rax
leaq -0x178(%rbp), %r13
leaq -0x150(%rbp), %r14
leaq -0x154(%rbp), %rbx
leaq -0x158(%rbp), %r11
movq %rax, (%rsp)
movq -0x1e0(%rbp), %rax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movl %r15d, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x168d60
movl %eax, -0x1b8(%rbp)
movl -0x1b8(%rbp), %eax
addl -0x1b4(%rbp), %eax
movl %eax, -0x1b4(%rbp)
cmpl $0x2, -0x1b8(%rbp)
je 0x11d014
jmp 0x11d019
jmp 0x11cf51
jmp 0x11d01b
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x140(%rbp)
jmp 0x11cf29
cmpl $0x0, -0x1b4(%rbp)
jne 0x11d03a
jmp 0x11d04e
movl -0x1bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1bc(%rbp)
jmp 0x11cf15
movq -0x1a8(%rbp), %rdi
callq 0xcdd10
movq -0x1a8(%rbp), %rdi
callq 0xce020
movq $0x0, -0x1d8(%rbp)
movl $0x0, -0x140(%rbp)
movl -0x140(%rbp), %eax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x11d18b
movl -0x140(%rbp), %eax
movl %eax, -0x1c0(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x11d0d4
jmp 0x11d177
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl -0x140(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11d0f6
jmp 0x11d177
movl $0x0, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
movq -0x1d8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x11d175
movq -0x1d8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x13c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x1c4(%rbp)
movq -0x60(%rbp), %rdi
movl -0x1c4(%rbp), %esi
movl -0x1c0(%rbp), %edx
movq -0x38(%rbp), %rax
movq 0x20(%rax), %r8
movl -0x1c4(%rbp), %eax
shlq $0x3, %rax
addq %rax, %r8
addq $0x4, %r8
movl $0x1, %ecx
callq 0xd0e20
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x11d100
jmp 0x11d177
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x140(%rbp)
jmp 0x11d07b
movq -0x1a8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x14c(%rbp)
movl $0x0, -0x140(%rbp)
movl -0x140(%rbp), %eax
cmpl -0x14c(%rbp), %eax
jae 0x11d309
movq -0x1a8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x140(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11d1dd
jmp 0x11d2f5
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x1d8(%rbp)
movl $0x0, -0x1cc(%rbp)
movl $0xffffffff, -0x1d0(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
movq -0x1d8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x11d2e5
movq -0x1d8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x13c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x1c4(%rbp)
movq -0x60(%rbp), %rdi
movl -0x1c4(%rbp), %esi
leaq -0x1c0(%rbp), %rdx
leaq -0x1c8(%rbp), %rcx
callq 0xd3d50
cmpl $0x1, -0x1c8(%rbp)
jne 0x11d27e
cmpl $-0x1, -0x1c0(%rbp)
jne 0x11d280
jmp 0x11d2d1
cmpl $0x0, -0x13c(%rbp)
jbe 0x11d299
movl -0x1d0(%rbp), %eax
cmpl -0x1c0(%rbp), %eax
jne 0x11d299
jmp 0x11d2d1
movl -0x1c0(%rbp), %eax
movl %eax, -0x1d0(%rbp)
movl -0x1c0(%rbp), %eax
movl %eax, %edx
movq -0x1d8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1cc(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x1cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1cc(%rbp)
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x11d21a
movl -0x1cc(%rbp), %ecx
movq -0x1d8(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x140(%rbp)
jmp 0x11d1aa
movq -0x1a8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x14c(%rbp)
movl $0x0, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
cmpl -0x14c(%rbp), %eax
jae 0x11d57e
movl -0x13c(%rbp), %eax
movl %eax, -0x140(%rbp)
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x1d8(%rbp)
movq -0x1a8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x140(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11d386
jmp 0x11d56a
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x8(%rax)
jne 0x11d3a9
jmp 0x11d56a
movq -0x1a8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x140(%rbp), %ecx
movzbl 0x4(%rax,%rcx,8), %eax
cmpl $0x1, %eax
jne 0x11d3c9
jmp 0x11d56a
movl -0x140(%rbp), %eax
shll %eax
movl %eax, -0x140(%rbp)
movq -0x1a8(%rbp), %rdi
movl -0x140(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
je 0x11d3f7
jmp 0x11d56a
movq -0x1a8(%rbp), %rdi
movl -0x140(%rbp), %esi
leaq -0x144(%rbp), %rdx
callq 0x166b50
movq -0x1a8(%rbp), %rdi
movl -0x144(%rbp), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
je 0x11d433
jmp 0x11d56a
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x144(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x8(%rax)
je 0x11d45a
jmp 0x11d56a
movl -0x144(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x150(%rbp)
movl -0x140(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x140(%rbp)
movq -0x1a8(%rbp), %rdi
movl -0x140(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
je 0x11d498
jmp 0x11d56a
movq -0x1a8(%rbp), %rdi
movl -0x140(%rbp), %esi
leaq -0x144(%rbp), %rdx
callq 0x166b50
movq -0x1a8(%rbp), %rdi
movl -0x144(%rbp), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
je 0x11d4d4
jmp 0x11d56a
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x144(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x8(%rax)
je 0x11d4f8
jmp 0x11d56a
movl -0x144(%rbp), %eax
movl %eax, -0x154(%rbp)
movq -0x30(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0x1d8(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x1d8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %ecx
movl -0x150(%rbp), %r8d
movl -0x154(%rbp), %r9d
movl 0x18(%rbp), %r11d
movq -0x1b0(%rbp), %rax
movss -0x64(%rbp), %xmm0
leaq -0x198(%rbp), %rbx
leaq -0xd0(%rbp), %r10
movq %rbx, (%rsp)
movl %r11d, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x148f70
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x11d328
movl $0x0, -0x140(%rbp)
movl -0x140(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x11d5e5
movq -0x60(%rbp), %rdi
movl -0x140(%rbp), %esi
leaq -0x1c0(%rbp), %rdx
leaq -0x1c8(%rbp), %rcx
callq 0xd3d50
cmpl $0x1, -0x1c8(%rbp)
jne 0x11d5d2
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x140(%rbp), %ecx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
jmp 0x11d5d4
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x140(%rbp)
jmp 0x11d588
movq -0x168(%rbp), %rdi
callq 0x2210
movq -0x188(%rbp), %rdi
callq 0x2210
movq -0x1a0(%rbp), %rdi
callq 0xcd6f0
movq -0x1b0(%rbp), %rdi
callq 0x2210
movq -0x88(%rbp), %rdi
callq 0x2210
movq -0xf0(%rbp), %rdi
callq 0x2210
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x14c(%rbp)
movl $0x0, -0x140(%rbp)
movl -0x140(%rbp), %eax
cmpl -0x14c(%rbp), %eax
jae 0x11d6df
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl -0x140(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11d67e
jmp 0x11d6cb
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
jne 0x11d69b
jmp 0x11d6cb
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x140(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x140(%rbp)
jmp 0x11d64d
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)