#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 displayGrid(char grid[9][9]) {
  for (int y = 0; y < 9; y++) {
    for (int x = 0; x < 9; x++)
      printf("%c", grid[x][y]);
    printf("\n");
  }
  for (int i = 0; i < 9; i++)
    if (!(i % 2))
      printf("%d", i + 1);
    else
      printf(" ");
  printf("\n");
}


x86 assembly (clang, -O0):
<displayGrid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    118d <displayGrid+0x7d>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    1171 <displayGrid+0x61>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x9,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <displayGrid+0x24>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <displayGrid+0x13>
movl   $0x0,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jge    11ec <displayGrid+0xdc>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11cb <displayGrid+0xbb>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d9 <displayGrid+0xc9>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <displayGrid+0xce>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1194 <displayGrid+0x84>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayGrid>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0xfffffffffffffff7,%rbx
xchg   %ax,%ax
movsbl 0x9(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x12(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x1b(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x24(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x2d(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x36(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x3f(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x48(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x51(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
inc    %rbx
jne    1130 <displayGrid+0x10>
lea    0xe57(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

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

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