// File: /workspace/github_c_makefile_star2_O3/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 $0x78, %rsp
movq %rdi, %r14
movq (%rdi), %rbx
movq 0x10(%rdi), %rax
movq %rax, 0x48(%rsp)
movl $0x1, %esi
movq %rbx, %rdi
callq 0x2250
movq %rax, %r13
movq %rbx, 0x38(%rsp)
testq %rbx, %rbx
movq %r14, 0x18(%rsp)
je 0x1842c
xorl %ebx, %ebx
xorl %eax, %eax
movq $0x0, 0x10(%rsp)
xorl %r10d, %r10d
movq %r13, 0x28(%rsp)
movq %rax, 0x20(%rsp)
leaq (%r10,%r10,4), %rax
movq 0x48(%rsp), %rcx
testb $0x40, 0x23(%rcx,%rax,8)
jne 0x17f2e
leaq (%r10,%r10), %r11
movq 0x28(%r14), %rax
movq 0x30(%r14), %rcx
movq %r10, %rdi
shlq $0x4, %rdi
movq 0x38(%r14), %rdx
movq (%rdx,%rdi), %rsi
testq %rsi, %rsi
je 0x17bdd
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 0x17bbe
cmpq $0x1, %r8
ja 0x17c22
movq 0x8(%rdx,%r11,8), %rdx
testq %rdx, %rdx
je 0x17f2e
movq 0x8(%rcx,%r11,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 0x17c02
cmpq $0x2, %rcx
jb 0x17f2e
movq %r11, 0x60(%rsp)
movq %r10, 0x40(%rsp)
movb $0x1, %al
movl %eax, 0x50(%rsp)
xorl %r15d, %r15d
orq 0x60(%rsp), %r15
movq 0x38(%r14), %rax
movq (%rax,%r15,8), %rsi
testq %rsi, %rsi
movq %rbx, 0x8(%rsp)
je 0x17f00
movq 0x28(%r14), %rax
movq 0x30(%r14), %rcx
movq (%rcx,%r15,8), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdi
addq %rcx, %rax
addq $0x20, %rax
movq %rsi, %rcx
movq %rsi, %r14
movl (%rax), %edx
addl %edx, %edx
sarl $0x1f, %edx
movslq %edx, %rdx
addq %rdx, %r14
addq $0x30, %rax
decq %rcx
jne 0x17c75
xorl %ebx, %ebx
movq %rsi, 0x58(%rsp)
movq %rdi, 0x30(%rsp)
leaq (%rbx,%rbx,2), %r12
shlq $0x4, %r12
testb $0x40, 0x23(%rdi,%r12)
jne 0x17ea0
movq %r15, %rax
shrq %rax
cmpb $0x0, (%r13,%rax)
jne 0x17cf0
movl $0x0, %ebp
movl $0x0, %eax
movl $0x0, %r11d
cmpq $0x1, %r14
jne 0x17cf7
movl $0x10, %edi
callq 0x2310
movq 0x30(%rsp), %rdi
movq %rax, %r11
movq %r15, (%rax)
movl $0x2, %eax
movl $0x1, %ebp
jmp 0x17cf7
xorl %ebp, %ebp
xorl %eax, %eax
xorl %r11d, %r11d
addq %rdi, %r12
movq 0x8(%r12), %r15
movq %r15, %r12
shrq %r12
cmpb $0x0, (%r13,%r12)
jne 0x17e8e
addq %r13, %r12
movq 0x18(%rsp), %rsi
movq 0x28(%rsi), %rcx
movq 0x30(%rsi), %rdx
movq 0x38(%rsi), %rsi
leaq (,%r15,8), %r8
xorq $0x8, %r8
movq (%rsi,%r8), %rdi
testq %rdi, %rdi
je 0x17e46
movq (%rdx,%r8), %r8
leaq (%r8,%r8,2), %r8
shlq $0x4, %r8
addq %rcx, %r8
addq $0x20, %r8
movq %rdi, %r9
movl (%r8), %r10d
addl %r10d, %r10d
sarl $0x1f, %r10d
movslq %r10d, %r10
addq %r10, %r9
addq $0x30, %r8
decq %rdi
jne 0x17d54
cmpq $0x1, %r9
jne 0x17e46
cmpq %rax, %rbp
jne 0x17db8
leaq (%rax,%rax), %r13
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r13
leaq (,%r13,8), %rsi
movq %r11, %rdi
callq 0x2350
movq %rax, %r11
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rcx
movq 0x30(%rax), %rdx
movq 0x38(%rax), %rsi
movq %r13, %rax
movq 0x28(%rsp), %r13
movq %r15, (%r11,%rbp,8)
incq %rbp
movb $0x1, (%r12)
movq (%rsi,%r15,8), %r8
testq %r8, %r8
je 0x17e46
movq %r11, %r12
movq (%rdx,%r15,8), %rdi
leaq (%rdi,%rdi,2), %r9
shlq $0x4, %r9
leaq (%rcx,%r9), %rdi
addq %rcx, %r9
addq $0x20, %r9
movq %r8, %r10
movl (%r9), %r11d
addl %r11d, %r11d
sarl $0x1f, %r11d
movslq %r11d, %r11
addq %r11, %r10
addq $0x30, %r9
decq %r8
jne 0x17dea
cmpq $0x1, %r10
jne 0x17e43
testb $0x40, 0x23(%rdi)
jne 0x17e17
movq %rdi, %r8
movq %r12, %r11
jmp 0x17e27
movq %r12, %r11
leaq 0x30(%rdi), %r8
testb $0x40, 0x53(%rdi)
movq %r8, %rdi
jne 0x17e1a
movq 0x8(%r8), %r15
movq %r15, %rdi
shrq %rdi
leaq (%rdi,%r13), %r12
cmpb $0x0, (%r13,%rdi)
je 0x17d25
jmp 0x17e46
movq %r12, %r11
cmpq $0x2, %rbp
jb 0x17e8e
movq 0x20(%rsp), %rax
cmpq %rax, 0x10(%rsp)
jne 0x17eae
leaq (%rax,%rax), %r12
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rax
leaq (%rax,%rax,4), %rsi
movq 0x8(%rsp), %rdi
movq %r11, %r13
callq 0x2350
movq %r13, %r11
movq %rax, %r13
movq %r12, 0x20(%rsp)
jmp 0x17eb3
movq %r11, %rdi
callq 0x2060
movq 0x58(%rsp), %rsi
movq 0x30(%rsp), %rdi
incq %rbx
cmpq %rsi, %rbx
jne 0x17c97
jmp 0x17f00
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %r12
incq %rax
movq %rax, 0x10(%rsp)
movq %rbp, (%r13,%r12,8)
movq %r11, 0x8(%r13,%r12,8)
shlq $0x3, %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r13,%r12,8)
movl $0x0, 0x20(%r13,%r12,8)
movq %r11, %rdi
movq %rbp, %rsi
callq 0x2350
movq %r13, 0x8(%rsp)
movq %rax, 0x8(%r13,%r12,8)
movq 0x28(%rsp), %r13
jmp 0x17e96
movl $0x1, %r15d
testb $0x1, 0x50(%rsp)
movl $0x0, 0x50(%rsp)
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %rbx
jne 0x17c35
movq 0x40(%rsp), %r10
movb $0x1, (%r13,%r10)
movq 0x20(%rsp), %rax
incq %r10
cmpq 0x38(%rsp), %r10
jne 0x17b6f
movq %rax, 0x20(%rsp)
xorl %r14d, %r14d
leaq (%r14,%r14,4), %rax
movq 0x48(%rsp), %rcx
testb $0x40, 0x23(%rcx,%rax,8)
jne 0x1820e
cmpb $0x0, (%r13,%r14)
jne 0x1820e
leaq (%r14,%r14), %rbp
movq 0x18(%rsp), %rax
movq 0x28(%rax), %r9
movq 0x30(%rax), %r10
movq %r14, %rcx
shlq $0x4, %rcx
movq 0x38(%rax), %r15
movq (%r15,%rcx), %rax
testq %rax, %rax
je 0x1803a
movq (%r10,%rcx), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %r9, %rcx
addq $0x20, %rcx
movq %rcx, %rdx
movq %rax, %rdi
movq %rax, %rsi
movl (%rdx), %r8d
addl %r8d, %r8d
sarl $0x1f, %r8d
movslq %r8d, %r8
addq %r8, %rsi
addq $0x30, %rdx
decq %rdi
jne 0x17fae
testq %rsi, %rsi
je 0x1800f
movq 0x8(%r15,%rbp,8), %rdx
testq %rdx, %rdx
je 0x1800f
movq 0x8(%r10,%rbp,8), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
addq %r9, %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 0x17fed
testq %rdi, %rdi
jne 0x1820e
movq %rax, %rdx
movl (%rcx), %esi
addl %esi, %esi
sarl $0x1f, %esi
movslq %esi, %rsi
addq %rsi, %rdx
addq $0x30, %rcx
decq %rax
jne 0x18012
movq %r10, %r12
movq %r9, 0x30(%rsp)
xorl %eax, %eax
testq %rdx, %rdx
sete %al
jmp 0x18047
movq %r10, %r12
movq %r9, 0x30(%rsp)
movl $0x1, %eax
orq %rax, %rbp
movl $0x10, %edi
callq 0x2310
movq %rax, %r13
movq %rbp, (%rax)
movq %r14, %rax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
andq %rcx, %rax
movq 0x28(%rsp), %rcx
movb $0x1, (%rcx,%rax)
movq (%r15,%rbp,8), %rdx
testq %rdx, %rdx
je 0x181b7
movq %r15, %r11
movq %r12, %r10
movq (%r12,%rbp,8), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
movq 0x30(%rsp), %r9
addq %r9, %rcx
movl $0x1, %ebp
movl $0x2, %eax
movq %rbx, 0x8(%rsp)
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 0x180b0
cmpq $0x1, %rdi
jne 0x18175
testb $0x40, 0x23(%rcx)
jne 0x180de
movq %rcx, %rdx
jmp 0x180eb
leaq 0x30(%rcx), %rdx
testb $0x40, 0x53(%rcx)
movq %rdx, %rcx
jne 0x180de
movq 0x8(%rdx), %r12
movq %r12, %rbx
shrq %rbx
movq 0x28(%rsp), %rcx
cmpb $0x0, (%rcx,%rbx)
jne 0x18170
cmpq %rax, %rbp
jne 0x1813c
leaq (%rax,%rax), %r15
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r13, %rdi
callq 0x2350
movq %rax, %r13
movq 0x18(%rsp), %rax
movq 0x28(%rax), %r9
movq 0x30(%rax), %r10
movq 0x38(%rax), %r11
movq %r15, %rax
movq %r12, (%r13,%rbp,8)
incq %rbp
movq 0x28(%rsp), %rcx
movb $0x1, (%rcx,%rbx)
movq (%r10,%r12,8), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %r9, %rcx
movq (%r11,%r12,8), %rdx
testq %rdx, %rdx
movq 0x8(%rsp), %rbx
jne 0x180a9
jmp 0x18175
movq 0x8(%rsp), %rbx
cmpq $0x2, %rbp
jb 0x181b7
movq 0x20(%rsp), %rax
cmpq %rax, 0x10(%rsp)
jne 0x181c1
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,4), %rsi
movq 0x8(%rsp), %rdi
callq 0x2350
movq %rax, %r15
movq %rbx, 0x20(%rsp)
jmp 0x181c6
movq %r13, %rdi
callq 0x2060
jmp 0x18209
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %rbx
incq %rax
movq %rax, 0x10(%rsp)
movq %rbp, (%r15,%rbx,8)
movq %r13, 0x8(%r15,%rbx,8)
shlq $0x3, %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15,%rbx,8)
movl $0x0, 0x20(%r15,%rbx,8)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2350
movq %rax, 0x8(%r15,%rbx,8)
movq %r15, %rbx
movq 0x28(%rsp), %r13
incq %r14
cmpq 0x38(%rsp), %r14
jne 0x17f49
movq %rbx, 0x8(%rsp)
xorl %ebx, %ebx
movq 0x18(%rsp), %r14
leaq (%rbx,%rbx,4), %rax
movq 0x48(%rsp), %rcx
testb $0x40, 0x23(%rcx,%rax,8)
jne 0x1841c
cmpb $0x0, (%r13,%rbx)
jne 0x1841c
leaq (%rbx,%rbx), %r15
movl $0x10, %edi
callq 0x2310
movq %r13, %rcx
movq %rax, %r13
movq %r15, (%rax)
movq %rbx, %rax
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
andq %rdx, %rax
movb $0x1, (%rcx,%rax)
movq 0x38(%r14), %rax
movq %rbx, %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %r8
testq %r8, %r8
je 0x183be
movq 0x28(%r14), %rcx
movq 0x30(%r14), %rdx
movq (%rdx,%r15,8), %rsi
leaq (%rsi,%rsi,2), %rdi
shlq $0x4, %rdi
addq %rcx, %rdi
movl $0x1, %ebp
movl $0x2, %esi
leaq 0x20(%rdi), %r9
movq %r8, %r10
movl (%r9), %r11d
addl %r11d, %r11d
sarl $0x1f, %r11d
movslq %r11d, %r11
addq %r11, %r10
addq $0x30, %r9
decq %r8
jne 0x182b3
testq %r10, %r10
je 0x1837c
testb $0x40, 0x23(%rdi)
jne 0x182e0
movq %rdi, %r8
jmp 0x182ed
leaq 0x30(%rdi), %r8
testb $0x40, 0x53(%rdi)
movq %r8, %rdi
jne 0x182e0
movq 0x8(%r8), %r15
movq %r15, %r12
shrq %r12
movq 0x28(%rsp), %rdi
cmpb $0x0, (%rdi,%r12)
jne 0x1837c
cmpq %rsi, %rbp
jne 0x1834e
leaq (%rsi,%rsi), %r14
testq %rsi, %rsi
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq %r13, %rdi
callq 0x2350
movq %rax, %r13
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rcx
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rdx
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq %r14, %rsi
movq 0x18(%rsp), %r14
movq %r15, (%r13,%rbp,8)
incq %rbp
movq 0x28(%rsp), %rdi
movb $0x1, (%rdi,%r12)
movq (%rdx,%r15,8), %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
addq %rcx, %rdi
movq (%rax,%r15,8), %r8
testq %r8, %r8
jne 0x182ac
cmpq $0x2, %rbp
jb 0x183be
movq 0x20(%rsp), %rax
cmpq %rax, 0x10(%rsp)
jne 0x183c8
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rax
leaq (%rax,%rax,4), %rsi
movq 0x8(%rsp), %rdi
callq 0x2350
movq %rax, %r15
movq %r14, 0x20(%rsp)
jmp 0x183cd
movq %r13, %rdi
callq 0x2060
jmp 0x18417
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %r14
incq %rax
movq %rax, 0x10(%rsp)
movq %rbp, (%r15,%r14,8)
movq %r13, 0x8(%r15,%r14,8)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15,%r14,8)
movl $0x80000000, 0x20(%r15,%r14,8) # imm = 0x80000000
shlq $0x3, %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2350
movq %r15, 0x8(%rsp)
movq %rax, 0x8(%r15,%r14,8)
movq 0x18(%rsp), %r14
movq 0x28(%rsp), %r13
incq %rbx
cmpq 0x38(%rsp), %rbx
jne 0x18228
jmp 0x18447
movq $0x0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x8(%rsp)
movq %r13, %rdi
callq 0x2060
movq 0x38(%rsp), %rax
leaq (,%rax,8), %r13
movq %r13, %rdi
callq 0x2310
movq %rax, %r12
movq %rax, %rdi
movl $0xff, %esi
movq %r13, %rdx
callq 0x21e0
cmpq $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rbx
je 0x1864d
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), %rdi
andq $-0x2, %rdi
movq %rdx, (%r12,%rdi,4)
movq (%rcx), %rdi
leaq -0x1(%rdi), %rbx
cmpq $0x2, %rbx
jb 0x18598
movl $0x1, %edx
movq 0x8(%rcx), %rsi
movq (%rsi,%rdx,8), %rdi
movq %rdi, %r8
andq $-0x2, %r8
movq $-0x2, (%r12,%r8,4)
movq -0x8(%rsi,%rdx,8), %rsi
movq 0x38(%r14), %r10
movq (%r10,%rsi,8), %r11
movq 0x28(%r14), %r8
movq 0x30(%r14), %r9
testq %r11, %r11
je 0x18543
movq (%r9,%rsi,8), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
addq %r8, %rsi
addq $0x20, %rsi
cmpq %rdi, -0x18(%rsi)
jne 0x18521
orb $0x40, 0x3(%rsi)
addq $0x30, %rsi
decq %r11
jne 0x18517
movq 0x8(%rcx), %rdi
movq -0x8(%rdi,%rdx,8), %rsi
movq (%rdi,%rdx,8), %rdi
movq 0x38(%r14), %r10
movq 0x28(%r14), %r8
movq 0x30(%r14), %r9
shlq $0x3, %rdi
xorq $0x8, %rdi
movq (%r10,%rdi), %r10
testq %r10, %r10
je 0x18581
movq (%r9,%rdi), %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
addq %r8, %rdi
addq $0x20, %rdi
movq -0x18(%rdi), %r8
xorq %rsi, %r8
cmpq $0x1, %r8
jne 0x18578
orb $0x40, 0x3(%rdi)
addq $0x30, %rdi
decq %r10
jne 0x18567
incq %rdx
movq (%rcx), %rdi
leaq -0x1(%rdi), %rbx
cmpq %rbx, %rdx
jb 0x184d3
movq 0x8(%rcx), %rsi
movq -0x10(%rsi,%rdi,8), %rdx
movq 0x38(%r14), %r10
movq (%r10,%rdx,8), %r11
movq 0x28(%r14), %r8
movq 0x30(%r14), %r9
testq %r11, %r11
je 0x185fb
movq (%rsi,%rbx,8), %rsi
movq (%r9,%rdx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq %r8, %rdx
addq $0x20, %rdx
movq 0x8(%rsp), %rbx
cmpq %rsi, -0x18(%rdx)
jne 0x185d8
orb $0x40, 0x3(%rdx)
addq $0x30, %rdx
decq %r11
jne 0x185ce
movq (%rcx), %rdi
movq 0x8(%rcx), %rsi
movq -0x10(%rsi,%rdi,8), %rdx
movq 0x38(%r14), %r10
movq 0x28(%r14), %r8
movq 0x30(%r14), %r9
jmp 0x18600
movq 0x8(%rsp), %rbx
movq -0x8(%rsi,%rdi,8), %rsi
xorq $0x1, %rsi
movq (%r10,%rsi,8), %rcx
testq %rcx, %rcx
je 0x1863f
movq (%r9,%rsi,8), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
addq %r8, %rsi
addq $0x20, %rsi
movq -0x18(%rsi), %rdi
xorq %rdx, %rdi
cmpq $0x1, %rdi
jne 0x18636
orb $0x40, 0x3(%rsi)
addq $0x30, %rsi
decq %rcx
jne 0x18625
incq %rax
cmpq 0x10(%rsp), %rax
jne 0x1848a
cmpq $0x0, 0x38(%rsp)
je 0x18777
xorl %ebx, %ebx
movl $0x2, %r14d
cmpq $-0x1, (%r12,%rbx,8)
jne 0x18769
leaq (%rbx,%rbx,4), %rax
movq 0x48(%rsp), %rcx
testb $0x40, 0x23(%rcx,%rax,8)
jne 0x18769
movq 0x10(%rsp), %rcx
leaq (%rcx,%rcx), %rax
movq %rax, (%r12,%rbx,8)
movq 0x20(%rsp), %rax
cmpq %rax, %rcx
jne 0x186c2
leaq (%rax,%rax), %r15
testq %rax, %rax
cmoveq %r14, %r15
leaq (,%r15,8), %rax
leaq (%rax,%rax,4), %rsi
movq 0x8(%rsp), %rdi
callq 0x2350
movq %rax, %rbp
movq %r15, 0x20(%rsp)
jmp 0x186c7
movq 0x8(%rsp), %rbp
movq 0x10(%rsp), %rax
leaq (%rax,%rax,4), %r15
leaq (%rbx,%rbx), %r13
movq $0x1, (%rbp,%r15,8)
movl $0x8, %edi
callq 0x2310
movq %rax, 0x8(%rbp,%r15,8)
movq %r13, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbp,%r15,8)
movq %rbp, 0x8(%rsp)
andl $0x80000000, 0x20(%rbp,%r15,8) # imm = 0x80000000
movq %rbx, %rdx
shlq $0x4, %rdx
movq 0x18(%rsp), %rdi
movq 0x38(%rdi), %rax
movq (%rax,%rdx), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x18758
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 0x18748
testb $0x40, 0x3(%rdx)
je 0x18753
addq $0x30, %rdx
decq %rcx
jne 0x1873c
jmp 0x18758
movl $0x80000000, %eax       # imm = 0x80000000
incq 0x10(%rsp)
movq 0x8(%rsp), %rcx
leaq (%rcx,%r15,8), %rcx
movl %eax, 0x20(%rcx)
incq %rbx
cmpq 0x38(%rsp), %rbx
jne 0x18661
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rbx
testq %rbx, %rbx
je 0x188ca
xorl %r14d, %r14d
movl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
movl $0x80000000, %r10d      # imm = 0x80000000
xorl %edi, %edi
xorl %r8d, %r8d
xorl %esi, %esi
movq 0x18(%rsp), %rax
movq 0x28(%rax), %r15
testb $0x40, 0x23(%r15,%r14)
jne 0x188bb
movq (%r15,%r14), %rax
andq $-0x2, %rax
movq (%r12,%rax,4), %r13
cmpq $-0x2, %r13
je 0x188bb
movq 0x8(%r15,%r14), %rax
andq $-0x2, %rax
movq (%r12,%rax,4), %r11
cmpq $-0x2, %r11
je 0x188bb
cmpq %r8, %rsi
jne 0x1882c
leaq (%r8,%r8), %rbp
testq %r8, %r8
movl $0x2, %eax
cmoveq %rax, %rbp
movq %rbp, %rax
shlq $0x4, %rax
movq %rsi, 0x40(%rsp)
leaq (%rax,%rax,2), %rsi
movq %r11, 0x30(%rsp)
callq 0x2350
movq 0x30(%rsp), %r11
movl $0x80000000, %r10d      # imm = 0x80000000
movl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
movq 0x40(%rsp), %rsi
movq %rax, %rdi
movq %rbp, %r8
movq %r13, %rax
shrq %rax
leaq (%rax,%rax,4), %rax
movq 0x8(%rsp), %rcx
cmpq $0x2, (%rcx,%rax,8)
jb 0x18848
xorq $0x1, %r13
jmp 0x18852
movq (%r15,%r14), %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 0x8(%rsp), %rdx
cmpq $0x1, (%rdx,%rcx,8)
ja 0x18881
movq 0x8(%r15,%r14), %rcx
andl $0x1, %ecx
orq %rcx, %r11
incq %rsi
movq %r11, 0x8(%rax)
movups 0x10(%r15,%r14), %xmm0
movups %xmm0, 0x10(%rax)
movq 0x28(%r15,%r14), %rcx
movq %rcx, 0x28(%rax)
movl 0x20(%r15,%r14), %ecx
andl %r9d, %ecx
movl 0x20(%rax), %edx
andl %r10d, %edx
orl %ecx, %edx
movl %edx, 0x20(%rax)
movl 0x20(%r15,%r14), %edx
andl %r10d, %edx
orl %ecx, %edx
movl %edx, 0x20(%rax)
addq $0x30, %r14
decq %rbx
jne 0x1879f
jmp 0x188d1
xorl %esi, %esi
xorl %r8d, %r8d
xorl %edi, %edi
movq %r8, 0x68(%rsp)
movq %rdi, 0x70(%rsp)
movq %rsi, 0x40(%rsp)
movq %r12, %rdi
callq 0x2060
cmpq $0x0, 0x10(%rsp)
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %rbx
je 0x18abe
xorl %eax, %eax
movq %rax, 0x60(%rsp)
leaq (%rax,%rax,4), %rax
leaq (%rbx,%rax,8), %r15
movq (%r15), %rax
movq 0x8(%r15), %rdi
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x18a7f
movq %r15, 0x38(%rsp)
xorl %eax, %eax
xorl %ebp, %ebp
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %rdi, 0x50(%rsp)
testq %rax, %rax
movq %rax, 0x28(%rsp)
je 0x1897f
movq -0x8(%rdi,%rax,8), %rcx
movq (%rdi,%rax,8), %rax
movq 0x28(%r14), %rdx
movq 0x30(%r14), %rsi
movq (%rsi,%rcx,8), %rcx
leaq (%rcx,%rcx,2), %rsi
shlq $0x4, %rsi
leaq (%rdx,%rsi), %rcx
cmpq %rax, 0x8(%rdx,%rsi)
jne 0x1896c
movq %rcx, %rdx
jmp 0x18979
leaq 0x30(%rcx), %rdx
cmpq %rax, 0x38(%rcx)
movq %rdx, %rcx
jne 0x1896c
subq 0x10(%rdx), %r13
jmp 0x18982
movq (%rdi), %rax
movq %rax, %rcx
shrq %rcx
leaq (%rcx,%rcx,4), %rcx
movq 0x48(%rsp), %rdx
movq (%rdx,%rcx,8), %r12
movq 0x8(%rdx,%rcx,8), %rcx
testb $0x1, %al
movq %rcx, 0x30(%rsp)
jne 0x189fd
testq %r12, %r12
je 0x18a52
leaq (,%r13,2), %r15
xorl %r14d, %r14d
cmpq %rbx, %r13
jne 0x189e3
testq %r13, %r13
movq %r15, %rbx
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq %rbp, %rdi
callq 0x2350
movq 0x30(%rsp), %rcx
movq %rax, %rbp
movq (%rcx,%r14,8), %rax
movq %rax, (%rbp,%r13,8)
incq %r13
incq %r14
addq $0x2, %r15
cmpq %r14, %r12
jne 0x189b7
jmp 0x18a52
testq %r12, %r12
je 0x18a52
leaq (,%r13,2), %r15
cmpq %rbx, %r13
jne 0x18a36
testq %r13, %r13
movq %r15, %rbx
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq %rbp, %rdi
callq 0x2350
movq 0x30(%rsp), %rcx
movq %rax, %rbp
decq %r12
movq (%rcx,%r12,8), %rax
xorq $0x1, %rax
movq %rax, (%rbp,%r13,8)
incq %r13
addq $0x2, %r15
testq %r12, %r12
jne 0x18a0a
movq 0x28(%rsp), %rax
incq %rax
cmpq 0x58(%rsp), %rax
movq 0x18(%rsp), %r14
movq 0x50(%rsp), %rdi
jne 0x18935
movq 0x38(%rsp), %r15
movq 0x8(%r15), %rdi
movq 0x8(%rsp), %rbx
jmp 0x18a84
xorl %r13d, %r13d
xorl %ebp, %ebp
callq 0x2060
movq %r13, (%r15)
movq %rbp, 0x8(%r15)
andl $0xc0000000, 0x20(%r15) # imm = 0xC0000000
shlq $0x3, %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2350
movq %rax, 0x8(%r15)
movq 0x60(%rsp), %rax
incq %rax
cmpq 0x10(%rsp), %rax
jne 0x18900
movl $0x1, %edi
movl $0x40, %esi
callq 0x2250
movq %rbx, %rcx
movq %rax, %rbx
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %rcx, 0x10(%rbx)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rbx)
movq 0x68(%rsp), %rax
movq %rax, 0x20(%rbx)
movq 0x70(%rsp), %rax
movq %rax, 0x28(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x15d06
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq