#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void unpack_31x8_40b(uint8_t *vec, const uint8_t *pvec) {
  uint32_t ii;
  vec[0] = pvec[0] & 0x1f;
  vec[1] = ((*(const uint32_t *)pvec) >> 5) & 0x1f;
  ii = (*(const uint32_t *)(&pvec[1])) >> 2;
  vec[2] = ii & 0x1f;
  ii >>= 5;
  vec[3] = ii & 0x1f;
  ii >>= 5;
  vec[4] = ii & 0x1f;
  ii >>= 5;
  vec[5] = ii & 0x1f;
  ii >>= 5;
  vec[6] = ii & 0x1f;
  ii >>= 5;
  vec[7] = ii & 0x1f;
}


x86 assembly (clang, -O0):
<unpack_31x8_40b>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sar    $0x5,%ecx
and    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
sar    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x14(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x14(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x14(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x14(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x14(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpack_31x8_40b>:
mov    (%rsi),%eax
and    $0x1f,%eax
mov    %eax,(%rdi)
mov    (%rsi),%eax
shr    $0x5,%eax
and    $0x1f,%eax
mov    %eax,0x4(%rdi)
mov    0x4(%rsi),%eax
mov    %eax,%ecx
shr    $0x2,%ecx
and    $0x1f,%ecx
mov    %ecx,0x8(%rdi)
mov    %eax,%ecx
shr    $0x7,%ecx
and    $0x1f,%ecx
mov    %ecx,0xc(%rdi)
mov    %eax,%ecx
shr    $0xc,%ecx
and    $0x1f,%ecx
mov    %ecx,0x10(%rdi)
mov    %eax,%ecx
shr    $0x11,%ecx
and    $0x1f,%ecx
mov    %ecx,0x14(%rdi)
mov    %eax,%ecx
shr    $0x16,%ecx
and    $0x1f,%ecx
mov    %ecx,0x18(%rdi)
shr    $0x1b,%eax
mov    %eax,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @unpack_31x8_40b(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = and i32 %8, 31
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 %9, i32* %11
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = ashr i32 %13, 5
%15 = and i32 %14, 31
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %15, i32* %17
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 1
%20 = load i32, i32* %19
%21 = ashr i32 %20, 2
store i32 %21, i32* %5
%22 = load i32, i32* %5
%23 = and i32 %22, 31
%24 = load i32*, i32** %3
%25 = getelementptr inbounds i32, i32* %24, i64 2
store i32 %23, i32* %25
%26 = load i32, i32* %5
%27 = ashr i32 %26, 5
store i32 %27, i32* %5
%28 = load i32, i32* %5
%29 = and i32 %28, 31
%30 = load i32*, i32** %3
%31 = getelementptr inbounds i32, i32* %30, i64 3
store i32 %29, i32* %31
%32 = load i32, i32* %5
%33 = ashr i32 %32, 5
store i32 %33, i32* %5
%34 = load i32, i32* %5
%35 = and i32 %34, 31
%36 = load i32*, i32** %3
%37 = getelementptr inbounds i32, i32* %36, i64 4
store i32 %35, i32* %37
%38 = load i32, i32* %5
%39 = ashr i32 %38, 5
store i32 %39, i32* %5
%40 = load i32, i32* %5
%41 = and i32 %40, 31
%42 = load i32*, i32** %3
%43 = getelementptr inbounds i32, i32* %42, i64 5
store i32 %41, i32* %43
%44 = load i32, i32* %5
%45 = ashr i32 %44, 5
store i32 %45, i32* %5
%46 = load i32, i32* %5
%47 = and i32 %46, 31
%48 = load i32*, i32** %3
%49 = getelementptr inbounds i32, i32* %48, i64 6
store i32 %47, i32* %49
%50 = load i32, i32* %5
%51 = ashr i32 %50, 5
store i32 %51, i32* %5
%52 = load i32, i32* %5
%53 = and i32 %52, 31
%54 = load i32*, i32** %3
%55 = getelementptr inbounds i32, i32* %54, i64 7
store i32 %53, i32* %55
ret void
}

LLVM IR (-O2):
define void @unpack_31x8_40b(i32* nocapture writeonly %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = and i32 %3, 31
store i32 %4, i32* %0
%5 = load i32, i32* %1
%6 = lshr i32 %5, 5
%7 = and i32 %6, 31
%8 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %7, i32* %8
%9 = getelementptr inbounds i32, i32* %1, i64 1
%10 = load i32, i32* %9
%11 = lshr i32 %10, 2
%12 = and i32 %11, 31
%13 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %12, i32* %13
%14 = lshr i32 %10, 7
%15 = and i32 %14, 31
%16 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %15, i32* %16
%17 = lshr i32 %10, 12
%18 = and i32 %17, 31
%19 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %18, i32* %19
%20 = lshr i32 %10, 17
%21 = and i32 %20, 31
%22 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %21, i32* %22
%23 = lshr i32 %10, 22
%24 = and i32 %23, 31
%25 = getelementptr inbounds i32, i32* %0, i64 6
store i32 %24, i32* %25
%26 = lshr i32 %10, 27
%27 = getelementptr inbounds i32, i32* %0, i64 7
store i32 %26, i32* %27
ret void
}