#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int print_table(FILE *f, int *d) {
  int x;
  for (x = 0; x < 256; x++) {
    if ((x % 8) == 0)
      fprintf(f, "  ");
    fprintf(f, "%d", d[x]);
    if ((x % 8) == 7) {
      if (x == 255)
        fprintf(f, " };\n");
      else
        fprintf(f, ",\n");
    } else
      fprintf(f, ", ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<print_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    11eb <print_table+0xdb>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115a <print_table+0x4a>
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x7,%edx
jne    11c6 <print_table+0xb6>
cmpl   $0xff,-0x14(%rbp)
jne    11af <print_table+0x9f>
mov    -0x8(%rbp),%rdi
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11c1 <print_table+0xb1>
mov    -0x8(%rbp),%rdi
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11d8 <print_table+0xc8>
mov    -0x8(%rbp),%rdi
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11dd <print_table+0xcd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <print_table+0x17>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecb(%rip),%r12
lea    0xecf(%rip),%r13
xor    %ebp,%ebp
jmp    119c <print_table+0x7c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe9f(%rip),%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    (%r14,%rbp,4),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r13,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
add    $0x1,%rbp
cmp    $0x100,%rbp
je     11e8 <print_table+0xc8>
mov    %ebp,%r15d
and    $0x7,%r15d
je     1150 <print_table+0x30>
mov    (%r14,%rbp,4),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r13,%rdi
cmp    $0x7,%r15d
jne    117d <print_table+0x5d>
lea    0xe45(%rip),%rdi
cmp    $0xff,%rbp
jne    117d <print_table+0x5d>
lea    0xe30(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c" };\0A\00"
@.str.3 = [3 x i8] c",\0A\00"
@.str.4 = [3 x i8] c", \00"
define i32 @print_table(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %6
6: ; preds = %41, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 256
br i1 %8, label %9, label %44
9: ; preds = %6
%10 = load i32, i32* %5
%11 = srem i32 %10, 8
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32*, i32** %3
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %9
%17 = load i32*, i32** %3
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %5
%25 = srem i32 %24, 8
%26 = icmp eq i32 %25, 7
br i1 %26, label %27, label %37
27: ; preds = %16
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 255
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32*, i32** %3
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %36
33: ; preds = %27
%34 = load i32*, i32** %3
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %33, %30
br label %40
37: ; preds = %16
%38 = load i32*, i32** %3
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %40
40: ; preds = %37, %36
br label %41
41: ; preds = %40
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %6
44: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c" \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c" };\0A\00"
@.str.3 = [3 x i8] c",\0A\00"
@.str.4 = [3 x i8] c", \00"
define i32 @print_table(i32* nocapture %0, i32* nocapture %1) {
br label %3
3: ; preds = %2, %22
%4 = phi i64 [ 0, %2 ], [ %25, %22 ]
%5 = trunc i64 %4 to i32
%6 = and i32 %5, 7
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %0)
%10 = getelementptr inbounds i32, i32* %1, i64 %4
%11 = load i32, i32* %10
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %22
13: ; preds = %3
%14 = getelementptr inbounds i32, i32* %1, i64 %4
%15 = load i32, i32* %14
%16 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = icmp eq i32 %6, 7
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = icmp eq i64 %4, 255
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 4, i64 1, i32* %0)
br label %27
22: ; preds = %13, %8, %18
%23 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %18 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %13 ]
%24 = tail call i64 @fwrite(i8* %23, i64 2, i64 1, i32* %0)
%25 = add nuw nsw i64 %4, 1
%26 = icmp eq i64 %25, 256
br i1 %26, label %27, label %3
27: ; preds = %22, %20
ret i32 0
}