// File: chhylp123[P]hifiasm/ecovlp.cpp
// Function: ha_print_ovlp_stat_1(ec_ovec_buf_t*, unsigned long, unsigned long)
void ha_print_ovlp_stat_1(ec_ovec_buf_t *b, uint64_t n_thre, uint64_t n_a)
{
    double tt0 = yak_realtime_0();
    uint64_t k, forward, reverse, strong, weak, exact, no_l_indel;

    forward = reverse = strong = weak = exact = no_l_indel = 0;

    ///calculate overlaps
    for (k = 0; k < n_thre; ++k) {
        b->a[k].cnt[0] = b->a[k].cnt[1] = b->a[k].cnt[2] = b->a[k].cnt[3] = b->a[k].cnt[4] = b->a[k].cnt[5] = 0;
    }

    kt_for(n_thre, worker_hap_dc_ec_gen, b, n_a);

    for (k = 0; k < n_thre; ++k) {
        forward += b->a[k].cnt[0];
        reverse += b->a[k].cnt[1];
        strong += b->a[k].cnt[2];
        weak += b->a[k].cnt[3];
        exact += b->a[k].cnt[4];
        no_l_indel += b->a[k].cnt[5];
    }

    fprintf(stderr, "[M::%s] # overlaps: %lu\n", __func__, forward);
	fprintf(stderr, "[M::%s] # strong overlaps: %lu\n", __func__, strong);
	fprintf(stderr, "[M::%s] # weak overlaps: %lu\n", __func__, weak);
	fprintf(stderr, "[M::%s] # exact overlaps: %lu\n", __func__, exact); // this seems not right
	fprintf(stderr, "[M::%s] # inexact overlaps: %lu\n", __func__, forward - exact);
	fprintf(stderr, "[M::%s] # overlaps without large indels: %lu\n", __func__, no_l_indel);
	fprintf(stderr, "[M::%s] # reverse overlaps: %lu\n", __func__, reverse);
    fprintf(stderr, "[M::%s] # running time: %.3f\n", __func__, yak_realtime_0()-tt0);

    // fprintf(stderr, "\n[M::%s] # reads->%lu\n", __func__, n_a);
    // fprintf(stderr, "[M::%s] # corrected reads->%lu\n", __func__, rb);
    // fprintf(stderr, "[M::%s] # uncorrected reads->%lu\n", __func__, urb);
    // fprintf(stderr, "[M::%s::%.3f]\n", __func__, yak_realtime_0()-tt0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
callq 0x1b7cc0
movsd %xmm0, -0x20(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x267a93
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xe8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xe0(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xd8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xd0(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xc8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xc0(%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2679c6
movq -0x10(%rbp), %rax
movl %eax, %edi
movq -0x8(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0x228(%rip), %rsi       # 0x267cd0
callq 0x16d710
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x267b9a
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq 0xc0(%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq 0xc8(%rax), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq 0xd0(%rax), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq 0xd8(%rax), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq 0xe0(%rax), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x28(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq 0xe8(%rax), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x267ab5
movq 0x15c43f(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x30(%rbp), %rcx
leaq 0x128610(%rip), %rsi    # 0x3901bf
leaq 0x128622(%rip), %rdx    # 0x3901d8
movb $0x0, %al
callq 0x22a0
movq 0x15c41c(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x40(%rbp), %rcx
leaq 0x12861b(%rip), %rsi    # 0x3901ed
leaq 0x1285ff(%rip), %rdx    # 0x3901d8
movb $0x0, %al
callq 0x22a0
movq 0x15c3f9(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x48(%rbp), %rcx
leaq 0x128618(%rip), %rsi    # 0x39020d
leaq 0x1285dc(%rip), %rdx    # 0x3901d8
movb $0x0, %al
callq 0x22a0
movq 0x15c3d6(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x50(%rbp), %rcx
leaq 0x128613(%rip), %rsi    # 0x39022b
leaq 0x1285b9(%rip), %rdx    # 0x3901d8
movb $0x0, %al
callq 0x22a0
movq 0x15c3b3(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x30(%rbp), %rcx
subq -0x50(%rbp), %rcx
leaq 0x12860b(%rip), %rsi    # 0x39024a
leaq 0x128592(%rip), %rdx    # 0x3901d8
movb $0x0, %al
callq 0x22a0
movq 0x15c38c(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x58(%rbp), %rcx
leaq 0x128609(%rip), %rsi    # 0x39026b
leaq 0x12856f(%rip), %rdx    # 0x3901d8
movb $0x0, %al
callq 0x22a0
movq 0x15c369(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x38(%rbp), %rcx
leaq 0x128614(%rip), %rsi    # 0x390299
leaq 0x12854c(%rip), %rdx    # 0x3901d8
movb $0x0, %al
callq 0x22a0
movq 0x15c346(%rip), %rax    # 0x3c3fe0
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x1b7cc0
movq -0x60(%rbp), %rdi
subsd -0x20(%rbp), %xmm0
leaq 0x128604(%rip), %rsi    # 0x3902ba
leaq 0x12851b(%rip), %rdx    # 0x3901d8
movb $0x1, %al
callq 0x22a0
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)