// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movsd %xmm0, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movl $0x1, %esi
callq 0x7990
movq %rax, -0x48(%rbp)
cmpq $-0x1, -0x48(%rbp)
jne 0x66fd
jmp 0x797f
movq $0x0, -0xa8(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xa0(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x48(%rbp), %rax
shlq %rax
movl %eax, %edi
callq 0x7c90
movq %rax, -0x68(%rbp)
movq -0xb0(%rbp), %rax
cmpq -0xa8(%rbp), %rax
jne 0x67b8
cmpq $0x0, -0xa8(%rbp)
je 0x677e
movq -0xa8(%rbp), %rax
shlq %rax
movq %rax, -0x1c8(%rbp)
jmp 0x678c
movl $0x2, %eax
movq %rax, -0x1c8(%rbp)
jmp 0x678c
movq -0x1c8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2330
movq %rax, -0xa0(%rbp)
movq -0x68(%rbp), %rdx
movq -0xa0(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xb0(%rbp)
movq %rdx, (%rax,%rcx,8)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x58(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x10(%rbp), %rdx
movl -0x1c(%rbp), %ecx
leaq -0x50(%rbp), %r8
leaq -0x58(%rbp), %r9
callq 0x7d00
movq %rax, -0x80(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x6a91
movq -0x80(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movl (%rax), %edi
xorl $0x1, %edi
callq 0x7c90
movq %rax, -0x68(%rbp)
movq -0xb0(%rbp), %rax
cmpq -0xa8(%rbp), %rax
jne 0x68aa
cmpq $0x0, -0xa8(%rbp)
je 0x6870
movq -0xa8(%rbp), %rax
shlq %rax
movq %rax, -0x1d0(%rbp)
jmp 0x687e
movl $0x2, %eax
movq %rax, -0x1d0(%rbp)
jmp 0x687e
movq -0x1d0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2330
movq %rax, -0xa0(%rbp)
movq -0x68(%rbp), %rdx
movq -0xa0(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xb0(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x68d0
movq -0x78(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x6920
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %edi
xorl $0x1, %edi
callq 0x7c90
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x68(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x81c0
movq -0x70(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x68d0
movq -0x68(%rbp), %rax
movl (%rax), %eax
movq -0x48(%rbp), %rcx
shlq %rcx
orq $0x1, %rcx
cmpq %rcx, %rax
jne 0x6938
jmp 0x6957
leaq 0x1ccc9(%rip), %rdi     # 0x23608
leaq 0x1cc5f(%rip), %rsi     # 0x235a5
movl $0x4d8, %edx            # imm = 0x4D8
leaq 0x1cccc(%rip), %rcx     # 0x2361e
callq 0x21a0
movq $0x0, -0xb8(%rbp)
movl $0x0, -0x58(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x10(%rbp), %rdx
movl -0x1c(%rbp), %ecx
leaq -0xb8(%rbp), %r8
leaq -0x58(%rbp), %r9
callq 0x7d00
movq %rax, -0xc0(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0xb8(%rbp), %rax
jae 0x6a53
jmp 0x69aa
movq -0x98(%rbp), %rax
cmpq -0x90(%rbp), %rax
jne 0x6a11
cmpq $0x0, -0x90(%rbp)
je 0x69d7
movq -0x90(%rbp), %rax
shlq %rax
movq %rax, -0x1d8(%rbp)
jmp 0x69e5
movl $0x2, %eax
movq %rax, -0x1d8(%rbp)
jmp 0x69e5
movq -0x1d8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2330
movq %rax, -0x88(%rbp)
movq -0xc0(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x88(%rbp), %rax
movq -0x98(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x98(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x6a42
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6997
movq -0xc0(%rbp), %rdi
callq 0x2060
cmpl $0x0, -0x58(%rbp)
jne 0x6a75
movq -0x98(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x6a7e
movl $0x1, -0x58(%rbp)
jmp 0x6a91
jmp 0x6a80
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x6813
movq -0x80(%rbp), %rdi
callq 0x2060
cmpl $0x0, -0x58(%rbp)
je 0x6ae6
movq 0x23551(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
movl -0x1c(%rbp), %ecx
leaq 0x1cbb2(%rip), %rsi     # 0x23666
leaq 0x1cbd6(%rip), %rdx     # 0x23691
movb $0x0, %al
callq 0x2290
movq 0x2352f(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
leaq 0x1cbd0(%rip), %rsi     # 0x236a3
leaq 0x1cbb7(%rip), %rdx     # 0x23691
movb $0x0, %al
callq 0x2290
jmp 0x7930
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x98(%rbp), %rax
jae 0x792e
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movq $0x0, -0xc8(%rbp)
movq -0x88(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq $0x0, -0xd8(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x6be8
jmp 0x6b4b
movq -0xd8(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jne 0x6bb2
cmpq $0x0, -0xd0(%rbp)
je 0x6b78
movq -0xd0(%rbp), %rax
shlq %rax
movq %rax, -0x1e0(%rbp)
jmp 0x6b86
movl $0x2, %eax
movq %rax, -0x1e0(%rbp)
jmp 0x6b86
movq -0x1e0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xc8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
shlq $0x2, %rsi
callq 0x2330
movq %rax, -0xc8(%rbp)
movq -0x78(%rbp), %rax
movl (%rax), %edx
movq -0xc8(%rbp), %rax
movq -0xd8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xd8(%rbp)
movl %edx, (%rax,%rcx,4)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x6b3e
movq -0xc8(%rbp), %rdi
movl -0xd8(%rbp), %esi
callq 0x8300
movq -0x60(%rbp), %rdi
movq -0xd8(%rbp), %rcx
movq -0xc8(%rbp), %rax
movl -0x4(%rax,%rcx,4), %ecx
movl %ecx, %esi
movl (%rax), %eax
movl %eax, %edx
callq 0x8370
testq %rax, %rax
setne %al
movzbl %al, %eax
movl %eax, -0x54(%rbp)
movq -0xd8(%rbp), %rdi
shlq $0x3, %rdi
callq 0x22f0
movq %rax, -0xf8(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xc8(%rbp), %rcx
movl (%rcx), %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movq 0x18(%rax,%rcx,8), %rcx
movq -0xf8(%rbp), %rax
movq %rcx, (%rax)
movq -0xf8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xc8(%rbp), %rcx
movl (%rcx), %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movl 0x20(%rax,%rcx,8), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x110(%rbp)
movsd -0x110(%rbp), %xmm0
movaps 0x1c8c0(%rip), %xmm2    # 0x23570
movq -0xe8(%rbp), %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x1c8bc(%rip), %xmm2    # 0x23580
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x118(%rbp)
movq $0x1, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0xd8(%rbp), %rax
jae 0x6e72
movq -0x60(%rbp), %rdi
movq -0xc8(%rbp), %rax
movq -0x40(%rbp), %rcx
subq $0x1, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %esi
movq -0xc8(%rbp), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %edx
callq 0x8370
movq %rax, -0xe0(%rbp)
cmpq $0x0, -0xe0(%rbp)
je 0x6d38
jmp 0x6d57
leaq 0x1c98e(%rip), %rdi     # 0x236cd
leaq 0x1c85f(%rip), %rsi     # 0x235a5
movl $0x515, %edx            # imm = 0x515
leaq 0x1c8cc(%rip), %rcx     # 0x2361e
callq 0x21a0
movq -0xf8(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x8(%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq -0xe0(%rbp), %rsi
movq 0x18(%rsi), %rsi
orq %rsi, %rdx
movq %rdx, -0x8(%rax,%rcx,8)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xc8(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl (%rdx,%rcx,4), %edx
shrl %edx
leaq (%rdx,%rdx,4), %rdx
movq 0x18(%rax,%rdx,8), %rdx
movq -0xf8(%rbp), %rax
movq %rdx, (%rax,%rcx,8)
movq -0xf8(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0xe0(%rbp), %rcx
movq 0x18(%rcx), %rcx
subq %rcx, %rax
movq %rax, -0xf0(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xc8(%rbp), %rcx
movq -0x40(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movl 0x20(%rax,%rcx,8), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x110(%rbp)
movq -0xf0(%rbp), %rcx
movq -0xe8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
movsd -0x110(%rbp), %xmm0
movaps 0x1c74a(%rip), %xmm1    # 0x23570
movq -0xf0(%rbp), %xmm2
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movapd 0x1c746(%rip), %xmm1    # 0x23580
subpd %xmm1, %xmm2
movaps %xmm2, %xmm1
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm1, %xmm2
movsd -0x118(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x118(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6ce7
movq -0xf8(%rbp), %rax
movq -0xd8(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq $0x0, -0x108(%rbp)
movq $0x0, -0x100(%rbp)
cmpl $0x0, -0x54(%rbp)
je 0x6fc9
movq -0x60(%rbp), %rdi
movq -0xc8(%rbp), %rax
movq -0xd8(%rbp), %rcx
subq $0x1, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %esi
movq -0xc8(%rbp), %rax
movl (%rax), %eax
movl %eax, %edx
callq 0x8370
movq %rax, -0xe0(%rbp)
cmpq $0x0, -0xe0(%rbp)
je 0x6eee
jmp 0x6f0d
leaq 0x1c7d8(%rip), %rdi     # 0x236cd
leaq 0x1c6a9(%rip), %rsi     # 0x235a5
movl $0x522, %edx            # imm = 0x522
leaq 0x1c716(%rip), %rcx     # 0x2361e
callq 0x21a0
movq -0xe0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xc8(%rbp), %rcx
movl (%rcx), %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movl 0x20(%rax,%rcx,8), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x110(%rbp)
movq -0xf0(%rbp), %rcx
movq -0xe8(%rbp), %rax
subq %rcx, %rax
movq %rax, -0xe8(%rbp)
movsd -0x110(%rbp), %xmm0
movaps 0x1c5fe(%rip), %xmm1    # 0x23570
movq -0xf0(%rbp), %xmm2
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movapd 0x1c5fa(%rip), %xmm1    # 0x23580
subpd %xmm1, %xmm2
movaps %xmm2, %xmm1
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm1, %xmm2
movsd -0x118(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x118(%rbp)
jmp 0x7117
movq -0xd8(%rbp), %rdi
shlq $0x2, %rdi
callq 0x22f0
movq %rax, -0x100(%rbp)
movq -0xd8(%rbp), %rdi
shlq $0x2, %rdi
callq 0x22f0
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rax
movl $0x0, (%rax)
movq $0x1, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0xd8(%rbp), %rax
jae 0x707b
movq -0x100(%rbp), %rax
movq -0x40(%rbp), %rcx
subq $0x1, %rcx
movl (%rax,%rcx,4), %eax
movq -0xf8(%rbp), %rcx
movq -0x40(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
addq %rcx, %rax
movq -0xf8(%rbp), %rcx
movq -0x40(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
subq %rcx, %rax
movl %eax, %edx
movq -0x100(%rbp), %rax
movq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x700c
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0xd8(%rbp), %rax
jae 0x70dc
movq -0xe8(%rbp), %rax
movq -0x100(%rbp), %rcx
movq -0x40(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
subq %rcx, %rax
movq -0xf8(%rbp), %rcx
movq -0x40(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
subq %rcx, %rax
movl %eax, %edx
movq -0x108(%rbp), %rax
movq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x7083
movq -0x108(%rbp), %rax
movq -0xd8(%rbp), %rcx
subq $0x1, %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x70f6
jmp 0x7115
leaq 0x1c5d4(%rip), %rdi     # 0x236d1
leaq 0x1c4a1(%rip), %rsi     # 0x235a5
movl $0x52f, %edx            # imm = 0x52F
leaq 0x1c50e(%rip), %rcx     # 0x2361e
callq 0x21a0
jmp 0x7117
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0xd8(%rbp), %rax
jae 0x71dd
movq -0x10(%rbp), %rdi
movq -0xc8(%rbp), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %esi
shrl %esi
callq 0x8430
movl %eax, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
movl %eax, -0x1e4(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x717b
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x1e8(%rbp)
jmp 0x7185
xorl %eax, %eax
movl %eax, -0x1e8(%rbp)
jmp 0x7185
movl -0x1e4(%rbp), %eax
movl -0x1e8(%rbp), %ecx
cmpl %ecx, %eax
jae 0x71ca
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x11c(%rbp), %ecx
movl 0x4(%rax,%rcx,8), %edx
shll %edx
movq -0xc8(%rbp), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0x1, %eax
orl %eax, %edx
movq -0xc8(%rbp), %rax
movq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x71cc
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x711f
movq $0x0, -0x150(%rbp)
movq -0xd8(%rbp), %rax
movl %eax, %ecx
movl -0x148(%rbp), %eax
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
andl $0xc0000000, %eax       # imm = 0xC0000000
orl %ecx, %eax
movl %eax, -0x148(%rbp)
movl -0x54(%rbp), %ecx
movl -0x148(%rbp), %eax
andl $0x1, %ecx
shll $0x1e, %ecx
andl $0xbfffffff, %eax       # imm = 0xBFFFFFFF
orl %ecx, %eax
movl %eax, -0x148(%rbp)
movl -0x148(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl $0x0, %eax
movl %eax, -0x148(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0xe8(%rbp), %rax
movl %eax, -0x138(%rbp)
movsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x130(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x128(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x72de
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x72a0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x1f0(%rbp)
jmp 0x72ae
movl $0x2, %eax
movq %rax, -0x1f0(%rbp)
jmp 0x72ae
movq -0x1f0(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
imulq $0x30, 0x8(%rax), %rsi
callq 0x2330
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, (%rcx)
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq -0x150(%rbp), %rsi
movl $0x30, %edx
callq 0x22c0
cmpl $0x0, -0x54(%rbp)
jne 0x78f9
cmpl $0x0, -0x2c(%rbp)
je 0x735a
cmpq $0x27100, -0xe8(%rbp) # imm = 0x27100
jae 0x733c
movq -0xe8(%rbp), %rax
movq %rax, -0x1f8(%rbp)
jmp 0x734a
movl $0x27100, %eax          # imm = 0x27100
movq %rax, -0x1f8(%rbp)
jmp 0x734a
movq -0x1f8(%rbp), %rax
movq %rax, -0x200(%rbp)
jmp 0x7368
movq -0xe8(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x200(%rbp), %rax
movq %rax, -0x188(%rbp)
movaps 0x1c1f3(%rip), %xmm3    # 0x23570
movq -0xe8(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x1c1ef(%rip), %xmm2    # 0x23580
subpd %xmm2, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0x188(%rbp), %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
movsd -0x28(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x160(%rbp)
movq -0xd8(%rbp), %rax
movl %eax, -0x17c(%rbp)
movl $0xffffffff, -0x178(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x174(%rbp) # imm = 0xFFFFFFFF
movsd 0x1c0f0(%rip), %xmm0    # 0x23500
movsd %xmm0, -0x168(%rbp)
movl $0x0, -0x16c(%rbp)
movl -0x16c(%rbp), %eax
cmpl -0x17c(%rbp), %eax
jge 0x758a
movq -0x100(%rbp), %rax
movslq -0x16c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cvtsi2sd %rax, %xmm0
ucomisd -0x160(%rbp), %xmm0
ja 0x7474
movq -0x100(%rbp), %rax
movslq -0x16c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cvtsi2sd %rax, %xmm0
ucomisd -0x168(%rbp), %xmm0
jb 0x7479
jmp 0x758a
movl -0x17c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x170(%rbp)
movl -0x170(%rbp), %eax
cmpl -0x16c(%rbp), %eax
jl 0x7574
movq -0x100(%rbp), %rax
movslq -0x16c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x108(%rbp), %rcx
movslq -0x170(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x158(%rbp)
movsd -0x158(%rbp), %xmm0
ucomisd -0x160(%rbp), %xmm0
ja 0x74ef
movsd -0x158(%rbp), %xmm0
ucomisd -0x168(%rbp), %xmm0
jb 0x74f4
jmp 0x7574
movq -0x60(%rbp), %rdi
movq -0xc8(%rbp), %rax
movslq -0x170(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %esi
movq -0xc8(%rbp), %rax
movslq -0x16c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %edx
callq 0x8370
movq %rax, -0xe0(%rbp)
cmpq $0x0, -0xe0(%rbp)
je 0x755e
movl -0x16c(%rbp), %eax
movl %eax, -0x174(%rbp)
movl -0x170(%rbp), %eax
movl %eax, -0x178(%rbp)
movsd -0x158(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
jmp 0x7574
jmp 0x7560
movl -0x170(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x170(%rbp)
jmp 0x7488
jmp 0x7576
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x7422
cmpl $0x0, -0x174(%rbp)
jl 0x78f7
movl -0x178(%rbp), %eax
movl -0x174(%rbp), %ecx
subl %ecx, %eax
incl %eax
movl %eax, -0x17c(%rbp)
movslq -0x17c(%rbp), %rdi
shlq $0x2, %rdi
callq 0x22f0
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rdi
movq -0xc8(%rbp), %rax
movslq -0x174(%rbp), %rcx
leaq (%rax,%rcx,4), %rsi
movslq -0x17c(%rbp), %rdx
shlq $0x2, %rdx
callq 0x22c0
movq -0xf8(%rbp), %rax
movslq -0x174(%rbp), %rsi
movl 0x4(%rax,%rsi,8), %eax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0xc8(%rbp), %rdx
movl (%rdx,%rsi,4), %edx
shrl %edx
leaq (%rdx,%rdx,4), %rdx
movl 0x20(%rcx,%rdx,8), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
imulq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x118(%rbp)
movl -0x174(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
movl -0x16c(%rbp), %eax
cmpl -0x178(%rbp), %eax
jg 0x76e3
movq -0xf8(%rbp), %rcx
movslq -0x16c(%rbp), %rsi
movl %esi, %edx
movl 0x4(%rcx,%rsi,8), %eax
decl %edx
movslq %edx, %rdx
movl (%rcx,%rdx,8), %ecx
subq %rcx, %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0xc8(%rbp), %rdx
movl (%rdx,%rsi,4), %edx
shrl %edx
leaq (%rdx,%rdx,4), %rdx
movl 0x20(%rcx,%rdx,8), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
imulq %rcx, %rax
movq %rax, %xmm0
movaps 0x1becc(%rip), %xmm1    # 0x23570
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x1bed0(%rip), %xmm1    # 0x23580
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
addsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x7641
movq -0x100(%rbp), %rax
movslq -0x174(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x108(%rbp), %rcx
movslq -0x178(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl %ecx, %eax
movl %eax, %ecx
movq -0xe8(%rbp), %rax
subq %rcx, %rax
movq %rax, -0xe8(%rbp)
movq -0x60(%rbp), %rdi
movq -0x190(%rbp), %rax
movl -0x17c(%rbp), %ecx
decl %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movl %ecx, %esi
movl (%rax), %eax
movl %eax, %edx
callq 0x8370
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0xe8(%rbp), %rax
subq %rcx, %rax
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x190(%rbp), %rdx
movl (%rdx), %edx
shrl %edx
leaq (%rdx,%rdx,4), %rdx
movl 0x20(%rcx,%rdx,8), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
imulq %rcx, %rax
movq %rax, %xmm1
movaps 0x1bdd3(%rip), %xmm0    # 0x23570
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x1bdd7(%rip), %xmm0    # 0x23580
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd -0x118(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x118(%rbp)
movq $0x0, -0x1c0(%rbp)
movl -0x17c(%rbp), %ecx
movl -0x1b8(%rbp), %eax
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
andl $0xc0000000, %eax       # imm = 0xC0000000
orl %ecx, %eax
movl %eax, -0x1b8(%rbp)
movl -0x1b8(%rbp), %eax
andl $0xbfffffff, %eax       # imm = 0xBFFFFFFF
orl $0x40000000, %eax       # imm = 0x40000000
movl %eax, -0x1b8(%rbp)
movl -0x1b8(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl $0x0, %eax
movl %eax, -0x1b8(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0xe8(%rbp), %rax
movl %eax, -0x1a8(%rbp)
movsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x198(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x78c4
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x7886
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x208(%rbp)
jmp 0x7894
movl $0x2, %eax
movq %rax, -0x208(%rbp)
jmp 0x7894
movq -0x208(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
imulq $0x30, 0x8(%rax), %rsi
callq 0x2330
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, (%rcx)
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq -0x1c0(%rbp), %rsi
movl $0x30, %edx
callq 0x22c0
jmp 0x78f7
jmp 0x78f9
movq -0xf8(%rbp), %rdi
callq 0x2060
movq -0x100(%rbp), %rdi
callq 0x2060
movq -0x108(%rbp), %rdi
callq 0x2060
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x6aee
jmp 0x7930
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0xb0(%rbp), %rax
jae 0x7967
movq -0xa0(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x8460
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x7938
movq -0xa0(%rbp), %rdi
callq 0x2060
movq -0x88(%rbp), %rdi
callq 0x2060
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
nopl (%rax,%rax)