// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movl %r8d, 0x14(%rsp)
movl %ecx, 0x8(%rsp)
movq %rdx, %r14
movq %rdi, %r13
movslq %r9d, %r12
xorl %r15d, %r15d
xorl %ebx, %ebx
movq %r12, %rax
movq %r12, 0x18(%rsp)
testq %r12, %r12
js 0x130d2
movq 0x8(%r14), %rax
movq (%rax,%r12,8), %rbp
cmpq $-0x1, %rbp
je 0x1309a
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, %rbx
movq 0x23ff3f(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movq (%r14), %rax
movq 0x20(%r14), %rdx
movslq (%rax,%r12,4), %rcx
movl (%rdx,%r12,4), %r8d
leaq 0x1d030f(%rip), %rsi    # 0x1e33c9
movq %r12, %rdx
movq %rbp, %r9
xorl %eax, %eax
callq 0x22b0
movq %r12, %rax
movq %rbp, %r12
jmp 0x13049
movq 0x23ff07(%rip), %rcx    # 0x252fe0
movq (%rcx), %rcx
movq %rcx, 0x30(%rsp)
movq 0x18(%rsp), %rdx
shlq $0x4, %rdx
movl 0x4(%r13,%rdx), %ecx
movq %rcx, 0x20(%rsp)
movl 0x8(%r13,%rdx), %edi
movq %rdi, 0x28(%rsp)
shlq $0x4, %rax
movl 0x4(%r13,%rax), %ebp
movl 0x8(%r13,%rax), %r13d
movslq 0x8(%rsp), %rdx
movq %rdx, 0x8(%rsp)
movslq 0x14(%rsp), %r12
movq %r13, %rsi
movq %rbp, %r8
movq %r12, %r9
callq 0x12ff0
movq %rax, %r10
subq $0x8, %rsp
leaq 0x1d02be(%rip), %rsi    # 0x1e33f5
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
movl %r13d, %r8d
movq 0x20(%rsp), %r13
movl %ebp, %r9d
xorl %eax, %eax
pushq %r12
pushq 0x18(%rsp)
pushq %r10
callq 0x22b0
addq $0x20, %rsp
movq 0x10(%r14), %rax
movslq (%rax,%r13,4), %rcx
cmpq %rcx, %r15
jne 0x1319e
movq 0x18(%r14), %rax
movslq (%rax,%r13,4), %rcx
cmpq %rcx, %rbx
jne 0x131bb
movq 0x23fe5b(%rip), %rax    # 0x252fe0
movq (%rax), %rsi
pushq $0xa
popq %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2270
movq 0x23fe3b(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x1d0167(%rip), %rsi    # 0x1e3316
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
jmp 0x13171
movq 0x23fe1e(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x1d016c(%rip), %rsi    # 0x1e3338
movq %rbx, %rdx
xorl %eax, %eax
callq 0x22b0
jmp 0x1317e