#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
unsigned int reduce(unsigned int);
int main(int argc, char **argv) {
  unsigned i;
  printf("4-bit table:\n");
  for (i = 0; i < 16; i++) {
    unsigned x;
    if (i && !(i % 8))
      printf("\n");
    x = reduce(i << 4);
    printf("W(%02x,%02x),", x >> 8, x & 0xff);
  }
  printf("\n\n");
  printf("8-bit table:\n");
  for (i = 0; i < 256; i++) {
    unsigned x;
    if (i && !(i % 8))
      printf("\n");
    x = reduce(i);
    printf("W(%02x,%02x),", x >> 8, x & 0xff);
  }
  printf("\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jae    11b5 <main+0x95>
cmpl   $0x0,-0x14(%rbp)
je     117c <main+0x5c>
mov    -0x14(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    117c <main+0x5c>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
shl    $0x4,%edi
call   1030 <reduce@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
shr    $0x8,%esi
mov    -0x18(%rbp),%edx
and    $0xff,%edx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <main+0x2b>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jae    1242 <main+0x122>
cmpl   $0x0,-0x14(%rbp)
je     120c <main+0xec>
mov    -0x14(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    120c <main+0xec>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <reduce@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
shr    $0x8,%esi
mov    -0x1c(%rbp),%edx
and    $0xff,%edx
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d8 <main+0xb8>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d89(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
lea    0xea9(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1187 <main+0x47>
nopl   (%rax)
mov    %ebp,%edi
call   1050 <reduce@plt>
movzbl %al,%edx
mov    %eax,%esi
shr    $0x8,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebx
add    $0x10,%ebp
cmp    $0x100,%ebp
je     119e <main+0x5e>
test   %ebp,%ebp
je     1160 <main+0x20>
mov    %ebx,%eax
and    $0x7,%eax
jne    1160 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x20>
lea    0xe76(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe43(%rip),%rbx
xor    %ebp,%ebp
jmp    11f4 <main+0xb4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1050 <reduce@plt>
movzbl %al,%edx
mov    %eax,%esi
shr    $0x8,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
je     120b <main+0xcb>
test   %ebp,%ebp
je     11d0 <main+0x90>
mov    %ebp,%eax
and    $0x7,%eax
jne    11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"4-bit table:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [14 x i8] c"W(%02x,%02x),\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
@.str.4 = [14 x i8] c"8-bit table:\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %10
10: ; preds = %31, %2
%11 = load i32, i32* %6
%12 = icmp ult i32 %11, 16
br i1 %12, label %13, label %34
13: ; preds = %10
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* %6
%18 = urem i32 %17, 8
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %16, %13
%23 = load i32, i32* %6
%24 = shl i32 %23, 4
%25 = call i32 @reduce(i32 %24)
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = lshr i32 %26, 8
%28 = load i32, i32* %7
%29 = and i32 %28, 255
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %27, i32 %29)
br label %31
31: ; preds = %22
%32 = load i32, i32* %6
%33 = add i32 %32, 1
store i32 %33, i32* %6
br label %10
34: ; preds = %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %6
br label %37
37: ; preds = %57, %34
%38 = load i32, i32* %6
%39 = icmp ult i32 %38, 256
br i1 %39, label %40, label %60
40: ; preds = %37
%41 = load i32, i32* %6
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load i32, i32* %6
%45 = urem i32 %44, 8
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %49
49: ; preds = %47, %43, %40
%50 = load i32, i32* %6
%51 = call i32 @reduce(i32 %50)
store i32 %51, i32* %8
%52 = load i32, i32* %8
%53 = lshr i32 %52, 8
%54 = load i32, i32* %8
%55 = and i32 %54, 255
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %53, i32 %55)
br label %57
57: ; preds = %49
%58 = load i32, i32* %6
%59 = add i32 %58, 1
store i32 %59, i32* %6
br label %37
60: ; preds = %37
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%62 = load i32, i32* @EXIT_SUCCESS
ret i32 %62
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"W(%02x,%02x),\00"
@EXIT_SUCCESS = global i32 0
@str = [13 x i8] c"4-bit table:\00"
@str.5 = [2 x i8] c"\0A\00"
@str.6 = [13 x i8] c"8-bit table:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %2, %12
%5 = phi i32 [ 0, %2 ], [ %18, %12 ]
%6 = icmp ne i32 %5, 0
%7 = and i32 %5, 7
%8 = icmp eq i32 %7, 0
%9 = and i1 %6, %8
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @putchar(i32 10)
br label %12
12: ; preds = %10, %4
%13 = shl nuw nsw i32 %5, 4
%14 = tail call i32 @reduce(i32 %13)
%15 = lshr i32 %14, 8
%16 = and i32 %14, 255
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16)
%18 = add nuw nsw i32 %5, 1
%19 = icmp eq i32 %18, 16
br i1 %19, label %20, label %4
20: ; preds = %12
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0))
br label %23
23: ; preds = %20, %31
%24 = phi i32 [ 0, %20 ], [ %36, %31 ]
%25 = icmp ne i32 %24, 0
%26 = and i32 %24, 7
%27 = icmp eq i32 %26, 0
%28 = and i1 %25, %27
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = tail call i32 @putchar(i32 10)
br label %31
31: ; preds = %29, %23
%32 = tail call i32 @reduce(i32 %24)
%33 = lshr i32 %32, 8
%34 = and i32 %32, 255
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %34)
%36 = add nuw nsw i32 %24, 1
%37 = icmp eq i32 %36, 256
br i1 %37, label %38, label %23
38: ; preds = %31
%39 = tail call i32 @putchar(i32 10)
%40 = load i32, i32* @EXIT_SUCCESS
ret i32 %40
}