#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 drawGrid(char *grid[8][8]) {
  printf("Grid:\n");
  printf("    ");
  for (int x = 0; x < 8; x++) {
    switch (x) {
    case 0:
      printf(" a   ");
      break;
    case 1:
      printf(" b   ");
      break;
    case 2:
      printf(" c   ");
      break;
    case 3:
      printf(" d   ");
      break;
    case 4:
      printf(" e   ");
      break;
    case 5:
      printf(" f   ");
      break;
    case 6:
      printf(" g   ");
      break;
    case 7:
      printf(" h   ");
      break;
    }
  }
  printf("\n");
  for (int y = 0; y < 8; y++) {
    printf(" %d  ", y + 1);
    for (int x = 0; x < 8; x++) {
      printf("%s  ", grid[y][x]);
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<drawGrid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1214 <drawGrid+0x104>
mov    -0xc(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x7,%rax
ja     1201 <drawGrid+0xf1>
mov    -0x20(%rbp),%rax
lea    0xe9b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <drawGrid+0xf1>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <drawGrid+0xf1>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <drawGrid+0xf1>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <drawGrid+0xf1>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <drawGrid+0xf1>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <drawGrid+0xf1>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <drawGrid+0xf1>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <drawGrid+0xf6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <drawGrid+0x2f>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    12a7 <drawGrid+0x197>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    128b <drawGrid+0x17b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124e <drawGrid+0x13e>
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1229 <drawGrid+0x119>
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawGrid>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r12
lea    0xefe(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebp
lea    0xe5a(%rip),%r14
lea    0xe59(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12,%rbx,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r12,%rbx,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%r12,%rbx,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%r12,%rbx,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%r12,%rbx,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%r12,%rbx,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%r12,%rbx,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%r12,%rbx,1),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x40,%rbx
add    $0x1,%ebp
cmp    $0x200,%rbx
jne    11f0 <drawGrid+0xc0>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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