// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: print_utg_coverage(ma_ug_t*, ma_sub_t*, unsigned int, ma_hit_t_alloc*)
void print_utg_coverage(ma_ug_t *ug, ma_sub_t* coverage_cut, uint32_t v, ma_hit_t_alloc* sources)
{
    asg_t* nsg = ug->g;
    uint32_t rId, k, j;
    ma_utg_t* u = NULL;
    ma_hit_t *h;

    if(nsg->seq[v].del) return;
    u = &(ug->u.a[v]);
    if(u->m == 0) return;
    long long R_bases = 0, C_bases = 0;
    long long U_R_bases = 0, U_C_bases = 0;
    for (k = 0; k < u->n; k++)
    {
        rId = u->a[k]>>33;
        C_bases = 0;
        R_bases = coverage_cut[rId].e - coverage_cut[rId].s;
        for (j = 0; j < (uint64_t)(sources[rId].length); j++)
        {
            h = &(sources[rId].buffer[j]);
            if(h->el != 1) continue;
            C_bases += Get_qe((*h)) - Get_qs((*h));
        }
        U_R_bases += R_bases;
        U_C_bases += C_bases;
        C_bases = C_bases/R_bases;

        fprintf(stderr, "%.*s\t%lld\n", (int)Get_NAME_LENGTH(R_INF, rId), Get_NAME(R_INF, rId), C_bases);
    }

    fprintf(stderr, "v: %u, coverage: %lld\n\n", v, U_C_bases/U_R_bases);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x14e666
jmp 0x14e848
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x14e68b
jmp 0x14e848
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x14e81a
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x2c(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x10(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
movl -0x2c(%rbp), %edx
imulq $0xc, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subl %ecx, %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x20(%rbp), %rcx
movl -0x2c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
jae 0x14e782
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzbl 0x20(%rax), %eax
cmpl $0x1, %eax
je 0x14e75d
jmp 0x14e777
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
subl %ecx, %eax
movl %eax, %eax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x14e716
movq -0x50(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rax
cqto
idivq -0x50(%rbp)
movq %rax, -0x58(%rbp)
movq 0x275831(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x276b17(%rip), %rax    # 0x3c52d0
movq 0x40(%rax), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
leaq 0x276b00(%rip), %rcx    # 0x3c52d0
movq 0x40(%rcx), %rcx
movl -0x2c(%rbp), %edx
subq (%rcx,%rdx,8), %rax
movl %eax, %edx
leaq 0x276aec(%rip), %rax    # 0x3c52d0
movq 0x8(%rax), %rcx
leaq 0x276ae1(%rip), %rax    # 0x3c52d0
movq 0x40(%rax), %rax
movl -0x2c(%rbp), %esi
addq (%rax,%rsi,8), %rcx
movq -0x58(%rbp), %r8
leaq 0x23aedd(%rip), %rsi    # 0x3896e2
movb $0x0, %al
callq 0x22a0
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x14e6b2
movq 0x2757bf(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x68(%rbp), %rax
cqto
idivq -0x60(%rbp)
movl -0x6c(%rbp), %edx
movq %rax, %rcx
leaq 0x23aeac(%rip), %rsi    # 0x3896ed
movb $0x0, %al
callq 0x22a0
addq $0x70, %rsp
popq %rbp
retq
nop