#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*/ BuildMainMenu();
int /*<<< orphan*/ LearnMenu();
int /*<<< orphan*/ SendMenu();
int /*<<< orphan*/ StatusMenu();
int atoi(char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ scanf(char *, char *);
int MainMenu(void) {
  char st[255];
  int choice = 0;
  BuildMainMenu();
  scanf("%s", st);
  getchar();
  choice = atoi(st);
  switch (choice) {
  case 1:
    while (SendMenu())
      ;
    break;
  case 2:
    while (LearnMenu())
      ;
    break;
  case 3:
    while (StatusMenu())
      ;
    break;
  case 99:
    return (0);
    break;
  }
  return (1);
}


x86 assembly (clang, -O0):
<MainMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x114(%rbp)
xor    %eax,%eax
mov    %al,-0x121(%rbp)
call   1060 <BuildMainMenu@plt>
lea    0xe67(%rip),%rdi
lea    -0x110(%rbp),%rsi
mov    %rsi,-0x120(%rbp)
call   1070 <scanf@plt>
mov    -0x121(%rbp),%al
call   1050 <getchar@plt>
mov    -0x120(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x114(%rbp)
mov    -0x114(%rbp),%eax
mov    %eax,-0x118(%rbp)
sub    $0x1,%eax
je     121f <MainMenu+0xaf>
jmp    11e3 <MainMenu+0x73>
mov    -0x118(%rbp),%eax
sub    $0x2,%eax
je     123e <MainMenu+0xce>
jmp    11f7 <MainMenu+0x87>
mov    -0x118(%rbp),%eax
sub    $0x3,%eax
je     125d <MainMenu+0xed>
jmp    120b <MainMenu+0x9b>
mov    -0x118(%rbp),%eax
sub    $0x63,%eax
je     127c <MainMenu+0x10c>
jmp    1288 <MainMenu+0x118>
jmp    1224 <MainMenu+0xb4>
mov    $0x0,%al
call   1030 <SendMenu@plt>
cmp    $0x0,%eax
je     1239 <MainMenu+0xc9>
jmp    1224 <MainMenu+0xb4>
jmp    1288 <MainMenu+0x118>
jmp    1243 <MainMenu+0xd3>
mov    $0x0,%al
call   1080 <LearnMenu@plt>
cmp    $0x0,%eax
je     1258 <MainMenu+0xe8>
jmp    1243 <MainMenu+0xd3>
jmp    1288 <MainMenu+0x118>
jmp    1262 <MainMenu+0xf2>
mov    $0x0,%al
call   1040 <StatusMenu@plt>
cmp    $0x0,%eax
je     1277 <MainMenu+0x107>
jmp    1262 <MainMenu+0xf2>
jmp    1288 <MainMenu+0x118>
movl   $0x0,-0x4(%rbp)
jmp    128f <MainMenu+0x11f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MainMenu>:
push   %r14
push   %rbx
sub    $0x108,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <BuildMainMenu@plt>
lea    0xe76(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %r14,%rdi
call   1090 <atoi@plt>
cmp    $0x2,%eax
jg     11dd <MainMenu+0x6d>
cmp    $0x1,%eax
je     11d0 <MainMenu+0x60>
cmp    $0x2,%eax
jne    11fb <MainMenu+0x8b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1080 <LearnMenu@plt>
test   %eax,%eax
jne    11c0 <MainMenu+0x50>
jmp    11fb <MainMenu+0x8b>
nopl   (%rax)
xor    %eax,%eax
call   1030 <SendMenu@plt>
test   %eax,%eax
jne    11d0 <MainMenu+0x60>
jmp    11fb <MainMenu+0x8b>
cmp    $0x63,%eax
je     1200 <MainMenu+0x90>
cmp    $0x3,%eax
jne    11fb <MainMenu+0x8b>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <StatusMenu@plt>
test   %eax,%eax
jne    11f0 <MainMenu+0x80>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @MainMenu() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = alloca i32
store i32 0, i32* %3
%4 = call i32 (...) @BuildMainMenu()
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 (...) @getchar()
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%9 = call i32 @atoi(i8* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
switch i32 %10, label %30 [
i32 1, label %11
i32 2, label %17
i32 3, label %23
i32 99, label %29
]
11: ; preds = %0
br label %12
12: ; preds = %15, %11
%13 = call i32 (...) @SendMenu()
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
br label %12
16: ; preds = %12
br label %30
17: ; preds = %0
br label %18
18: ; preds = %21, %17
%19 = call i32 (...) @LearnMenu()
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
br label %18
22: ; preds = %18
br label %30
23: ; preds = %0
br label %24
24: ; preds = %27, %23
%25 = call i32 (...) @StatusMenu()
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %24
br label %24
28: ; preds = %24
br label %30
29: ; preds = %0
store i32 0, i32* %1
br label %31
30: ; preds = %0, %28, %22, %16
store i32 1, i32* %1
br label %31
31: ; preds = %30, %29
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @MainMenu() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @BuildMainMenu()
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 (...) @getchar()
%6 = call i32 @atoi(i8* %2)
switch i32 %6, label %16 [
i32 1, label %7
i32 2, label %10
i32 3, label %13
i32 99, label %17
]
7: ; preds = %0, %7
%8 = call i32 (...) @SendMenu()
%9 = icmp eq i32 %8, 0
br i1 %9, label %16, label %7
10: ; preds = %0, %10
%11 = call i32 (...) @LearnMenu()
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %10
13: ; preds = %0, %13
%14 = call i32 (...) @StatusMenu()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %13
16: ; preds = %13, %10, %7, %0
br label %17
17: ; preds = %0, %16
%18 = phi i32 [ 1, %16 ], [ 0, %0 ]
ret i32 %18
}