#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 /*<<< orphan*/ printf(char *, ...);
unsigned char reverse_byte(unsigned char);
int main() {
  printf("// auto-generated file (do not edit)\n");
  printf("\n");
  printf("// reverse byte table\n");
  printf("unsigned const char liquid_reverse_byte[256] = {\n    ");
  unsigned int i;
  for (i = 0; i < 256; i++) {
    unsigned char byte_rev = reverse_byte((unsigned char)i);
    printf("0x%.2x", byte_rev);
    if (i != 255) {
      printf(",");
      if (((i + 1) % 8) == 0)
        printf("\n    ");
      else
        printf(" ");
    }
  }
  printf("};\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jae    1201 <main+0xe1>
mov    -0x8(%rbp),%eax
movzbl %al,%edi
call   1040 <reverse_byte@plt>
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%esi
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xff,-0x8(%rbp)
je     11ee <main+0xce>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    11db <main+0xbb>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e9 <main+0xc9>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <main+0xce>
jmp    11f3 <main+0xd3>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <main+0x4e>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xef2(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf01(%rip),%rdi
call   1040 <puts@plt>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebb(%rip),%rbx
lea    0xeae(%rip),%r14
xor    %ebp,%ebp
jmp    11a2 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x100,%ebp
je     11e5 <main+0xa5>
movzbl %bpl,%edi
call   1060 <reverse_byte@plt>
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xff,%ebp
je     11e5 <main+0xa5>
mov    $0x2c,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
test   $0x7,%bpl
je     1190 <main+0x50>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0x100,%ebp
jne    11a2 <main+0x62>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"// auto-generated file (do not edit)\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [23 x i8] c"// reverse byte table\0A\00"
@.str.3 = [54 x i8] c"unsigned const char liquid_reverse_byte[256] = {\0A \00"
@.str.4 = [7 x i8] c"0x%.2x\00"
@.str.5 = [2 x i8] c",\00"
@.str.6 = [6 x i8] c"\0A \00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [5 x i8] c"};\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %8
8: ; preds = %32, %0
%9 = load i32, i32* %2
%10 = icmp ult i32 %9, 256
br i1 %10, label %11, label %35
11: ; preds = %8
%12 = load i32, i32* %2
%13 = trunc i32 %12 to i8
%14 = call zeroext i8 @reverse_byte(i8 zeroext %13)
store i8 %14, i8* %3
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 255
br i1 %19, label %20, label %31
20: ; preds = %11
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%22 = load i32, i32* %2
%23 = add i32 %22, 1
%24 = urem i32 %23, 8
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %30
28: ; preds = %20
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30, %11
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add i32 %33, 1
store i32 %34, i32* %2
br label %8
35: ; preds = %8
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [54 x i8] c"unsigned const char liquid_reverse_byte[256] = {\0A \00"
@.str.4 = [7 x i8] c"0x%.2x\00"
@.str.6 = [6 x i8] c"\0A \00"
@str = [37 x i8] c"// auto-generated file (do not edit)\00"
@str.9 = [22 x i8] c"// reverse byte table\00"
@str.10 = [4 x i8] c"};\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
br label %5
5: ; preds = %0, %21
%6 = phi i32 [ 0, %0 ], [ %14, %21 ]
%7 = trunc i32 %6 to i8
%8 = tail call zeroext i8 @reverse_byte(i8 zeroext %7)
%9 = zext i8 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = icmp eq i32 %6, 255
br i1 %11, label %23, label %12
12: ; preds = %5
%13 = tail call i32 @putchar(i32 44)
%14 = add nuw nsw i32 %6, 1
%15 = and i32 %14, 7
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %21
19: ; preds = %12
%20 = tail call i32 @putchar(i32 32)
br label %21
21: ; preds = %17, %19
%22 = icmp eq i32 %14, 256
br i1 %22, label %23, label %5
23: ; preds = %5, %21
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}