// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]oatk/path.c
// Function: graph_path_finder
void graph_path_finder(asg_t *asg, kh_u32_t *seg_dups, path_v *paths, int max_path, double sub_circ_minf, int is_pltd)
{
    uint64_t i, j, s, n_leaf;
    int circ, exceed_limit;
    asmg_t *g;
    llnode *root, *next_node, *node, **leaves;
    kvec_t(llnodep) leaf_node, root_node;

    g = asg->asmg;
    
    // find source vertex
    s = find_source_vtx(g, 1);

    if (s == UINT64_MAX) return;

    kv_init(root_node);
    kv_init(leaf_node);

    root = new_node(s << 1);
    kv_push(llnodep, root_node, root);

    n_leaf = 0;
    exceed_limit = 0;
    leaves = graph_path_extension(g, root, seg_dups, max_path, &n_leaf, &exceed_limit);
    // for linear paths do extension from the other direction of root node
    // no - should do this even if the path is circular
    // n_leaf will be zero if path number exceeds limit
    for (i = 0; i < n_leaf; ++i) {
        node = leaves[i];
        // circ = asmg_arc1(g, node->v, s << 1) != 0;
        // if (circ) {
        //     kv_push(llnodep, leaf_node, node);
        //     continue;
        // }
        
        // make a new path tracing back from leaf to root
        root = new_node(node->v^1);
        kv_push(llnodep, root_node, root);
        while (node->prev != NULL) {
            next_node = new_node(node->prev->v^1);
            next_node->prev = root;
            add_next(root, next_node);
            root = next_node;
            node = node->prev;
        }

        assert(root->v == (s<<1 | 1)); // should be always ended with seq s
        uint64_t n = 0;
        exceed_limit = 0;
        llnode **tmp_nodes = graph_path_extension(g, root, seg_dups, max_path, &n, &exceed_limit);
        
        for (j = 0; j < n; ++j)
            kv_push(llnodep, leaf_node, tmp_nodes[j]);
        free(tmp_nodes);

        if (exceed_limit || leaf_node.n > max_path) {
            exceed_limit = 1;
            break;
        }
    }
    free(leaves);

    if (exceed_limit) {
        fprintf(stderr, "[W::%s] path exploration exceeds limit %d\n", __func__, max_path);
        fprintf(stderr, "[W::%s] consider an larger value of '-N'\n", __func__);
        goto final_clean;
    }

#ifdef DEBUG_PATH_FINDER
    fprintf(stderr, "[DEBUG_PATH_FINDER::%s] number leaf nodes: %lu\n", __func__, leaf_node.n);
#endif

    for (i = 0; i < leaf_node.n; ++i) {
        kvec_t(uint32_t) path;
        kv_init(path);
        node = leaf_node.a[i];
        path.n = 0;
        while (node != NULL) {
            kv_push(uint32_t, path, node->v);
            node = node->prev;
        }
        rev_array(path.a, path.n);

        circ = asmg_arc1(g, path.a[path.n-1], path.a[0]) != 0;

#ifdef DEBUG_PATH_FINDER
        uint64_t n = path.n;
        fprintf(stderr, "[DEBUG_PATH_FINDER::%s] Path %lu [%s] (%lu): %s%c", __func__, i, 
                circ? "circle" : "linear", n, asg->seg[path.a[0]>>1].name, "+-"[path.a[0]&1]);
        for (j = 1; j < n; ++j)
            fprintf(stderr, ",%s%c", asg->seg[path.a[j]>>1].name, "+-"[path.a[j]&1]);
        fprintf(stderr, "\n");
#endif

        // calculate sequence length
        asmg_arc_t *a;
        uint64_t l, l1, *l_seg;
        uint32_t *l_beg, *l_end;
        double cov, wl;
        
        MYMALLOC(l_seg, path.n);
        l_seg[0] = g->vtx[path.a[0]>>1].len;
        l = l_seg[0];
        cov = g->vtx[path.a[0]>>1].cov;
        wl = cov * l;
        for (j = 1; j < path.n; ++j) {
            a = asmg_arc1(g, path.a[j-1], path.a[j]);
            assert(!!a);
            l_seg[j-1] = l_seg[j-1] << 32 | a->ls;
            l_seg[j] = g->vtx[path.a[j]>>1].len;
            l1 = l_seg[j] - a->ls;
            cov = g->vtx[path.a[j]>>1].cov;
            l += l1;
            wl += cov * l1;
        }
        l_seg[path.n-1] <<= 32;
        
        l_beg = l_end = 0;
        if (circ) {
            a = asmg_arc1(g, path.a[path.n-1], path.a[0]);
            assert(!!a);
            l1 = a->ls;
            cov = g->vtx[path.a[0]>>1].cov;
            l -= l1;
            wl -= cov * l1;
        } else {
            MYMALLOC(l_beg, path.n);
            MYMALLOC(l_end, path.n);
            l_beg[0] = 0;
            for (j = 1; j < path.n; ++j)
                l_beg[j] = l_beg[j-1] + (l_seg[j-1] >> 32) - (uint32_t) l_seg[j-1];
            for (j = 0; j < path.n; ++j) 
                l_end[j] = l - l_beg[j] - (l_seg[j] >> 32);
            assert(l_end[path.n-1] == 0);
        }
        
        // replace copied vertices with originals
        khint32_t k32;
        for (j = 0; j < path.n; ++j) {
            k32 = kh_u32_get(seg_dups, path.a[j]>>1);
            if (k32 < kh_end(seg_dups))
                path.a[j] = kh_val(seg_dups, k32)<<1 | (path.a[j]&1);
        }

        path_t p = {0, path.n, circ, 0, path.a, l, wl, .0};
        kv_push(path_t, *paths, p);
        
        if (!circ) {
            // for linear paths add longest circular subpaths if at least sub_circ_minf sequences covered
            double drop, max_drop, min_drop;
            int beg, end, beg1, end1, n;
            
            uint64_t L = is_pltd? MIN(l, COMMON_AVG_PLTD_SIZE) : l;
            max_drop = l - (double) L * sub_circ_minf;
            n = path.n;
            beg1 = end1 = -1;
            min_drop = FLT_MAX;
            for (beg = 0; beg < n; ++beg) {
                if (l_beg[beg] > max_drop || l_beg[beg] >= min_drop)
                    break;
                for (end = n - 1; end >= beg; --end) {
                    drop = l_beg[beg] + l_end[end];
                    if (drop > max_drop || drop >= min_drop)
                        break;
                    // check if the path [beg, end] is a circular
                    a = asmg_arc1(g, path.a[end], path.a[beg]);
                    if (a) {
                        beg1 = beg;
                        end1 = end;
                        min_drop = drop;
                        break; // only need the longest subpath
                    }
                }
            }

            if (beg1 >= 0) {
                // circular subpath found
                // add subpath
                uint32_t *v;
                n = end1 - beg1 + 1;
                MYMALLOC(v, n);
                memcpy(v, &path.a[beg1], sizeof(uint32_t) * n);
                wl = (l_seg[beg1] >> 32) * g->vtx[path.a[beg1]>>1].cov;
                for (beg = beg1 + 1; beg <= end1; ++beg)
                    wl += ((l_seg[beg] >> 32) - (uint32_t) l_seg[beg-1]) * g->vtx[path.a[beg]>>1].cov;
                l -= l_beg[beg1] + l_end[end1];
                a = asmg_arc1(g, v[n-1], v[0]);
                l -= a->ls;
                wl -= a->ls * g->vtx[v[0]>>1].cov;
                path_t p1 = {0, n, 1, 0, v, l, wl, .0};
                kv_push(path_t, *paths, p1);
            }
        }
        
        free(l_seg);
        free(l_beg);
        free(l_end);
    }

final_clean:
    for (i = 0; i < root_node.n; ++i)
        llnode_destroy(root_node.a[i]);

    kv_destroy(root_node);
    kv_destroy(leaf_node);

    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %r8d, 0x94(%rsp)
movsd %xmm0, 0xa0(%rsp)
movl %ecx, %r13d
movq %rdx, 0x88(%rsp)
movq %rsi, 0x58(%rsp)
movq 0x20(%rdi), %r15
movq (%r15), %rdi
leaq (%rdi,%rdi), %rbx
shlq $0x3, %rdi
callq 0x32f0
movq %rax, %r14
movq %r15, 0x10(%rsp)
movq %r15, %rdi
movq %rax, %rsi
callq 0x16a83
movl %eax, %ebp
movslq %eax, %rdi
movl $0x8, %esi
callq 0x3240
movq %rax, %r15
testq %rbx, %rbx
je 0x712f
xorl %eax, %eax
movslq (%r14,%rax,4), %rcx
testq %rcx, %rcx
js 0x7127
testb $0x1, %al
jne 0x7100
movq %rax, %rdx
xorq $0x1, %rdx
cmpl (%r14,%rdx,4), %ecx
je 0x7127
movq 0x10(%rsp), %rdx
movq 0x10(%rdx), %rdx
movq %rax, %rsi
shrq %rsi
leaq (%rsi,%rsi,4), %rsi
movl 0x20(%rdx,%rsi,8), %edi
andl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
imulq 0x18(%rdx,%rsi,8), %rdi
addq %rdi, (%r15,%rcx,8)
incq %rax
cmpq %rax, %rbx
jne 0x70e6
testl %ebp, %ebp
jle 0x71c7
movl %ebp, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %esi, %esi
movq (%r15,%rdx,8), %rdi
cmpq %rdi, %rsi
cmovbeq %rdi, %rsi
cmovbl %edx, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x7142
xorl %ecx, %ecx
testl %eax, %eax
sets %cl
shlq $0x3f, %rcx
movabsq $0x7fffffffffffffff, %rbp # imm = 0x7FFFFFFFFFFFFFFF
orq %rcx, %rbp
testq %rbx, %rbx
je 0x71ce
testl %eax, %eax
js 0x71ce
movq $-0x1, %rbp
xorl %ecx, %ecx
xorl %edx, %edx
cmpl %eax, (%r14,%rcx,4)
jne 0x71ba
movq 0x10(%rsp), %rsi
movq 0x10(%rsi), %rsi
movq %rcx, %rdi
shrq %rdi
leaq (%rdi,%rdi,4), %rdi
movl 0x20(%rsi,%rdi,8), %r8d
andl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
imulq 0x18(%rsi,%rdi,8), %r8
cmpq %r8, %rdx
cmovbeq %r8, %rdx
cmovbq %rcx, %rbp
incq %rcx
cmpq %rcx, %rbx
jne 0x7184
shrq %rbp
jmp 0x71ce
movq $-0x1, %rbp
movq %r14, %rdi
callq 0x3060
movq %r15, %rdi
callq 0x3060
cmpq $-0x1, %rbp
je 0x7db1
addq %rbp, %rbp
movl $0x28, %edi
callq 0x32f0
movq %rax, %r14
movl %ebp, (%rax)
movq $0x4, 0x10(%rax)
xorl %ebx, %ebx
movq %rbx, 0x18(%rax)
movq %rbx, 0x8(%rax)
movl $0x20, %edi
callq 0x32f0
movq %rax, 0x20(%r14)
movl $0x10, %edi
callq 0x32f0
movq %rax, %r12
movq %r14, (%rax)
leaq 0xb0(%rsp), %r15
movq %rbx, (%r15)
leaq 0x24(%rsp), %r9
movl $0x0, (%r9)
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq 0x58(%rsp), %rdx
movl %r13d, %ecx
movq %r15, %r8
callq 0x7eea
movq (%r15), %rcx
movq %rcx, 0x28(%rsp)
testq %rcx, %rcx
movl %r13d, (%rsp)
je 0x7dc3
movq %r12, 0x30(%rsp)
orq $0x1, %rbp
movq %rbp, 0x18(%rsp)
movslq %r13d, %rcx
movq %rcx, 0x70(%rsp)
movl $0x1, %r13d
xorl %ecx, %ecx
movq $0x0, 0x38(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
movl $0x2, %edx
movq %rdx, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq %rcx, 0x8(%rsp)
movq (%rax,%rcx,8), %r14
movl (%r14), %r15d
xorl $0x1, %r15d
movl $0x28, %edi
callq 0x32f0
movq %r13, %rbx
movq %rax, %r13
movl %r15d, (%rax)
movq $0x4, 0x10(%rax)
xorl %eax, %eax
movq %rax, 0x18(%r13)
movq %rax, 0x8(%r13)
movl $0x20, %edi
callq 0x32f0
movq %rax, 0x20(%r13)
movq %rbx, 0x50(%rsp)
movq 0x40(%rsp), %rax
cmpq %rax, %rbx
jne 0x7324
leaq (%rax,%rax), %r15
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq 0x30(%rsp), %rdi
callq 0x3330
movq %r15, 0x40(%rsp)
jmp 0x7329
movq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rcx
movq %r13, (%rax,%rcx,8)
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x739a
addq $0x8, %r14
movl (%rax), %ebx
xorl $0x1, %ebx
movl $0x28, %edi
callq 0x32f0
movq %rax, %r15
movl %ebx, (%rax)
movq $0x4, 0x10(%rax)
movq $0x0, 0x18(%rax)
movl $0x20, %edi
callq 0x32f0
movq %rax, 0x20(%r15)
movq %r13, 0x8(%r15)
movq %r13, %rdi
movq %r15, %rsi
callq 0x86c3
movq (%r14), %r14
movq 0x8(%r14), %rax
addq $0x8, %r14
movq %r15, %r13
testq %rax, %rax
jne 0x7344
jmp 0x739d
movq %r13, %r15
movl (%r15), %eax
cmpq %rax, 0x18(%rsp)
jne 0x7eac
movq $0x0, 0x98(%rsp)
movl $0x0, 0x24(%rsp)
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq 0x58(%rsp), %rdx
movl (%rsp), %ecx
leaq 0x98(%rsp), %r8
leaq 0x24(%rsp), %r9
callq 0x7eea
movq %rax, %r15
movq 0x98(%rsp), %r14
testq %r14, %r14
je 0x743b
movq %r15, %r13
movq 0x38(%rsp), %rdi
cmpq %rbp, %r12
jne 0x7425
leaq (,%rbp,2), %rbx
testq %rbp, %rbp
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
callq 0x3330
movq %rax, %rdi
movq %rbx, %rbp
movq (%r13), %rax
movq %rax, (%rdi,%r12,8)
incq %r12
addq $0x8, %r13
decq %r14
jne 0x73f9
jmp 0x7440
movq 0x38(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq 0x50(%rsp), %r13
incq %r13
movq %r15, %rdi
callq 0x3060
cmpl $0x0, 0x24(%rsp)
jne 0x7deb
cmpq 0x70(%rsp), %r12
ja 0x7deb
movq 0x8(%rsp), %rcx
incq %rcx
cmpq 0x28(%rsp), %rcx
movq 0x48(%rsp), %rax
jb 0x72a9
movq %rax, %rdi
callq 0x3060
testq %r12, %r12
je 0x7de4
movq %r13, 0x50(%rsp)
xorl %ecx, %ecx
movq 0x38(%rsp), %rax
movq (%rax,%rcx,8), %rbx
testq %rbx, %rbx
movq %rcx, 0x48(%rsp)
je 0x7529
xorl %r13d, %r13d
xorl %eax, %eax
xorl %ebp, %ebp
movq %rbp, %r14
cmpq %rax, %rbp
jne 0x74e3
leaq (%rax,%rax), %r15
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,4), %rsi
movq %r13, %rdi
callq 0x3330
movq %rax, %r13
movq %r15, %rax
movl (%rbx), %ecx
leaq 0x1(%r14), %rbp
movl %ecx, (%r13,%r14,4)
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0x74b5
cmpl $0x1, %ebp
jbe 0x7525
movl %r14d, %eax
decq %rax
xorl %ecx, %ecx
movl (%r13,%rcx,4), %edx
movl 0x4(%r13,%rax,4), %esi
movl %esi, (%r13,%rcx,4)
movl %edx, 0x4(%r13,%rax,4)
incq %rcx
movl %eax, %edx
decq %rax
cmpq %rdx, %rcx
jb 0x7504
movl %ebp, %esi
jmp 0x7530
xorl %esi, %esi
xorl %r13d, %r13d
xorl %ebp, %ebp
movl -0x4(%r13,%rbp,4), %eax
movl (%r13), %r15d
movq 0x10(%rsp), %rdx
movq 0x28(%rdx), %r14
movq 0x30(%rdx), %rcx
movq %rcx, 0x28(%rsp)
movq (%rcx,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq 0x38(%rdx), %rdx
movq %rdx, (%rsp)
movq (%rdx,%rax,8), %rbx
testq %rbx, %rbx
movl %esi, 0x70(%rsp)
movq %rcx, 0xa8(%rsp)
je 0x759c
leaq (%r14,%rcx), %rax
movq %rbx, %rcx
cmpq %r15, 0x8(%rax)
jne 0x7587
testb $0x40, 0x23(%rax)
je 0x7592
addq $0x30, %rax
decq %rcx
jne 0x757b
xorl %eax, %eax
testq %rax, %rax
sete 0x18(%rsp)
jmp 0x75a1
movb $0x1, 0x18(%rsp)
leaq (,%rbp,8), %rdi
callq 0x32f0
movq %rax, %rsi
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movl %r15d, %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rdx
movq 0x18(%rax,%rdx,8), %rcx
movq %rsi, 0x8(%rsp)
movq %rcx, (%rsi)
movl 0x20(%rax,%rdx,8), %edx
movl $0x3fffffff, %esi       # imm = 0x3FFFFFFF
andl %esi, %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movq %rcx, %xmm1
movq 0x12fa1(%rip), %xmm4    # 0x1a590
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
movapd 0x12fa5(%rip), %xmm5    # 0x1a5a0
subpd %xmm5, %xmm1
movapd %xmm1, %xmm6
unpckhpd %xmm1, %xmm6            # xmm6 = xmm6[1],xmm1[1]
addsd %xmm1, %xmm6
mulsd %xmm0, %xmm6
cmpq $0x2, %rbp
movq %r14, 0x60(%rsp)
jb 0x76e9
leaq 0x20(%r14), %rdx
movl $0x1, %esi
movl %r15d, %edi
movq %rcx, %r14
movl %edi, %r9d
movq (%rsp), %rdi
movq (%rdi,%r9,8), %r8
testq %r8, %r8
je 0x7e6e
movl (%r13,%rsi,4), %edi
movq 0x28(%rsp), %r10
movq (%r10,%r9,8), %r9
leaq (%r9,%r9,2), %r9
shlq $0x4, %r9
addq %rdx, %r9
cmpq %rdi, -0x18(%r9)
jne 0x7667
testb $0x40, 0x3(%r9)
je 0x7675
addq $0x30, %r9
decq %r8
jne 0x765a
jmp 0x7e6e
shlq $0x20, %rcx
movq -0x8(%r9), %r8
orq %r8, %rcx
movq 0x8(%rsp), %r10
movq %rcx, -0x8(%r10,%rsi,8)
movl %edi, %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %r9
movq 0x18(%rax,%r9,8), %rcx
movq %rcx, (%r10,%rsi,8)
movq %rcx, %r10
movl 0x20(%rax,%r9,8), %r9d
movl $0x3fffffff, %r11d      # imm = 0x3FFFFFFF
andl %r11d, %r9d
xorps %xmm1, %xmm1
cvtsi2sd %r9d, %xmm1
subq %r8, %r10
addq %r10, %r14
movq %r10, %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm5, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
mulsd %xmm1, %xmm3
addsd %xmm3, %xmm6
incq %rsi
cmpq %rbp, %rsi
jne 0x762d
jmp 0x76ec
movq %rcx, %r14
movq 0x8(%rsp), %rax
shlq $0x20, -0x8(%rax,%rbp,8)
cmpb $0x0, 0x18(%rsp)
je 0x7772
movapd %xmm6, 0x60(%rsp)
leaq (,%rbp,4), %r15
movq %r15, %rdi
callq 0x32f0
movq %rax, %rbx
movq %r15, %rdi
callq 0x32f0
movq %rbx, %r15
movq %rax, %r9
movl $0x0, (%rbx)
cmpq $0x2, %rbp
jb 0x77e7
leaq -0x1(%rbp), %rax
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x12e4b(%rip), %xmm4    # 0x1a590
movq 0x8(%rsp), %rdi
movapd 0x60(%rsp), %xmm6
movl %edx, %esi
movq (%rdi,%rcx,8), %rdx
subq %rdx, %rsi
shrq $0x20, %rdx
addq %rsi, %rdx
movl %edx, 0x4(%r15,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x7750
jmp 0x7803
testq %rbx, %rbx
je 0x7e8d
movq 0x60(%rsp), %rax
movq 0xa8(%rsp), %rcx
addq %rcx, %rax
addq $0x20, %rax
cmpq %r15, -0x18(%rax)
jne 0x779b
testb $0x40, 0x3(%rax)
je 0x77a9
addq $0x30, %rax
decq %rbx
jne 0x778f
jmp 0x7e8d
movq -0x8(%rax), %rax
subq %rax, %r14
movq %rax, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm5, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm6
movl $0x0, %r15d
movl $0x0, %r9d
testq %rbp, %rbp
jne 0x782a
jmp 0x7926
testq %rbp, %rbp
movq 0x12d9e(%rip), %xmm4    # 0x1a590
movq 0x8(%rsp), %rdi
movapd 0x60(%rsp), %xmm6
je 0x7ecb
xorl %eax, %eax
movl 0x4(%rdi,%rax,8), %ecx
addl (%r15,%rax,4), %ecx
movl %r14d, %edx
subl %ecx, %edx
movl %edx, (%r9,%rax,4)
incq %rax
cmpq %rax, %rbp
jne 0x7805
cmpl $0x0, -0x4(%r9,%rbp,4)
jne 0x7ecb
movq %r15, (%rsp)
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rdx
xorl %esi, %esi
movq %rbp, 0x40(%rsp)
testq %rdx, %rdx
je 0x7916
movq %r12, %rbp
movq %r14, %r12
movq %r9, %r14
movl (%r13,%rsi,4), %edi
movl %edi, %r9d
shrl %r9d
movq 0x58(%rsp), %r11
movl (%r11), %eax
movl $0x1, %r8d
movl %eax, %ecx
shll %cl, %r8d
movl %r9d, %ecx
shll $0xf, %ecx
notl %ecx
addl %r9d, %ecx
movl %ecx, %r10d
shrl $0xa, %r10d
xorl %ecx, %r10d
leal (%r10,%r10,8), %ecx
movl %ecx, %r10d
shrl $0x6, %r10d
xorl %ecx, %r10d
movl %r10d, %ecx
shll $0xb, %ecx
notl %ecx
addl %r10d, %ecx
movl %ecx, %r10d
shrl $0x10, %r10d
xorl %ecx, %r10d
imull $0x9e3779b9, %r10d, %r10d # imm = 0x9E3779B9
movl %eax, %ecx
negb %cl
shrl %cl, %r10d
leal -0x1(%r8), %ecx
movq 0x8(%r11), %rbx
movl %r10d, %r11d
movl %r11d, %r15d
shrl $0x5, %r15d
movl (%rbx,%r15,4), %r15d
btl %r11d, %r15d
jae 0x78e9
movl %r11d, %r15d
cmpl (%rdx,%r15,8), %r9d
je 0x78e6
incl %r11d
andl %ecx, %r11d
cmpl %r10d, %r11d
jne 0x78bf
jmp 0x78e9
movl %r11d, %r8d
movl %r8d, %r9d
movl %eax, %ecx
shrl %cl, %r9d
testl %r9d, %r9d
movq %r14, %r9
movq %r12, %r14
movq %rbp, %r12
movq 0x40(%rsp), %rbp
jne 0x7916
movl %r8d, %eax
movl 0x4(%rdx,%rax,8), %eax
andl $0x1, %edi
leal (%rdi,%rax,2), %eax
movl %eax, (%r13,%rsi,4)
incq %rsi
cmpq %rbp, %rsi
jne 0x783e
movq (%rsp), %r15
movq %r15, (%rsp)
movq %r9, 0x28(%rsp)
movq 0x88(%rsp), %rbx
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x7983
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rbx)
shlq $0x4, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
movapd %xmm6, 0x60(%rsp)
callq 0x3330
movapd 0x60(%rsp), %xmm6
movq 0x12c14(%rip), %xmm4    # 0x1a590
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movl 0x70(%rsp), %r8d
movl %r8d, %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movb 0x18(%rsp), %dil
movl %edi, %esi
xorb $0x1, %sil
movzbl %sil, %esi
shll $0x1e, %esi
orl %edx, %esi
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movq %rdx, (%rax,%rcx)
movl %esi, 0x8(%rax,%rcx)
movq %r13, 0x10(%rax,%rcx)
movl %r14d, 0x18(%rax,%rcx)
movsd %xmm6, 0x20(%rax,%rcx)
movq %rdx, 0x28(%rax,%rcx)
testb %dil, %dil
movq 0x8(%rsp), %rdi
je 0x7d79
movl $0x27100, %eax          # imm = 0x27100
cmpq %rax, %r14
cmovbq %r14, %rax
cmpl $0x0, 0x94(%rsp)
cmoveq %r14, %rax
testl %r8d, %r8d
jle 0x7d79
movq %r14, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
movapd 0x12b8d(%rip), %xmm2    # 0x1a5a0
subpd %xmm2, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm2, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd 0xa0(%rsp), %xmm2
subsd %xmm2, %xmm0
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %eax, %eax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movsd 0x12aac(%rip), %xmm1    # 0x1a510
movq (%rsp), %rcx
movq 0x28(%rsp), %r11
movl (%rcx,%rax,4), %ecx
xorps %xmm2, %xmm2
cvtsi2sd %rcx, %xmm2
ucomisd %xmm0, %xmm2
ja 0x7b28
ucomisd %xmm1, %xmm2
jae 0x7b28
movq %rbp, %rdx
movl -0x4(%r11,%rdx,4), %esi
addl %ecx, %esi
xorps %xmm2, %xmm2
cvtsi2sd %rsi, %xmm2
ucomisd %xmm0, %xmm2
ja 0x7b04
ucomisd %xmm1, %xmm2
jae 0x7b04
decq %rdx
movl (%r13,%rdx,4), %r8d
movq 0x10(%rsp), %rsi
movq 0x38(%rsi), %rsi
movq (%rsi,%r8,8), %rsi
testq %rsi, %rsi
je 0x7aff
movl (%r13,%rax,4), %edi
movq 0x10(%rsp), %r10
movq 0x28(%r10), %r9
movq 0x30(%r10), %r10
movq (%r10,%r8,8), %r8
leaq (%r8,%r8,2), %r8
shlq $0x4, %r8
addq %r9, %r8
addq $0x20, %r8
cmpq %rdi, -0x18(%r8)
jne 0x7af6
testb $0x40, 0x3(%r8)
je 0x7b0a
addq $0x30, %r8
decq %rsi
jne 0x7ae9
cmpq %rax, %rdx
jg 0x7a8f
movapd %xmm1, %xmm2
jmp 0x7b0f
movl %eax, %ebx
movl %edx, %r15d
incq %rax
movapd %xmm2, %xmm1
cmpq %rbp, %rax
movq 0x8(%rsp), %rdi
movq (%rsp), %rcx
jne 0x7a6d
testl %ebx, %ebx
js 0x7d79
movl %r15d, %eax
movl %r15d, 0x18(%rsp)
subl %ebx, %eax
cltq
leaq 0x4(,%rax,4), %rdi
movq %rdi, 0x70(%rsp)
callq 0x32f0
movl %ebx, %ebp
leaq (,%rbp,4), %rsi
addq %r13, %rsi
movq %rsi, 0x60(%rsp)
movq %rax, 0x40(%rsp)
movq %rax, %rdi
movq 0x70(%rsp), %rdx
callq 0x32c0
movq 0x8(%rsp), %rsi
movq (%rsi,%rbp,8), %r8
movq %r8, %rcx
shrq $0x20, %rcx
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rsp), %rdx
movl (%rdx), %edx
shrl %edx
leaq (%rdx,%rdx,4), %rdx
movl 0x20(%rax,%rdx,8), %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
imulq %rcx, %rdx
movl 0x18(%rsp), %ecx
cvtsi2sd %rdx, %xmm4
subl %ebx, %ecx
jle 0x7c38
leaq 0x4(,%rbp,4), %rdx
addq %r13, %rdx
leaq (%rsi,%rbp,8), %rsi
addq $0x8, %rsi
xorl %edi, %edi
movq 0x129bc(%rip), %xmm2    # 0x1a590
movapd 0x129c4(%rip), %xmm3    # 0x1a5a0
movq 0x28(%rsp), %r11
movq (%rsi,%rdi,8), %r9
movl %r8d, %r10d
movq %r9, %r8
shrq $0x20, %r9
subq %r10, %r9
movl (%rdx,%rdi,4), %r10d
shrl %r10d
leaq (%r10,%r10,4), %r10
movl 0x20(%rax,%r10,8), %r10d
andl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
imulq %r9, %r10
movq %r10, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addsd %xmm1, %xmm4
incq %rdi
leal (%rdi,%rbp), %r9d
cmpl %r9d, %r15d
jg 0x7be1
jmp 0x7c4d
movq 0x12950(%rip), %xmm2    # 0x1a590
movapd 0x12958(%rip), %xmm3    # 0x1a5a0
movq 0x28(%rsp), %r11
leal 0x1(%rcx), %ebx
movslq %r15d, %rdx
movl (%r11,%rdx,4), %r13d
movq (%rsp), %rdx
addl (%rdx,%rbp,4), %r13d
movslq %ecx, %rcx
movq 0x40(%rsp), %r15
movl (%r15,%rcx,4), %edx
movl (%r15), %ecx
movq 0x10(%rsp), %rdi
movq 0x28(%rdi), %rsi
movq 0x30(%rdi), %rdi
movq (%rdi,%rdx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq %rsi, %rdx
addq $0x20, %rdx
movq 0x88(%rsp), %rsi
cmpq %rcx, -0x18(%rdx)
jne 0x7ca2
testb $0x40, 0x3(%rdx)
je 0x7ca8
addq $0x30, %rdx
jmp 0x7c96
movq -0x8(%rdx), %rbp
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movl 0x20(%rax,%rcx,8), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
imulq %rbp, %rax
movq %rax, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movq (%rsi), %rcx
movq 0x10(%rsi), %rax
cmpq 0x8(%rsi), %rcx
jne 0x7d24
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rsi)
shlq $0x4, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
movsd %xmm4, 0x18(%rsp)
movapd %xmm1, 0x70(%rsp)
callq 0x3330
movapd 0x70(%rsp), %xmm1
movsd 0x18(%rsp), %xmm4
movq 0x88(%rsp), %rsi
movq %rax, 0x10(%rsi)
movq (%rsi), %rcx
addl %r13d, %ebp
subl %ebp, %r14d
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
subsd %xmm0, %xmm4
andl $0x3fffffff, %ebx       # imm = 0x3FFFFFFF
orl $0x40000000, %ebx       # imm = 0x40000000
leaq 0x1(%rcx), %rdx
movq %rdx, (%rsi)
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movq %rdx, (%rax,%rcx)
movl %ebx, 0x8(%rax,%rcx)
movq %r15, 0x10(%rax,%rcx)
movl %r14d, 0x18(%rax,%rcx)
movsd %xmm4, 0x20(%rax,%rcx)
movq %rdx, 0x28(%rax,%rcx)
movq 0x8(%rsp), %rdi
callq 0x3060
movq (%rsp), %rdi
callq 0x3060
movq 0x28(%rsp), %rdi
callq 0x3060
movq 0x48(%rsp), %rcx
incq %rcx
cmpq %r12, %rcx
jne 0x749b
movq 0x30(%rsp), %r12
movq 0x50(%rsp), %r13
jmp 0x7e33
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x24(%rsp), %ebx
movq %rax, %rdi
callq 0x3060
movq $0x0, 0x38(%rsp)
movl $0x1, %r13d
testl %ebx, %ebx
je 0x7e38
jmp 0x7dfa
movq 0x30(%rsp), %r12
jmp 0x7e33
movq 0x48(%rsp), %rdi
callq 0x3060
movq 0x30(%rsp), %r12
movq 0x181f7(%rip), %rbx     # 0x1fff8
movq (%rbx), %rdi
leaq 0x1293b(%rip), %rsi     # 0x1a746
leaq 0x1295f(%rip), %r14     # 0x1a771
movq %r14, %rdx
movl (%rsp), %ecx
xorl %eax, %eax
callq 0x3290
movq (%rbx), %rdi
leaq 0x1295a(%rip), %rsi     # 0x1a783
movq %r14, %rdx
xorl %eax, %eax
callq 0x3290
testq %r13, %r13
je 0x7e4b
xorl %ebx, %ebx
movq (%r12,%rbx,8), %rdi
callq 0x874f
incq %rbx
cmpq %rbx, %r13
jne 0x7e3a
movq %r12, %rdi
callq 0x3060
movq 0x38(%rsp), %rdi
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3060
leaq 0x12938(%rip), %rdi     # 0x1a7ad
leaq 0x12809(%rip), %rsi     # 0x1a685
leaq 0x1287b(%rip), %rcx     # 0x1a6fe
movl $0x515, %edx            # imm = 0x515
callq 0x3190
leaq 0x12919(%rip), %rdi     # 0x1a7ad
leaq 0x127ea(%rip), %rsi     # 0x1a685
leaq 0x1285c(%rip), %rcx     # 0x1a6fe
movl $0x522, %edx            # imm = 0x522
callq 0x3190
leaq 0x12835(%rip), %rdi     # 0x1a6e8
leaq 0x127cb(%rip), %rsi     # 0x1a685
leaq 0x1283d(%rip), %rcx     # 0x1a6fe
movl $0x4d8, %edx            # imm = 0x4D8
callq 0x3190
leaq 0x128df(%rip), %rdi     # 0x1a7b1
leaq 0x127ac(%rip), %rsi     # 0x1a685
leaq 0x1281e(%rip), %rcx     # 0x1a6fe
movl $0x52f, %edx            # imm = 0x52F
callq 0x3190