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


x86 assembly (clang, -O0):
<Enter_New_Cipher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1090 <Display_Enter_New_Cipher_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    $0x4,%edx
call   10c0 <Error_Trap@plt>
cmp    $0x1,%eax
jne    127a <Enter_New_Cipher+0xda>
movsbl -0x12(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     1262 <Enter_New_Cipher+0xc2>
mov    -0x20(%rbp),%rax
lea    0xde4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
call   1070 <Load_Cipher_From_File@plt>
mov    -0x8(%rbp),%rdi
call   1030 <Choose_Analysis@plt>
jmp    126e <Enter_New_Cipher+0xce>
mov    -0x8(%rbp),%rdi
call   1080 <Enter_Cipher_Text@plt>
mov    -0x8(%rbp),%rdi
call   1030 <Choose_Analysis@plt>
jmp    126e <Enter_New_Cipher+0xce>
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rdi
call   10a0 <Exit_Program@plt>
lea    0xda7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1090 <Display_Enter_New_Cipher_Menu@plt>
jmp    128d <Enter_New_Cipher+0xed>
lea    0xda8(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1090 <Display_Enter_New_Cipher_Menu@plt>
jmp    11c3 <Enter_New_Cipher+0x23>

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

LLVM IR (-O2):
%struct.cipherdata = type { i32 }
@stdin = global i32 0
@str = [28 x i8] c"Try entering a number 1 - 4\00"
@str.2 = [24 x i8] c"\0ADEBUG - switch default\00"
define void @Enter_New_Cipher(%struct.cipherdata* %0) {
%2 = alloca [10 x i8]
%3 = tail call i32 (...) @Display_Enter_New_Cipher_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 4)
%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 %17
i32 51, label %20
i32 52, label %21
]
14: ; preds = %11
%15 = call i32 @Load_Cipher_From_File(%struct.cipherdata* %0)
%16 = call i32 @Choose_Analysis(%struct.cipherdata* %0)
br label %27
17: ; preds = %11
%18 = call i32 @Enter_Cipher_Text(%struct.cipherdata* %0)
%19 = call i32 @Choose_Analysis(%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, %17, %23, %25
%28 = call i32 (...) @Display_Enter_New_Cipher_Menu()
br label %5
}