#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, ...);
void print_array(char array[2][3]) {
  int element1;
  for (element1 = 0; element1 < 2; ++element1) {
    printf("level %d:\n", element1 + 1);
    int element2;
    for (element2 = 0; element2 < 3; ++element2)
      printf("\tarray[%d][%d] = [%c]\n", element1, element2,
             array[element1][element2]);
  }
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    119e <print_array+0x8e>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    118b <print_array+0x7b>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1148 <print_array+0x38>
jmp    1190 <print_array+0x80>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_array+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xee1(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl (%rbx),%ecx
lea    0xed3(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x1(%rbx),%ecx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x2(%rbx),%ecx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x3(%rbx),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x4(%rbx),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x5(%rbx),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"level %d:\0A\00"
@.str.1 = [23 x i8] c"\09array[%d][%d] = [%c]\0A\00"
define void @print_array([3 x i8]* nocapture %0) {
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 0
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 %5)
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1, i32 %9)
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 2, i32 %13)
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 2)
%16 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 0, i32 %18)
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 1, i32 %22)
%24 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 2
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 2, i32 %26)
ret void
}