// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/htscodecs/htscodecs/rANS_static32x16pr_avx512.c
// Function: mm512_i32gather_epi32x
static inline __m512i _mm512_i32gather_epi32x(__m512i idx, void *v, int size) {
    uint32_t *b = (uint32_t *)v;

#ifndef __clang__
    volatile
#endif
    int c[16] __attribute__((aligned(32)));

    //_mm512_store_si512((__m512i *)c, idx); // equivalent, but slower
    _mm256_store_si256((__m256i *)(c),   _mm512_castsi512_si256(idx));
    _mm256_store_si256((__m256i *)(c+8), _mm512_extracti64x4_epi64(idx, 1));

    __m128i x0 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[0]]), b[c[1]], 1);
    __m128i x1 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[2]]), b[c[3]], 1);
    __m128i x2 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[4]]), b[c[5]], 1);
    __m128i x3 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[6]]), b[c[7]], 1);

    __m128i x01 = _mm_unpacklo_epi64(x0, x1);
    __m128i x23 = _mm_unpacklo_epi64(x2, x3);
    __m256i y0 =_mm256_castsi128_si256(x01);

    __m128i x4 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[ 8]]), b[c[ 9]], 1);
    __m128i x5 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[10]]), b[c[11]], 1);
    __m128i x6 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[12]]), b[c[13]], 1);
    __m128i x7 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[14]]), b[c[15]], 1);

    __m128i x45 = _mm_unpacklo_epi64(x4, x5);
    __m128i x67 = _mm_unpacklo_epi64(x6, x7);
    __m256i y1 =_mm256_castsi128_si256(x45);

    y0 = _mm256_inserti128_si256(y0, x23, 1);
    y1 = _mm256_inserti128_si256(y1, x67, 1);

    return _mm512_inserti64x4(_mm512_castsi256_si512(y0), y1, 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x40, %rsp
subq $0x480, %rsp            # imm = 0x480
vmovdqa64 %zmm0, 0x180(%rsp)
movq %rdi, 0x178(%rsp)
movl %esi, 0x174(%rsp)
movq 0x178(%rsp), %rax
movq %rax, 0x168(%rsp)
vmovdqa64 0x180(%rsp), %zmm0
vmovdqa64 %zmm0, 0x240(%rsp)
vmovdqa64 0x240(%rsp), %zmm0
leaq 0x120(%rsp), %rax
movq %rax, 0x238(%rsp)
vmovaps %ymm0, 0x200(%rsp)
vmovaps 0x200(%rsp), %ymm0
movq 0x238(%rsp), %rax
vmovaps %ymm0, (%rax)
leaq 0x140(%rsp), %rax
vmovdqa64 0x180(%rsp), %zmm0
movq %rax, 0x1f8(%rsp)
vextracti64x4 $0x1, %zmm0, 0x1c0(%rsp)
vmovaps 0x1c0(%rsp), %ymm0
movq 0x1f8(%rsp), %rax
vmovaps %ymm0, (%rax)
movq 0x168(%rsp), %rax
movslq 0x120(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x39c(%rsp)
vmovd 0x39c(%rsp), %xmm0
vmovdqa %xmm0, 0x380(%rsp)
vmovdqa 0x380(%rsp), %xmm0
movq 0x168(%rsp), %rax
movslq 0x124(%rsp), %rcx
movl (%rax,%rcx,4), %eax
vpinsrd $0x1, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0x110(%rsp)
movq 0x168(%rsp), %rax
movslq 0x128(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x37c(%rsp)
vmovd 0x37c(%rsp), %xmm0
vmovdqa %xmm0, 0x360(%rsp)
vmovdqa 0x360(%rsp), %xmm0
movq 0x168(%rsp), %rax
movslq 0x12c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
vpinsrd $0x1, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0x100(%rsp)
movq 0x168(%rsp), %rax
movslq 0x130(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x35c(%rsp)
vmovd 0x35c(%rsp), %xmm0
vmovdqa %xmm0, 0x340(%rsp)
vmovdqa 0x340(%rsp), %xmm0
movq 0x168(%rsp), %rax
movslq 0x134(%rsp), %rcx
movl (%rax,%rcx,4), %eax
vpinsrd $0x1, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
movq 0x168(%rsp), %rax
movslq 0x138(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x33c(%rsp)
vmovd 0x33c(%rsp), %xmm0
vmovdqa %xmm0, 0x320(%rsp)
vmovdqa 0x320(%rsp), %xmm0
movq 0x168(%rsp), %rax
movslq 0x13c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
vpinsrd $0x1, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0xe0(%rsp)
vmovdqa 0x110(%rsp), %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x410(%rsp)
vmovdqa %xmm0, 0x400(%rsp)
vmovdqa 0x410(%rsp), %xmm0
vmovdqa 0x400(%rsp), %xmm1
vpunpcklqdq %xmm1, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm1[0]
vmovdqa %xmm0, 0xd0(%rsp)
vmovdqa 0xf0(%rsp), %xmm1
vmovdqa 0xe0(%rsp), %xmm0
vmovdqa %xmm1, 0x3f0(%rsp)
vmovdqa %xmm0, 0x3e0(%rsp)
vmovdqa 0x3f0(%rsp), %xmm0
vmovdqa 0x3e0(%rsp), %xmm1
vpunpcklqdq %xmm1, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm1[0]
vmovdqa %xmm0, 0xc0(%rsp)
vmovdqa 0xd0(%rsp), %xmm0
vmovdqa %xmm0, 0x430(%rsp)
vmovdqa 0x430(%rsp), %xmm0
vmovdqa %xmm1, 0xb0(%rsp)
vmovdqa %xmm0, 0xa0(%rsp)
movq 0x168(%rsp), %rax
movslq 0x140(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x31c(%rsp)
vmovd 0x31c(%rsp), %xmm0
vmovdqa %xmm0, 0x300(%rsp)
vmovdqa 0x300(%rsp), %xmm0
movq 0x168(%rsp), %rax
movslq 0x144(%rsp), %rcx
movl (%rax,%rcx,4), %eax
vpinsrd $0x1, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0x90(%rsp)
movq 0x168(%rsp), %rax
movslq 0x148(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x2fc(%rsp)
vmovd 0x2fc(%rsp), %xmm0
vmovdqa %xmm0, 0x2e0(%rsp)
vmovdqa 0x2e0(%rsp), %xmm0
movq 0x168(%rsp), %rax
movslq 0x14c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
vpinsrd $0x1, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0x80(%rsp)
movq 0x168(%rsp), %rax
movslq 0x150(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x2dc(%rsp)
vmovd 0x2dc(%rsp), %xmm0
vmovdqa %xmm0, 0x2c0(%rsp)
vmovdqa 0x2c0(%rsp), %xmm0
movq 0x168(%rsp), %rax
movslq 0x154(%rsp), %rcx
movl (%rax,%rcx,4), %eax
vpinsrd $0x1, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0x70(%rsp)
movq 0x168(%rsp), %rax
movslq 0x158(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x2bc(%rsp)
vmovd 0x2bc(%rsp), %xmm0
vmovdqa %xmm0, 0x2a0(%rsp)
vmovdqa 0x2a0(%rsp), %xmm0
movq 0x168(%rsp), %rax
movslq 0x15c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
vpinsrd $0x1, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0x60(%rsp)
vmovdqa 0x90(%rsp), %xmm2
vmovdqa 0x80(%rsp), %xmm0
vmovdqa %xmm2, 0x3d0(%rsp)
vmovdqa %xmm0, 0x3c0(%rsp)
vmovdqa 0x3d0(%rsp), %xmm0
vmovdqa 0x3c0(%rsp), %xmm2
vpunpcklqdq %xmm2, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm2[0]
vmovdqa %xmm0, 0x50(%rsp)
vmovdqa 0x70(%rsp), %xmm2
vmovdqa 0x60(%rsp), %xmm0
vmovdqa %xmm2, 0x3b0(%rsp)
vmovdqa %xmm0, 0x3a0(%rsp)
vmovdqa 0x3b0(%rsp), %xmm0
vmovdqa 0x3a0(%rsp), %xmm2
vpunpcklqdq %xmm2, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm2[0]
vmovdqa %xmm0, 0x40(%rsp)
vmovdqa 0x50(%rsp), %xmm0
vmovdqa %xmm0, 0x420(%rsp)
vmovdqa 0x420(%rsp), %xmm0
vmovdqa %xmm1, 0x30(%rsp)
vmovdqa %xmm0, 0x20(%rsp)
vmovaps 0xa0(%rsp), %ymm0
vmovdqa 0xc0(%rsp), %xmm1
vinserti128 $0x1, %xmm1, %ymm0, %ymm0
vmovaps %ymm0, 0xa0(%rsp)
vmovaps 0x20(%rsp), %ymm0
vmovdqa 0x40(%rsp), %xmm1
vinserti128 $0x1, %xmm1, %ymm0, %ymm0
vmovaps %ymm0, 0x20(%rsp)
vmovaps 0xa0(%rsp), %ymm0
vmovaps %ymm0, 0x440(%rsp)
vmovaps 0x440(%rsp), %ymm2
vmovaps 0x20(%rsp), %ymm1
vmovaps %ymm2, %ymm0
vinserti64x4 $0x1, %ymm1, %zmm0, %zmm0
movq %rbp, %rsp
popq %rbp
retq
nop