#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*/ view_clearStack();
int /*<<< orphan*/ view_displayArray();
int /*<<< orphan*/ view_displayMenu();
int /*<<< orphan*/ view_displayStack();
int /*<<< orphan*/ view_doBubbleSort();
int /*<<< orphan*/ view_exit();
int /*<<< orphan*/ view_makeAStackFromFile();
int /*<<< orphan*/ view_makeAnArrayFromStack();
int /*<<< orphan*/ view_popANumber();
int /*<<< orphan*/ view_pushANumber();
int view_selectMenu();
int /*<<< orphan*/ view_writeAFileFromStack();
void view_frontEnd(void) {
  int selectedItem = 0;
  while (selectedItem != 10) {
    view_displayMenu();
    selectedItem = view_selectMenu();
    switch (selectedItem) {
    case 1:
      view_makeAStackFromFile();
      break;
    case 2:
      view_writeAFileFromStack();
      break;
    case 3:
      view_displayStack();
      break;
    case 4:
      view_clearStack();
      break;
    case 5:
      view_pushANumber();
      break;
    case 6:
      view_popANumber();
      break;
    case 7:
      view_makeAnArrayFromStack();
      break;
    case 8:
      view_displayArray();
      break;
    case 9:
      view_doBubbleSort();
      break;
    case 10:
      view_exit();
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<view_frontEnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
je     1299 <view_frontEnd+0xd9>
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   10a0 <view_displayMenu@plt>
mov    -0x11(%rbp),%al
call   10d0 <view_selectMenu@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     128f <view_frontEnd+0xcf>
mov    -0x10(%rbp),%rax
lea    0xdf2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10b0 <view_makeAStackFromFile@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   10e0 <view_writeAFileFromStack@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   1050 <view_displayStack@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   1070 <view_clearStack@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   1040 <view_pushANumber@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   1090 <view_popANumber@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   10c0 <view_makeAnArrayFromStack@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   1060 <view_displayArray@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   1030 <view_doBubbleSort@plt>
jmp    1294 <view_frontEnd+0xd4>
mov    $0x0,%al
call   1080 <view_exit@plt>
jmp    1294 <view_frontEnd+0xd4>
jmp    1294 <view_frontEnd+0xd4>
jmp    11cf <view_frontEnd+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<view_frontEnd>:
push   %rbx
lea    0xe38(%rip),%rbx
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
call   1030 <view_doBubbleSort@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10a0 <view_displayMenu@plt>
xor    %eax,%eax
call   10d0 <view_selectMenu@plt>
add    $0xffffffff,%eax
cmp    $0x9,%eax
ja     11e0 <view_frontEnd+0x20>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   10b0 <view_makeAStackFromFile@plt>
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
call   10e0 <view_writeAFileFromStack@plt>
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
call   1050 <view_displayStack@plt>
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
call   1070 <view_clearStack@plt>
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
call   1040 <view_pushANumber@plt>
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
call   1090 <view_popANumber@plt>
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
call   10c0 <view_makeAnArrayFromStack@plt>
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
call   1060 <view_displayArray@plt>
jmp    11e0 <view_frontEnd+0x20>
xor    %eax,%eax
pop    %rbx
jmp    1080 <view_exit@plt>

LLVM IR (-O0):
define void @view_frontEnd() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %30, %0
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 10
br i1 %4, label %5, label %31
5: ; preds = %2
%6 = call i32 (...) @view_displayMenu()
%7 = call i32 (...) @view_selectMenu()
store i32 %7, i32* %1
%8 = load i32, i32* %1
switch i32 %8, label %29 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
i32 6, label %19
i32 7, label %21
i32 8, label %23
i32 9, label %25
i32 10, label %27
]
9: ; preds = %5
%10 = call i32 (...) @view_makeAStackFromFile()
br label %30
11: ; preds = %5
%12 = call i32 (...) @view_writeAFileFromStack()
br label %30
13: ; preds = %5
%14 = call i32 (...) @view_displayStack()
br label %30
15: ; preds = %5
%16 = call i32 (...) @view_clearStack()
br label %30
17: ; preds = %5
%18 = call i32 (...) @view_pushANumber()
br label %30
19: ; preds = %5
%20 = call i32 (...) @view_popANumber()
br label %30
21: ; preds = %5
%22 = call i32 (...) @view_makeAnArrayFromStack()
br label %30
23: ; preds = %5
%24 = call i32 (...) @view_displayArray()
br label %30
25: ; preds = %5
%26 = call i32 (...) @view_doBubbleSort()
br label %30
27: ; preds = %5
%28 = call i32 (...) @view_exit()
br label %30
29: ; preds = %5
br label %30
30: ; preds = %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9
br label %2
31: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @view_frontEnd() {
br label %1
1: ; preds = %6, %0
%2 = tail call i32 (...) @view_displayMenu()
%3 = tail call i32 (...) @view_selectMenu()
switch i32 %3, label %6 [
i32 1, label %4
i32 2, label %7
i32 3, label %9
i32 4, label %11
i32 5, label %13
i32 6, label %15
i32 7, label %17
i32 8, label %19
i32 9, label %21
i32 10, label %23
]
4: ; preds = %1
%5 = tail call i32 (...) @view_makeAStackFromFile()
br label %6
6: ; preds = %4, %7, %9, %11, %13, %15, %17, %19, %21, %1
br label %1
7: ; preds = %1
%8 = tail call i32 (...) @view_writeAFileFromStack()
br label %6
9: ; preds = %1
%10 = tail call i32 (...) @view_displayStack()
br label %6
11: ; preds = %1
%12 = tail call i32 (...) @view_clearStack()
br label %6
13: ; preds = %1
%14 = tail call i32 (...) @view_pushANumber()
br label %6
15: ; preds = %1
%16 = tail call i32 (...) @view_popANumber()
br label %6
17: ; preds = %1
%18 = tail call i32 (...) @view_makeAnArrayFromStack()
br label %6
19: ; preds = %1
%20 = tail call i32 (...) @view_displayArray()
br label %6
21: ; preds = %1
%22 = tail call i32 (...) @view_doBubbleSort()
br label %6
23: ; preds = %1
%24 = tail call i32 (...) @view_exit()
ret void
}