#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 *, ...);
void table_print(int *table) {
  int i, j;
  for (j = 0; j < 4; j++) {
    for (i = 0; i < 4; i++) {
      if (table[4 * j + i] == 16)
        printf("    ");
      else
        printf("%4d", table[4 * j + i]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<table_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11bb <table_print+0xab>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    119f <table_print+0x8f>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x2,%ecx
add    -0xc(%rbp),%ecx
movslq %ecx,%rcx
cmpl   $0x10,(%rax,%rcx,4)
jne    116b <table_print+0x5b>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118c <table_print+0x7c>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x2,%ecx
add    -0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1191 <table_print+0x81>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <table_print+0x24>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <table_print+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<table_print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
lea    0xece(%rip),%r14
lea    0xecc(%rip),%r15
xor    %ebx,%ebx
jmp    1162 <table_print+0x42>
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rbx
cmp    $0x40,%rbx
je     11e7 <table_print+0xc7>
mov    (%r12,%rbx,1),%esi
cmp    $0x10,%esi
jne    1180 <table_print+0x60>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    118a <table_print+0x6a>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%r12,%rbx,1),%esi
cmp    $0x10,%esi
jne    11a0 <table_print+0x80>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11aa <table_print+0x8a>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r12,%rbx,1),%esi
cmp    $0x10,%esi
jne    11c0 <table_print+0xa0>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ca <table_print+0xaa>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%r12,%rbx,1),%esi
cmp    $0x10,%esi
je     1140 <table_print+0x20>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    114a <table_print+0x2a>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
@.str.1 = [4 x i8] c"%4d\00"
define void @table_print(i32* nocapture %0) {
br label %2
2: ; preds = %1, %39
%3 = phi i64 [ 0, %1 ], [ %41, %39 ]
%4 = shl nsw i64 %3, 2
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 16
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %12
12: ; preds = %8, %10
%13 = or i64 %4, 1
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 16
br i1 %16, label %19, label %17
17: ; preds = %12
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %21
19: ; preds = %12
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
%22 = or i64 %4, 2
%23 = getelementptr inbounds i32, i32* %0, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 16
br i1 %25, label %28, label %26
26: ; preds = %21
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %30
28: ; preds = %21
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
%31 = or i64 %4, 3
%32 = getelementptr inbounds i32, i32* %0, i64 %31
%33 = load i32, i32* %32
%34 = icmp eq i32 %33, 16
br i1 %34, label %37, label %35
35: ; preds = %30
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %39
37: ; preds = %30
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
%40 = tail call i32 @putchar(i32 10)
%41 = add nuw nsw i64 %3, 1
%42 = icmp eq i64 %41, 4
br i1 %42, label %43, label %2
43: ; preds = %39
ret void
}