// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0xc(%rsp)
movl %ecx, 0x8(%rsp)
movq %rdx, %rbx
movq %rdi, %r13
movslq %r9d, %rbp
testl %ebp, %ebp
movq %rbp, 0x10(%rsp)
js 0x4f47
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %rbp, %r12
movq 0x8(%rbx), %rax
movq (%rax,%rbp,8), %rbp
cmpq $-0x1, %rbp
je 0x4f13
movq %r12, %rax
shlq $0x4, %rax
movl 0x4(%r13,%rax), %ecx
movl 0x8(%r13,%rax), %eax
movq %rbp, %rdx
shlq $0x4, %rdx
subl 0x8(%r13,%rdx), %eax
subl 0x4(%r13,%rdx), %ecx
movq %rax, %rdx
subq %rcx, %rdx
movq %rcx, %rsi
subq %rax, %rsi
cmpl %eax, %ecx
cmovbeq %rdx, %rsi
addq %rsi, %r15
addq %rax, %r14
movq 0x2900c6(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movq (%rbx), %rax
movq 0x20(%rbx), %rdx
movslq (%rax,%r12,4), %rcx
movl (%rdx,%r12,4), %r8d
leaq 0x22c506(%rip), %rsi    # 0x231439
movq %r12, %rdx
movq %rbp, %r9
xorl %eax, %eax
callq 0x22b0
testq %rbp, %rbp
jns 0x4ec8
jmp 0x4f50
xorl %r15d, %r15d
xorl %r14d, %r14d
movq %rbp, %r12
movq 0x290089(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movq 0x10(%rsp), %rax
shlq $0x4, %rax
movl 0x4(%r13,%rax), %ecx
movl 0x8(%r13,%rax), %edx
shlq $0x4, %r12
movl 0x4(%r13,%r12), %r9d
movl 0x8(%r13,%r12), %ebp
movslq 0x8(%rsp), %r10
movslq 0xc(%rsp), %r11
movq %rcx, %rax
subq %rdx, %rax
incq %rax
movq %rbp, %rsi
notq %rsi
addq %r10, %rsi
movq %r9, %r12
notq %r12
addq %r11, %r12
leaq -0x1(%r10), %r13
movq %rbp, %r8
addq %r12, %r8
cmpq %r12, %rsi
cmovleq %r13, %r8
movq 0x290028(%rip), %r13    # 0x294fe0
cmpl %ecx, %edx
pushq $0x1
popq %r12
cmovaq %rax, %r12
addq %r8, %r12
subq $0x8, %rsp
leaq 0x22c495(%rip), %rsi    # 0x231465
movl %ebp, %r8d
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %r12
movq 0x30(%rsp), %r12
callq 0x22b0
addq $0x20, %rsp
movq 0x10(%rbx), %rax
movslq (%rax,%r12,4), %rcx
cmpq %rcx, %r15
jne 0x501d
movq 0x18(%rbx), %rax
movslq (%rax,%r12,4), %rcx
cmpq %rcx, %r14
jne 0x5034
movq (%r13), %rsi
pushq $0xa
popq %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2270
movq (%r13), %rdi
leaq 0x22c35e(%rip), %rsi    # 0x231386
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
jmp 0x4ff6
movq (%r13), %rdi
leaq 0x22c369(%rip), %rsi    # 0x2313a8
movq %r14, %rdx
xorl %eax, %eax
callq 0x22b0
jmp 0x5003