// File: /workspace/github_c_makefile_star2_O1/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 $0xa8, %rsp
movl %r8d, 0x7c(%rsp)
movsd %xmm0, 0x90(%rsp)
movl %ecx, 0x18(%rsp)
movq %rdx, 0x60(%rsp)
movq %rsi, 0x38(%rsp)
movq 0x20(%rdi), %r15
movq (%r15), %rdi
leaq (%rdi,%rdi), %rbx
shlq $0x3, %rdi
callq 0x32f0
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x1532b
movl %eax, %ebp
movslq %eax, %rdi
movl $0x8, %esi
callq 0x3240
movq %rax, %r13
testq %rbx, %rbx
je 0x6f9e
xorl %eax, %eax
movslq (%r14,%rax,4), %rcx
testq %rcx, %rcx
js 0x6f96
testb $0x1, %al
jne 0x6f73
movq %rax, %rdx
xorq $0x1, %rdx
cmpl (%r14,%rdx,4), %ecx
je 0x6f96
movq 0x10(%r15), %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, (%r13,%rcx,8)
incq %rax
cmpq %rax, %rbx
jne 0x6f59
testl %ebp, %ebp
jle 0x6fc6
movl %ebp, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %esi, %esi
movq (%r13,%rdx,8), %rdi
cmpq %rdi, %rsi
cmovbeq %rdi, %rsi
cmovbl %edx, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x6fad
jmp 0x6fcb
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
testl %eax, %eax
sets %cl
shlq $0x3f, %rcx
movabsq $0x7fffffffffffffff, %r9 # imm = 0x7FFFFFFFFFFFFFFF
orq %rcx, %r9
testq %rbx, %rbx
je 0x7033
testl %eax, %eax
js 0x7033
movq $-0x1, %r9
xorl %ecx, %ecx
xorl %edx, %edx
cmpl %eax, (%r14,%rcx,4)
jne 0x7028
movq 0x10(%r15), %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, %r9
incq %rcx
cmpq %rcx, %rbx
jne 0x6ff7
shrq %r9
movq %r14, %rdi
movq %r9, %r12
callq 0x3060
movq %r13, %rdi
callq 0x3060
cmpq $-0x1, %r12
je 0x72ff
addq %r12, %r12
movl $0x28, %edi
callq 0x32f0
movq %rax, %r14
movl %r12d, (%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, 0x50(%rsp)
movq %r14, (%rax)
leaq 0xa0(%rsp), %r13
movq %rbx, (%r13)
leaq 0x14(%rsp), %r9
movl $0x0, (%r9)
movq %r15, 0x20(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq 0x38(%rsp), %rdx
movl 0x18(%rsp), %ebx
movl %ebx, %ecx
movq %r13, %r8
callq 0x7cbf
xorl %ecx, %ecx
movq %rax, 0x58(%rsp)
cmpq %rcx, (%r13)
je 0x7311
orq $0x1, %r12
movq %r12, 0x40(%rsp)
movslq %ebx, %rax
movq %rax, 0x68(%rsp)
movl $0x1, %eax
movq %rax, 0x28(%rsp)
xorl %ecx, %ecx
movq $0x0, 0x30(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
movl $0x2, %eax
movq %rax, (%rsp)
movq %r15, %r14
movq 0x58(%rsp), %rax
movq %rcx, 0x8(%rsp)
movq (%rax,%rcx,8), %r12
movl (%r12), %r13d
xorl $0x1, %r13d
movl $0x28, %edi
callq 0x32f0
movq %rax, %rbp
movl %r13d, (%rax)
movq $0x4, 0x10(%rax)
xorl %eax, %eax
movq %rax, 0x18(%rbp)
movq %rax, 0x8(%rbp)
movl $0x20, %edi
callq 0x32f0
movq %rax, 0x20(%rbp)
movq (%rsp), %rax
cmpq %rax, 0x28(%rsp)
jne 0x718c
leaq (%rax,%rax), %r13
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r13
leaq (,%r13,8), %rsi
movq 0x50(%rsp), %rdi
callq 0x3330
movq %r13, (%rsp)
jmp 0x7191
movq 0x50(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x28(%rsp), %rcx
movq %rbp, (%rax,%rcx,8)
movq 0x8(%r12), %rax
testq %rax, %rax
je 0x720a
addq $0x8, %r12
movl (%rax), %r15d
xorl $0x1, %r15d
movl $0x28, %edi
callq 0x32f0
movq %rax, %r13
movl %r15d, (%rax)
xorl %eax, %eax
movq $0x4, 0x10(%r13)
movq %rax, 0x18(%r13)
movq %rax, 0x8(%r13)
movl $0x20, %edi
callq 0x32f0
movq %rax, 0x20(%r13)
movq %rbp, 0x8(%r13)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x8120
movq (%r12), %r12
movq 0x8(%r12), %rax
addq $0x8, %r12
movq %r13, %rbp
testq %rax, %rax
jne 0x71ad
jmp 0x720d
movq %rbp, %r13
movl (%r13), %eax
cmpq %rax, 0x40(%rsp)
jne 0x7c62
movq $0x0, 0x70(%rsp)
movl $0x0, 0x14(%rsp)
movq 0x20(%rsp), %rdi
movq %r13, %rsi
movq 0x38(%rsp), %rdx
movl 0x18(%rsp), %ecx
leaq 0x70(%rsp), %r8
leaq 0x14(%rsp), %r9
callq 0x7cbf
movq %rax, %r13
cmpq $0x0, 0x70(%rsp)
movq %r14, %r15
je 0x72b9
leaq (,%r15,8), %rbp
xorl %r12d, %r12d
movq 0x30(%rsp), %rdi
leaq (%r14,%r12), %rax
cmpq %rbx, %rax
jne 0x7297
leaq (%rbx,%rbx), %r15
testq %rbx, %rbx
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
callq 0x3330
movq %rax, %rdi
movq %r15, %rbx
movq (%r13,%r12,8), %rax
leaq (%rdi,%rbp), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
cmpq 0x70(%rsp), %r12
jb 0x726b
movq %rdi, 0x30(%rsp)
movq %r14, %r15
addq %r12, %r15
incq 0x28(%rsp)
movq %r13, %rdi
callq 0x3060
movl 0x14(%rsp), %eax
testl %eax, %eax
sete %cl
cmpq 0x68(%rsp), %r15
setbe %dl
testb %dl, %cl
movl $0x1, %ecx
cmovel %ecx, %eax
movl %eax, 0x14(%rsp)
je 0x7327
movq 0x8(%rsp), %rcx
incq %rcx
cmpq 0xa0(%rsp), %rcx
jb 0x7110
jmp 0x7327
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, 0x30(%rsp)
movl $0x1, %eax
movq %rax, 0x28(%rsp)
xorl %r15d, %r15d
movq 0x58(%rsp), %rdi
callq 0x3060
cmpl $0x0, 0x14(%rsp)
jne 0x7c38
testq %r15, %r15
movq 0x20(%rsp), %r12
je 0x7bf3
movl $0x2, %r13d
xorl %ecx, %ecx
movq %r15, 0x68(%rsp)
movq 0x30(%rsp), %rax
movq %rcx, 0x58(%rsp)
movq (%rax,%rcx,8), %rbx
testq %rbx, %rbx
je 0x73ac
xorl %ebp, %ebp
xorl %eax, %eax
xorl %r14d, %r14d
cmpq %rax, %r14
jne 0x7397
leaq (%rax,%rax), %r15
testq %rax, %rax
cmoveq %r13, %r15
leaq (,%r15,4), %rsi
movq %rbp, %rdi
callq 0x3330
movq %rax, %rbp
movq %r15, %rax
movl (%rbx), %ecx
movl %ecx, (%rbp,%r14,4)
incq %r14
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0x7371
jmp 0x73b1
xorl %r14d, %r14d
xorl %ebp, %ebp
cmpl $0x2, %r14d
jb 0x73dd
leal -0x1(%r14), %eax
decq %rax
xorl %ecx, %ecx
movl (%rbp,%rcx,4), %edx
movl 0x4(%rbp,%rax,4), %esi
movl %esi, (%rbp,%rcx,4)
movl %edx, 0x4(%rbp,%rax,4)
incq %rcx
movl %eax, %edx
decq %rax
cmpq %rdx, %rcx
jb 0x73c0
movl -0x4(%rbp,%r14,4), %eax
movl (%rbp), %ebx
movq 0x28(%r12), %rdx
movq 0x30(%r12), %rsi
movq (%rsi,%rax,8), %rcx
leaq (%rcx,%rcx,2), %r13
shlq $0x4, %r13
addq %rdx, %r13
movq 0x38(%r12), %rcx
movq %rcx, 0x8(%rsp)
movq (%rcx,%rax,8), %r12
testq %r12, %r12
movq %rdx, 0x18(%rsp)
movq %rsi, 0x40(%rsp)
je 0x7441
movq %r13, %rax
movq %r12, %rcx
cmpq %rbx, 0x8(%rax)
jne 0x742d
testb $0x40, 0x23(%rax)
je 0x7438
addq $0x30, %rax
decq %rcx
jne 0x7421
xorl %eax, %eax
testq %rax, %rax
sete (%rsp)
jmp 0x7445
movb $0x1, (%rsp)
leaq (,%r14,8), %rdi
callq 0x32f0
movq %rax, %r10
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movl %ebx, %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movq 0x18(%rax,%rcx,8), %r15
movq %r15, (%r10)
movl 0x20(%rax,%rcx,8), %ecx
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl %edx, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movq %r15, %xmm1
movq 0x12103(%rip), %xmm4    # 0x19590
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
movapd 0x12107(%rip), %xmm5    # 0x195a0
subpd %xmm5, %xmm1
movapd %xmm1, %xmm6
unpckhpd %xmm1, %xmm6            # xmm6 = xmm6[1],xmm1[1]
addsd %xmm1, %xmm6
mulsd %xmm0, %xmm6
cmpq $0x2, %r14
jb 0x7576
movl $0x1, %ecx
movq 0x18(%rsp), %r9
movq 0x40(%rsp), %r11
movl -0x4(%rbp,%rcx,4), %esi
movl (%rbp,%rcx,4), %edx
movq 0x8(%rsp), %rdi
movq (%rdi,%rsi,8), %rdi
testq %rdi, %rdi
je 0x7500
movq (%r11,%rsi,8), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
addq %r9, %rsi
cmpq %rdx, 0x8(%rsi)
jne 0x74f7
testb $0x40, 0x23(%rsi)
je 0x7502
addq $0x30, %rsi
decq %rdi
jne 0x74eb
xorl %esi, %esi
testq %rsi, %rsi
je 0x7c43
movq -0x8(%r10,%rcx,8), %rdi
shlq $0x20, %rdi
movq 0x18(%rsi), %rsi
orq %rsi, %rdi
movq %rdi, -0x8(%r10,%rcx,8)
shrl %edx
leaq (%rdx,%rdx,4), %rdx
movq 0x18(%rax,%rdx,8), %rdi
movq %rdi, (%r10,%rcx,8)
movl 0x20(%rax,%rdx,8), %edx
movl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
andl %r8d, %edx
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
subq %rsi, %rdi
addq %rdi, %r15
movq %rdi, %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 %rcx
cmpq %r14, %rcx
jne 0x74c6
shlq $0x20, -0x8(%r10,%r14,8)
cmpb $0x0, (%rsp)
movq %r10, 0x8(%rsp)
je 0x7623
movapd %xmm6, 0x40(%rsp)
leaq (,%r14,4), %r13
movq %r13, %rdi
callq 0x32f0
movq %rax, %rbx
movq %r13, %rdi
callq 0x32f0
movq 0x8(%rsp), %r10
movq %rax, %r13
movl $0x0, (%rbx)
cmpq $0x2, %r14
jb 0x75e2
leaq -0x1(%r14), %rax
movl (%rbx), %edx
xorl %ecx, %ecx
movq (%r10,%rcx,8), %rsi
subl %esi, %edx
shrq $0x20, %rsi
addl %edx, %esi
movl %esi, 0x4(%rbx,%rcx,4)
incq %rcx
movl %esi, %edx
cmpq %rcx, %rax
jne 0x75c8
testq %r14, %r14
movq 0x20(%rsp), %r12
movq 0x11f9e(%rip), %xmm4    # 0x19590
movapd 0x40(%rsp), %xmm6
je 0x7616
xorl %eax, %eax
movl 0x4(%r10,%rax,8), %ecx
addl (%rbx,%rax,4), %ecx
movl %r15d, %edx
subl %ecx, %edx
movl %edx, (%r13,%rax,4)
incq %rax
cmpq %rax, %r14
jne 0x75fc
cmpl $0x0, -0x4(%r13,%r14,4)
je 0x767c
jmp 0x7ca0
testq %r12, %r12
je 0x763e
cmpq %rbx, 0x8(%r13)
jne 0x7635
testb $0x40, 0x23(%r13)
je 0x7641
addq $0x30, %r13
decq %r12
jne 0x7628
xorl %r13d, %r13d
testq %r13, %r13
movq 0x20(%rsp), %r12
je 0x7c81
movq 0x18(%r13), %rax
subq %rax, %r15
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
xorl %r13d, %r13d
xorl %ebx, %ebx
movq %rbx, 0x18(%rsp)
testq %r14, %r14
je 0x777c
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
xorl %edx, %edx
movl (%rbp,%rdx,4), %esi
xorl %edi, %edi
movl $0x0, %r8d
testq %rax, %rax
je 0x7747
movl %esi, %r9d
shrl %r9d
movq 0x38(%rsp), %rbx
movb (%rbx), %cl
movl $0x1, %r8d
shll %cl, %r8d
movl %r9d, %r10d
shll $0xf, %r10d
notl %r10d
addl %r9d, %r10d
movl %r10d, %r11d
shrl $0xa, %r11d
xorl %r10d, %r11d
leal (%r11,%r11,8), %r10d
movl %r10d, %r11d
shrl $0x6, %r11d
xorl %r10d, %r11d
movl %r11d, %r10d
shll $0xb, %r10d
notl %r10d
addl %r11d, %r10d
movl %r10d, %r11d
shrl $0x10, %r11d
xorl %r10d, %r11d
imull $0x9e3779b9, %r11d, %r10d # imm = 0x9E3779B9
negb %cl
shrl %cl, %r10d
leal -0x1(%r8), %ecx
movq 0x8(%rbx), %rbx
movl %r10d, %r11d
movl %r11d, %r12d
shrl $0x5, %r12d
movl (%rbx,%r12,4), %r12d
btl %r11d, %r12d
jae 0x773d
movl %r11d, %r12d
cmpl (%rax,%r12,8), %r9d
je 0x773a
incl %r11d
andl %ecx, %r11d
cmpl %r10d, %r11d
jne 0x7713
jmp 0x773d
movl %r11d, %r8d
movq 0x20(%rsp), %r12
movq 0x8(%rsp), %r10
testq %rax, %rax
je 0x775a
movq 0x38(%rsp), %rcx
movb (%rcx), %cl
movl $0x1, %edi
shll %cl, %edi
cmpl %edi, %r8d
jae 0x7770
movl %r8d, %ecx
movl 0x4(%rax,%rcx,8), %ecx
andl $0x1, %esi
leal (%rsi,%rcx,2), %ecx
movl %ecx, (%rbp,%rdx,4)
incq %rdx
cmpq %r14, %rdx
jne 0x7695
movq 0x60(%rsp), %rdx
movq 0x8(%rdx), %rax
cmpq %rax, (%rdx)
jne 0x77d1
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%rdx)
movq 0x10(%rdx), %rdi
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rsi
movapd %xmm6, 0x40(%rsp)
callq 0x3330
movapd 0x40(%rsp), %xmm6
movq 0x8(%rsp), %r10
movq 0x11dc8(%rip), %xmm4    # 0x19590
movq 0x60(%rsp), %rdx
movq %rax, 0x10(%rdx)
movl %r14d, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movb (%rsp), %r8b
movl %r8d, %ecx
xorb $0x1, %cl
movzbl %cl, %ecx
shll $0x1e, %ecx
orl %eax, %ecx
movq (%rdx), %rax
movq %rdx, %rdi
movq 0x10(%rdx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, (%rdi)
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
xorl %esi, %esi
movq %rsi, (%rdx,%rax)
movl %ecx, 0x8(%rdx,%rax)
movq %rbp, 0x10(%rdx,%rax)
movl %r15d, 0x18(%rdx,%rax)
movsd %xmm6, 0x20(%rdx,%rax)
movq %rsi, 0x28(%rdx,%rax)
testb %r8b, %r8b
je 0x7bbd
movl $0x27100, %eax          # imm = 0x27100
cmpq %rax, %r15
cmovbq %r15, %rax
cmpl $0x0, 0x7c(%rsp)
cmoveq %r15, %rax
testl %r14d, %r14d
jle 0x795f
movq %r15, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
movapd 0x11d45(%rip), %xmm2    # 0x195a0
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 0x90(%rsp), %xmm2
subsd %xmm2, %xmm0
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
xorl %eax, %eax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movsd 0x11c62(%rip), %xmm1    # 0x19510
movq 0x18(%rsp), %r11
movl (%r11,%rax,4), %ecx
xorps %xmm2, %xmm2
cvtsi2sd %rcx, %xmm2
ucomisd %xmm0, %xmm2
ja 0x796b
ucomisd %xmm1, %xmm2
jae 0x796b
movq %r14, %rdx
cmpq %rax, %rdx
jle 0x7949
movl -0x4(%r13,%rdx,4), %esi
addl %ecx, %esi
xorps %xmm2, %xmm2
cvtsi2sd %rsi, %xmm2
ucomisd %xmm0, %xmm2
ja 0x7949
ucomisd %xmm1, %xmm2
jae 0x7949
movl -0x4(%rbp,%rdx,4), %edi
decq %rdx
movq 0x38(%r12), %rsi
movq (%rsi,%rdi,8), %rsi
testq %rsi, %rsi
je 0x78d6
movl (%rbp,%rax,4), %r8d
movq 0x30(%r12), %r9
movq (%r9,%rdi,8), %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
addq 0x28(%r12), %rdi
cmpq %r8, 0x8(%rdi)
jne 0x7932
testb $0x40, 0x23(%rdi)
je 0x793d
addq $0x30, %rdi
decq %rsi
jne 0x7926
xorl %edi, %edi
testq %rdi, %rdi
je 0x78d6
movl %eax, %ebx
movl %edx, (%rsp)
jmp 0x794d
movapd %xmm1, %xmm2
incq %rax
movapd %xmm2, %xmm1
cmpq %r14, %rax
jne 0x78b3
jmp 0x796b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
testl %ebx, %ebx
js 0x7bbd
movl (%rsp), %eax
subl %ebx, %eax
cltq
leaq 0x4(,%rax,4), %rdi
movq %rdi, 0x80(%rsp)
callq 0x32f0
movl %ebx, %r14d
leaq (,%r14,4), %rsi
addq %rbp, %rsi
movq %rsi, 0x98(%rsp)
movq %rax, 0x40(%rsp)
movq %rax, %rdi
movq 0x80(%rsp), %rdx
callq 0x32c0
movq 0x8(%rsp), %r10
movl 0x4(%r10,%r14,8), %ecx
movq 0x10(%r12), %rax
movq 0x98(%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 (%rsp), %ecx
xorps %xmm4, %xmm4
cvtsi2sd %rdx, %xmm4
subl %ebx, %ecx
jle 0x7a7a
leaq (%r10,%r14,8), %rdx
addq $0x8, %rdx
leaq 0x4(,%r14,4), %rsi
addq %rbp, %rsi
xorl %edi, %edi
movq 0x11b79(%rip), %xmm2    # 0x19590
movapd 0x11b81(%rip), %xmm3    # 0x195a0
movq 0x18(%rsp), %r11
movl (%rsp), %ebp
movl -0x8(%rdx,%rdi,8), %r8d
movl 0x4(%rdx,%rdi,8), %r9d
subq %r8, %r9
movl (%rsi,%rdi,4), %r8d
shrl %r8d
leaq (%r8,%r8,4), %r8
movl 0x20(%rax,%r8,8), %r8d
andl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
imulq %r9, %r8
movq %r8, %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,%r14), %r8d
cmpl %r8d, %ebp
jg 0x7a27
jmp 0x7a92
movq 0x11b0e(%rip), %xmm2    # 0x19590
movapd 0x11b16(%rip), %xmm3    # 0x195a0
movq 0x18(%rsp), %r11
movl (%rsp), %ebp
leal 0x1(%rcx), %ebx
movslq %ebp, %rdx
movl (%r13,%rdx,4), %ebp
addl (%r11,%r14,4), %ebp
movslq %ecx, %rcx
movq 0x40(%rsp), %rsi
movl (%rsi,%rcx,4), %edx
movl (%rsi), %ecx
movq 0x28(%r12), %rsi
movq 0x30(%r12), %rdi
movq (%rdi,%rdx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq %rsi, %rdx
addq $0x20, %rdx
cmpq %rcx, -0x18(%rdx)
jne 0x7ad7
testb $0x40, 0x3(%rdx)
je 0x7add
addq $0x30, %rdx
jmp 0x7acb
movq -0x8(%rdx), %r14
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movl 0x20(%rax,%rcx,8), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
imulq %r14, %rax
movq %rax, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movq 0x60(%rsp), %rdx
movq 0x8(%rdx), %rax
cmpq %rax, (%rdx)
jne 0x7b5e
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%rdx)
movq 0x10(%rdx), %rdi
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rsi
movsd %xmm4, (%rsp)
movapd %xmm1, 0x80(%rsp)
callq 0x3330
movapd 0x80(%rsp), %xmm1
movsd (%rsp), %xmm4
movq 0x8(%rsp), %r10
movq 0x60(%rsp), %rdx
movq %rax, 0x10(%rdx)
addl %ebp, %r14d
subl %r14d, %r15d
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
movq (%rdx), %rax
movq 0x10(%rdx), %rcx
movq %rdx, %rsi
leaq 0x1(%rax), %rdx
movq %rdx, (%rsi)
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
xorl %edx, %edx
movq %rdx, (%rcx,%rax)
movl %ebx, 0x8(%rcx,%rax)
movq 0x40(%rsp), %rsi
movq %rsi, 0x10(%rcx,%rax)
movl %r15d, 0x18(%rcx,%rax)
movsd %xmm4, 0x20(%rcx,%rax)
movq %rdx, 0x28(%rcx,%rax)
movq %r10, %rdi
callq 0x3060
movq 0x18(%rsp), %rdi
callq 0x3060
movq %r13, %rdi
callq 0x3060
movq 0x58(%rsp), %rcx
incq %rcx
movq 0x68(%rsp), %r15
cmpq %r15, %rcx
movl $0x2, %r13d
jne 0x7357
movq 0x28(%rsp), %r15
testq %r15, %r15
movq 0x50(%rsp), %r14
je 0x7c15
xorl %ebx, %ebx
movq (%r14,%rbx,8), %rdi
callq 0x81a7
incq %rbx
cmpq %rbx, %r15
jne 0x7c04
movq %r14, %rdi
callq 0x3060
movq 0x30(%rsp), %rdi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3060
movl 0x18(%rsp), %edi
callq 0x370e
jmp 0x7bf3
leaq 0x11b53(%rip), %rdi     # 0x1979d
leaq 0x11a24(%rip), %rsi     # 0x19675
leaq 0x11a96(%rip), %rcx     # 0x196ee
movl $0x515, %edx            # imm = 0x515
callq 0x3190
leaq 0x11a6f(%rip), %rdi     # 0x196d8
leaq 0x11a05(%rip), %rsi     # 0x19675
leaq 0x11a77(%rip), %rcx     # 0x196ee
movl $0x4d8, %edx            # imm = 0x4D8
callq 0x3190
leaq 0x11b15(%rip), %rdi     # 0x1979d
leaq 0x119e6(%rip), %rsi     # 0x19675
leaq 0x11a58(%rip), %rcx     # 0x196ee
movl $0x522, %edx            # imm = 0x522
callq 0x3190
leaq 0x11afa(%rip), %rdi     # 0x197a1
leaq 0x119c7(%rip), %rsi     # 0x19675
leaq 0x11a39(%rip), %rcx     # 0x196ee
movl $0x52f, %edx            # imm = 0x52F
callq 0x3190