#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 uint32_t;

/* Variables and functions */
uint32_t crc32c_shift(uint32_t zeros[][256], uint32_t crc) {
  return zeros[0][crc & 0xff] ^ zeros[1][(crc >> 8) & 0xff] ^
         zeros[2][(crc >> 16) & 0xff] ^ zeros[3][crc >> 24];
}


x86 assembly (clang, -O0):
<crc32c_shift>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
sar    $0x8,%edx
and    $0xff,%edx
movslq %edx,%rdx
xor    0x400(%rcx,%rdx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
sar    $0x10,%edx
and    $0xff,%edx
movslq %edx,%rdx
xor    0x800(%rcx,%rdx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
sar    $0x18,%edx
movslq %edx,%rdx
xor    0xc00(%rcx,%rdx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc32c_shift>:
mov    %esi,%ecx
movzbl %cl,%edx
movzbl %ch,%eax
mov    0x400(%rdi,%rax,4),%eax
xor    (%rdi,%rdx,4),%eax
mov    %esi,%edx
shr    $0x10,%edx
movzbl %dl,%edx
xor    0x800(%rdi,%rdx,4),%eax
sar    $0x18,%ecx
movslq %ecx,%rcx
xor    0xc00(%rdi,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @crc32c_shift([256 x i32]* %0, i32 %1) {
%3 = alloca [256 x i32]*
%4 = alloca i32
store [256 x i32]* %0, [256 x i32]** %3
store i32 %1, i32* %4
%5 = load [256 x i32]*, [256 x i32]** %3
%6 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0
%7 = load i32, i32* %4
%8 = and i32 %7, 255
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = load [256 x i32]*, [256 x i32]** %3
%13 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 1
%14 = load i32, i32* %4
%15 = ashr i32 %14, 8
%16 = and i32 %15, 255
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [256 x i32], [256 x i32]* %13, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = xor i32 %11, %19
%21 = load [256 x i32]*, [256 x i32]** %3
%22 = getelementptr inbounds [256 x i32], [256 x i32]* %21, i64 2
%23 = load i32, i32* %4
%24 = ashr i32 %23, 16
%25 = and i32 %24, 255
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [256 x i32], [256 x i32]* %22, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = xor i32 %20, %28
%30 = load [256 x i32]*, [256 x i32]** %3
%31 = getelementptr inbounds [256 x i32], [256 x i32]* %30, i64 3
%32 = load i32, i32* %4
%33 = ashr i32 %32, 24
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [256 x i32], [256 x i32]* %31, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = xor i32 %29, %36
ret i32 %37
}

LLVM IR (-O2):
define i32 @crc32c_shift([256 x i32]* nocapture %0, i32 %1) {
%3 = and i32 %1, 255
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = lshr i32 %1, 8
%8 = and i32 %7, 255
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 1, i64 %9
%11 = load i32, i32* %10
%12 = xor i32 %11, %6
%13 = lshr i32 %1, 16
%14 = and i32 %13, 255
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 2, i64 %15
%17 = load i32, i32* %16
%18 = xor i32 %12, %17
%19 = ashr i32 %1, 24
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i64 3, i64 %20
%22 = load i32, i32* %21
%23 = xor i32 %18, %22
ret i32 %23
}