// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %r9, 0x18(%rsp)
movq %rcx, %r15
movl %edx, %r14d
movq %rsi, %r12
movl %edi, %ebp
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movq %r8, 0x20(%rsp)
movl 0x8(%r8), %r13d
decq %r13
decl %r14d
xorl %edx, %edx
movl %r14d, %ebx
incl %ebx
js 0x11445
testl %ebp, %ebp
js 0x11445
movl %ebx, %eax
movb (%r15,%rax), %al
movl %ebp, %ecx
cmpb (%r12,%rcx), %al
jne 0x11445
decl %ebp
incl %edx
decl %r14d
jmp 0x11423
testl %edx, %edx
jle 0x11454
movq %rsp, %rdi
pushq $0x7
popq %rsi
callq 0x11de6
testl %ebx, %ebx
js 0x114f1
testl %ebp, %ebp
js 0x114f1
testl %r13d, %r13d
js 0x11579
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movl %r13d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
shlq $0x4, %rdx
movl 0x4(%rax,%rdx), %esi
addl %ebp, %esi
movl %ebx, %ecx
subl %esi, %ecx
cmpl (%rax,%rdx), %ecx
jge 0x1155a
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 0x114cd
cmpl $0x1, %eax
jne 0x114dc
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
callq 0x11de6
decl %ebp
jmp 0x1141b
pushq $0x1
popq %rdx
movl %edx, %esi
callq 0x11de6
jmp 0x1141b
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x11de6
decl %ebp
movl %ebx, %r14d
jmp 0x1141b
testl %ebp, %ebx
js 0x1150e
xorl %esi, %esi
testl %ebx, %ebx
sets %sil
cmovnsl %ebx, %ebp
incl %esi
incl %ebp
movq %rsp, %rdi
movl %ebp, %edx
callq 0x11de6
movl 0x4(%rsp), %ecx
movl %ecx, %edx
sarl %edx
movq 0x8(%rsp), %rax
xorl %esi, %esi
testl %edx, %edx
cmovlel %esi, %edx
leal -0x1(%rcx), %edi
cmpq %rsi, %rdx
je 0x11544
movl (%rax,%rsi,4), %r8d
movslq %edi, %rdi
movl (%rax,%rdi,4), %r9d
movl %r9d, (%rax,%rsi,4)
movl %r8d, (%rax,%rdi,4)
incq %rsi
decl %edi
jmp 0x11525
movq 0x18(%rsp), %rdx
movl %ecx, (%rdx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9692(%rip), %rdi      # 0x1abf3
leaq 0x94d9(%rip), %rsi      # 0x1aa41
leaq 0x9629(%rip), %rcx      # 0x1ab98
movl $0xf0, %edx
callq 0x21d0
leaq 0x9611(%rip), %rdi      # 0x1ab91
leaq 0x94ba(%rip), %rsi      # 0x1aa41
leaq 0x960a(%rip), %rcx      # 0x1ab98
movl $0xee, %edx
callq 0x21d0