#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 *, int);
int /*<<< orphan*/ puts(char *);
void print(int mat[3][3], char c) {
  int i, j;
  if (c == 'c') {
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        printf("%5c", mat[i][j]);
      }
      puts("");
    }
  } else {
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        printf("%5d", mat[i][j]);
      }
      puts("");
    }
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x63,%eax
jne    11b0 <print+0x90>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    11ab <print+0x8b>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1191 <print+0x71>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <print+0x37>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <print+0x26>
jmp    1221 <print+0x101>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    121c <print+0xfc>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1202 <print+0xe2>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c8 <print+0xa8>
lea    0xdfa(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b7 <print+0x97>
jmp    1221 <print+0x101>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
cmp    $0x63,%sil
mov    (%rdi),%esi
lea    0xecc(%rip),%rax
lea    0xec9(%rip),%rbx
cmove  %rax,%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x4(%r14),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x8(%r14),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%r14),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x10(%r14),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x14(%r14),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x18(%r14),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x1c(%r14),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x20(%r14),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%5c\00"
@.str.2 = [4 x i8] c"%5d\00"
define void @print([3 x i32]* nocapture %0, i8 signext %1) {
%3 = icmp eq i8 %1, 99
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 0, i64 0
%5 = load i32, i32* %4
%6 = select i1 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 @printf(i8* %6, i32 %5)
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 0, i64 1
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* %6, i32 %9)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 0, i64 2
%12 = load i32, i32* %11
%13 = tail call i32 @printf(i8* %6, i32 %12)
%14 = tail call i32 @putchar(i32 10)
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 1, i64 0
%16 = load i32, i32* %15
%17 = tail call i32 @printf(i8* %6, i32 %16)
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 1, i64 1
%19 = load i32, i32* %18
%20 = tail call i32 @printf(i8* %6, i32 %19)
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 1, i64 2
%22 = load i32, i32* %21
%23 = tail call i32 @printf(i8* %6, i32 %22)
%24 = tail call i32 @putchar(i32 10)
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 2, i64 0
%26 = load i32, i32* %25
%27 = tail call i32 @printf(i8* %6, i32 %26)
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 2, i64 1
%29 = load i32, i32* %28
%30 = tail call i32 @printf(i8* %6, i32 %29)
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 2, i64 2
%32 = load i32, i32* %31
%33 = tail call i32 @printf(i8* %6, i32 %32)
%34 = tail call i32 @putchar(i32 10)
ret void
}