// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/htscodecs/htscodecs/utils.h
// Function: unstripe
static inline void unstripe(unsigned char *out, unsigned char *outN,
                            unsigned int ulen, unsigned int N,
                            unsigned int idxN[256]) {
    int j = 0, k;

    if (ulen >= N) {
        switch (N) {
        case 4:
#define LLN 16
            if (ulen >= 4*LLN) {
                while (j < ulen-4*LLN) {
                    int l;
                    for (l = 0; l < LLN; l++) {
                        for (k = 0; k < 4; k++)
                            out[j+k+l*4] = outN[idxN[k]+l];
                    }
                    for (k = 0; k < 4; k++)
                        idxN[k] += LLN;
                    j += 4*LLN;
                }
            }
            while (j < ulen-4) {
                for (k = 0; k < 4; k++)
                    out[j++] = outN[idxN[k]++];
            }
#undef LLN
            break;

        case 2:
#define LLN 4
            if (ulen >= 2*LLN) {
                while (j < ulen-2*LLN) {
                    int l;
                    for (l = 0; l < LLN; l++) {
                        for (k = 0; k < 2; k++)
                            out[j++] = outN[idxN[k]+l];
                    }
                    for (k = 0; k < 2; k++)
                        idxN[k] += l;
                }
            }
            while (j < ulen-2) {
                for (k = 0; k < 2; k++)
                    out[j++] = outN[idxN[k]++];
            }
#undef LLN
            break;

        default:
            // General case, around 25% slower overall decode
            while (j < ulen-N) {
                for (k = 0; k < N; k++)
                    out[j++] = outN[idxN[k]++];
            }
            break;
        }
    }
    for (k = 0; j < ulen; k++)
        out[j++] = outN[idxN[k]++];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jb 0x84f45
movl -0x18(%rbp), %eax
movl %eax, -0x34(%rbp)
subl $0x2, %eax
je 0x84dde
jmp 0x84cba
movl -0x34(%rbp), %eax
subl $0x4, %eax
jne 0x84ee5
jmp 0x84cc8
cmpl $0x40, -0x14(%rbp)
jb 0x84d7f
jmp 0x84cd4
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x40, %ecx
cmpl %ecx, %eax
jae 0x84d7d
movl $0x0, -0x2c(%rbp)
cmpl $0x10, -0x2c(%rbp)
jge 0x84d46
movl $0x0, -0x28(%rbp)
cmpl $0x4, -0x28(%rbp)
jge 0x84d39
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x28(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x2c(%rbp), %ecx
movl %ecx, %ecx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
addl -0x28(%rbp), %ecx
movl -0x2c(%rbp), %esi
shll $0x2, %esi
addl %esi, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x84cf9
jmp 0x84d3b
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x84cec
movl $0x0, -0x28(%rbp)
cmpl $0x4, -0x28(%rbp)
jge 0x84d6f
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x10, %edx
movl %edx, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x84d4d
movl -0x24(%rbp), %eax
addl $0x40, %eax
movl %eax, -0x24(%rbp)
jmp 0x84cd4
jmp 0x84d7f
jmp 0x84d81
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
jae 0x84dd9
movl $0x0, -0x28(%rbp)
cmpl $0x4, -0x28(%rbp)
jge 0x84dd7
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq -0x28(%rbp), %rsi
movl (%rdx,%rsi,4), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rdx,%rsi,4)
movl %ecx, %ecx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x84d95
jmp 0x84d81
jmp 0x84f43
cmpl $0x8, -0x14(%rbp)
jb 0x84e89
jmp 0x84dea
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x8, %ecx
cmpl %ecx, %eax
jae 0x84e87
movl $0x0, -0x30(%rbp)
cmpl $0x4, -0x30(%rbp)
jge 0x84e59
movl $0x0, -0x28(%rbp)
cmpl $0x2, -0x28(%rbp)
jge 0x84e4c
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x28(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x30(%rbp), %ecx
movl %ecx, %ecx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x84e0f
jmp 0x84e4e
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x84e02
movl $0x0, -0x28(%rbp)
cmpl $0x2, -0x28(%rbp)
jge 0x84e82
movl -0x30(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x84e60
jmp 0x84dea
jmp 0x84e89
jmp 0x84e8b
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jae 0x84ee3
movl $0x0, -0x28(%rbp)
cmpl $0x2, -0x28(%rbp)
jge 0x84ee1
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq -0x28(%rbp), %rsi
movl (%rdx,%rsi,4), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rdx,%rsi,4)
movl %ecx, %ecx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x84e9f
jmp 0x84e8b
jmp 0x84f43
jmp 0x84ee7
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl -0x18(%rbp), %ecx
cmpl %ecx, %eax
jae 0x84f41
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x18(%rbp), %eax
jae 0x84f3f
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq -0x28(%rbp), %rsi
movl (%rdx,%rsi,4), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rdx,%rsi,4)
movl %ecx, %ecx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x84efb
jmp 0x84ee7
jmp 0x84f43
jmp 0x84f45
movl $0x0, -0x28(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x84f90
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rdx
movslq -0x28(%rbp), %rsi
movl (%rdx,%rsi,4), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rdx,%rsi,4)
movl %ecx, %ecx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x84f4c
popq %rbp
retq
nopw %cs:(%rax,%rax)