// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]oatk/levdist.c
// Function: wf_traceback
static uint32_t *wf_traceback(int32_t t_end, const char *ts, int32_t q_end, const char *qs, wf_tb_t *tb, int32_t *n_cigar)
{
    wf_cigar_t cigar = {0,0,0};
    int32_t i = q_end, k = t_end, s = tb->n - 1;
    for (;;) {
        int32_t k0 = k, j, pre;
        while (i >= 0 && k >= 0 && qs[i] == ts[k])
            --i, --k;
        if (k0 - k > 0)    
            wf_cigar_push1(&cigar, 7, k0 - k);
        if (i < 0 || k < 0) break;
        assert(s >= 0);
        j = i - k - tb->a[s].d0;
        assert(j < tb->a[s].n);
        pre = (int32_t)(tb->a[s].a[j>>5] >> (j&0x1f)*2 & 0x3) - 1;
        if (pre == 0) {
            wf_cigar_push1(&cigar, 8, 1);
            --i, --k;
        } else if (pre < 0) {
            wf_cigar_push1(&cigar, 1, 1);
            --i;
        } else {
            wf_cigar_push1(&cigar, 2, 1);
            --k;
        }
        --s;
    }
    if (i >= 0) wf_cigar_push1(&cigar, 1, i + 1);
    else if (k >= 0) wf_cigar_push1(&cigar, 2, k + 1);
    for (i = 0; i < cigar.n>>1; ++i) {
        uint32_t t = cigar.cigar[i];
        cigar.cigar[i] = cigar.cigar[cigar.n - i - 1];
        cigar.cigar[cigar.n - i - 1] = t;
    }
    *n_cigar = cigar.n;
    return cigar.cigar;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %r14
movq %rcx, %r15
movl %edx, %eax
movq %rsi, %r12
movl %edi, %edx
xorps %xmm0, %xmm0
movq %rsp, %rcx
movaps %xmm0, (%rcx)
movl 0x8(%r8), %ebx
testl %eax, %eax
js 0x14b8d
testl %edx, %edx
js 0x14b8d
movl %edx, %ecx
movl %eax, %esi
movb (%r15,%rsi), %sil
movl %ecx, %edi
cmpb (%r12,%rdi), %sil
jne 0x14b91
leal -0x1(%rax), %r13d
leal -0x1(%rcx), %ebp
testl %eax, %eax
jle 0x14b96
movl %r13d, %eax
testl %ecx, %ecx
movl %ebp, %ecx
jg 0x14b69
jmp 0x14b96
movl %edx, %ebp
jmp 0x14b93
movl %ecx, %ebp
movl %eax, %r13d
subl %ebp, %edx
jle 0x14ba7
movq %rsp, %rdi
movl $0x7, %esi
callq 0x159a8
movl %r13d, %eax
orl %ebp, %eax
js 0x14c49
decq %rbx
testl %ebx, %ebx
js 0x14cb8
movq 0x10(%r14), %rax
movl %ebx, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
shlq $0x4, %rdx
movl 0x4(%rax,%rdx), %esi
addl %ebp, %esi
movl %r13d, %ecx
subl %esi, %ecx
cmpl (%rax,%rdx), %ecx
jge 0x14cd7
addq %rdx, %rax
movq 0x8(%rax), %rax
movl %ecx, %edx
sarl $0x5, %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
addl %ecx, %ecx
shrq %cl, %rax
movq %rsp, %rdi
andl $0x3, %eax
je 0x14c1a
cmpl $0x1, %eax
jne 0x14c2e
movl $0x8, %esi
movl $0x1, %edx
callq 0x159a8
decl %r13d
jmp 0x14c3d
movl $0x1, %esi
movl $0x1, %edx
callq 0x159a8
decl %r13d
jmp 0x14c3f
movl $0x2, %esi
movl $0x1, %edx
callq 0x159a8
decl %ebp
movl %ebp, %edx
movl %r13d, %eax
jmp 0x14b5f
movl $0x1, %esi
testl %r13d, %r13d
jns 0x14c5f
movl $0x2, %esi
movl %ebp, %r13d
testl %ebp, %ebp
js 0x14c6d
incl %r13d
movq %rsp, %rdi
movl %r13d, %edx
callq 0x159a8
movl 0x4(%rsp), %ecx
movl %ecx, %edx
sarl %edx
movq 0x8(%rsp), %rax
testl %edx, %edx
jle 0x14ca2
movl %edx, %edx
leal -0x1(%rcx), %esi
xorl %edi, %edi
movl (%rax,%rdi,4), %r8d
movslq %esi, %rsi
movl (%rax,%rsi,4), %r9d
movl %r9d, (%rax,%rdi,4)
movl %r8d, (%rax,%rsi,4)
incq %rdi
decl %esi
cmpq %rdi, %rdx
jne 0x14c85
movq 0x10(%rsp), %rdx
movl %ecx, (%rdx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbf12(%rip), %rdi      # 0x20bd1
leaq 0xbdbb(%rip), %rsi      # 0x20a81
leaq 0xbf0b(%rip), %rcx      # 0x20bd8
movl $0xee, %edx
callq 0x21d0
leaq 0xbf55(%rip), %rdi      # 0x20c33
leaq 0xbd9c(%rip), %rsi      # 0x20a81
leaq 0xbeec(%rip), %rcx      # 0x20bd8
movl $0xf0, %edx
callq 0x21d0