#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 pl_crc32_for_byte(uint32_t r) {
  for (int j = 0; j < 8; ++j)
    r = (r & 1 ? 0 : (uint32_t)0xEDB88320L) ^ r >> 1;
  return r ^ (uint32_t)0xFF000000L;
}


x86 assembly (clang, -O0):
<pl_crc32_for_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    1144 <pl_crc32_for_byte+0x44>
mov    -0x4(%rbp),%edx
and    $0x1,%edx
mov    $0xedb88320,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x1,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <pl_crc32_for_byte+0xe>
mov    -0x4(%rbp),%eax
xor    $0xff000000,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl_crc32_for_byte>:
xor    %eax,%eax
test   $0x2,%dil
mov    $0xedb88320,%r9d
mov    $0x0,%r10d
cmove  %r9d,%r10d
mov    %edi,%ecx
sar    $0x2,%ecx
test   $0x1,%dil
mov    $0xf6dc4190,%r8d
mov    $0x0,%r11d
cmove  %r8d,%r11d
xor    %ecx,%r11d
xor    %r11d,%r10d
test   $0x8,%dil
mov    $0x0,%ecx
cmove  %r9d,%ecx
mov    %r10d,%esi
sar    $0x2,%esi
test   $0x4,%dil
mov    $0x0,%edx
cmove  %r8d,%edx
xor    %ecx,%edx
xor    %esi,%edx
test   $0x20,%dil
mov    $0x0,%ecx
cmove  %r9d,%ecx
sar    $0x2,%edx
test   $0x10,%dil
mov    $0x0,%esi
cmove  %r8d,%esi
xor    %ecx,%esi
xor    %edx,%esi
test   $0x20,%r10b
cmovne %eax,%r9d
sar    $0x2,%esi
test   $0x10,%r11b
cmove  %r8d,%eax
xor    %r9d,%eax
xor    %esi,%eax
xor    $0xff000000,%eax
ret

LLVM IR (-O0):
define i32 @pl_crc32_for_byte(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 8
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %2
%9 = and i32 %8, 1
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 0, i32 -306674912
%13 = load i32, i32* %2
%14 = ashr i32 %13, 1
%15 = xor i32 %12, %14
store i32 %15, i32* %2
br label %16
16: ; preds = %7
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
%20 = load i32, i32* %2
%21 = xor i32 %20, -16777216
ret i32 %21
}

LLVM IR (-O2):
define i32 @pl_crc32_for_byte(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 2
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -306674912, i32 0
%7 = ashr i32 %0, 2
%8 = select i1 %3, i32 -153337456, i32 0
%9 = xor i32 %7, %8
%10 = xor i32 %6, %9
%11 = and i32 %0, 4
%12 = icmp eq i32 %11, 0
%13 = and i32 %0, 8
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i32 -306674912, i32 0
%16 = ashr i32 %10, 2
%17 = select i1 %12, i32 -153337456, i32 0
%18 = xor i32 %16, %17
%19 = xor i32 %15, %18
%20 = and i32 %0, 16
%21 = icmp eq i32 %20, 0
%22 = and i32 %0, 32
%23 = icmp eq i32 %22, 0
%24 = select i1 %23, i32 -306674912, i32 0
%25 = ashr i32 %19, 2
%26 = select i1 %21, i32 -153337456, i32 0
%27 = xor i32 %25, %26
%28 = xor i32 %24, %27
%29 = and i32 %9, 16
%30 = icmp eq i32 %29, 0
%31 = and i32 %10, 32
%32 = icmp eq i32 %31, 0
%33 = select i1 %32, i32 -306674912, i32 0
%34 = ashr i32 %28, 2
%35 = select i1 %30, i32 -153337456, i32 0
%36 = xor i32 %34, %35
%37 = xor i32 %33, %36
%38 = xor i32 %37, -16777216
ret i32 %38
}