#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*/ ConnectMenu();
int GetMenuChoice();
int /*<<< orphan*/ SideBySideSensorsTest();
int /*<<< orphan*/ puts(char *);
void MainMenu(void) {
  for (;;) {
    int lChoice;
    puts("\n\n1. Connect");
    puts("2. Connect to two LeddarOne");
    puts("3. Quit");
    lChoice = GetMenuChoice();
    switch (lChoice) {
    case '1':
      ConnectMenu();
      break;
    case '2':
      SideBySideSensorsTest();
      break;
    case 27:
    case '3':
    case 'Q':
      return;
    }
  }
}


x86 assembly (clang, -O0):
<MainMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <GetMenuChoice@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1b,%eax
je     11e6 <MainMenu+0xa6>
jmp    118a <MainMenu+0x4a>
mov    -0x8(%rbp),%eax
sub    $0x31,%eax
je     11ce <MainMenu+0x8e>
jmp    119b <MainMenu+0x5b>
mov    -0x8(%rbp),%eax
sub    $0x32,%eax
je     11da <MainMenu+0x9a>
jmp    11ac <MainMenu+0x6c>
mov    -0x8(%rbp),%eax
sub    $0x33,%eax
je     11e6 <MainMenu+0xa6>
jmp    11bd <MainMenu+0x7d>
mov    -0x8(%rbp),%eax
sub    $0x51,%eax
je     11e6 <MainMenu+0xa6>
jmp    11ec <MainMenu+0xac>
mov    $0x0,%al
call   1060 <ConnectMenu@plt>
jmp    11ec <MainMenu+0xac>
mov    $0x0,%al
call   1030 <SideBySideSensorsTest@plt>
jmp    11ec <MainMenu+0xac>
add    $0x10,%rsp
pop    %rbp
ret
jmp    1148 <MainMenu+0x8>

x86 assembly (clang, -O2):
<MainMenu>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xf35(%rip),%r14
lea    0xf3b(%rip),%r15
lea    0xf50(%rip),%r12
lea    0xe9c(%rip),%rbx
jmp    1177 <MainMenu+0x37>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <SideBySideSensorsTest@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <GetMenuChoice@plt>
lea    -0x31(%rax),%ecx
cmp    $0x20,%ecx
ja     11b0 <MainMenu+0x70>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <ConnectMenu@plt>
jmp    1177 <MainMenu+0x37>
cmp    $0x1b,%eax
jne    1177 <MainMenu+0x37>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"\0A\0A1. Connect\00"
@.str.1 = [28 x i8] c"2. Connect to two LeddarOne\00"
@.str.2 = [8 x i8] c"3. Quit\00"
define void @MainMenu() {
%1 = alloca i32
br label %2
2: ; preds = %13, %0
%3 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 (...) @GetMenuChoice()
store i32 %6, i32* %1
%7 = load i32, i32* %1
switch i32 %7, label %13 [
i32 49, label %8
i32 50, label %10
i32 27, label %12
i32 51, label %12
i32 81, label %12
]
8: ; preds = %2
%9 = call i32 (...) @ConnectMenu()
br label %13
10: ; preds = %2
%11 = call i32 (...) @SideBySideSensorsTest()
br label %13
12: ; preds = %2, %2, %2
ret void
13: ; preds = %2, %10, %8
br label %2
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0A\0A1. Connect\00"
@.str.1 = [28 x i8] c"2. Connect to two LeddarOne\00"
@.str.2 = [8 x i8] c"3. Quit\00"
define void @MainMenu() {
br label %1
1: ; preds = %8, %0
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 (...) @GetMenuChoice()
switch i32 %5, label %8 [
i32 49, label %6
i32 50, label %9
i32 27, label %11
i32 51, label %11
i32 81, label %11
]
6: ; preds = %1
%7 = tail call i32 (...) @ConnectMenu()
br label %8
8: ; preds = %6, %9, %1
br label %1
9: ; preds = %1
%10 = tail call i32 (...) @SideBySideSensorsTest()
br label %8
11: ; preds = %1, %1, %1
ret void
}