// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: debug_ma_hit_t(ma_hit_t_alloc*, ma_sub_t*, long long, int, int)
void debug_ma_hit_t(ma_hit_t_alloc* sources, ma_sub_t *coverage_cut, long long num_sources,
int max_hang, int min_ovlp)
{
    double startTime = Get_T();

    long long i, j, index;
    uint32_t qn, tn;
    ma_sub_t *sq = NULL;
    ma_sub_t *st = NULL;
    ma_hit_t *h = NULL;
    int32_t r_0, r_1;
    asg_arc_t t_0, t_1;
    fprintf(stderr, "start!\n");

    for (i = 0; i < num_sources; i++)
    {

        for (j = 0; j < sources[i].length; j++)
        {
            qn = Get_qn(sources[i].buffer[j]);
            tn = Get_tn(sources[i].buffer[j]);


            ///if(sources[i].buffer[j].del) continue;

            index = get_specific_overlap(&(sources[tn]), tn, qn);
            if(index == -1)
            {
                fprintf(stderr, "ERROR 0: qn: %u, tn: %u\n", qn, tn);
                continue;
            } 



            if(sources[i].buffer[j].del != sources[tn].buffer[index].del)
            {
                fprintf(stderr, "ERROR 2: qn: %u, tn: %u\n", qn, tn);
            }

            h = &(sources[i].buffer[j]);
            sq = &(coverage_cut[Get_qn(*h)]);
            st = &(coverage_cut[Get_tn(*h)]);
            r_0 = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, max_hang, 
                                asm_opt.max_hang_rate, min_ovlp, &t_0);


            h = &(sources[tn].buffer[index]);
            sq = &(coverage_cut[Get_qn(*h)]);
            st = &(coverage_cut[Get_tn(*h)]);
            r_1 = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, max_hang, 
                                asm_opt.max_hang_rate, min_ovlp, &t_1);
            t_0.ul=t_0.v=t_1.ul=t_1.v = 0;
            if(r_0 < 0 && r_1 < 0) continue;
            if((t_0.ul>>32) != (t_1.v^1)) fprintf(stderr, "ERROR 3: qn: %u, tn: %u\n", qn, tn);
            if((t_1.ul>>32) != (t_0.v^1)) fprintf(stderr, "ERROR 4: qn: %u, tn: %u\n", qn, tn);
        }
    }

    if(VERBOSE >= 1)
    {
        fprintf(stderr, "[M::%s] takes %0.2fs\n\n", __func__, Get_T()-startTime);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r8d, 0xc(%rsp)
movl %ecx, 0x8(%rsp)
movq %rdx, %rbx
movq %rsi, 0x40(%rsp)
movq %rdi, 0x18(%rsp)
callq 0x251c
movq 0x19329e(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x12b139(%rip), %rdi    # 0x1eae85
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
xorl %eax, %eax
testq %rbx, %rbx
cmovleq %rax, %rbx
movq %rbx, 0x30(%rsp)
xorl %eax, %eax
cmpq 0x30(%rsp), %rax
je 0xbff6e
movq %rax, 0x38(%rsp)
imulq $0x18, %rax, %rax
addq 0x18(%rsp), %rax
movq %rax, (%rsp)
xorl %r15d, %r15d
xorl %r14d, %r14d
movq (%rsp), %rax
movl 0xc(%rax), %eax
cmpq %rax, %r14
jae 0xbff61
movq (%rsp), %rax
movq (%rax), %r12
movq (%r12,%r15), %r13
shrq $0x20, %r13
movl 0xc(%r12,%r15), %ebp
imulq $0x18, %rbp, %rbx
addq 0x18(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %esi
movl %r13d, %edx
callq 0x696ab
leaq 0x12b0c2(%rip), %rsi    # 0x1eae8d
cmpq $-0x1, %rax
je 0xbff46
movq %r14, 0x48(%rsp)
movq %r13, %rcx
movq (%rbx), %r13
imulq $0x28, %rax, %r14
movq 0x18(%r13,%r14), %rax
xorq 0x18(%r12,%r15), %rax
movq %rbp, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
js 0xbfedd
addq %r15, %r12
imulq $0xc, %rcx, %rcx
imulq $0xc, %rbp, %rax
movq %r15, 0x50(%rsp)
movq 0x40(%rsp), %r15
movl 0x4(%r15,%rcx), %esi
movl (%r15,%rcx), %ecx
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andl %ebx, %ecx
subl %ecx, %esi
movl 0x4(%r15,%rax), %edx
movl (%r15,%rax), %eax
andl %ebx, %eax
subl %eax, %edx
leaq 0x19391f(%rip), %rax    # 0x253758
movss 0x158(%rax), %xmm0
movss %xmm0, 0x10(%rsp)
movq %r12, %rdi
movl 0x8(%rsp), %ebp
movl %ebp, %ecx
movl 0xc(%rsp), %r12d
movl %r12d, %r8d
leaq 0x70(%rsp), %r9
callq 0x6a4a7
movl %eax, 0x14(%rsp)
leaq (%r14,%r13), %rdi
movl 0x4(%r13,%r14), %eax
movl 0xc(%r13,%r14), %ecx
imulq $0xc, %rax, %rax
imulq $0xc, %rcx, %rcx
movl 0x4(%r15,%rax), %esi
movl (%r15,%rax), %eax
andl %ebx, %eax
subl %eax, %esi
movl 0x4(%r15,%rcx), %edx
movl (%r15,%rcx), %eax
movq 0x50(%rsp), %r15
andl %ebx, %eax
subl %eax, %edx
movl %ebp, %ecx
movss 0x10(%rsp), %xmm0
movl %r12d, %r8d
leaq 0x58(%rsp), %r9
callq 0x6a4a7
andl $0x0, 0x60(%rsp)
andq $0x0, 0x58(%rsp)
andl $0x0, 0x78(%rsp)
andq $0x0, 0x70(%rsp)
testl %eax, 0x14(%rsp)
movq 0x48(%rsp), %r14
jns 0xbff18
incq %r14
addq $0x28, %r15
jmp 0xbfd8a
movq 0x1930fc(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x12afb8(%rip), %rsi    # 0x1eaea6
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0x22b0
movq (%rsp), %rax
movq (%rax), %r12
movl 0x4(%r12,%r15), %ecx
movl 0xc(%r12,%r15), %ebp
movq (%rbx), %r13
jmp 0xbfdfe
movq 0x1930c1(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x12af96(%rip), %rsi    # 0x1eaebf
movq 0x28(%rsp), %r13
movl %r13d, %edx
movq 0x20(%rsp), %rbp
movl %ebp, %ecx
xorl %eax, %eax
callq 0x22b0
leaq 0x12af92(%rip), %rsi    # 0x1eaed8
movq 0x193093(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movl %r13d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x22b0
jmp 0xbfed1
movq 0x38(%rsp), %rax
incq %rax
jmp 0xbfd67
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq