// File: chhylp123[P]hifiasm/Hash_Table.cpp
// Function: debug_chain_single_site(k_mer_hit*, long long, Chain_Data*, int, int, int)
void debug_chain_single_site(k_mer_hit* a, long long a_n, Chain_Data* dp, int x_readLen, int y_readLen, int s_index)
{
    long long j, current_j = s_index;
    long long selfLen = 0, indels = 0;
    long long distance_self_pos, distance_pos, distance_gap;

    j = s_index;
    while (j >= 0)
    {
        current_j = j;

        j = dp->pre[j];

        if(j != -1)
        {
            distance_self_pos = a[current_j].self_offset - a[j].self_offset;
            distance_pos = a[current_j].offset - a[j].offset;
            distance_gap = distance_pos > distance_self_pos? distance_pos - distance_self_pos : distance_self_pos - distance_pos;

            indels += distance_gap; 
            selfLen += distance_self_pos;
        }
        fprintf(stderr, "j: %lld, score: %lld, occ: %d, pre_j: %lld\n", 
                    current_j, (long long)dp->score[current_j], dp->occ[current_j], j);
    }

    fprintf(stderr, "s_self_offset: %u, s_offset: %u, e_self_offset: %u, e_offset: %u, ovlp length: %lld, x_readLen: %d, y_readLen: %d\n", 
    a[s_index].self_offset, a[s_index].offset, a[current_j].self_offset, a[current_j].offset,
    get_chainLen(a[s_index].self_offset, a[current_j].self_offset, x_readLen, 
                                     a[s_index].offset, a[current_j].offset, y_readLen), x_readLen, y_readLen);

    if(indels != dp->indels[s_index])
    {
        fprintf(stderr, "indels: %lld, dp->indels[i]: %ld\n", indels, (long)dp->indels[s_index]);
    }

    if(selfLen != dp->self_length[s_index])
    {
        fprintf(stderr, "selfLen: %lld, dp->self_length[i]: %ld\n", selfLen, (long)dp->self_length[s_index]);
    }
    fprintf(stderr,"\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jl 0x21790
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
cmpq $-0x1, -0x30(%rbp)
je 0x2174c
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
movq -0x30(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq -0x30(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jle 0x21720
movq -0x58(%rbp), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x2172c
movq -0x50(%rbp), %rax
subq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x3a288d(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x38(%rbp), %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x38(%rbp), %rsi
movl (%rax,%rsi,4), %r8d
movq -0x30(%rbp), %r9
leaq 0x3609cd(%rip), %rsi    # 0x382151
movb $0x0, %al
callq 0x22a0
jmp 0x21682
movq 0x3a2849(%rip), %rax    # 0x3c3fe0
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, %edi
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, %esi
movslq -0x1c(%rbp), %rdx
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %r8
shlq $0x4, %r8
addq %r8, %rax
movl 0x4(%rax), %eax
movl %eax, %r8d
movslq -0x20(%rbp), %r9
callq 0x21580
movq -0x80(%rbp), %rdi
movl -0x78(%rbp), %edx
movl -0x74(%rbp), %ecx
movl -0x70(%rbp), %r8d
movl -0x6c(%rbp), %r9d
movq %rax, %r11
movl -0x1c(%rbp), %r10d
movl -0x20(%rbp), %eax
leaq 0x36090a(%rip), %rsi    # 0x38217d
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x22a0
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
je 0x218cc
movq 0x3a2739(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x48(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x3607d9(%rip), %rsi    # 0x38209e
movb $0x0, %al
callq 0x22a0
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
je 0x21911
movq 0x3a26f4(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x40(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x3607b6(%rip), %rsi    # 0x3820c0
movb $0x0, %al
callq 0x22a0
movq 0x3a26c8(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x365106(%rip), %rsi    # 0x386a28
movb $0x0, %al
callq 0x22a0
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)