// File: chhylp123[P]hifiasm/hic.cpp
// Function: all_pair_shortest_path(asg_t*, hc_links*, MT*)
void all_pair_shortest_path(asg_t *sg, hc_links* link, MT* M)
{
    hc_linkeage* t = NULL;
    pdq pq;
    init_pdq(&pq, sg->n_seq<<1);
    uint32_t n_vtx = sg->n_seq<<1, v;
    uint64_t k, *p = NULL;

    for (v = 0; v < n_vtx; ++v)
    {
        if (sg->seq[v>>1].del) continue;
        t = &(link->a.a[v>>1]);
        if (t->e.n == 0) continue;
        get_shortest_path(v, &pq, sg, NULL);
        for (k = 0; k < pq.dis.n; k++)
        {
            if(pq.dis.a[k] == (uint64_t)-1) continue;
            kv_pushp(uint64_t, M->matrix.a[v].a, &p);
            (*p) = k << M->uID_shift;
            (*p) = (*p) | pq.dis.a[k];
        }
    }
    
    destory_pdq(&pq);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movslq %eax, %rsi
leaq -0x88(%rbp), %rdi
callq 0x1cb9c0
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x8c(%rbp)
movq $0x0, -0xa0(%rbp)
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jae 0x1cc539
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x90(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x1cc309
jmp 0x1cc525
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1cc335
jmp 0x1cc525
movl -0x90(%rbp), %edi
movq -0x8(%rbp), %rdx
leaq -0x88(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1cc080
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x1cc523
movq -0x48(%rbp), %rax
movq -0x98(%rbp), %rcx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x1cc382
jmp 0x1cc50c
jmp 0x1cc384
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x90(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0x1cc481
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x1cc3fc
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xa8(%rbp)
jmp 0x1cc40a
movl $0x2, %eax
movq %rax, -0xa8(%rbp)
jmp 0x1cc40a
movq -0xa8(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x90(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rdx
movl -0x90(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shlq %cl, %rax
movq %rax, %rcx
movq -0xa0(%rbp), %rax
movq %rcx, (%rax)
movq -0xa0(%rbp), %rax
movq (%rax), %rcx
movq -0x48(%rbp), %rax
movq -0x98(%rbp), %rdx
orq (%rax,%rdx,8), %rcx
movq -0xa0(%rbp), %rax
movq %rcx, (%rax)
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x1cc35a
jmp 0x1cc525
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x1cc2d5
leaq -0x88(%rbp), %rdi
callq 0x1cbb60
addq $0xb0, %rsp
popq %rbp
retq
nop