#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void printGridRow(int i) {
  switch (i) {
  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;
  case 8:
    printf("I | ");
    break;
  case 9:
    printf("J | ");
    break;
  default:
    printf("Unknown grid row value: %d. Program terminating.\n", i);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<printGridRow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x9,%rax
ja     120e <printGridRow+0xee>
mov    -0x10(%rbp),%rax
lea    0xeb9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <printGridRow+0x109>
mov    -0x4(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printGridRow>:
push   %rax
mov    %edi,%esi
cmp    $0xa,%edi
jae    1141 <printGridRow+0x21>
movslq %esi,%rax
lea    0xf32(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>
lea    0xeea(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"A | \00"
@.str.1 = [5 x i8] c"B | \00"
@.str.2 = [5 x i8] c"C | \00"
@.str.3 = [5 x i8] c"D | \00"
@.str.4 = [5 x i8] c"E | \00"
@.str.5 = [5 x i8] c"F | \00"
@.str.6 = [5 x i8] c"G | \00"
@.str.7 = [5 x i8] c"H | \00"
@.str.8 = [5 x i8] c"I | \00"
@.str.9 = [5 x i8] c"J | \00"
@.str.10 = [50 x i8] c"Unknown grid row value: %d. Program terminating.\0A\00"
define void @printGridRow(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %24 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %16
i32 7, label %18
i32 8, label %20
i32 9, label %22
]
4: ; preds = %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %28
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %28
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %28
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %28
14: ; preds = %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %28
16: ; preds = %1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %28
18: ; preds = %1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %28
20: ; preds = %1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %28
22: ; preds = %1
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %28
24: ; preds = %1
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.10, i64 0, i64 0), i32 %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %22, %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"A | \00"
@.str.1 = [5 x i8] c"B | \00"
@.str.2 = [5 x i8] c"C | \00"
@.str.3 = [5 x i8] c"D | \00"
@.str.4 = [5 x i8] c"E | \00"
@.str.5 = [5 x i8] c"F | \00"
@.str.6 = [5 x i8] c"G | \00"
@.str.7 = [5 x i8] c"H | \00"
@.str.8 = [5 x i8] c"I | \00"
@.str.9 = [5 x i8] c"J | \00"
@.str.10 = [50 x i8] c"Unknown grid row value: %d. Program terminating.\0A\00"
@reltable.printGridRow = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.printGridRow to i64)) to i32)]
define void @printGridRow(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.10, i64 0, i64 0), i32 %0)
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %1
%7 = sext i32 %0 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.printGridRow to i8*), i64 %8)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9)
ret void
}