LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/graph.c
// Function: graph_add_symm_arcs
int graph_add_symm_arcs(graph_t *g)
{
    uint32_t na, v, w, n_add;
    graph_arc_t *av, *a;

    // need to do it this as graph_add_arc could reallocate g->arc
    na = g->n_arc;
    av = g->arc;
    n_add = 0;
    for (a = av; a < av + na; ++a) {
        v = a->v;
        w = a->w;
        if (!graph_arc(g, w^1, v^1))
            ++n_add;
    }
    uint64_t old_m = g->m_arc;
    while (g->m_arc < na + n_add)
        g->m_arc <<= 1;
    g->arc = (graph_arc_t *) realloc(g->arc, g->m_arc * sizeof(graph_arc_t));
    memset(&g->arc[old_m], 0, (g->m_arc - old_m) * sizeof(graph_arc_t));
    
    av = g->arc;
    for (a = av; a < av + na; ++a) {
        v = a->v;
        w = a->w;
        if (graph_arc(g, w^1, v^1))
            continue;
        graph_add_arc(g, w^1, v^1, -1, 0, .0);
    }
#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] number symm-arcs added: %d\n", __func__, n_add);
#endif
    graph_arc_sort(g);
    graph_arc_index(g);

    return n_add;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq 0x20(%rdi), %rdi
movl %eax, %r13d
movq %r13, %r12
shlq $0x5, %r12
testq %r13, %r13
je 0x8a77
leaq (%rdi,%r12), %rcx
movq 0x28(%rbx), %rdx
xorl %r14d, %r14d
movq %rdi, %rsi
movl 0x4(%rsi), %r8d
xorq $0x1, %r8
movq (%rdx,%r8,8), %r10
testl %r10d, %r10d
je 0x8a63
movl (%rsi), %r9d
movq %r10, %r8
shrq $0x1b, %r8
andq $-0x20, %r8
addq %rdi, %r8
movl %r10d, %r10d
movl 0x4(%r8), %r11d
xorl %r9d, %r11d
cmpl $0x1, %r11d
je 0x8a57
addq $0x20, %r8
decq %r10
jne 0x8a3e
xorl %r8d, %r8d
xorl %r9d, %r9d
testq %r8, %r8
sete %r9b
jmp 0x8a69
movl $0x1, %r9d
addl %r9d, %r14d
addq $0x20, %rsi
cmpq %rcx, %rsi
jb 0x8a19
jmp 0x8a7a
xorl %r14d, %r14d
movq 0x10(%rbx), %rbp
addl %r14d, %eax
movq %rbp, %rsi
cmpq %rax, %rbp
jae 0x8a98
movq %rbp, %rsi
addq %rsi, %rsi
cmpq %rax, %rsi
jb 0x8a8c
movq %rsi, 0x10(%rbx)
shlq $0x5, %rsi
callq 0x2390
movq %rax, %r15
movq %rax, 0x20(%rbx)
movq %rbp, %rdi
shlq $0x5, %rdi
addq %rax, %rdi
movq 0x10(%rbx), %rdx
subq %rbp, %rdx
shlq $0x5, %rdx
xorl %esi, %esi
callq 0x21e0
testq %r13, %r13
je 0x8b2a
addq %r15, %r12
movl (%r15), %edx
movl 0x4(%r15), %esi
xorq $0x1, %rsi
xorl $0x1, %edx
movq 0x28(%rbx), %rax
movq (%rax,%rsi,8), %rcx
testl %ecx, %ecx
je 0x8b0c
movq %rcx, %rax
shrq $0x1b, %rax
andq $-0x20, %rax
addq 0x20(%rbx), %rax
movl %ecx, %ecx
cmpl %edx, 0x4(%rax)
je 0x8b07
addq $0x20, %rax
decq %rcx
jne 0x8af7
xorl %eax, %eax
testq %rax, %rax
jne 0x8b21
xorps %xmm0, %xmm0
movq %rbx, %rdi
movq $-0x1, %rcx
xorl %r8d, %r8d
callq 0x8408
addq $0x20, %r15
cmpq %r12, %r15
jb 0x8acc
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdi
shlq $0x5, %rsi
addq %rdi, %rsi
callq 0x826f
movq %rbx, %rdi
callq 0x85bd
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/graph.c
// Function: trim_graph_tips
int trim_graph_tips(graph_t *g)
{
    uint32_t v, nv, n_del;
    graph_arc_t *av;
    nv = graph_n_vtx(g);
    nv <<= 1;
    n_del = 0;

    for (v = 0; v < nv; ++v) {
        if (graph_arc_n(g, v^1) != 1 || graph_arc_n(g, v) > 0)
            continue;
        av = graph_arc_a(g, v^1);
        if (graph_arc_n(g, av->w^1) > 1 && !is_mwt(g, av->w^1, v))
            n_del += graph_arc_del_existed(g, av);
    }

    graph_clean(g, 1);

#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] #del tips: %u\n", __func__, n_del);
#endif

    return n_del;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x8(%rdi), %rax
movl (%rax), %ecx
addl %ecx, %ecx
je 0x944d
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movl %ecx, %ecx
xorl %edx, %edx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x1, %r8d
xorl %ebx, %ebx
movq 0x28(%rdi), %r14
movl %edx, %r9d
xorq $0x1, %r9
movq (%r14,%r9,8), %r10
cmpl $0x1, %r10d
jne 0x936b
cmpl $0x0, (%r14,%rdx,8)
je 0x9378
incq %rdx
cmpq %rcx, %rdx
jne 0x934f
jmp 0x944f
movq 0x20(%rdi), %r9
shrq $0x1b, %r10
andq $-0x20, %r10
movl 0x4(%r9,%r10), %r11d
xorq $0x1, %r11
movq (%r14,%r11,8), %r14
testl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
je 0x936b
movq %r14, %r15
andq %rsi, %r15
je 0x93e2
shrq $0x1b, %r14
andq $-0x20, %r14
addq %r9, %r14
shlq $0x5, %r15
addq %r14, %r15
xorl %ebp, %ebp
xorpd %xmm0, %xmm0
movsd 0x10(%r14), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x93d5
movl 0x4(%r14), %r12d
cmpq %r12, %rdx
cmovel %r8d, %ebp
movapd %xmm1, %xmm0
addq $0x20, %r14
cmpq %r15, %r14
jb 0x93ba
testl %ebp, %ebp
jne 0x936b
addq %r10, %r9
movq 0x18(%r9), %r14
xorl %r10d, %r10d
testq %rax, %r14
jne 0x9445
orq %rax, %r14
movq %r14, 0x18(%r9)
movq 0x28(%rdi), %r10
movq (%r10,%r11,8), %r14
movq %r14, %r11
movl $0x1, %r10d
andq %rsi, %r11
je 0x9445
movl (%r9), %r9d
movq 0x20(%rdi), %r15
shrq $0x20, %r14
shlq $0x5, %r11
shlq $0x5, %r14
addq %r15, %r14
addq $0x18, %r14
xorl %r15d, %r15d
movl -0x14(%r14,%r15), %ebp
xorl %r9d, %ebp
cmpl $0x1, %ebp
jne 0x943c
orq %rax, (%r14,%r15)
addq $0x20, %r15
cmpq %r15, %r11
jne 0x942b
addl %r10d, %ebx
jmp 0x936b
xorl %ebx, %ebx
movl $0x1, %esi
callq 0x8744
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/graph.c
// Function: trim_graph_blunts
int trim_graph_blunts(graph_t *g)
{
    uint32_t v, nv, na, n_del;
    uint8_t del;
    graph_arc_t *a, *av;
    nv = graph_n_vtx(g);
    nv <<= 1;
    n_del = 0;

    for (v = 0; v < nv; ++v) {
        if (graph_arc_n(g, v^1) > 0)
            continue;
        na = graph_arc_n(g, v);
        if (na > 1) {
            av = graph_arc_a(g, v);
            del = 1;
            for (a = av; a < av + na; ++a) {
                if (graph_arc_n(g, a->w) < 1) {
                    del = 0;
                    break;
                }
            }
            if (del)
                for (a = av; a < av + na; ++a)
                    n_del += graph_arc_del_existed(g, a);
        }
    }

    graph_clean(g, 1);

#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] #del blunts: %u\n", __func__, n_del);
#endif

    return n_del;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x8(%rdi), %rax
movl (%rax), %ecx
addl %ecx, %ecx
je 0x9567
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movl %ecx, %ecx
xorl %edx, %edx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ebx, %ebx
movq 0x28(%rdi), %r10
movl %edx, %r8d
xorq $0x1, %r8
cmpl $0x0, (%r10,%r8,8)
je 0x94ae
incq %rdx
cmpq %rcx, %rdx
jne 0x948f
jmp 0x9569
movq (%r10,%rdx,8), %r8
testl $0xfffffffe, %r8d       # imm = 0xFFFFFFFE
je 0x94a1
movl %r8d, %r9d
testq %r9, %r9
je 0x94a1
shrq $0x1b, %r8
andq $-0x20, %r8
addq 0x20(%rdi), %r8
shlq $0x5, %r9
addq %r8, %r9
movq %r8, %r11
movl 0x4(%r11), %r14d
cmpl $0x0, (%r10,%r14,8)
je 0x94a1
addq $0x20, %r11
cmpq %r9, %r11
jb 0x94d9
movq 0x18(%r8), %r11
xorl %r10d, %r10d
testq %rax, %r11
jne 0x9556
orq %rax, %r11
movq %r11, 0x18(%r8)
movl 0x4(%r8), %r10d
xorq $0x1, %r10
movq 0x28(%rdi), %r11
movq (%r11,%r10,8), %r14
movq %r14, %r11
movl $0x1, %r10d
andq %rsi, %r11
je 0x9556
movl (%r8), %ebp
movq 0x20(%rdi), %r15
shrq $0x20, %r14
shlq $0x5, %r11
shlq $0x5, %r14
addq %r15, %r14
addq $0x18, %r14
xorl %r15d, %r15d
movl -0x14(%r14,%r15), %r12d
xorl %ebp, %r12d
cmpl $0x1, %r12d
jne 0x954d
orq %rax, (%r14,%r15)
addq $0x20, %r15
cmpq %r15, %r11
jne 0x953b
addl %r10d, %ebx
addq $0x20, %r8
cmpq %r9, %r8
jb 0x94ed
jmp 0x94a1
xorl %ebx, %ebx
movl $0x1, %esi
callq 0x8744
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/graph.c
// Function: trim_graph_self_loops
int trim_graph_self_loops(graph_t *g)
{
    uint32_t n_del;
    graph_arc_t *a, *aw;
    n_del = 0;
    for (a = g->arc; a < g->arc + g->n_arc; ++a) {
        // might have bugs here
        if (graph_arc_n(g, a->v) > 1) 
            continue;
        aw = graph_arc(g, a->w, a->v);
        if (aw) 
            n_del += graph_arc_del_existed(g, aw);
    }

    graph_clean(g, 1);

#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] #del self loops: %u\n", __func__, n_del);
#endif

    return n_del;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpq $0x0, 0x18(%rdi)
jle 0x99dd
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq 0x20(%rdi), %rsi
xorl %ebx, %ebx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rsi, %rdx
movq 0x28(%rdi), %r9
movl (%rdx), %r8d
testl $0xfffffffe, (%r9,%r8,8) # imm = 0xFFFFFFFE
jne 0x99bf
movl 0x4(%rdx), %r10d
movq (%r9,%r10,8), %r9
testl %r9d, %r9d
je 0x994f
movq %r9, %r10
shrq $0x1b, %r10
andq $-0x20, %r10
addq %r10, %rsi
movl %r9d, %r9d
cmpl %r8d, 0x4(%rsi)
je 0x9951
addq $0x20, %rsi
decq %r9
jne 0x9940
xorl %esi, %esi
testq %rsi, %rsi
je 0x99bf
movq 0x18(%rsi), %r9
xorl %r8d, %r8d
testq %rax, %r9
jne 0x99bc
orq %rax, %r9
movq %r9, 0x18(%rsi)
movl 0x4(%rsi), %r8d
xorq $0x1, %r8
movq 0x28(%rdi), %r9
movq (%r9,%r8,8), %r10
movq %r10, %r9
movl $0x1, %r8d
andq %rcx, %r9
je 0x99bc
movl (%rsi), %esi
movq 0x20(%rdi), %r11
shrq $0x20, %r10
shlq $0x5, %r9
shlq $0x5, %r10
addq %r11, %r10
addq $0x18, %r10
xorl %r11d, %r11d
movl -0x14(%r10,%r11), %ebp
xorl %esi, %ebp
cmpl $0x1, %ebp
jne 0x99b3
orq %rax, (%r10,%r11)
addq $0x20, %r11
cmpq %r11, %r9
jne 0x99a3
addl %r8d, %ebx
addq $0x20, %rdx
movq 0x18(%rdi), %r8
movq 0x20(%rdi), %rsi
shlq $0x5, %r8
addq %rsi, %r8
cmpq %r8, %rdx
jb 0x990d
jmp 0x99df
xorl %ebx, %ebx
movl $0x1, %esi
callq 0x8744
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/graph.c
// Function: trim_graph_transitive_edges
int trim_graph_transitive_edges(graph_t *g)
{
    // TODO a more sophisticated implemetation for transitive edges > 2
    uint32_t v, nv, na, n_del;
    graph_arc_t *a1, *a2, *av;
    nv = graph_n_vtx(g);
    nv <<= 1;
    n_del = 0;

    for (v = 0; v < nv; ++v) {
        na = graph_arc_n(g, v);
        if (na < 2) 
            continue;
        av = graph_arc_a(g, v);
        for (a1 = av; a1 < av + na; ++a1) {
            for (a2 = av; a2 < av + na; ++a2) {
                if (a1 == a2) 
                    continue;
                if (graph_arc(g, a1->w, a2->w))
                    n_del += graph_arc_del_existed(g, a2);
            }
        }
    }

    graph_clean(g, 1);

#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] #del transitive edges: %u\n", __func__, n_del);
#endif

    return n_del;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x8(%rdi), %rax
movl (%rax), %ecx
addl %ecx, %ecx
je 0x9b36
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movl %ecx, %ecx
movq %rcx, (%rsp)
xorl %edx, %edx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ebx, %ebx
movq 0x28(%rdi), %r8
movq (%r8,%rdx,8), %r8
testl $0xfffffffe, %r8d       # imm = 0xFFFFFFFE
je 0x9b27
movl %r8d, %r9d
testq %r9, %r9
je 0x9b27
shrq $0x1b, %r8
andq $-0x20, %r8
addq 0x20(%rdi), %r8
shlq $0x5, %r9
addq %r8, %r9
movq %r8, %r10
movq %r8, %r11
cmpq %r11, %r10
je 0x9b0d
movl 0x4(%r10), %r14d
movq 0x28(%rdi), %r15
movq (%r15,%r14,8), %r12
testl %r12d, %r12d
je 0x9b0d
movl 0x4(%r11), %r14d
movq %r12, %r15
shrq $0x1b, %r15
andq $-0x20, %r15
addq 0x20(%rdi), %r15
movl %r12d, %r12d
cmpl %r14d, 0x4(%r15)
je 0x9aa4
addq $0x20, %r15
decq %r12
jne 0x9a92
xorl %r15d, %r15d
testq %r15, %r15
je 0x9b0d
movq 0x18(%r11), %r15
xorl %ebp, %ebp
testq %rax, %r15
jne 0x9b0b
orq %rax, %r15
movq %r15, 0x18(%r11)
xorq $0x1, %r14
movq 0x28(%rdi), %r15
movq (%r15,%r14,8), %r12
movq %r12, %r14
movl $0x1, %ebp
andq %rsi, %r14
je 0x9b0b
movl (%r11), %r15d
movq 0x20(%rdi), %r13
shrq $0x20, %r12
shlq $0x5, %r14
shlq $0x5, %r12
addq %r13, %r12
addq $0x18, %r12
xorl %r13d, %r13d
movl -0x14(%r12,%r13), %ecx
xorl %r15d, %ecx
cmpl $0x1, %ecx
jne 0x9b02
orq %rax, (%r12,%r13)
addq $0x20, %r13
cmpq %r13, %r14
jne 0x9af1
addl %ebp, %ebx
addq $0x20, %r11
cmpq %r9, %r11
jb 0x9a5e
addq $0x20, %r10
cmpq %r9, %r10
jb 0x9a5b
incq %rdx
cmpq (%rsp), %rdx
jne 0x9a24
jmp 0x9b38
xorl %ebx, %ebx
movl $0x1, %esi
callq 0x8744
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/graph.c
// Function: trim_graph_pop_undirected
int trim_graph_pop_undirected(graph_t *g)
{
    uint32_t v, w, n_del;
    graph_arc_t *a;
    n_del = 0;
    for (a = g->arc; a < g->arc + g->n_arc; ++a) {
        if (graph_arc_n(g, a->v) != 1)
            continue;
        v = a->v;
        w = a->w;
        if (graph_arc(g, v^1, w) &&
                graph_arc_n(g, v^1) > 1 &&
                graph_arc_n(g, w) > 0) {
            ++n_del;
            graph_arc_del(g, w^1, v, 1);
            graph_arc_del(g, v^1, w, 1);
        }
    }

    graph_clean(g, 1);

#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] #solved undirected: %u\n", __func__, n_del);
#endif

    return n_del;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpq $0x0, 0x18(%rdi)
jle 0x9f1a
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq 0x20(%rdi), %r8
xorl %ebx, %ebx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %r8, %rdx
movq 0x28(%rdi), %r11
movl (%rdx), %r9d
cmpl $0x1, (%r11,%r9,8)
jne 0x9efc
movl 0x4(%rdx), %esi
movq %r9, %r10
xorq $0x1, %r10
movq (%r11,%r10,8), %r14
testl %r14d, %r14d
je 0x9e5f
movq %r14, %r15
shrq $0x1b, %r15
andq $-0x20, %r15
addq %r8, %r15
movl %r14d, %r12d
cmpl %esi, 0x4(%r15)
je 0x9e56
addq $0x20, %r15
decq %r12
jne 0x9e44
xorl %r15d, %r15d
testq %r15, %r15
sete %bpl
jmp 0x9e62
movb $0x1, %bpl
testl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
je 0x9efc
testb %bpl, %bpl
jne 0x9efc
cmpl $0x0, (%r11,%rsi,8)
je 0x9efc
movq %rsi, %r14
xorq $0x1, %r14
movq (%r11,%r14,8), %r14
movq %r14, %r11
andq %rcx, %r11
je 0x9ebc
shrq $0x20, %r14
shlq $0x5, %r11
shlq $0x5, %r14
addq %r14, %r8
addq $0x18, %r8
xorl %r14d, %r14d
cmpl %r9d, -0x14(%r8,%r14)
jne 0x9eb3
orq %rax, (%r8,%r14)
addq $0x20, %r14
cmpq %r14, %r11
jne 0x9ea8
incl %ebx
movq 0x28(%rdi), %r8
movq (%r8,%r10,8), %r9
movq %r9, %r8
andq %rcx, %r8
je 0x9efc
movq 0x20(%rdi), %r10
shrq $0x20, %r9
shlq $0x5, %r8
shlq $0x5, %r9
addq %r10, %r9
addq $0x18, %r9
xorl %r10d, %r10d
cmpl %esi, -0x14(%r9,%r10)
jne 0x9ef3
orq %rax, (%r9,%r10)
addq $0x20, %r10
cmpq %r10, %r8
jne 0x9ee8
addq $0x20, %rdx
movq 0x18(%rdi), %rsi
movq 0x20(%rdi), %r8
shlq $0x5, %rsi
addq %r8, %rsi
cmpq %rsi, %rdx
jb 0x9e0e
jmp 0x9f1c
xorl %ebx, %ebx
movl $0x1, %esi
callq 0x8744
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/graph.c
// Function: trim_graph_weak_edges
int trim_graph_weak_edges(graph_t *g)
{
    uint32_t n_del;
    graph_arc_t *a;
    n_del = 0;
    for (a = g->arc; a < g->arc + g->n_arc; ++a)
        if (exist_strong_edge(g, a->v, a->wt) && exist_strong_edge(g, a->w^1, a->wt))
            n_del += graph_arc_del_existed(g, a);

    graph_clean(g, 1);

#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] #del weak edges: %u\n", __func__, n_del);
#endif

    return n_del;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpq $0x0, 0x18(%rdi)
jle 0xa076
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq 0x20(%rdi), %r8
xorl %ebx, %ebx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %r8, %rdx
movl (%rdx), %esi
movq 0x28(%rdi), %r10
movq (%r10,%rsi,8), %r9
testl $0xfffffffe, %r9d       # imm = 0xFFFFFFFE
je 0xa058
movl %r9d, %r11d
testq %r11, %r11
je 0xa058
movsd 0x10(%rdx), %xmm0
shrq $0x1b, %r9
andq $-0x20, %r9
addq %r8, %r9
shlq $0x5, %r11
addq %r9, %r11
movsd 0x10(%r9), %xmm1
ucomisd %xmm0, %xmm1
ja 0x9fab
addq $0x20, %r9
cmpq %r11, %r9
jb 0x9f91
jmp 0xa058
movl 0x4(%rdx), %r9d
xorq $0x1, %r9
movq (%r10,%r9,8), %r11
testl $0xfffffffe, %r11d      # imm = 0xFFFFFFFE
je 0xa058
movl %r11d, %r10d
testq %r10, %r10
je 0xa058
shrq $0x1b, %r11
andq $-0x20, %r11
addq %r11, %r8
shlq $0x5, %r10
addq %r8, %r10
movsd 0x10(%r8), %xmm1
ucomisd %xmm0, %xmm1
ja 0x9ff9
addq $0x20, %r8
cmpq %r10, %r8
jb 0x9fe2
jmp 0xa058
movq 0x18(%rdx), %r10
xorl %r8d, %r8d
testq %rax, %r10
jne 0xa055
orq %rax, %r10
movq %r10, 0x18(%rdx)
movq 0x28(%rdi), %r8
movq (%r8,%r9,8), %r10
movq %r10, %r9
movl $0x1, %r8d
andq %rcx, %r9
je 0xa055
movq 0x20(%rdi), %r11
shrq $0x20, %r10
shlq $0x5, %r9
shlq $0x5, %r10
addq %r11, %r10
addq $0x18, %r10
xorl %r11d, %r11d
movl -0x14(%r10,%r11), %ebp
xorl %esi, %ebp
cmpl $0x1, %ebp
jne 0xa04c
orq %rax, (%r10,%r11)
addq $0x20, %r11
cmpq %r11, %r9
jne 0xa03c
addl %r8d, %ebx
addq $0x20, %rdx
movq 0x18(%rdi), %rsi
movq 0x20(%rdi), %r8
shlq $0x5, %rsi
addq %r8, %rsi
cmpq %rsi, %rdx
jb 0x9f57
jmp 0xa078
xorl %ebx, %ebx
movl $0x1, %esi
callq 0x8744
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/graph.c
// Function: trim_graph_ambiguous_edges
int trim_graph_ambiguous_edges(graph_t *g)
{
    uint32_t n_del;
    graph_arc_t *a;
    n_del = 0;
    for (a = g->arc; a < g->arc + g->n_arc; ++a)
        if (graph_arc_n(g, a->v) > 1 || graph_arc_n(g, a->w^1) > 1)
            n_del += graph_arc_del_existed(g, a);

    graph_clean(g, 1);

#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] #del ambiguous edges: %u\n", __func__, n_del);
#endif

    return n_del;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpq $0x0, 0x18(%rdi)
jle 0xa152
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq 0x20(%rdi), %rcx
xorl %ebx, %ebx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x28(%rdi), %r8
movl (%rcx), %esi
testl $0xfffffffe, (%r8,%rsi,8) # imm = 0xFFFFFFFE
jne 0xa0d0
movl 0x4(%rcx), %r9d
xorq $0x1, %r9
testl $0xfffffffe, (%r8,%r9,8) # imm = 0xFFFFFFFE
je 0xa137
movq 0x18(%rcx), %r9
xorl %r8d, %r8d
testq %rax, %r9
jne 0xa134
orq %rax, %r9
movq %r9, 0x18(%rcx)
movl 0x4(%rcx), %r8d
xorq $0x1, %r8
movq 0x28(%rdi), %r9
movq (%r9,%r8,8), %r10
movq %r10, %r9
movl $0x1, %r8d
andq %rdx, %r9
je 0xa134
movq 0x20(%rdi), %r11
shrq $0x20, %r10
shlq $0x5, %r9
shlq $0x5, %r10
addq %r11, %r10
addq $0x18, %r10
xorl %r11d, %r11d
movl -0x14(%r10,%r11), %ebp
xorl %esi, %ebp
cmpl $0x1, %ebp
jne 0xa12b
orq %rax, (%r10,%r11)
addq $0x20, %r11
cmpq %r11, %r9
jne 0xa11b
addl %r8d, %ebx
addq $0x20, %rcx
movq 0x18(%rdi), %rsi
shlq $0x5, %rsi
addq 0x20(%rdi), %rsi
cmpq %rsi, %rcx
jb 0xa0ae
jmp 0xa154
xorl %ebx, %ebx
movl $0x1, %esi
callq 0x8744
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: inter_link_mat_destroy
void inter_link_mat_destroy(inter_link_mat_t *link_mat)
{
    if (!link_mat) return;
    uint32_t i, j;
    for (i = 0; i < link_mat->n; ++i) {
        if (link_mat->links[i].n) {
            for (j = 0; j < 4; ++j) {
                free(link_mat->links[i].link[j]);
                free(link_mat->links[i].linkb[j]);
            }
        }
    }
    if (link_mat->links)
        free(link_mat->links);
    free(link_mat);
}

// Assembly:
testq %rdi, %rdi
je 0xc4bb
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, (%rdi)
je 0xc49c
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movq %r15, %rcx
shlq $0x7, %rcx
cmpl $0x0, 0x14(%rax,%rcx)
je 0xc48e
movl $0x4, %r12d
movq %r14, %r13
movq 0x10(%rbx), %rax
movq 0x20(%rax,%r13), %rdi
callq 0x2060
movq 0x10(%rbx), %rax
movq 0x40(%rax,%r13), %rdi
callq 0x2060
addq $0x8, %r13
decq %r12
jne 0xc469
incq %r15
movl (%rbx), %eax
subq $-0x80, %r14
cmpq %rax, %r15
jb 0xc44e
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0xc4aa
callq 0x2060
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2060
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: estimate_inter_link_mat_init_rss
long estimate_inter_link_mat_init_rss(asm_dict_t *dict, uint32_t resolution, uint32_t radius)
{
    long bytes, p, m;
    uint32_t i, j, b0, b1, n, r, r2;

    n = dict->n;
    m = (long) n * (n - 1) / 2;
    if (m > UINT32_MAX)
        return -1;

    r2 = resolution * 2;

    bytes = 0;
    bytes += sizeof(inter_link_mat_t);
    bytes += m * sizeof(inter_link_t);

    for (i = 0; i < n; ++i) {
        if (dict->s[i].len < r2)
            continue;

        b0 = MIN(radius, div_ceil(dict->s[i].len, r2));
        for (j = i + 1; j < n; ++j) {
            if (dict->s[j].len < r2)
                continue;

            b1 = MIN(radius, div_ceil(dict->s[j].len, r2));
            p = b0 * b1;
            if (p > UINT32_MAX)
                return -1;
            r = MIN(radius, (uint32_t) (b0 + b1 - 1));

            bytes += (p + r) * 4 * sizeof(double);
        }
    }

    return bytes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl (%rdi), %ecx
leal -0x1(%rcx), %r12d
movq %r12, %rax
movq %rcx, 0x8(%rsp)
imulq %rcx, %rax
movq %rax, %rcx
shrq $0x21, %rcx
movq $-0x1, 0x10(%rsp)
jne 0xc940
shlq $0x6, %rax
movabsq $0x7fffffff80, %rcx     # imm = 0x7FFFFFFF80
andq %rax, %rcx
orq $0x18, %rcx
movq %rcx, 0x10(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0xc940
movl %edx, %ebx
movq %rdi, %r14
addl %esi, %esi
movl %esi, 0x4(%rsp)
movl %esi, %r13d
movl $0x60, %eax
movq %rax, 0x20(%rsp)
xorl %ebp, %ebp
movq 0x8(%r14), %rax
imulq $0x58, %rbp, %r15
movq 0x8(%rax,%r15), %rdi
cmpq %r13, %rdi
movq %r12, 0x28(%rsp)
jb 0xc924
movl 0x4(%rsp), %esi
callq 0x4bf1
movl %ebx, %ecx
movq %rcx, 0x18(%rsp)
cmpl %ebx, %eax
ja 0xc8b0
movq 0x8(%r14), %rax
movq 0x8(%rax,%r15), %rdi
movl 0x4(%rsp), %esi
callq 0x4bf1
movq %rax, 0x18(%rsp)
leaq 0x1(%rbp), %rax
cmpq 0x8(%rsp), %rax
jae 0xc924
movq 0x18(%rsp), %rax
decl %eax
movq %rax, 0x30(%rsp)
movl %r12d, %r15d
movq 0x20(%rsp), %r12
movq 0x8(%r14), %rax
movq (%rax,%r12), %rdi
cmpq %r13, %rdi
jb 0xc91b
movl 0x4(%rsp), %esi
callq 0x4bf1
movl %eax, %ecx
movl %ebx, %eax
cmpl %ebx, %ecx
ja 0xc8fe
movq 0x8(%r14), %rax
movq (%rax,%r12), %rdi
movl 0x4(%rsp), %esi
callq 0x4bf1
movq 0x30(%rsp), %rcx
addl %eax, %ecx
imull 0x18(%rsp), %eax
cmpl %ebx, %ecx
cmovael %ebx, %ecx
addq %rax, %rcx
shlq $0x5, %rcx
addq %rcx, 0x10(%rsp)
addq $0x58, %r12
decl %r15d
jne 0xc8cf
incq %rbp
addq $0x58, 0x20(%rsp)
movq 0x28(%rsp), %r12
decl %r12d
cmpq 0x8(%rsp), %rbp
jne 0xc86a
movq 0x10(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: intra_link_mat_init
intra_link_mat_t *intra_link_mat_init(void *dict, uint32_t resolution, int use_gap_seq)
{
    intra_link_mat_t *link_mat;
    intra_link_t *link;
    uint32_t i, n, b, p;
    uint64_t len;

    n = use_gap_seq? ((asm_dict_t *) dict)->n : ((sdict_t *) dict)->n;
    link_mat = (intra_link_mat_t *) malloc(sizeof(intra_link_mat_t));
    link_mat->n = n;
    link_mat->links = (intra_link_t *) calloc(n, sizeof(intra_link_t));

    for (i = 0; i < n; ++i) {
        link = &link_mat->links[i];
        link->c = i;
        len = use_gap_seq? ((asm_dict_t *) dict)->s[i].len : ((sdict_t *) dict)->s[i].len;
        if (len < resolution) {
            link->n = 0;
            continue;
        }
        b = div_ceil(len, resolution);
        link->n = b;
        p = (long) b * (b + 1) / 2;
        link->link = (double *) calloc(p, sizeof(double));
        if (!link->link) {
            fprintf(stderr, "[E::%s] memory allocation failure\n", __func__);
            exit(EXIT_FAILURE);
        }

#ifdef DEBUG_INTRA
        fprintf(stderr, "[DEBUG_INTRA::%s] %s bins: %d\n", __func__, use_gap_seq? ((asm_dict_t *) dict)->s[i].name : ((sdict_t *) dict)->s[i].name, link->n);
#endif
    }

    return link_mat;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, 0x4(%rsp)
movl %esi, (%rsp)
movq %rdi, 0x8(%rsp)
movl (%rdi), %r15d
movl $0x10, %r12d
movl $0x10, %edi
callq 0x2330
movq %rax, %rbx
movl %r15d, (%rax)
movl $0x10, %esi
movq %r15, %rdi
callq 0x2290
movq %rbx, 0x10(%rsp)
movq %rax, 0x8(%rbx)
testq %r15, %r15
je 0xca2e
movq %rax, %r13
movl (%rsp), %ebp
addq $0x8, %r13
movl $0x8, %ebx
xorl %r14d, %r14d
movl %r14d, -0x8(%r13)
cmpl $0x0, 0x4(%rsp)
je 0xc9d2
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%rbx), %rdi
jmp 0xc9df
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movl (%rax,%r12), %edi
cmpq %rbp, %rdi
jae 0xc9ee
movl $0x0, -0x4(%r13)
jmp 0xca1a
movl (%rsp), %esi
callq 0x4bf1
movl %eax, -0x4(%r13)
movl %eax, %ecx
incl %eax
imulq %rcx, %rax
shrq %rax
movl %eax, %edi
movl $0x8, %esi
callq 0x2290
movq %rax, (%r13)
testq %rax, %rax
je 0xca42
incq %r14
addq $0x10, %r13
addq $0x18, %r12
addq $0x58, %rbx
cmpq %r14, %r15
jne 0xc9b8
movq 0x10(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x28ae
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: estimate_intra_link_mat_init_rss
long estimate_intra_link_mat_init_rss(void *dict, uint32_t resolution, int use_gap_seq)
{
    long bytes, p;
    uint32_t i, n, b;
    uint64_t len;

    n = use_gap_seq? ((asm_dict_t *) dict)->n : ((sdict_t *) dict)->n;

    bytes = 0;
    bytes += sizeof(intra_link_mat_t);
    bytes += n * sizeof(intra_link_t);

    for (i = 0; i < n; ++i) {
        len = use_gap_seq? ((asm_dict_t *) dict)->s[i].len : ((sdict_t *) dict)->s[i].len;
        if (len < resolution)
            continue;
        b = div_ceil(len, resolution);
        p = (long) b * (b + 1) / 2;
        if (p > UINT32_MAX)
            return -1;

        bytes += p * sizeof(double);
    }
    return bytes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl (%rdi), %eax
movq %rax, %rbx
shlq $0x4, %rbx
addq $0x10, %rbx
testq %rax, %rax
je 0xcaf7
movl %edx, %r12d
movq %rdi, %r13
movl %esi, %r8d
shlq $0x3, %rax
leaq (%rax,%rax,2), %r10
movl $0x8, %r14d
xorl %ebp, %ebp
movq %r8, 0x10(%rsp)
movq %r10, 0x8(%rsp)
testl %r12d, %r12d
je 0xca9d
movq 0x8(%r13), %rax
movq (%rax,%r14), %rdi
jmp 0xcaa5
movq 0x8(%r13), %rax
movl 0x10(%rax,%rbp), %edi
cmpq %r8, %rdi
jb 0xcae1
movl %esi, %r15d
callq 0x4bf1
movl %eax, %ecx
incl %eax
imulq %rcx, %rax
movq %rax, %rcx
shrq $0x21, %rcx
jne 0xcaf0
movabsq $0x1fffffffe, %rcx      # imm = 0x1FFFFFFFE
andq %rcx, %rax
leaq (%rbx,%rax,4), %rbx
movl %r15d, %esi
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %r10
addq $0x18, %rbp
addq $0x58, %r14
cmpq %rbp, %r10
jne 0xca8e
jmp 0xcaf7
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: cov_norm_from_file
cov_norm_t *cov_norm_from_file(const char *f, sdict_t *dict)
{
    uint32_t i;
    uint64_t m, n;
    double *norm_a, **norm;
    int64_t magic_number;
    cov_norm_t *cov_norm;
    FILE *fp;
    
    fp = fopen(f, "r");
    if (fp == NULL)
        return 0;

    m = fread(&magic_number, sizeof(int64_t), 1, fp);
    if (m != 1) bin_fread_error();
    if (!is_valid_bin_header(magic_number)) {
        fprintf(stderr, "[E::%s] not a valid BIN file\n", __func__);
        fclose(fp);
        return 0;
    }
    file_seek_skip_sdict(fp);
    m = fread(&n, sizeof(uint64_t), 1, fp);
    if (m != 1) bin_fread_error();
    fseek(fp, n * 17, SEEK_CUR);
    m = fread(&n, sizeof(uint64_t), 1, fp);
    if (m != 1) bin_fread_error();
    norm_a = (double *) malloc(sizeof(double) * n);
    m = fread(norm_a, sizeof(double), n, fp);
    if (m != n) bin_fread_error();
    
    norm = (double **) malloc(sizeof(double *) * dict->n);
    norm[0] = norm_a;
    for (i = 1; i < dict->n; ++i)
        norm[i] = norm[i-1] + div_ceil(dict->s[i-1].len, COV_NORM_WINDOW);
    
    fclose(fp);
    
    cov_norm = (cov_norm_t *) malloc(sizeof(cov_norm_t));
    cov_norm->n = n;
    cov_norm->w = COV_NORM_WINDOW;
    cov_norm->norm = norm;

    return cov_norm;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
leaq 0x14983(%rip), %rsi     # 0x2240f
callq 0x23e0
testq %rax, %rax
je 0xdbf7
movq %rax, %r14
leaq 0x10(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x20f0
cmpq $0x1, %rax
je 0xdac1
xorl %eax, %eax
callq 0x4c81
movq 0x10(%rsp), %rdi
callq 0x4c6e
testl %eax, %eax
je 0xdbef
movq %r14, %rdi
callq 0x15804
movq %rsp, %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x20f0
cmpq $0x1, %rax
je 0xdafd
xorl %eax, %eax
callq 0x4c81
movq %rsp, %r15
movq (%r15), %rax
movq %rax, %rsi
shlq $0x4, %rsi
addq %rax, %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x2370
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x20f0
cmpq $0x1, %rax
je 0xdb3c
xorl %eax, %eax
callq 0x4c81
movq (%rsp), %r15
leaq (,%r15,8), %rdi
callq 0x2330
movq %rax, %r13
movl $0x8, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x20f0
movq %r15, 0x8(%rsp)
cmpq %r15, %rax
je 0xdb74
xorl %eax, %eax
callq 0x4c81
movl (%rbx), %ebp
leaq (,%rbp,8), %rdi
callq 0x2330
movq %rax, %r12
movq %r13, (%rax)
cmpq $0x2, %rbp
jb 0xdbc8
movl $0x1, %r13d
movl $0x2, %ebp
movq -0x8(%r12,%r13,8), %r15
movq 0x8(%rbx), %rax
movl (%rax,%rbp,8), %edi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x4bf1
movl %eax, %eax
leaq (%r15,%rax,8), %rax
movq %rax, (%r12,%r13,8)
incq %r13
movl (%rbx), %eax
addq $0x3, %rbp
cmpq %rax, %r13
jb 0xdb9a
movq %r14, %rdi
callq 0x2150
movl $0x18, %edi
callq 0x2330
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
movl $0x3e8, 0x8(%rax)       # imm = 0x3E8
movq %r12, 0x10(%rax)
jmp 0xdbf9
movq %r14, %rdi
callq 0x2914
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: norm_destroy
void norm_destroy(norm_t *norm)
{
    if (!norm) return;
    //uint32_t i;
    free(norm->bs);
    //for (i = 0; i < norm->n; ++i)
    //    free(norm->link[i]);
    //free(norm->link);
    free(norm->linkc);
    free(norm->norms);
    free(norm);
}

// Assembly:
testq %rdi, %rdi
je 0xdc35
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x2060
movq 0x18(%rbx), %rdi
callq 0x2060
movq 0x10(%rbx), %rdi
callq 0x2060
movq %rbx, %rdi
popq %rbx
jmp 0x2060
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: print_inter_link_norms
void print_inter_link_norms(FILE *fp, inter_link_mat_t *link_mat, asm_dict_t *dict)
{
    uint32_t i, n;
    inter_link_t *link;

    n = link_mat->n;
    for (i = 0; i < n; ++i) {
        link = &link_mat->links[i];
        if (link->n)
            fprintf(fp, "NORM: %s %s (%u) [%.3f %.3f %.3f %.3f]\n", dict->s[link->c0].name, dict->s[link->c1].name, link->n0, link->norms[0], link->norms[1], link->norms[2], link->norms[3]);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl (%rsi), %r13d
testq %r13, %r13
je 0xe09f
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
shlq $0x7, %r13
xorl %ebp, %ebp
leaq 0x137a4(%rip), %r12     # 0x217ea
movq 0x10(%r14), %rax
cmpl $0x0, 0x14(%rax,%rbp)
je 0xe096
movq 0x8(%rbx), %rcx
movl (%rax,%rbp), %edx
movl 0x4(%rax,%rbp), %esi
imulq $0x58, %rdx, %rdx
movq (%rcx,%rdx), %rdx
imulq $0x58, %rsi, %rsi
movq (%rcx,%rsi), %rcx
movl 0x18(%rax,%rbp), %r8d
movsd 0x60(%rax,%rbp), %xmm0
movsd 0x68(%rax,%rbp), %xmm1
movsd 0x70(%rax,%rbp), %xmm2
movsd 0x78(%rax,%rbp), %xmm3
movq %r15, %rdi
movq %r12, %rsi
movb $0x4, %al
callq 0x22c0
subq $-0x80, %rbp
cmpq %rbp, %r13
jne 0xe046
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: print_inter_link_bands
void print_inter_link_bands(FILE *fp, inter_link_mat_t *link_mat, asm_dict_t *dict)
{
    uint32_t i, j, k, n;
    inter_link_t *link;
    
    n = link_mat->n;
    for (i = 0; i < n; ++i) {
        link = &link_mat->links[i];
        if (link->n) {
            for (j = 0; j < 4; ++j) {
                fprintf(fp, "BAND [%u %u]: %s%s %s%s (%u, %u) [%.3f]", i, j, dict->s[link->c0].name, j < 2? "-" : "+", dict->s[link->c1].name, j & 1? "-" : "+", link->n0, link->r, link->norms[j]);
                for (k = 0; k < link->r; ++k)
                    fprintf(fp, " %.0f", link->linkb[j][k]);
                fprintf(fp, "\n");
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movl (%rsi), %eax
movq %rax, (%rsp)
testq %rax, %rax
je 0xe1d8
movq %rdi, %r15
xorl %edx, %edx
leaq 0x1375b(%rip), %rbp     # 0x2183c
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r13
movq %rdx, %rax
shlq $0x7, %rax
cmpl $0x0, 0x14(%r13,%rax)
je 0xe1cb
addq %rax, %r13
xorl %r14d, %r14d
movq %rdx, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %r10
movl (%r13), %eax
movl 0x4(%r13), %ecx
imulq $0x58, %rax, %rax
cmpq $0x2, %r14
leaq 0x13712(%rip), %rsi     # 0x2183a
movq %rsi, %r9
leaq 0x1320f(%rip), %rbx     # 0x21341
cmovbq %rbx, %r9
imulq $0x58, %rcx, %rcx
movq %rcx, 0x20(%rsp)
testb $0x1, %r14b
cmoveq %rsi, %rbx
movq (%r10,%rax), %r8
movl 0x18(%r13), %r12d
movl 0x10(%r13), %r11d
movsd 0x60(%r13,%r14,8), %xmm0
movq %r15, %rdi
leaq 0x136ae(%rip), %rsi     # 0x21812
movl %r14d, %ecx
movb $0x1, %al
pushq %r11
pushq %r12
pushq %rbx
movq 0x38(%rsp), %r11
pushq (%r10,%r11)
callq 0x22c0
addq $0x20, %rsp
cmpl $0x0, 0x10(%r13)
je 0xe1ac
xorl %ebx, %ebx
movq 0x40(%r13,%r14,8), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r15, %rdi
movq %rbp, %rsi
movb $0x1, %al
callq 0x22c0
incq %rbx
movl 0x10(%r13), %eax
cmpq %rax, %rbx
jb 0xe189
movl $0xa, %edi
movq %r15, %rsi
callq 0x2260
incq %r14
cmpq $0x4, %r14
movq 0x18(%rsp), %rdx
jne 0xe108
incq %rdx
cmpq (%rsp), %rdx
jne 0xe0e1
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: get_max_inter_norms
double *get_max_inter_norms(inter_link_mat_t *link_mat, asm_dict_t *dict)
{
    uint32_t i, j, n, c0, c1;
    double *max_norms;
    inter_link_t *link;

    n = link_mat->n;
    max_norms = (double *) calloc(dict->n, sizeof(double));
    for (i = 0; i < n; ++i) {
        link = &link_mat->links[i];
        if (link->n) {
            c0 = link->c0;
            c1 = link->c1;
            for (j = 0; j < 4; ++j) {
                max_norms[c0] = MAX(max_norms[c0], link->norms[j]);
                max_norms[c1] = MAX(max_norms[c1], link->norms[j]);
            }
        }
    }
    return max_norms;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %r14d
movl (%rsi), %edi
movl $0x8, %esi
callq 0x2290
testq %r14, %r14
je 0xe261
movq 0x10(%rbx), %rcx
leaq 0x60(%rcx), %rdx
xorl %esi, %esi
movq %rsi, %r8
shlq $0x7, %r8
cmpl $0x0, 0x14(%rcx,%r8)
je 0xe255
addq %rcx, %r8
movl (%r8), %edi
movl 0x4(%r8), %r8d
xorl %r9d, %r9d
movsd (%rax,%rdi,8), %xmm0
movsd (%rdx,%r9,8), %xmm1
maxsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rdi,8)
movsd (%rax,%r8,8), %xmm0
maxsd %xmm1, %xmm0
movsd %xmm0, (%rax,%r8,8)
incq %r9
cmpq $0x4, %r9
jne 0xe228
incq %rsi
subq $-0x80, %rdx
cmpq %r14, %rsi
jne 0xe20c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: print_norms
void print_norms(FILE *fp, norm_t *norm)
{
    uint32_t i/**, j, n**/;
    //uint64_t link_count;
    //double *link;

    //link_count = 0;

    fprintf(fp, "norms:");
    for (i = 0; i < norm->n; ++i)
        fprintf(fp, " %.1f", norm->norms[i]);
    fprintf(fp, "\n");
    
    fprintf(fp, "links:");
    for (i = 0; i < norm->n; ++i)
        fprintf(fp, " %.0f", norm->linkc[i]);
    fprintf(fp, "\n");

    /***
    for (i = 0; i < norm->n; ++i) {
        fprintf(fp, "band %d:", i);
        n = norm->bs[i];
        link = norm->link[i];
        for (j = 0; j < n; ++j) {
            link_count += link[j];
            fprintf(fp, " %.0f", link[j]);
        }
        fprintf(fp, "\n");
    }
    **/
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x135c4(%rip), %rdi     # 0x21842
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x24d0
cmpl $0x0, (%r14)
je 0xe2c2
xorl %r12d, %r12d
leaq 0x135a9(%rip), %r15     # 0x21849
movq 0x10(%r14), %rax
movsd (%rax,%r12,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x22c0
incq %r12
movl (%r14), %eax
cmpq %rax, %r12
jb 0xe2a0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x2260
leaq 0x13579(%rip), %rdi     # 0x2184f
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x24d0
cmpl $0x0, (%r14)
je 0xe31a
xorl %r12d, %r12d
leaq 0x13544(%rip), %r15     # 0x2183c
movq 0x18(%r14), %rax
movsd (%rax,%r12,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x22c0
incq %r12
movl (%r14), %eax
cmpq %rax, %r12
jb 0xe2f8
movl $0xa, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2260
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: estimate_noise
int estimate_noise(inter_link_mat_t *link_mat)
{
    uint32_t i, j, k, n;
    uint32_t bin, *hist;
    uint64_t total;
    double l;
    inter_link_t *inter_link;

    bin = 4096;
    hist = (uint32_t *) calloc(bin, sizeof(uint32_t));
    for (i = 0; i < link_mat->n; ++i) {
        inter_link = &link_mat->links[i];
        n = inter_link->n;
        for (j = 0; j < n; ++j) {
            for (k = 0; k < 4; ++k) {
                l = inter_link->link[k][j];
                if (l < .0) 
                    continue;
                ++hist[MIN(bin - 1, (int) l)];
            }
        }
    }
   
    hist[0] = 0;

    total = 0;
    for (i = 0; i < bin; ++i)
        total += hist[i];
    total >>= 1;

#ifdef DEBUG_NOISE
    for (i = 0; i < bin; ++i)
        fprintf(stderr, "[DEBUG_NOISE::%s] noise bin %d %d\n", __func__, i, hist[i]);
#endif

    n = 0;
    while (hist[n] < total) {
        ++n;
        if (n == bin)
            break;
        hist[n] += hist[n - 1];
    }

    if (n == 4096)
        fprintf(stderr, "[W::%s] noise esimation might be incorrect %d\n", __func__, n);
    
    free(hist);

    return n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1000, %edi           # imm = 0x1000
movl $0x4, %esi
callq 0x2290
movq %rax, %rbx
movl (%r14), %eax
testq %rax, %rax
je 0xe3ba
movq 0x10(%r14), %rcx
leaq 0x20(%rcx), %rdx
xorl %esi, %esi
xorpd %xmm0, %xmm0
movl $0xfff, %edi            # imm = 0xFFF
movq %rsi, %r8
shlq $0x7, %r8
movl 0x14(%rcx,%r8), %r8d
testq %r8, %r8
je 0xe3ae
xorl %r9d, %r9d
xorl %r10d, %r10d
movq (%rdx,%r10,8), %r11
movsd (%r11,%r9,8), %xmm1
ucomisd %xmm1, %xmm0
ja 0xe39d
cvttsd2si %xmm1, %r11d
cmpl %edi, %r11d
cmovael %edi, %r11d
incl (%rbx,%r11,4)
incq %r10
cmpq $0x4, %r10
jne 0xe37d
incq %r9
cmpq %r8, %r9
jne 0xe37a
incq %rsi
subq $-0x80, %rdx
cmpq %rax, %rsi
jne 0xe366
movl $0x0, (%rbx)
xorl %ecx, %ecx
xorl %eax, %eax
movl (%rbx,%rcx,4), %edx
addq %rdx, %rax
incq %rcx
cmpq $0x1000, %rcx           # imm = 0x1000
jne 0xe3c4
shrq %rax
movl (%rbx), %ecx
xorl %r14d, %r14d
cmpq %rcx, %rax
jbe 0xe409
xorl %r14d, %r14d
cmpq $0xfff, %r14            # imm = 0xFFF
je 0xe403
addl 0x4(%rbx,%r14,4), %ecx
movl %ecx, 0x4(%rbx,%r14,4)
incq %r14
cmpq %rcx, %rax
ja 0xe3e6
jmp 0xe409
movl $0x1000, %r14d          # imm = 0x1000
cmpl $0x1000, %r14d          # imm = 0x1000
je 0xe425
movq %rbx, %rdi
callq 0x2060
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x295f
jmp 0xe412
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/link.c
// Function: parse_bam_rec
static char *parse_bam_rec(bam1_t *b, bam_header_t *h, int32_t *s, int32_t *e, uint8_t *q, char **cname)
{
    // 0x4 0x100 0x200 0x400 0x800
    if ((b->core.flag & 0xF04) || (!b->core.flag))
        return 0;
    *cname = h->target_name[b->core.tid];
    *s = b->core.pos;
    *e = get_target_end(b);
    *q = b->core.qual;

    return strdup(bam1_qname(b));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %r15
movq 0x8(%rdi), %rax
shrq $0x20, %rax
testl $0xf04, %eax            # imm = 0xF04
setne %cl
testw %ax, %ax
sete %al
orb %cl, %al
je 0xfcfc
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r8, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %rax
movslq (%rdi), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, (%r9)
movl 0x4(%rdi), %eax
movl %eax, (%rdx)
callq 0x56a1
movl %eax, (%r15)
movb 0xa(%r14), %al
movb %al, (%rbx)
movq 0x30(%r14), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2510
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/cov.c
// Function: cov_init
cov_t *cov_init(uint32_t n)
{
    cov_t *cov = (cov_t *) malloc(sizeof(cov_t));
    cov->n = n;
    cov->p = (pos_t *) malloc(sizeof(pos_t) * n);
    uint32_t i;
    for (i = 0; i < n; ++i)
        kv_init(cov->p[i]);

    return cov;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebp
movl $0x10, %edi
callq 0x2330
movq %rax, %rbx
movl %ebp, (%rax)
movl %ebp, %r14d
leaq (,%r14,8), %rax
leaq (%rax,%rax,2), %rdi
callq 0x2330
movq %rax, 0x8(%rbx)
testl %ebp, %ebp
je 0x1609b
shlq $0x3, %r14
leaq (%r14,%r14,2), %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x21e0
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/cov.c
// Function: cov_destroy
void cov_destroy(cov_t* cov)
{
    if (!cov) return;
    uint32_t i;
    for (i = 0; i < cov->n; ++i)
        kv_destroy(cov->p[i]);
    free(cov->p);
    free(cov);

    return;
}

// Assembly:
testq %rdi, %rdi
je 0x160ef
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, (%rdi)
je 0x160d9
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x2060
incq %r15
movl (%rbx), %eax
addq $0x18, %r14
cmpq %rax, %r15
jb 0x160be
movq 0x8(%rbx), %rdi
callq 0x2060
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2060
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/cov.c
// Function: cov_norm_destroy
void cov_norm_destroy(cov_norm_t *cov_norm)
{
    if (!cov_norm) return;
    free(cov_norm->norm[0]);
    free(cov_norm->norm);
    free(cov_norm);

    return;
}

// Assembly:
testq %rdi, %rdi
je 0x16117
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movq (%rax), %rdi
callq 0x2060
movq 0x10(%rbx), %rdi
callq 0x2060
movq %rbx, %rdi
popq %rbx
jmp 0x2060
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/cov.c
// Function: pos_compression
uint64_t pos_compression(cov_t *cov)
{
    uint32_t i, p, p1;
    int32_t c;
    size_t j, k, n;
    uint64_t m, *a;
    
    m = 0;
    for (i = 0; i < cov->n; ++i) {
        a = cov->p[i].a;
        n = cov->p[i].n;
        if (n == 0) continue;

        qsort(a, n, sizeof(uint64_t), u64_cmpfunc);
        p = (uint32_t) (a[0] >> 32);
        c = (int32_t) a[0];
        k = 0;
        for(j = 1; j < n; ++j) {
            p1 = (uint32_t) (a[j] >> 32);
            if (p != p1) {
                if (c != 0) a[k++] = (uint64_t) p << 32 | (uint32_t) c;
                p = p1;
                c = (int32_t) a[j];
            } else {
                c += (int32_t) a[j];
            }
        }
        if (c != 0) a[k++] = (uint64_t) p << 32 | (uint32_t) c;
        cov->p[i].n = k;
        m += k;
    }

    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, (%rdi)
je 0x161f1
movq %rdi, %rbx
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
leaq (,%rbp,2), %r15
addq %rbp, %r15
movq (%rax,%r15,8), %r13
testq %r13, %r13
je 0x161e1
movq 0x10(%rax,%r15,8), %r12
movl $0x8, %edx
movq %r12, %rdi
movq %r13, %rsi
leaq 0x9f(%rip), %rcx        # 0x16206
callq 0x20e0
movq (%r12), %rcx
movq %rcx, %rdx
shrq $0x20, %rdx
cmpq $0x1, %r13
jne 0x16181
xorl %eax, %eax
jmp 0x161c2
movl $0x1, %esi
movl %edx, %edi
xorl %eax, %eax
movq (%r12,%rsi,8), %r8
movq %r8, %rdx
shrq $0x20, %rdx
cmpl %edx, %edi
jne 0x161a0
addl %r8d, %ecx
movl %edi, %edx
jmp 0x161b8
testl %ecx, %ecx
je 0x161b4
shlq $0x20, %rdi
movl %ecx, %ecx
orq %rdi, %rcx
movq %rcx, (%r12,%rax,8)
incq %rax
movl (%r12,%rsi,8), %ecx
incq %rsi
movl %edx, %edi
cmpq %rsi, %r13
jne 0x1618a
testl %ecx, %ecx
je 0x161d6
shlq $0x20, %rdx
movl %ecx, %ecx
orq %rdx, %rcx
movq %rcx, (%r12,%rax,8)
incq %rax
movq 0x8(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
addq %rax, %r14
incq %rbp
movl (%rbx), %eax
cmpq %rax, %rbp
jb 0x16134
jmp 0x161f4
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]yahs/cov.c
// Function: print_cov_in_bed
void print_cov_in_bed(cov_t *cov, sdict_t *sdict, FILE *fo)
{
    size_t i, j, s;
    int32_t c;
    uint32_t p, p1;
    uint64_t *a;

    for (i = 0; i < cov->n; ++i) {
        a = cov->p[i].a;
        s = cov->p[i].n;

        p = 0, c = 0;
        for (j = 0; j < s; ++j) {
            p1 = (uint32_t) (a[j] >> 32);
            if (p1 > p)
                fprintf(fo, "%s\t%u\t%u\t%d\n", sdict->s[i].name, p, p1, c);
            p = p1;
            c += (int32_t) a[j];
        }

        if (p < sdict->s[i].len)
            fprintf(fo, "%s\t%u\t%u\t%d\n", sdict->s[i].name, p, sdict->s[i].len, 0);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
cmpl $0x0, (%rdi)
je 0x16eda
xorl %ecx, %ecx
movq %rdi, 0x18(%rsp)
movq 0x8(%rdi), %rax
movq %rcx, 0x20(%rsp)
leaq (%rcx,%rcx,2), %r12
movq (%rax,%r12,8), %r15
movl $0x0, %ebp
testq %r15, %r15
je 0x16e90
movq 0x10(%rax,%r12,8), %rbx
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %r13d, %r13d
movl 0x4(%rbx,%r14,8), %ebp
cmpl %ebp, %ecx
jae 0x16e82
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%r12,8), %rdx
movq 0x8(%rsp), %rdi
leaq 0xb9fc(%rip), %rsi      # 0x22871
movl %ebp, %r8d
movl %r13d, %r9d
xorl %eax, %eax
callq 0x22c0
addl (%rbx,%r14,8), %r13d
incq %r14
movl %ebp, %ecx
cmpq %r14, %r15
jne 0x16e53
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax,%r12,8), %r8d
cmpl %r8d, %ebp
jae 0x16ec2
leaq (%rax,%r12,8), %rax
movq (%rax), %rdx
movq 0x8(%rsp), %rdi
leaq 0xb9bb(%rip), %rsi      # 0x22871
movl %ebp, %ecx
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x22c0
movq 0x20(%rsp), %rcx
incq %rcx
movq 0x18(%rsp), %rdi
movl (%rdi), %eax
cmpq %rax, %rcx
jb 0x16e2b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq