// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/htscodecs/htscodecs/rANS_static4x16pr.c
// Function: rans_dec_func
static inline
unsigned char *(*rans_dec_func(int do_simd, int order))
    (unsigned char *in,
     unsigned int in_size,
     unsigned char *out,
     unsigned int out_size) {

    if (!do_simd) { // SIMD disabled
        return order & 1
            ? rans_uncompress_O1_4x16
            : rans_uncompress_O0_4x16;
    }

#ifdef NO_THREADS
    htscodecs_tls_cpu_init();
#else
    int err = pthread_once(&rans_cpu_once, htscodecs_tls_cpu_init);
    if (err != 0) {
        fprintf(stderr, "Initialising TLS data failed: pthread_once: %s\n",
                strerror(err));
        fprintf(stderr, "Using scalar code only\n");
    }
#endif

    int have_d_sse4_1  = have_sse4_1;
    int have_d_avx2    = have_avx2;
    int have_d_avx512f = have_avx512f;

    if (!(rans_cpu & RANS_CPU_DEC_AVX512)) have_d_avx512f = 0;
    if (!(rans_cpu & RANS_CPU_DEC_AVX2))   have_d_avx2    = 0;
    if (!(rans_cpu & RANS_CPU_DEC_SSE4))   have_d_sse4_1  = 0;

    if (order & 1) {
#if defined(HAVE_AVX512)
        if (have_d_avx512f)
            return rans_uncompress_O1_32x16_avx512;
#endif
#if defined(HAVE_AVX2)
        if (have_d_avx2)
            return rans_uncompress_O1_32x16_avx2;
#endif
#if defined(HAVE_SSE4_1) && defined(HAVE_SSSE3) && defined(HAVE_POPCNT)
        if (have_d_sse4_1)
            return rans_uncompress_O1_32x16_sse4;
#endif
        return rans_uncompress_O1_32x16;
    } else {
#if defined(HAVE_AVX512)
        if (have_d_avx512f)
            return rans_uncompress_O0_32x16_avx512;
#endif
#if defined(HAVE_AVX2)
        if (have_d_avx2)
            return rans_uncompress_O0_32x16_avx2;
#endif
#if defined(HAVE_SSE4_1) && defined(HAVE_SSSE3) && defined(HAVE_POPCNT)
        if (have_d_sse4_1)
            return rans_uncompress_O0_32x16_sse4;
#endif
        return rans_uncompress_O0_32x16;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
testl %edi, %edi
je 0x5133f
leaq 0x4de34(%rip), %rdi     # 0x9f114
leaq -0x16e5(%rip), %rsi     # 0x4fc02
callq 0x4470
testl %eax, %eax
jne 0x51397
movl 0x4d496(%rip), %eax     # 0x9e790
btl $0xa, %eax
setae %sil
movl %eax, %ecx
shll $0x16, %ecx
sarl $0x1f, %ecx
andl 0x4ddfc(%rip), %ecx     # 0x9f10c
shll $0x17, %eax
sarl $0x1f, %eax
andl 0x4ddec(%rip), %eax     # 0x9f108
cmpl $0x0, 0x4dded(%rip)     # 0x9f110
sete %dl
orb %sil, %dl
testb $0x1, %bl
jne 0x51356
testb %dl, %dl
je 0x51367
testl %ecx, %ecx
je 0x5137d
leaq 0x2704(%rip), %rax      # 0x53a41
jmp 0x51377
testb $0x1, %bl
leaq -0x1d50(%rip), %rcx     # 0x4f5f9
leaq 0xadd(%rip), %rax       # 0x51e2d
cmoveq %rcx, %rax
jmp 0x51377
testb %dl, %dl
je 0x51370
testl %ecx, %ecx
je 0x5138a
leaq 0x3b47(%rip), %rax      # 0x54eac
jmp 0x51377
leaq 0x5e5d(%rip), %rax      # 0x571cb
jmp 0x51377
leaq 0x72fa(%rip), %rax      # 0x58671
popq %rbx
popq %r14
popq %r15
retq
testl %eax, %eax
jne 0x513d6
leaq 0xbd27(%rip), %rax      # 0x5d0af
jmp 0x51377
testl %eax, %eax
jne 0x513df
leaq 0xcca3(%rip), %rax      # 0x5e038
jmp 0x51377
movq 0x4cc3a(%rip), %r15     # 0x9dfd8
movq (%r15), %r14
movl %eax, %edi
callq 0x4150
leaq 0x2c8c6(%rip), %rsi     # 0x7dc75
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4700
movq (%r15), %rcx
leaq 0x2c8df(%rip), %rdi     # 0x7dca5
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x49b0
jmp 0x512f4
leaq 0x8463(%rip), %rax      # 0x59840
jmp 0x51377
leaq 0x8de8(%rip), %rax      # 0x5a1ce
jmp 0x51377