#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 nChars();
int nColumns();
int nRows();
int /*<<< orphan*/ printFile();
int /*<<< orphan*/ printRow();
int /*<<< orphan*/ printf(char *, int);
int rowMax();
void selectOption(int option) {
  switch (option) {
  case 0:
    break;
  case 1:
    printf("Total number of rows: %d\n\n", nRows());
    break;
  case 2:
    printf("Total number of columns: %d\n\n", nColumns());
    break;
  case 3:
    printf("Total number of characters: %d\n\n", nChars());
    break;
  case 4:
    printf("Longest row: %d\n\n", rowMax());
    break;
  case 5:
    printRow();
    break;
  case 6:
    printFile();
    break;
  }
}


x86 assembly (clang, -O0):
<selectOption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x6,%rax
ja     1220 <selectOption+0xb0>
mov    -0x10(%rbp),%rax
lea    0xe69(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1220 <selectOption+0xb0>
mov    $0x0,%al
call   1070 <nRows@plt>
mov    %eax,%esi
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
jmp    1220 <selectOption+0xb0>
mov    $0x0,%al
call   1060 <nColumns@plt>
mov    %eax,%esi
lea    0xe68(%rip),%rdi
call   1050 <printf@plt>
jmp    1220 <selectOption+0xb0>
mov    $0x0,%al
call   1090 <nChars@plt>
mov    %eax,%esi
lea    0xe6c(%rip),%rdi
call   1050 <printf@plt>
jmp    1220 <selectOption+0xb0>
mov    $0x0,%al
call   1080 <rowMax@plt>
mov    %eax,%esi
lea    0xe73(%rip),%rdi
call   1050 <printf@plt>
jmp    1220 <selectOption+0xb0>
mov    $0x0,%al
call   1030 <printRow@plt>
jmp    1220 <selectOption+0xb0>
mov    $0x0,%al
call   1040 <printFile@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<selectOption>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x5,%edi
ja     1199 <selectOption+0x29>
lea    0xe80(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
call   1070 <nRows@plt>
lea    0xe81(%rip),%rdi
jmp    11c9 <selectOption+0x59>
pop    %rax
ret
xor    %eax,%eax
call   1060 <nColumns@plt>
lea    0xe8a(%rip),%rdi
jmp    11c9 <selectOption+0x59>
xor    %eax,%eax
call   1090 <nChars@plt>
lea    0xe98(%rip),%rdi
jmp    11c9 <selectOption+0x59>
xor    %eax,%eax
call   1080 <rowMax@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <printRow@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <printFile@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Total number of rows: %d\0A\0A\00"
@.str.1 = [30 x i8] c"Total number of columns: %d\0A\0A\00"
@.str.2 = [33 x i8] c"Total number of characters: %d\0A\0A\00"
@.str.3 = [18 x i8] c"Longest row: %d\0A\0A\00"
define void @selectOption(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %21 [
i32 0, label %4
i32 1, label %5
i32 2, label %8
i32 3, label %11
i32 4, label %14
i32 5, label %17
i32 6, label %19
]
4: ; preds = %1
br label %21
5: ; preds = %1
%6 = call i32 (...) @nRows()
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %21
8: ; preds = %1
%9 = call i32 (...) @nColumns()
%10 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %21
11: ; preds = %1
%12 = call i32 (...) @nChars()
%13 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %21
14: ; preds = %1
%15 = call i32 (...) @rowMax()
%16 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %21
17: ; preds = %1
%18 = call i32 (...) @printRow()
br label %21
19: ; preds = %1
%20 = call i32 (...) @printFile()
br label %21
21: ; preds = %1, %19, %17, %14, %11, %8, %5, %4
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Total number of rows: %d\0A\0A\00"
@.str.1 = [30 x i8] c"Total number of columns: %d\0A\0A\00"
@.str.2 = [33 x i8] c"Total number of characters: %d\0A\0A\00"
@.str.3 = [18 x i8] c"Longest row: %d\0A\0A\00"
define void @selectOption(i32 %0) {
switch i32 %0, label %18 [
i32 6, label %16
i32 1, label %2
i32 2, label %5
i32 3, label %8
i32 4, label %11
i32 5, label %14
]
2: ; preds = %1
%3 = tail call i32 (...) @nRows()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %18
5: ; preds = %1
%6 = tail call i32 (...) @nColumns()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %18
8: ; preds = %1
%9 = tail call i32 (...) @nChars()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %18
11: ; preds = %1
%12 = tail call i32 (...) @rowMax()
%13 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %12)
br label %18
14: ; preds = %1
%15 = tail call i32 (...) @printRow()
br label %18
16: ; preds = %1
%17 = tail call i32 (...) @printFile()
br label %18
18: ; preds = %1, %16, %14, %11, %8, %5, %2
ret void
}