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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  uint8_t byte = 0;
  printf("static const uint8_t reflect8[256] = {\n");
  while (1) {
    if (byte % 10 == 0)
      printf("    ");
    uint8_t res = 0;
    for (size_t i = 0; i < 8; ++i) {
      if (byte & (1 << i))
        res |= (1 << (7 - i));
    }
    printf("0x%02X", res);
    if (byte != 255)
      printf(",");
    if (byte % 10 == 9)
      printf("\n");
    if (byte == 255)
      break;
    ++byte;
  }
  printf("\n};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1156 <main+0x46>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x8,-0x18(%rbp)
jae    11b9 <main+0xa9>
mov    -0x8(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11a3 <main+0x93>
mov    $0x7,%eax
sub    -0x18(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11a8 <main+0x98>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1165 <main+0x55>
mov    -0xc(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xff,-0x8(%rbp)
je     11e5 <main+0xd5>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x9,%edx
jne    1207 <main+0xf7>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xff,-0x8(%rbp)
jne    1219 <main+0x109>
jmp    1227 <main+0x117>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <main+0x24>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
mov    $0xcccccccd,%r15d
lea    0xeaf(%rip),%r14
lea    0xead(%rip),%r12
xor    %ebp,%ebp
jmp    1163 <main+0x33>
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %ebp,%ebx
imul   %r15,%rbx
shr    $0x23,%rbx
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
cmp    %ebp,%eax
jne    1180 <main+0x50>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%eax
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x55,%cl
add    %cl,%cl
shr    %al
and    $0x55,%al
or     %cl,%al
movzbl %al,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xff,%ebp
je     11d6 <main+0xa6>
lea    (%rbx,%rbx,4),%ebx
add    $0x9,%ebx
mov    $0x2c,%edi
call   1030 <putchar@plt>
cmp    %ebp,%ebx
jne    1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x30>
lea    0xe56(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"static const uint8_t reflect8[256] = {\0A\00"
@.str.1 = [5 x i8] c" \00"
@.str.2 = [7 x i8] c"0x%02X\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [5 x i8] c"\0A};\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %0, %51
%7 = load i32, i32* %2
%8 = srem i32 %7, 10
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
store i32 0, i32* %3
store i64 0, i64* %4
br label %13
13: ; preds = %31, %12
%14 = load i64, i64* %4
%15 = icmp ult i64 %14, 8
br i1 %15, label %16, label %34
16: ; preds = %13
%17 = load i32, i32* %2
%18 = load i64, i64* %4
%19 = trunc i64 %18 to i32
%20 = shl i32 1, %19
%21 = and i32 %17, %20
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %16
%24 = load i64, i64* %4
%25 = sub i64 7, %24
%26 = trunc i64 %25 to i32
%27 = shl i32 1, %26
%28 = load i32, i32* %3
%29 = or i32 %28, %27
store i32 %29, i32* %3
br label %30
30: ; preds = %23, %16
br label %31
31: ; preds = %30
%32 = load i64, i64* %4
%33 = add i64 %32, 1
store i64 %33, i64* %4
br label %13
34: ; preds = %13
%35 = load i32, i32* %3
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %2
%38 = icmp ne i32 %37, 255
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %39, %34
%42 = load i32, i32* %2
%43 = srem i32 %42, 10
%44 = icmp eq i32 %43, 9
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %47
47: ; preds = %45, %41
%48 = load i32, i32* %2
%49 = icmp eq i32 %48, 255
br i1 %49, label %50, label %51
50: ; preds = %47
br label %54
51: ; preds = %47
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %6
54: ; preds = %50
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c" \00"
@.str.2 = [7 x i8] c"0x%02X\00"
@str = [39 x i8] c"static const uint8_t reflect8[256] = {\00"
@str.6 = [4 x i8] c"\0A};\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %19, %0
%3 = phi i32 [ 0, %0 ], [ %20, %19 ]
%4 = urem i32 %3, 10
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = trunc i32 %3 to i8
%10 = call i8 @llvm.bitreverse.i8(i8 %9)
%11 = zext i8 %10 to i32
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = icmp eq i32 %3, 255
br i1 %13, label %21, label %14
14: ; preds = %8
%15 = tail call i32 @putchar(i32 44)
%16 = icmp eq i32 %4, 9
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @putchar(i32 10)
br label %19
19: ; preds = %17, %14
%20 = add nuw nsw i32 %3, 1
br label %2
21: ; preds = %8
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}