// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/graph.c
// Function: asmg_unitigging
asmg_t *asmg_unitigging(asmg_t *g)
{
    uint64_t i, j, k, n_vtx, n_arc, n_arc1, v, w, n, m, *vtx_p;
    asmg_arc_t *arc, *arc1;
    asmg_vtx_t *vtx, *vtx1;
    uint8_t *vtx_visited;
    asmg_t *utg_asmg;
    kvec_t(asmg_vtx_t) utgs = {0, 0, 0};
    kvec_t(asmg_arc_t) arcs = {0, 0, 0};
    vtx = g->vtx;
    n_vtx = g->n_vtx;
    MYCALLOC(vtx_visited, n_vtx);

    /* first visit for all untigs connected to a junction */
    for (i = 0; i < n_vtx; ++i) {
        if (vtx[i].del || !is_junction(g, i))
            continue;
        for (k = 0; k < 2; ++k) {
            v = i << 1 | k;
            n_arc = asmg_arc_n(g, v);
            n_arc1 = asmg_arc_n1(g, v);
            arc = asmg_arc_a(g, v);
            for (j = 0; j < n_arc; ++j) {
                if (arc[j].del)
                    continue;
                kvec_t(uint64_t) vec = {0, 0, 0};
                if (!vtx_visited[v>>1] && n_arc1 == 1)
                    kv_push(uint64_t, vec, v); /* add to utg vec */
                v = asmg_arc_tail(arc[j]);
                /* v can be the start point of a unitig */
                while (!vtx_visited[v>>1] && asmg_arc_n1(g, v^1) == 1) {
                    kv_push(uint64_t, vec, v);
                    vtx_visited[v>>1] = 1;
                    if (asmg_arc_n1(g, v) == 1) /* at most one outgoing edge */
                        v = asmg_arc_a1(g, v)->w;
                    else
                        break;
                }
                if (vec.n > 1) {
                    kv_pushp(asmg_vtx_t, utgs, &vtx1);
                    vtx1->n = vec.n;
                    vtx1->a = vec.a;
                    vtx1->seq = 0;
                    vtx1->len = 0;
                    vtx1->cov = vtx1->del = vtx1->circ = 0;
                    MYREALLOC(vtx1->a, vtx1->n);
                } else {
                    kv_destroy(vec);
                }
            }
        }
        vtx_visited[i] = 1;
    }

    /* second visit to get linear path */
    /* TODO */
    /* consider this special case as linear */
    /* v(-)->v(+) v(+)->w(+) w(+)->w(-) */
    for (i = 0; i < n_vtx; ++i) {
        if (vtx[i].del || vtx_visited[i] ||
                (asmg_arc_n1(g, i << 1) > 0 &&
                 asmg_arc_n1(g, i << 1 | 1) > 0))
            continue;
        v = asmg_arc_n1(g, i << 1) > 0? i << 1 : i << 1 | 1;
        kvec_t(uint64_t) vec = {0, 0, 0};
        kv_push(uint64_t, vec, v);
        vtx_visited[v>>1] = 1;
        while (asmg_arc_n1(g, v) == 1) { /* should always be 1 */
            v = asmg_arc_a1(g, v)->w;
            if (!vtx_visited[v>>1])
                kv_push(uint64_t, vec, v);
            else
                break;
            vtx_visited[v>>1] = 1;
        }
        if (vec.n > 1) {
            kv_pushp(asmg_vtx_t, utgs, &vtx1);
            vtx1->n = vec.n;
            vtx1->a = vec.a;
            vtx1->seq = 0;
            vtx1->len = 0;
            vtx1->cov = vtx1->del = vtx1->circ = 0;
            MYREALLOC(vtx1->a, vtx1->n);
        } else {
            kv_destroy(vec);
        }
    }

    /* last visit for the remaining unvisited non-juntions on circles */
    for (i = 0; i < n_vtx; ++i) {
        if (vtx[i].del || vtx_visited[i]) continue;
        v = i << 1; /* either direction would work */
        kvec_t(uint64_t) vec = {0, 0, 0};
        kv_push(uint64_t, vec, v);
        vtx_visited[v>>1] = 1;
        while (asmg_arc_n1(g, v) > 0) {
            v = asmg_arc_a1(g, v)->w;
            if (!vtx_visited[v>>1])
                kv_push(uint64_t, vec, v);
            else
                break;
            vtx_visited[v>>1] = 1;
        }
        if (vec.n > 1) {
            kv_pushp(asmg_vtx_t, utgs, &vtx1);
            vtx1->n = vec.n;
            vtx1->a = vec.a;
            vtx1->seq = 0;
            vtx1->len = 0;
            vtx1->cov = vtx1->del = 0;
            vtx1->circ = 1;
            MYREALLOC(vtx1->a, vtx1->n);
        } else {
            kv_destroy(vec);
        }
    }
    free(vtx_visited);

    /* singleton: UINT64_MAX; start: u << 1 | 0; end: u << 1 | 1; mid: UINT64_MAX - 1 */
    MYMALLOC(vtx_p, n_vtx);
    MYBONE(vtx_p, n_vtx);
    for (i = 0; i < utgs.n; ++i) {
        vtx1 = &utgs.a[i];
        vtx_p[vtx1->a[0]>>1] = i << 1;
        vtx_p[vtx1->a[vtx1->n-1]>>1] = i << 1 | 1;
        for (j = 1; j < vtx1->n-1; ++j) { /* vtx1->n > 1 */
            vtx_p[vtx1->a[j]>>1] = UINT64_MAX - 1;
            asmg_arc_del(g, vtx1->a[j-1], vtx1->a[j], 1);
            asmg_arc_del(g, vtx1->a[j]^1, vtx1->a[j-1]^1, 1);
        }
        asmg_arc_del(g, vtx1->a[vtx1->n-2], vtx1->a[vtx1->n-1], 1);
        asmg_arc_del(g, vtx1->a[vtx1->n-1]^1, vtx1->a[vtx1->n-2]^1, 1);
    }
    
    /* add singletons to utg set */
    for (i = 0; i < n_vtx; ++i) {
        if (vtx_p[i] == UINT64_MAX && !vtx[i].del) {
            vtx_p[i] = utgs.n << 1; /*update index*/
            kv_pushp(asmg_vtx_t, utgs, &vtx1);
            v = i << 1;
            vtx1->n = 1;
            MYMALLOC(vtx1->a, 1);
            vtx1->a[0] = v;
            vtx1->seq = 0;
            vtx1->len = 0;
            vtx1->cov = vtx1->del = 0;
            vtx1->circ = asmg_arc_exist1(g, v, v);
        }
    }

    /* add arcs */
    for (i = 0, n_arc = g->n_arc; i < n_arc; ++i) {
        arc = &g->arc[i];
        if (arc->del) continue;
        v = vtx_p[arc->v>>1];
        w = vtx_p[arc->w>>1];
        if (v == UINT64_MAX - 1 || w == UINT64_MAX - 1) continue;
        kv_pushp(asmg_arc_t, arcs, &arc1);
        arc1->v = utgs.a[v>>1].n>1? v^1 : v|(arc->v&1);
        arc1->w = utgs.a[w>>1].n>1?  w  : w|(arc->w&1);
        arc1->ln = arc->ln;
        arc1->ls = arc->ls;
        arc1->link_id = arc->link_id;
        arc1->cov = arc->cov;
        arc1->del = 0;
        arc1->comp = arc->comp;
    }
    free(vtx_p);

    /* expand utgs */
    for (i = 0, n = utgs.n; i < n; ++i) {
        vtx_p = utgs.a[i].a;
        m = utgs.a[i].n;
        u64_v_t v_vec = {0, 0, 0};
        for (j = 0; j < m; ++j) {
            if (j > 0)
                v_vec.n -= asmg_arc(g, vtx_p[j-1], vtx_p[j])->ln;
            vtx1 = &vtx[vtx_p[j]>>1];
            vec_add(&v_vec, vtx1->a, vtx1->n, !!(vtx_p[j]&1));
        }
        vtx1 = &utgs.a[i];
        free(vtx1->a);
        vtx1->n = v_vec.n;
        vtx1->a = v_vec.a;
        vtx1->cov = 0; // need to redo alignment and coverage estimation
        MYREALLOC(vtx1->a, vtx1->n);
    }

    /* finalize */
    MYCALLOC(utg_asmg, 1);
    utg_asmg->n_vtx = utgs.n;
    utg_asmg->m_vtx = utgs.m;
    utg_asmg->vtx = utgs.a;
    utg_asmg->n_arc = arcs.n;
    utg_asmg->m_arc = arcs.m;
    utg_asmg->arc = arcs.a;

    asmg_finalize(utg_asmg, 1);

    return utg_asmg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
movq (%rdi), %rbx
movq 0x10(%rdi), %rax
movq %rax, 0x40(%rsp)
movl $0x1, %esi
movq %rbx, %rdi
callq 0x2250
movq %rax, %r10
movq %rbx, 0x28(%rsp)
testq %rbx, %rbx
movq %r14, 0x20(%rsp)
movq %rax, 0x10(%rsp)
je 0x17412
movq $0x0, (%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r11d, %r11d
leaq (%r11,%r11,4), %rax
movq 0x40(%rsp), %rcx
testb $0x40, 0x23(%rcx,%rax,8)
jne 0x17402
leaq (%r11,%r11), %r15
movq 0x28(%r14), %rax
movq 0x30(%r14), %rcx
movq %r11, %rdi
shlq $0x4, %rdi
movq 0x38(%r14), %rdx
movq (%rdx,%rdi), %rsi
testq %rsi, %rsi
je 0x170b5
movq (%rcx,%rdi), %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
addq %rax, %rdi
addq $0x20, %rdi
movq %rsi, %r8
movl (%rdi), %r9d
addl %r9d, %r9d
sarl $0x1f, %r9d
movslq %r9d, %r9
addq %r9, %r8
addq $0x30, %rdi
decq %rsi
jne 0x17096
cmpq $0x1, %r8
ja 0x170fa
movq 0x8(%rdx,%r15,8), %rdx
testq %rdx, %rdx
je 0x17402
movq 0x8(%rcx,%r15,8), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
addq $0x20, %rax
movq %rdx, %rcx
movl (%rax), %esi
addl %esi, %esi
sarl $0x1f, %esi
movslq %esi, %rsi
addq %rsi, %rcx
addq $0x30, %rax
decq %rdx
jne 0x170da
cmpq $0x2, %rcx
jb 0x17402
movq %r11, 0x58(%rsp)
xorl %ebx, %ebx
movq %r15, 0x38(%rsp)
movq %rbx, 0x60(%rsp)
orq %r15, %rbx
movq 0x38(%r14), %rax
movq (%rax,%rbx,8), %r8
movq 0x28(%r14), %rdx
movq 0x30(%r14), %rax
movq (%rax,%rbx,8), %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
testq %r8, %r8
je 0x17166
movq %rdx, %r9
leaq (%rdx,%rax), %rcx
addq $0x20, %rcx
movq %r8, %rsi
movq %r8, %rdx
movl (%rcx), %edi
addl %edi, %edi
sarl $0x1f, %edi
movslq %edi, %rdi
addq %rdi, %rdx
addq $0x30, %rcx
decq %rsi
jne 0x17140
cmpq $0x1, %rdx
sete %cl
movl %ecx, 0x50(%rsp)
movq %r9, %rdx
jmp 0x1716e
movl $0x0, 0x50(%rsp)
testq %r8, %r8
je 0x173e1
addq %rax, %rdx
xorl %r15d, %r15d
movq %rdx, 0x30(%rsp)
movq %r8, 0x48(%rsp)
leaq (%r15,%r15,2), %r12
shlq $0x4, %r12
testb $0x40, 0x23(%rdx,%r12)
jne 0x173d5
movq %rbx, %rax
shrq %rax
cmpb $0x0, (%r10,%rax)
sete %cl
andb 0x50(%rsp), %cl
movl $0x0, %r13d
movl $0x0, %eax
movl $0x0, %ebp
cmpb $0x1, %cl
jne 0x171e7
movl $0x10, %edi
callq 0x2320
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %r10
movq %rax, %rbp
movq %rbx, (%rax)
movl $0x2, %eax
movl $0x1, %r13d
addq %rdx, %r12
movq 0x8(%r12), %rbx
movq %rbx, %r12
shrq %r12
cmpb $0x0, (%r10,%r12)
je 0x17251
cmpq $0x2, %r13
jb 0x17244
movq 0x18(%rsp), %rax
cmpq %rax, 0x8(%rsp)
jne 0x17379
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rax
leaq (%rax,%rax,4), %rsi
movq (%rsp), %rdi
callq 0x2360
movq %rax, %r12
movq %r14, 0x18(%rsp)
jmp 0x1737d
movq %rbp, %rdi
callq 0x2060
jmp 0x173c6
addq %r10, %r12
leaq (,%rbx,8), %rdx
xorq $0x8, %rdx
movq 0x38(%r14), %rcx
movq (%rcx,%rdx), %rcx
testq %rcx, %rcx
je 0x171fc
movq 0x28(%r14), %rsi
movq 0x30(%r14), %rdi
movq (%rdi,%rdx), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq %rsi, %rdx
addq $0x20, %rdx
movq %rcx, %rsi
movl (%rdx), %edi
addl %edi, %edi
sarl $0x1f, %edi
movslq %edi, %rdi
addq %rdi, %rsi
addq $0x30, %rdx
decq %rcx
jne 0x1728b
cmpq $0x1, %rsi
jne 0x171fc
cmpq %rax, %r13
jne 0x172e0
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq %rbp, %rdi
callq 0x2360
movq 0x10(%rsp), %r10
movq %rax, %rbp
movq %r14, %rax
movq 0x20(%rsp), %r14
movq %rbx, (%rbp,%r13,8)
incq %r13
movb $0x1, (%r12)
movq 0x38(%r14), %rcx
movq (%rcx,%rbx,8), %rdx
testq %rdx, %rdx
je 0x171fc
movq 0x28(%r14), %rsi
movq 0x30(%r14), %rcx
movq (%rcx,%rbx,8), %rcx
leaq (%rcx,%rcx,2), %rdi
shlq $0x4, %rdi
leaq (%rsi,%rdi), %rcx
addq %rdi, %rsi
addq $0x20, %rsi
movq %rdx, %rdi
movl (%rsi), %r8d
addl %r8d, %r8d
sarl $0x1f, %r8d
movslq %r8d, %r8
addq %r8, %rdi
addq $0x30, %rsi
decq %rdx
jne 0x17320
cmpq $0x1, %rdi
jne 0x171fc
testb $0x40, 0x23(%rcx)
jne 0x1734e
movq %rcx, %rdx
jmp 0x1735b
leaq 0x30(%rcx), %rdx
testb $0x40, 0x53(%rcx)
movq %rdx, %rcx
jne 0x1734e
movq 0x8(%rdx), %rbx
movq %rbx, %rcx
shrq %rcx
leaq (%r10,%rcx), %r12
cmpb $0x0, (%r10,%rcx)
je 0x17254
jmp 0x171fc
movq (%rsp), %r12
movq 0x8(%rsp), %rax
leaq (%rax,%rax,4), %r14
incq %rax
movq %rax, 0x8(%rsp)
movq %r13, (%r12,%r14,8)
movq %rbp, 0x8(%r12,%r14,8)
shlq $0x3, %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12,%r14,8)
movl $0x0, 0x20(%r12,%r14,8)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2360
movq %r12, (%rsp)
movq %rax, 0x8(%r12,%r14,8)
movq 0x20(%rsp), %r14
movq 0x10(%rsp), %r10
movq 0x48(%rsp), %r8
movq 0x30(%rsp), %rdx
incq %r15
cmpq %r8, %r15
jne 0x17187
movq 0x60(%rsp), %rcx
leaq 0x1(%rcx), %rbx
testq %rcx, %rcx
movq 0x38(%rsp), %r15
je 0x17106
movq 0x58(%rsp), %r11
movb $0x1, (%r10,%r11)
incq %r11
cmpq 0x28(%rsp), %r11
jne 0x1704c
jmp 0x1742c
movq $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, (%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x17731
xorl %r15d, %r15d
leaq (%r15,%r15,4), %rax
movq 0x40(%rsp), %rcx
testb $0x40, 0x23(%rcx,%rax,8)
jne 0x176c3
cmpb $0x0, (%r10,%r15)
movq 0x18(%rsp), %rax
jne 0x176c8
movq %r14, %rbx
leaq (%r15,%r15), %r14
movq %r15, %rcx
shlq $0x4, %rcx
movq 0x38(%rbx), %rsi
movq (%rsi,%rcx), %rax
movl $0x1, %r13d
movl $0x1, %edi
testq %rax, %rax
je 0x1754f
movq 0x28(%rbx), %rdx
movq 0x30(%rbx), %rdi
movq (%rdi,%rcx), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %rdx, %rcx
addq $0x20, %rcx
movq %rcx, %r8
movq %rax, %r10
movq %rax, %r9
movl (%r8), %r11d
addl %r11d, %r11d
sarl $0x1f, %r11d
movslq %r11d, %r11
addq %r11, %r9
addq $0x30, %r8
decq %r10
jne 0x174ad
testq %r9, %r9
movq 0x10(%rsp), %r10
je 0x17519
movq 0x8(%rsi,%r14,8), %rsi
testq %rsi, %rsi
je 0x17519
movq 0x8(%rdi,%r14,8), %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
addq %rdi, %rdx
addq $0x20, %rdx
movq %rsi, %rdi
movl (%rdx), %r8d
addl %r8d, %r8d
sarl $0x1f, %r8d
movslq %r8d, %r8
addq %r8, %rdi
addq $0x30, %rdx
decq %rsi
jne 0x174f1
testq %rdi, %rdi
je 0x17519
movq 0x20(%rsp), %r14
jmp 0x176c3
movl $0x1, %edi
testq %rax, %rax
movq 0x20(%rsp), %rbx
je 0x1754f
movq %rax, %rdx
movl (%rcx), %esi
addl %esi, %esi
sarl $0x1f, %esi
movslq %esi, %rsi
addq %rsi, %rdx
addq $0x30, %rcx
decq %rax
jne 0x1752b
xorl %edi, %edi
testq %rdx, %rdx
sete %dil
movq 0x20(%rsp), %rbx
orq %rdi, %r14
movl $0x10, %edi
callq 0x2320
movq 0x10(%rsp), %r9
movq %rax, %rbp
movq %r14, (%rax)
movq %r15, %rax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
andq %rcx, %rax
movb $0x1, (%r9,%rax)
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdx
testq %rdx, %rdx
je 0x1766b
movq 0x30(%rbx), %rax
movq (%rax,%r14,8), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
addq 0x28(%rbx), %rcx
movl $0x1, %r13d
movl $0x2, %eax
movq %rbx, %r14
leaq 0x20(%rcx), %rsi
movq %rdx, %rdi
movl (%rsi), %r8d
addl %r8d, %r8d
sarl $0x1f, %r8d
movslq %r8d, %r8
addq %r8, %rdi
addq $0x30, %rsi
decq %rdx
jne 0x175b6
cmpq $0x1, %rdi
jne 0x17675
testb $0x40, 0x23(%rcx)
jne 0x175e4
movq %rcx, %rdx
jmp 0x175f1
leaq 0x30(%rcx), %rdx
testb $0x40, 0x53(%rcx)
movq %rdx, %rcx
jne 0x175e4
movq 0x8(%rdx), %rbx
movq %rbx, %r14
shrq %r14
cmpb $0x0, (%r9,%r14)
jne 0x17670
cmpq %rax, %r13
jne 0x17632
leaq (%rax,%rax), %r12
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq %rbp, %rdi
callq 0x2360
movq 0x10(%rsp), %r9
movq %rax, %rbp
movq %r12, %rax
movq %rbx, (%rbp,%r13,8)
incq %r13
movb $0x1, (%r9,%r14)
movq 0x20(%rsp), %r14
movq 0x30(%r14), %rcx
movq 0x38(%r14), %rdx
movq (%rcx,%rbx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq 0x28(%r14), %rcx
movq (%rdx,%rbx,8), %rdx
testq %rdx, %rdx
jne 0x175af
jmp 0x17675
movq %rbx, %r14
jmp 0x17675
movq 0x20(%rsp), %r14
cmpq $0x2, %r13
jb 0x176b6
movq 0x18(%rsp), %rax
cmpq %rax, 0x8(%rsp)
jne 0x176dd
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,4), %rsi
movq (%rsp), %rdi
callq 0x2360
movq %rax, %r12
movq %rbx, 0x18(%rsp)
jmp 0x176e1
movq %rbp, %rdi
callq 0x2060
movq 0x10(%rsp), %r10
movq 0x18(%rsp), %rax
movq %rax, 0x18(%rsp)
incq %r15
cmpq 0x28(%rsp), %r15
jne 0x1743b
jmp 0x17731
movq (%rsp), %r12
movq 0x8(%rsp), %rax
leaq (%rax,%rax,4), %rbx
incq %rax
movq %rax, 0x8(%rsp)
movq %r13, (%r12,%rbx,8)
movq %rbp, 0x8(%r12,%rbx,8)
shlq $0x3, %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12,%rbx,8)
movl $0x0, 0x20(%r12,%rbx,8)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2360
movq %r12, (%rsp)
movq %rax, 0x8(%r12,%rbx,8)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %r10
jmp 0x176c8
cmpq $0x0, 0x28(%rsp)
je 0x1792e
xorl %r14d, %r14d
leaq (%r14,%r14,4), %rax
movq 0x40(%rsp), %rcx
testb $0x40, 0x23(%rcx,%rax,8)
jne 0x17920
cmpb $0x0, (%r10,%r14)
jne 0x17920
leaq (%r14,%r14), %rbx
movl $0x10, %edi
callq 0x2320
movq 0x10(%rsp), %r9
movq %rax, %r13
movq %rbx, (%rax)
movq %r14, %rax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
andq %rcx, %rax
movb $0x1, (%r9,%rax)
movq 0x20(%rsp), %rsi
movq 0x38(%rsi), %rax
movq %r14, %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rdx
testq %rdx, %rdx
je 0x17883
movq 0x30(%rsi), %rax
movq (%rax,%rbx,8), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
addq 0x28(%rsi), %rcx
movl $0x1, %ebp
movl $0x2, %eax
leaq 0x20(%rcx), %rsi
movq %rdx, %rdi
movl (%rsi), %r8d
addl %r8d, %r8d
sarl $0x1f, %r8d
movslq %r8d, %r8
addq %r8, %rdi
addq $0x30, %rsi
decq %rdx
jne 0x177cf
testq %rdi, %rdi
je 0x17888
testb $0x40, 0x23(%rcx)
jne 0x177fc
movq %rcx, %rdx
jmp 0x17809
leaq 0x30(%rcx), %rdx
testb $0x40, 0x53(%rcx)
movq %rdx, %rcx
jne 0x177fc
movq 0x8(%rdx), %rbx
movq %rbx, %r12
shrq %r12
cmpb $0x0, (%r9,%r12)
jne 0x17888
cmpq %rax, %rbp
jne 0x1784a
leaq (%rax,%rax), %r15
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r13, %rdi
callq 0x2360
movq 0x10(%rsp), %r9
movq %rax, %r13
movq %r15, %rax
movq %rbx, (%r13,%rbp,8)
incq %rbp
movb $0x1, (%r9,%r12)
movq 0x20(%rsp), %rsi
movq 0x30(%rsi), %rcx
movq 0x38(%rsi), %rdx
movq (%rcx,%rbx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq 0x28(%rsi), %rcx
movq (%rdx,%rbx,8), %rdx
testq %rdx, %rdx
jne 0x177c8
jmp 0x17888
movl $0x1, %ebp
cmpq $0x2, %rbp
jb 0x178c9
movq 0x18(%rsp), %rax
cmpq %rax, 0x8(%rsp)
jne 0x178d3
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,4), %rsi
movq (%rsp), %rdi
callq 0x2360
movq %rax, %r15
movq %rbx, 0x18(%rsp)
jmp 0x178d7
movq %r13, %rdi
callq 0x2060
jmp 0x1791b
movq (%rsp), %r15
movq 0x8(%rsp), %rax
leaq (%rax,%rax,4), %rbx
incq %rax
movq %rax, 0x8(%rsp)
movq %rbp, (%r15,%rbx,8)
movq %r13, 0x8(%r15,%rbx,8)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15,%rbx,8)
movl $0x80000000, 0x20(%r15,%rbx,8) # imm = 0x80000000
shlq $0x3, %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2360
movq %r15, (%rsp)
movq %rax, 0x8(%r15,%rbx,8)
movq 0x10(%rsp), %r10
incq %r14
cmpq 0x28(%rsp), %r14
jne 0x17740
movq %r10, %rdi
callq 0x2060
movq 0x28(%rsp), %rax
leaq (,%rax,8), %r13
movq %r13, %rdi
callq 0x2320
movq %rax, %r12
movq %rax, %rdi
movl $0xff, %esi
movq %r13, %rdx
callq 0x21e0
cmpq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %r11
movq (%rsp), %rbx
je 0x17b2a
xorl %eax, %eax
leaq (%rax,%rax,4), %rcx
leaq (%rbx,%rcx,8), %rcx
leaq (%rax,%rax), %rdx
movq 0x8(%rcx), %rsi
movq (%rsi), %rdi
andq $-0x2, %rdi
movq %rdx, (%r12,%rdi,4)
leaq 0x1(,%rax,2), %rdx
movq (%rcx), %rdi
movq -0x8(%rsi,%rdi,8), %rsi
andq $-0x2, %rsi
movq %rdx, (%r12,%rsi,4)
movq (%rcx), %rdi
leaq -0x1(%rdi), %rsi
cmpq $0x2, %rsi
jb 0x17a7d
movl $0x1, %edx
movq 0x8(%rcx), %rdi
movq (%rdi,%rdx,8), %rsi
movq %rsi, %r8
andq $-0x2, %r8
movq $-0x2, (%r12,%r8,4)
movq -0x8(%rdi,%rdx,8), %r8
movq 0x38(%r11), %rdi
movq (%rdi,%r8,8), %rdi
testq %rdi, %rdi
je 0x17a16
movq 0x28(%r11), %r9
movq 0x30(%r11), %r10
movq (%r10,%r8,8), %r8
leaq (%r8,%r8,2), %r8
shlq $0x4, %r8
addq %r9, %r8
addq $0x20, %r8
cmpq %rsi, -0x18(%r8)
jne 0x17a0d
orb $0x40, 0x3(%r8)
addq $0x30, %r8
decq %rdi
jne 0x17a02
movq 0x8(%rcx), %rdi
movq (%rdi,%rdx,8), %r8
xorq $0x1, %r8
movq 0x38(%r11), %rsi
movq (%rsi,%r8,8), %rsi
testq %rsi, %rsi
je 0x17a6a
movq -0x8(%rdi,%rdx,8), %rdi
movq 0x28(%r11), %r9
movq 0x30(%r11), %r10
movq (%r10,%r8,8), %r8
leaq (%r8,%r8,2), %r8
shlq $0x4, %r8
addq %r9, %r8
addq $0x20, %r8
movq -0x18(%r8), %r9
xorq %rdi, %r9
cmpq $0x1, %r9
jne 0x17a61
orb $0x40, 0x3(%r8)
addq $0x30, %r8
decq %rsi
jne 0x17a4f
incq %rdx
movq (%rcx), %rdi
leaq -0x1(%rdi), %rsi
cmpq %rsi, %rdx
jb 0x179be
movq 0x8(%rcx), %r8
movq -0x10(%r8,%rdi,8), %rdi
movq 0x38(%r11), %rdx
movq (%rdx,%rdi,8), %rdx
testq %rdx, %rdx
je 0x17ac5
movq (%r8,%rsi,8), %rsi
movq 0x28(%r11), %r8
movq 0x30(%r11), %r9
movq (%r9,%rdi,8), %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
addq %r8, %rdi
addq $0x20, %rdi
cmpq %rsi, -0x18(%rdi)
jne 0x17abc
orb $0x40, 0x3(%rdi)
addq $0x30, %rdi
decq %rdx
jne 0x17ab2
movq (%rcx), %rdx
movq 0x8(%rcx), %rdi
movq -0x8(%rdi,%rdx,8), %rsi
xorq $0x1, %rsi
movq 0x38(%r11), %rcx
movq (%rcx,%rsi,8), %rcx
testq %rcx, %rcx
je 0x17b1c
movq -0x10(%rdi,%rdx,8), %rdx
movq 0x28(%r11), %rdi
movq 0x30(%r11), %r8
movq (%r8,%rsi,8), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
addq %rdi, %rsi
addq $0x20, %rsi
movq -0x18(%rsi), %rdi
xorq %rdx, %rdi
cmpq $0x1, %rdi
jne 0x17b13
orb $0x40, 0x3(%rsi)
addq $0x30, %rsi
decq %rcx
jne 0x17b02
incq %rax
cmpq 0x8(%rsp), %rax
jne 0x17975
cmpq $0x0, 0x28(%rsp)
je 0x17c4f
xorl %r14d, %r14d
movl $0x2, %r15d
cmpq $-0x1, (%r12,%r14,8)
jne 0x17c41
leaq (%r14,%r14,4), %rax
movq 0x40(%rsp), %rcx
testb $0x40, 0x23(%rcx,%rax,8)
jne 0x17c41
movq 0x8(%rsp), %rcx
leaq (%rcx,%rcx), %rax
movq %rax, (%r12,%r14,8)
movq 0x18(%rsp), %rax
cmpq %rax, %rcx
jne 0x17b9f
leaq (%rax,%rax), %rbx
testq %rax, %rax
cmoveq %r15, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,4), %rsi
movq (%rsp), %rdi
callq 0x2360
movq %rax, %rbp
movq %rbx, 0x18(%rsp)
jmp 0x17ba3
movq (%rsp), %rbp
movq 0x8(%rsp), %rax
leaq (%rax,%rax,4), %rbx
leaq (%r14,%r14), %r13
movq $0x1, (%rbp,%rbx,8)
movl $0x8, %edi
callq 0x2320
movq %rax, 0x8(%rbp,%rbx,8)
movq %r13, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbp,%rbx,8)
movq %rbp, (%rsp)
andl $0x80000000, 0x20(%rbp,%rbx,8) # imm = 0x80000000
movq %r14, %rdx
shlq $0x4, %rdx
movq 0x20(%rsp), %rdi
movq 0x38(%rdi), %rax
movq (%rax,%rdx), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x17c31
movq 0x28(%rdi), %rsi
movq 0x30(%rdi), %rdi
movq (%rdi,%rdx), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq %rsi, %rdx
addq $0x20, %rdx
cmpq %r13, -0x18(%rdx)
jne 0x17c21
testb $0x40, 0x3(%rdx)
je 0x17c2c
addq $0x30, %rdx
decq %rcx
jne 0x17c15
jmp 0x17c31
movl $0x80000000, %eax       # imm = 0x80000000
incq 0x8(%rsp)
movq (%rsp), %rcx
leaq (%rcx,%rbx,8), %rcx
movl %eax, 0x20(%rcx)
incq %r14
cmpq 0x28(%rsp), %r14
jne 0x17b3f
movq 0x20(%rsp), %rax
movq 0x18(%rax), %r14
testq %r14, %r14
je 0x17dad
movl $0x28, %r15d
xorl %edi, %edi
movl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
movl $0x80000000, %r10d      # imm = 0x80000000
xorl %r8d, %r8d
xorl %esi, %esi
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rbp
testb $0x40, -0x5(%rbp,%r15)
jne 0x17d9e
movq -0x28(%rbp,%r15), %rax
andq $-0x2, %rax
movq (%r12,%rax,4), %r13
cmpq $-0x2, %r13
je 0x17d9e
movq -0x20(%rbp,%r15), %rax
andq $-0x2, %rax
movq (%r12,%rax,4), %r11
cmpq $-0x2, %r11
je 0x17d9e
cmpq %r8, %rsi
jne 0x17d08
leaq (%r8,%r8), %rbx
testq %r8, %r8
movl $0x2, %eax
cmoveq %rax, %rbx
movq %rbx, %rax
shlq $0x4, %rax
movq %rsi, 0x38(%rsp)
leaq (%rax,%rax,2), %rsi
movq %r11, 0x10(%rsp)
callq 0x2360
movq 0x10(%rsp), %r11
movl $0x80000000, %r10d      # imm = 0x80000000
movl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
movq 0x38(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %r8
movq %r13, %rax
shrq %rax
leaq (%rax,%rax,4), %rax
movq (%rsp), %rcx
cmpq $0x2, (%rcx,%rax,8)
jb 0x17d23
xorq $0x1, %r13
jmp 0x17d2e
movq -0x28(%rbp,%r15), %rax
andl $0x1, %eax
orq %rax, %r13
leaq (%rsi,%rsi,2), %rax
shlq $0x4, %rax
addq %rdi, %rax
movq %r13, (%rax)
movq %r11, %rcx
shrq %rcx
leaq (%rcx,%rcx,4), %rcx
movq (%rsp), %rdx
cmpq $0x1, (%rdx,%rcx,8)
ja 0x17d5c
movq -0x20(%rbp,%r15), %rcx
andl $0x1, %ecx
orq %rcx, %r11
incq %rsi
movq %r11, 0x8(%rax)
movq -0x18(%rbp,%r15), %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp,%r15), %rcx
movq %rcx, 0x18(%rax)
movq (%rbp,%r15), %rcx
movq %rcx, 0x28(%rax)
movl -0x8(%rbp,%r15), %ecx
andl %r9d, %ecx
movl 0x20(%rax), %edx
andl %r10d, %edx
orl %ecx, %edx
movl %edx, 0x20(%rax)
movl -0x8(%rbp,%r15), %edx
andl %r10d, %edx
orl %ecx, %edx
movl %edx, 0x20(%rax)
addq $0x30, %r15
decq %r14
jne 0x17c7a
jmp 0x17db4
xorl %esi, %esi
xorl %r8d, %r8d
xorl %edi, %edi
movq %r8, 0x58(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, 0x28(%rsp)
movq %r12, %rdi
callq 0x2060
cmpq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %r14
movq (%rsp), %r15
je 0x17f81
xorl %eax, %eax
movq %rax, 0x48(%rsp)
leaq (%rax,%rax,4), %rax
movq (%r15,%rax,8), %rcx
movq %rcx, 0x50(%rsp)
testq %rcx, %rcx
movq %rax, 0x60(%rsp)
je 0x17f31
movq 0x8(%r15,%rax,8), %rax
movq %rax, 0x30(%rsp)
xorl %r8d, %r8d
xorl %r13d, %r13d
xorl %eax, %eax
xorl %r12d, %r12d
testq %r8, %r8
je 0x17e5f
movq 0x30(%rsp), %rcx
movq -0x8(%rcx,%r8,8), %rdx
movq (%rcx,%r8,8), %rcx
movq 0x28(%r14), %rsi
movq 0x30(%r14), %rdi
movq (%rdi,%rdx,8), %rdx
leaq (%rdx,%rdx,2), %rdi
shlq $0x4, %rdi
leaq (%rsi,%rdi), %rdx
cmpq %rcx, 0x8(%rsi,%rdi)
jne 0x17e4e
movq %rdx, %rsi
jmp 0x17e5b
leaq 0x30(%rdx), %rsi
cmpq %rcx, 0x38(%rdx)
movq %rsi, %rdx
jne 0x17e4e
subq 0x10(%rsi), %r12
movq 0x30(%rsp), %rcx
movq (%rcx,%r8,8), %rcx
movq %rcx, %rdx
shrq %rdx
leaq (%rdx,%rdx,4), %rdx
movq 0x40(%rsp), %rsi
movq (%rsi,%rdx,8), %r14
movq 0x8(%rsi,%rdx,8), %rbp
testb $0x1, %cl
movq %r8, 0x10(%rsp)
jne 0x17eeb
testq %r14, %r14
je 0x17ed1
xorl %ebx, %ebx
cmpq %rax, %r12
jne 0x17ebc
leaq (%rax,%rax), %r15
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r13, %rdi
callq 0x2360
movq %rax, %r13
movq %r15, %rax
movq (%rbp,%rbx,8), %rcx
movq %rcx, (%r13,%r12,8)
incq %r12
incq %rbx
cmpq %rbx, %r14
jne 0x17e91
movq 0x10(%rsp), %r8
incq %r8
cmpq 0x50(%rsp), %r8
movq 0x20(%rsp), %r14
jne 0x17e17
jmp 0x17f37
testq %r14, %r14
je 0x17ed1
cmpq %rax, %r12
jne 0x17f1b
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq %r13, %rdi
callq 0x2360
movq %rax, %r13
movq %rbx, %rax
decq %r14
movq (%rbp,%r14,8), %rcx
xorq $0x1, %rcx
movq %rcx, (%r13,%r12,8)
incq %r12
jmp 0x17eeb
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%rsp), %r15
movq 0x60(%rsp), %rax
leaq (%r15,%rax,8), %rbx
movq 0x8(%rbx), %rdi
callq 0x2060
movq %r12, (%rbx)
movq %r13, 0x8(%rbx)
andl $0xc0000000, 0x20(%rbx) # imm = 0xC0000000
shlq $0x3, %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x2360
movq %rax, 0x8(%rbx)
movq 0x48(%rsp), %rax
incq %rax
cmpq 0x8(%rsp), %rax
jne 0x17de2
movl $0x1, %edi
movl $0x40, %esi
callq 0x2250
movq %rax, %rbx
movq 0x8(%rsp), %rax
movq %rax, (%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rbx)
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rbx)
movq 0x28(%rsp), %rax
movq %rax, 0x28(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x15237
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq