#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*/ Basic_Analysis(struct cipherdata *);
int /*<<< orphan*/ Display_Analysis_Menu();
int Error_Trap(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ Exit_Program(struct cipherdata *);
int /*<<< orphan*/ Freq_Checker(struct cipherdata *);
int /*<<< orphan*/ Manual_Key_Entry(struct cipherdata *);
int /*<<< orphan*/ atoi(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
void Choose_Analysis(struct cipherdata *Cipher) {
  Display_Analysis_Menu();
  char Option[10] = {0};
  while (1) {
    if (Error_Trap(atoi(fgets(Option, 10, stdin)), 1, 9) == 1) {
      switch (Option[0]) {
      case '1':
        Basic_Analysis(Cipher);
        break;
      case '2':
        Manual_Key_Entry(Cipher);
        break;
      case '3':
        Freq_Checker(Cipher);
        break;
      case '8':
        return;
      case '9':
        Exit_Program(Cipher);
      default:
        printf("\nDEBUG - switch default\n");
        break;
      }
      Display_Analysis_Menu();
    } else {
      printf("Try entering a number 1 - 9\n");
      Display_Analysis_Menu();
    }
  }
}


x86 assembly (clang, -O0):
<Choose_Analysis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1090 <Display_Analysis_Menu@plt>
lea    -0x12(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    -0x12(%rbp),%rdi
mov    0x2e1a(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1060 <fgets@plt>
mov    %eax,%edi
call   10b0 <atoi@plt>
mov    %eax,%edi
mov    $0x1,%esi
mov    $0x9,%edx
call   10c0 <Error_Trap@plt>
cmp    $0x1,%eax
jne    1276 <Choose_Analysis+0xd6>
movsbl -0x12(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x8,%eax
ja     125e <Choose_Analysis+0xbe>
mov    -0x20(%rbp),%rax
lea    0xde4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
call   1030 <Basic_Analysis@plt>
jmp    126a <Choose_Analysis+0xca>
mov    -0x8(%rbp),%rdi
call   1080 <Manual_Key_Entry@plt>
jmp    126a <Choose_Analysis+0xca>
mov    -0x8(%rbp),%rdi
call   1070 <Freq_Checker@plt>
jmp    126a <Choose_Analysis+0xca>
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rdi
call   10a0 <Exit_Program@plt>
lea    0xdbf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1090 <Display_Analysis_Menu@plt>
jmp    1289 <Choose_Analysis+0xe9>
lea    0xdc0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1090 <Display_Analysis_Menu@plt>
jmp    11c3 <Choose_Analysis+0x23>

x86 assembly (clang, -O2):
<Choose_Analysis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
xor    %eax,%eax
call   1080 <Display_Analysis_Menu@plt>
movw   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2e29(%rip),%r13
lea    0x8(%rsp),%rbx
lea    0xe75(%rip),%r15
lea    0xe2e(%rip),%rbp
lea    0xe4b(%rip),%r12
jmp    11ef <Choose_Analysis+0x5f>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <Display_Analysis_Menu@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <fgets@plt>
mov    %eax,%edi
call   10a0 <atoi@plt>
mov    %eax,%edi
mov    $0x1,%esi
mov    $0x9,%edx
call   10b0 <Error_Trap@plt>
cmp    $0x1,%eax
jne    11e0 <Choose_Analysis+0x50>
movsbl 0x8(%rsp),%eax
add    $0xffffffcf,%eax
cmp    $0x8,%eax
ja     125a <Choose_Analysis+0xca>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
mov    %r14,%rdi
call   1040 <Basic_Analysis@plt>
jmp    11e8 <Choose_Analysis+0x58>
mov    %r14,%rdi
call   1070 <Manual_Key_Entry@plt>
jmp    11e8 <Choose_Analysis+0x58>
mov    %r14,%rdi
call   1060 <Freq_Checker@plt>
jmp    11e8 <Choose_Analysis+0x58>
mov    %r14,%rdi
call   1090 <Exit_Program@plt>
mov    %r15,%rdi
jmp    11e3 <Choose_Analysis+0x53>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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 - 9\0A\00"
define void @Choose_Analysis(%struct.cipherdata* %0) {
%2 = alloca %struct.cipherdata*
%3 = alloca [10 x i8]
store %struct.cipherdata* %0, %struct.cipherdata** %2
%4 = call i32 (...) @Display_Analysis_Menu()
%5 = bitcast [10 x i8]* %3 to i8*
br label %6
6: ; preds = %1, %37
%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 9)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %34
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 %30 [
i32 49, label %17
i32 50, label %20
i32 51, label %23
i32 56, label %26
i32 57, label %27
]
17: ; preds = %13
%18 = load %struct.cipherdata*, %struct.cipherdata** %2
%19 = call i32 @Basic_Analysis(%struct.cipherdata* %18)
br label %32
20: ; preds = %13
%21 = load %struct.cipherdata*, %struct.cipherdata** %2
%22 = call i32 @Manual_Key_Entry(%struct.cipherdata* %21)
br label %32
23: ; preds = %13
%24 = load %struct.cipherdata*, %struct.cipherdata** %2
%25 = call i32 @Freq_Checker(%struct.cipherdata* %24)
br label %32
26: ; preds = %13
ret void
27: ; preds = %13
%28 = load %struct.cipherdata*, %struct.cipherdata** %2
%29 = call i32 @Exit_Program(%struct.cipherdata* %28)
br label %30
30: ; preds = %13, %27
%31 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %30, %23, %20, %17
%33 = call i32 (...) @Display_Analysis_Menu()
br label %37
34: ; preds = %6
%35 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 (...) @Display_Analysis_Menu()
br label %37
37: ; preds = %34, %32
br label %6
}

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