#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 */
struct cipherdata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Choose_Analysis(struct cipherdata *);
int /*<<< orphan*/ Display_Open_Ex_Analysis_Menu();
int Error_Trap(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ Exit_Program(struct cipherdata *);
int /*<<< orphan*/ Open_Data_File(struct cipherdata *);
int /*<<< orphan*/ atoi(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
void Open_Ex_Analysis(struct cipherdata *Cipher) {
  Display_Open_Ex_Analysis_Menu();
  char Option[10] = {0};
  while (1) {
    if (Error_Trap(atoi(fgets(Option, 10, stdin)), 1, 3) == 1) {
      switch (Option[0]) {
      case '1':
        Open_Data_File(Cipher);
        Choose_Analysis(Cipher);
        break;
      case '2':
        return;
      case '3':
        Exit_Program(Cipher);
      default:
        printf("\nDEBUG - switch default\n");
        break;
      }
      Display_Open_Ex_Analysis_Menu();
    } else {
      printf("Try entering a number 1 - 3\n");
      Display_Open_Ex_Analysis_Menu();
    }
  }
}


x86 assembly (clang, -O0):
<Open_Ex_Analysis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1080 <Display_Open_Ex_Analysis_Menu@plt>
lea    -0x12(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    -0x12(%rbp),%rdi
mov    0x2e2a(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1070 <fgets@plt>
mov    %eax,%edi
call   10a0 <atoi@plt>
mov    %eax,%edi
mov    $0x1,%esi
mov    $0x3,%edx
call   10b0 <Error_Trap@plt>
cmp    $0x1,%eax
jne    1260 <Open_Ex_Analysis+0xd0>
movsbl -0x12(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x31,%eax
je     1222 <Open_Ex_Analysis+0x92>
jmp    1200 <Open_Ex_Analysis+0x70>
mov    -0x18(%rbp),%eax
sub    $0x32,%eax
je     1239 <Open_Ex_Analysis+0xa9>
jmp    1211 <Open_Ex_Analysis+0x81>
mov    -0x18(%rbp),%eax
sub    $0x33,%eax
je     123f <Open_Ex_Analysis+0xaf>
jmp    1248 <Open_Ex_Analysis+0xb8>
mov    -0x8(%rbp),%rdi
call   1060 <Open_Data_File@plt>
mov    -0x8(%rbp),%rdi
call   1030 <Choose_Analysis@plt>
jmp    1254 <Open_Ex_Analysis+0xc4>
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rdi
call   1090 <Exit_Program@plt>
lea    0xdb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <Display_Open_Ex_Analysis_Menu@plt>
jmp    1273 <Open_Ex_Analysis+0xe3>
lea    0xdb2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <Display_Open_Ex_Analysis_Menu@plt>
jmp    11b3 <Open_Ex_Analysis+0x23>

x86 assembly (clang, -O2):
<Open_Ex_Analysis>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <Display_Open_Ex_Analysis_Menu@plt>
movw   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
mov    0x2e3b(%rip),%r13
mov    %rsp,%rbx
lea    0xe65(%rip),%r15
lea    0xe42(%rip),%r12
jmp    11d7 <Open_Ex_Analysis+0x57>
mov    %r14,%rdi
call   1080 <Exit_Program@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <Display_Open_Ex_Analysis_Menu@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <fgets@plt>
mov    %eax,%edi
call   1090 <atoi@plt>
mov    %eax,%edi
mov    $0x1,%esi
mov    $0x3,%edx
call   10a0 <Error_Trap@plt>
cmp    $0x1,%eax
jne    1220 <Open_Ex_Analysis+0xa0>
movsbl (%rsp),%eax
cmp    $0x31,%eax
je     1225 <Open_Ex_Analysis+0xa5>
cmp    $0x33,%eax
je     11c0 <Open_Ex_Analysis+0x40>
cmp    $0x32,%eax
jne    11c8 <Open_Ex_Analysis+0x48>
jmp    1237 <Open_Ex_Analysis+0xb7>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
jmp    11cb <Open_Ex_Analysis+0x4b>
mov    %r14,%rdi
call   1050 <Open_Data_File@plt>
mov    %r14,%rdi
call   1040 <Choose_Analysis@plt>
jmp    11d0 <Open_Ex_Analysis+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.cipherdata = type { i32 }
@stdin = global i32 0
@.str = [25 x i8] c"\0ADEBUG - switch default\0A\00"
@.str.1 = [29 x i8] c"Try entering a number 1 - 3\0A\00"
define void @Open_Ex_Analysis(%struct.cipherdata* %0) {
%2 = alloca %struct.cipherdata*
%3 = alloca [10 x i8]
store %struct.cipherdata* %0, %struct.cipherdata** %2
%4 = call i32 (...) @Display_Open_Ex_Analysis_Menu()
%5 = bitcast [10 x i8]* %3 to i8*
br label %6
6: ; preds = %1, %33
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 10, i32 %8)
%10 = call i32 @atoi(i32 %9)
%11 = call i32 @Error_Trap(i32 %10, i32 1, i32 3)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %30
13: ; preds = %6
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
switch i32 %16, label %26 [
i32 49, label %17
i32 50, label %22
i32 51, label %23
]
17: ; preds = %13
%18 = load %struct.cipherdata*, %struct.cipherdata** %2
%19 = call i32 @Open_Data_File(%struct.cipherdata* %18)
%20 = load %struct.cipherdata*, %struct.cipherdata** %2
%21 = call i32 @Choose_Analysis(%struct.cipherdata* %20)
br label %28
22: ; preds = %13
ret void
23: ; preds = %13
%24 = load %struct.cipherdata*, %struct.cipherdata** %2
%25 = call i32 @Exit_Program(%struct.cipherdata* %24)
br label %26
26: ; preds = %13, %23
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %26, %17
%29 = call i32 (...) @Display_Open_Ex_Analysis_Menu()
br label %33
30: ; preds = %6
%31 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 (...) @Display_Open_Ex_Analysis_Menu()
br label %33
33: ; preds = %30, %28
br label %6
}

LLVM IR (-O2):
%struct.cipherdata = type { i32 }
@stdin = global i32 0
@str = [28 x i8] c"Try entering a number 1 - 3\00"
@str.2 = [24 x i8] c"\0ADEBUG - switch default\00"
define void @Open_Ex_Analysis(%struct.cipherdata* %0) {
%2 = alloca [10 x i8]
%3 = tail call i32 (...) @Display_Open_Ex_Analysis_Menu()
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %24, %1
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %4, i32 10, i32 %6)
%8 = call i32 @atoi(i32 %7)
%9 = call i32 @Error_Trap(i32 %8, i32 1, i32 3)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %22
11: ; preds = %5
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
switch i32 %13, label %20 [
i32 49, label %14
i32 50, label %17
i32 51, label %18
]
14: ; preds = %11
%15 = call i32 @Open_Data_File(%struct.cipherdata* %0)
%16 = call i32 @Choose_Analysis(%struct.cipherdata* %0)
br label %24
17: ; preds = %11
ret void
18: ; preds = %11
%19 = call i32 @Exit_Program(%struct.cipherdata* %0)
br label %20
20: ; preds = %11, %18
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.2, i64 0, i64 0))
br label %24
22: ; preds = %5
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %14, %20, %22
%25 = call i32 (...) @Display_Open_Ex_Analysis_Menu()
br label %5
}