// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]yahs/graph.c
// Function: graph_print_all_clusters
void graph_print_all_clusters(graph_t *g, FILE *fp)
{
    uint32_t nv, na, v, i, c;
    uint64_t lens;
    graph_arc_t *av, *a;
    kdq_t(uint32_t) *q, *s;
    
    graph_remove_multi_arcs(g);
    graph_add_symm_arcs(g);

    nv = graph_n_vtx(g);
    q = kdq_init(uint32_t);
    s = kdq_init(uint32_t);
    uint8_t *visited = calloc(nv, sizeof(uint8_t));

    c = 0;
    for (i = 0; i < nv; ++i) {
        if (visited[i]) 
            continue;
        kdq_push(uint32_t, q, i << 1);
        kdq_push(uint32_t, s, i);
        visited[i] = 1;
        while (kdq_size(q) > 0) {
            v = *kdq_shift(uint32_t, q);
            na = graph_arc_n(g, v);
            if (na) {
                av = graph_arc_a(g, v);
                for (a = av; a < av + na; ++a) {
                    if (!visited[(a->w) >> 1]) {
                        kdq_push(uint32_t, q, a->w);
                        kdq_push(uint32_t, s, a->w >> 1);
                        visited[a->w >> 1] = 1;
                    }
                }
            }
            na = graph_arc_n(g, v^1);
            if (na) {
                av = graph_arc_a(g, v^1);
                for (a = av; a < av + na; ++a) {
                    if (!visited[(a->w^1) >> 1]) {
                        kdq_push(uint32_t, q, a->w^1);
                        kdq_push(uint32_t, s, (a->w^1) >> 1);
                        visited[(a->w^1) >> 1] = 1;
                    }
                }    
            }
        }

        lens = 0;
        for (i = 0; i < kdq_size(s); ++i)
            lens += g->sdict->s[kdq_at(s, i)].len;
        fprintf(fp, "Cluster %d [%ld seqs, %ld bp]:", ++c, kdq_size(s), lens);
        while (kdq_size(s) > 0)
            fprintf(fp, " %s", g->sdict->s[*kdq_shift(uint32_t, s)].name);
        fprintf(fp, "\n");
    }
    
    kdq_destroy(uint32_t, q);
    kdq_destroy(uint32_t, s);
    free(visited);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
callq 0x641c
movq %r14, %rdi
callq 0x64b3
movq 0x8(%r14), %rax
movl (%rax), %ebx
callq 0x82c2
movq %rax, %r12
callq 0x82c2
movq %rax, %r13
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x2290
movq %rbx, %rcx
movq %rax, %rbp
movl $0x0, 0xc(%rsp)
xorl %r15d, %r15d
movq %r14, 0x20(%rsp)
movq %rbx, 0x18(%rsp)
cmpl %ecx, %r15d
jae 0x6827
movl %r15d, %ebx
cmpb $0x0, (%rbp,%rbx)
jne 0x681f
leal (%r15,%r15), %esi
movq %r12, %rdi
callq 0x684d
movq %r13, %rdi
movl %r15d, %esi
callq 0x684d
movb $0x1, (%rbp,%rbx)
cmpq $0x0, 0x8(%r12)
je 0x676e
movq %r12, %rdi
callq 0x699a
movl (%rax), %r15d
movq 0x28(%r14), %rax
movq (%rax,%r15,8), %rbx
movq %r14, %rcx
movq %rbx, %r14
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %r14
je 0x66fd
shrq $0x1b, %rbx
andq $-0x20, %rbx
addq 0x20(%rcx), %rbx
shlq $0x5, %r14
addq %rbx, %r14
cmpq %r14, %rbx
jae 0x66f4
movl 0x4(%rbx), %esi
movl %esi, %eax
shrl %eax
cmpb $0x0, (%rbp,%rax)
jne 0x66ee
movq %r12, %rdi
callq 0x684d
movl 0x4(%rbx), %esi
shrl %esi
movq %r13, %rdi
callq 0x684d
movl 0x4(%rbx), %eax
shrl %eax
movb $0x1, (%rbp,%rax)
addq $0x20, %rbx
jmp 0x66bc
movq 0x20(%rsp), %rcx
movq 0x28(%rcx), %rax
xorq $0x1, %r15
movq (%rax,%r15,8), %r15
movq %r15, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
andq %rax, %rbx
movq %rcx, %r14
je 0x667a
shrq $0x1b, %r15
andq $-0x20, %r15
addq 0x20(%r14), %r15
shlq $0x5, %rbx
addq %r15, %rbx
cmpq %rbx, %r15
jae 0x667a
movl 0x4(%r15), %esi
movl %esi, %eax
shrl %eax
cmpb $0x0, (%rbp,%rax)
jne 0x6768
xorl $0x1, %esi
movq %r12, %rdi
callq 0x684d
movl 0x4(%r15), %esi
shrl %esi
movq %r13, %rdi
callq 0x684d
movl 0x4(%r15), %eax
shrl %eax
movb $0x1, (%rbp,%rax)
addq $0x20, %r15
jmp 0x672c
movq 0x8(%r13), %r15
xorl %r8d, %r8d
xorl %eax, %eax
movabsq $0x3ffffffffffffff, %rdi # imm = 0x3FFFFFFFFFFFFFF
movl %eax, %eax
cmpq %rax, %r15
jbe 0x67b2
movq 0x8(%r14), %rcx
movq 0x8(%rcx), %rcx
movq 0x18(%r13), %rdx
movq (%r13), %rsi
andq %rdi, %rsi
addq %rax, %rsi
andq 0x10(%r13), %rsi
movl (%rdx,%rsi,4), %edx
imulq $0x58, %rdx, %rdx
addq 0x8(%rcx,%rdx), %r8
incl %eax
jmp 0x6781
movl 0xc(%rsp), %edx
incl %edx
movq 0x10(%rsp), %rdi
leaq 0x17c08(%rip), %rsi     # 0x1e3cc
movl %edx, 0xc(%rsp)
movq %r15, %rcx
xorl %eax, %eax
callq 0x22c0
movq %r15, %rax
testq %rax, %rax
je 0x680d
movq 0x8(%r14), %rax
movq 0x8(%rax), %rbx
movq %r13, %rdi
callq 0x699a
movl (%rax), %eax
imulq $0x58, %rax, %rax
movq (%rbx,%rax), %rdx
movq 0x10(%rsp), %rdi
leaq 0x17950(%rip), %rsi     # 0x1e150
xorl %eax, %eax
callq 0x22c0
movq 0x8(%r13), %rax
jmp 0x67d5
pushq $0xa
popq %rdi
movq 0x10(%rsp), %rsi
callq 0x2260
movq 0x18(%rsp), %rcx
incl %r15d
jmp 0x6647
movq %r12, %rdi
callq 0x69e4
movq %r13, %rdi
callq 0x69e4
movq %rbp, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2060