#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 /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
void print_grid(char grid[3][3]) {
  for (int i = 0; i < 3; i++)
    printf("   %c", 'a' + i);
  puts("");
  for (int i = 0; i < 3; i++) {
    printf("%d ", i + 1);
    for (int j = 0; j < 3; j++) {
      printf(" %c ", grid[i][j]);
      if (j < 3 - 1)
        putchar('|');
    }
    printf("\n  ");
    if (i < 3 - 1)
      for (int j = 0; j < 3 * 3 + 3 - 1; j++)
        putchar('-');
    puts("");
  }
}


x86 assembly (clang, -O0):
<print_grid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    116f <print_grid+0x3f>
mov    -0xc(%rbp),%esi
add    $0x61,%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <print_grid+0x13>
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    125d <print_grid+0x12d>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11fd <print_grid+0xcd>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x2,-0x14(%rbp)
jge    11ea <print_grid+0xba>
mov    $0x7c,%edi
call   1030 <putchar@plt>
jmp    11ef <print_grid+0xbf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a7 <print_grid+0x77>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x2,-0x10(%rbp)
jge    1243 <print_grid+0x113>
movl   $0x0,-0x18(%rbp)
cmpl   $0xb,-0x18(%rbp)
jge    123e <print_grid+0x10e>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    121c <print_grid+0xec>
jmp    1243 <print_grid+0x113>
lea    0xdc8(%rip),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1182 <print_grid+0x52>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_grid>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r13
lea    0xecd(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x62,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x63,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe95(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x0(%r13),%esi
lea    0xe7e(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl 0x1(%r13),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl 0x2(%r13),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe40(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x3(%r13),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl 0x4(%r13),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl 0x5(%r13),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x6(%r13),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl 0x7(%r13),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl 0x8(%r13),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c" %c\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [5 x i8] c" %c \00"
@.str.4 = [4 x i8] c"\0A \00"
define void @print_grid([3 x i8]* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 97)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 98)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 99)
%5 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = tail call i32 @putchar(i8 signext 124)
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = tail call i32 @putchar(i8 signext 124)
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%22 = tail call i32 @putchar(i8 signext 45)
%23 = tail call i32 @putchar(i8 signext 45)
%24 = tail call i32 @putchar(i8 signext 45)
%25 = tail call i32 @putchar(i8 signext 45)
%26 = tail call i32 @putchar(i8 signext 45)
%27 = tail call i32 @putchar(i8 signext 45)
%28 = tail call i32 @putchar(i8 signext 45)
%29 = tail call i32 @putchar(i8 signext 45)
%30 = tail call i32 @putchar(i8 signext 45)
%31 = tail call i32 @putchar(i8 signext 45)
%32 = tail call i32 @putchar(i8 signext 45)
%33 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 2)
%35 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = tail call i32 @putchar(i8 signext 124)
%40 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 1
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = tail call i32 @putchar(i8 signext 124)
%45 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 2
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%50 = tail call i32 @putchar(i8 signext 45)
%51 = tail call i32 @putchar(i8 signext 45)
%52 = tail call i32 @putchar(i8 signext 45)
%53 = tail call i32 @putchar(i8 signext 45)
%54 = tail call i32 @putchar(i8 signext 45)
%55 = tail call i32 @putchar(i8 signext 45)
%56 = tail call i32 @putchar(i8 signext 45)
%57 = tail call i32 @putchar(i8 signext 45)
%58 = tail call i32 @putchar(i8 signext 45)
%59 = tail call i32 @putchar(i8 signext 45)
%60 = tail call i32 @putchar(i8 signext 45)
%61 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%63 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %65)
%67 = tail call i32 @putchar(i8 signext 124)
%68 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 1
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %70)
%72 = tail call i32 @putchar(i8 signext 124)
%73 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 2
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %75)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%78 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
ret void
}