#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 */

/* Variables and functions */
int CRC_reflect(unsigned long, int);
void CRC_init_table(unsigned long *table) {
  unsigned long ulPolynomial = 0x04C11DB7;
  int i, j;
  for (i = 0; i <= 0xFF; i++) {
    table[i] = CRC_reflect(i, 8) << 24;
    for (j = 0; j < 8; j++)
      table[i] = (table[i] << 1) ^ (table[i] & (1 << 31) ? ulPolynomial : 0);
    table[i] = CRC_reflect(table[i], 32);
  }
}


x86 assembly (clang, -O0):
<CRC_init_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x4c11db7,-0x10(%rbp)
04
movl   $0x0,-0x14(%rbp)
cmpl   $0xff,-0x14(%rbp)
jg     1209 <CRC_init_table+0xf9>
movslq -0x14(%rbp),%rdi
mov    $0x8,%esi
call   1030 <CRC_reflect@plt>
shl    $0x18,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    11d6 <CRC_init_table+0xc6>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
shl    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
and    $0xffffffff80000000,%rax
cmp    $0x0,%rax
je     11a6 <CRC_init_table+0x96>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    11b1 <CRC_init_table+0xa1>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    11b1 <CRC_init_table+0xa1>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rax
xor    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115f <CRC_init_table+0x4f>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x20,%esi
call   1030 <CRC_reflect@plt>
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <CRC_init_table+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRC_init_table>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x80000000,%r15d
xor    %ebx,%ebx
jmp    1158 <CRC_init_table+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %rax,%rdi
mov    %rdi,(%r14,%rbx,8)
mov    $0x20,%esi
call   1030 <CRC_reflect@plt>
cltq
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x100,%rbx
je     1220 <CRC_init_table+0x110>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <CRC_reflect@plt>
shl    $0x18,%eax
movslq %eax,%rdx
lea    (%rdx,%rdx,1),%rax
mov    $0x0,%ecx
test   %edx,%edx
jns    117d <CRC_init_table+0x6d>
mov    $0x4c11db7,%ecx
xor    %rax,%rcx
lea    (%rcx,%rcx,1),%rdx
mov    $0x0,%eax
cmp    %r15,%rcx
jb     1193 <CRC_init_table+0x83>
mov    $0x4c11db7,%eax
xor    %rdx,%rax
lea    (%rax,%rax,1),%rdx
mov    $0x0,%ecx
cmp    %r15,%rax
jb     11a9 <CRC_init_table+0x99>
mov    $0x4c11db7,%ecx
xor    %rdx,%rcx
lea    (%rcx,%rcx,1),%rdx
mov    $0x0,%eax
cmp    %r15,%rcx
jb     11bf <CRC_init_table+0xaf>
mov    $0x4c11db7,%eax
xor    %rdx,%rax
lea    (%rax,%rax,1),%rdx
mov    $0x0,%ecx
cmp    %r15,%rax
jb     11d5 <CRC_init_table+0xc5>
mov    $0x4c11db7,%ecx
xor    %rdx,%rcx
lea    (%rcx,%rcx,1),%rdx
mov    $0x0,%eax
cmp    %r15,%rcx
jb     11eb <CRC_init_table+0xdb>
mov    $0x4c11db7,%eax
xor    %rdx,%rax
lea    (%rax,%rax,1),%rdx
mov    $0x0,%ecx
cmp    %r15,%rax
jb     1201 <CRC_init_table+0xf1>
mov    $0x4c11db7,%ecx
xor    %rdx,%rcx
lea    (%rcx,%rcx,1),%rax
mov    $0x0,%edi
cmp    %r15,%rcx
jb     1130 <CRC_init_table+0x20>
mov    $0x4c11db7,%edi
jmp    1130 <CRC_init_table+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @CRC_init_table(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i64* %0, i64** %2
store i64 79764919, i64* %3
store i32 0, i32* %4
br label %6
6: ; preds = %61, %1
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 255
br i1 %8, label %9, label %64
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = call i32 @CRC_reflect(i64 %11, i32 8)
%13 = shl i32 %12, 24
%14 = sext i32 %13 to i64
%15 = load i64*, i64** %2
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i64, i64* %15, i64 %17
store i64 %14, i64* %18
store i32 0, i32* %5
br label %19
19: ; preds = %46, %9
%20 = load i32, i32* %5
%21 = icmp slt i32 %20, 8
br i1 %21, label %22, label %49
22: ; preds = %19
%23 = load i64*, i64** %2
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i64, i64* %23, i64 %25
%27 = load i64, i64* %26
%28 = shl i64 %27, 1
%29 = load i64*, i64** %2
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i64, i64* %29, i64 %31
%33 = load i64, i64* %32
%34 = and i64 %33, -2147483648
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %22
%37 = load i64, i64* %3
br label %39
38: ; preds = %22
br label %39
39: ; preds = %38, %36
%40 = phi i64 [ %37, %36 ], [ 0, %38 ]
%41 = xor i64 %28, %40
%42 = load i64*, i64** %2
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i64, i64* %42, i64 %44
store i64 %41, i64* %45
br label %46
46: ; preds = %39
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %19
49: ; preds = %19
%50 = load i64*, i64** %2
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i64, i64* %50, i64 %52
%54 = load i64, i64* %53
%55 = call i32 @CRC_reflect(i64 %54, i32 32)
%56 = sext i32 %55 to i64
%57 = load i64*, i64** %2
%58 = load i32, i32* %4
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i64, i64* %57, i64 %59
store i64 %56, i64* %60
br label %61
61: ; preds = %49
%62 = load i32, i32* %4
%63 = add nsw i32 %62, 1
store i32 %63, i32* %4
br label %6
64: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @CRC_init_table(i64* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %42, %2 ]
%4 = tail call i32 @CRC_reflect(i64 %3, i32 8)
%5 = shl i32 %4, 24
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i64, i64* %0, i64 %3
%8 = shl nsw i64 %6, 1
%9 = icmp sgt i32 %5, -1
%10 = select i1 %9, i64 0, i64 79764919
%11 = xor i64 %10, %8
%12 = shl nsw i64 %11, 1
%13 = icmp ult i64 %11, 2147483648
%14 = select i1 %13, i64 0, i64 79764919
%15 = xor i64 %14, %12
%16 = shl nsw i64 %15, 1
%17 = icmp ult i64 %15, 2147483648
%18 = select i1 %17, i64 0, i64 79764919
%19 = xor i64 %18, %16
%20 = shl i64 %19, 1
%21 = icmp ult i64 %19, 2147483648
%22 = select i1 %21, i64 0, i64 79764919
%23 = xor i64 %22, %20
%24 = shl i64 %23, 1
%25 = icmp ult i64 %23, 2147483648
%26 = select i1 %25, i64 0, i64 79764919
%27 = xor i64 %26, %24
%28 = shl i64 %27, 1
%29 = icmp ult i64 %27, 2147483648
%30 = select i1 %29, i64 0, i64 79764919
%31 = xor i64 %30, %28
%32 = shl i64 %31, 1
%33 = icmp ult i64 %31, 2147483648
%34 = select i1 %33, i64 0, i64 79764919
%35 = xor i64 %34, %32
%36 = shl i64 %35, 1
%37 = icmp ult i64 %35, 2147483648
%38 = select i1 %37, i64 0, i64 79764919
%39 = xor i64 %38, %36
store i64 %39, i64* %7
%40 = tail call i32 @CRC_reflect(i64 %39, i32 32)
%41 = sext i32 %40 to i64
store i64 %41, i64* %7
%42 = add nuw nsw i64 %3, 1
%43 = icmp eq i64 %42, 256
br i1 %43, label %44, label %2
44: ; preds = %2
ret void
}