#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 prtable(const char *type, const char *name, int *table, int size) {
  int i;
  printf("  static %s %s[%d] =\n", type, name, size);
  printf("  {\n");
  for (i = 0; i < size; i++) {
    if ((i % 12) == 0)
      printf("    %3d,", table[i]);
    else if ((i % 12) == 11)
      printf(" %3d,\n", table[i]);
    else
      printf(" %3d,", table[i]);
  }
  if ((i % 12) != 0)
    printf("\n");
  printf("  };\n");
}


x86 assembly (clang, -O0):
<prtable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11f6 <prtable+0xe6>
mov    -0x20(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1193 <prtable+0x83>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <prtable+0xd3>
mov    -0x20(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cmp    $0xb,%edx
jne    11c5 <prtable+0xb5>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <prtable+0xce>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <prtable+0xd3>
jmp    11e8 <prtable+0xd8>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1155 <prtable+0x45>
mov    -0x20(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1218 <prtable+0x108>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prtable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    11ee <prtable+0xbe>
mov    %ebp,0x4(%rsp)
mov    %ebp,%ebp
mov    $0xaaaaaaab,%r15d
lea    0xea4(%rip),%r12
lea    0xe94(%rip),%r14
xor    %r13d,%r13d
jmp    11ab <prtable+0x7b>
nopw   0x0(%rax,%rax,1)
cmp    %eax,%r13d
cmove  %r14,%rdi
mov    (%rbx,%r13,4),%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
je     11d2 <prtable+0xa2>
mov    %r13d,%eax
imul   %r15,%rax
shr    $0x23,%rax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
mov    %r13d,%ecx
sub    %eax,%ecx
mov    %r12,%rdi
cmp    $0xb,%ecx
je     1190 <prtable+0x60>
lea    0xe49(%rip),%rdi
jmp    1190 <prtable+0x60>
imul   $0xaaaaaaab,0x4(%rsp),%eax
aa
ror    $0x2,%eax
cmp    $0x15555556,%eax
jb     11ee <prtable+0xbe>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe35(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@.str = [22 x i8] c" static %s %s[%d] =\0A\00"
@.str.2 = [9 x i8] c" %3d,\00"
@.str.3 = [7 x i8] c" %3d,\0A\00"
@.str.4 = [6 x i8] c" %3d,\00"
@str = [4 x i8] c" {\00"
@str.7 = [5 x i8] c" };\00"
define void @prtable(i8* %0, i8* %1, i32* nocapture %2, i32 %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %3)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %28
8: ; preds = %4
%9 = zext i32 %3 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %21, %10 ]
%12 = trunc i64 %11 to i32
%13 = urem i32 %12, 12
%14 = icmp eq i32 %13, 11
%15 = select i1 %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%16 = icmp eq i32 %13, 0
%17 = select i1 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %15
%18 = getelementptr inbounds i32, i32* %2, i64 %11
%19 = load i32, i32* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %17, i32 %19)
%21 = add nuw nsw i64 %11, 1
%22 = icmp eq i64 %21, %9
br i1 %22, label %23, label %10
23: ; preds = %10
%24 = urem i32 %3, 12
%25 = icmp eq i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = tail call i32 @putchar(i32 10)
br label %28
28: ; preds = %4, %26, %23
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.7, i64 0, i64 0))
ret void
}