#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*/ bzero(char *, int);
int /*<<< orphan*/ cry();
int /*<<< orphan*/ cryname(char *);
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/, int);
unsigned int menu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pwn();
int /*<<< orphan*/ setname();
int main(int argc, char *argv[]) {
  unsigned int choice = 35;
  char name[128];
  do {
    choice = menu();
    switch (choice) {
    case 1:
      cry();
      break;
    case 2:
      bzero(name, 128);
      memcpy(name, setname(), 128);
      break;
    case 3:
      cryname(name);
      break;
    case 4:
      pwn();
      break;
    }
  } while (choice != 0);
  printf("\nGoodbye...\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x23,-0x14(%rbp)
xor    %eax,%eax
call   1030 <menu@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0xa8(%rbp)
sub    $0x3,%eax
ja     123b <main+0xbb>
mov    -0xa8(%rbp),%rax
lea    0xe30(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1090 <cry@plt>
jmp    123b <main+0xbb>
lea    -0xa0(%rbp),%rdi
mov    $0x80,%esi
call   1080 <bzero@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    $0x0,%al
call   10a0 <setname@plt>
mov    -0xb0(%rbp),%rdi
mov    %eax,%esi
mov    $0x80,%edx
call   1060 <memcpy@plt>
jmp    123b <main+0xbb>
lea    -0xa0(%rbp),%rdi
call   1070 <cryname@plt>
jmp    123b <main+0xbb>
mov    $0x0,%al
call   1050 <pwn@plt>
jmp    1240 <main+0xc0>
cmpl   $0x0,-0x14(%rbp)
jne    11a0 <main+0x20>
lea    0xdbf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
lea    0xe6f(%rip),%rbx
mov    %rsp,%r14
jmp    11a0 <main+0x20>
xor    %eax,%eax
call   1050 <pwn@plt>
nopl   (%rax)
xor    %eax,%eax
call   1040 <menu@plt>
cmp    $0x4,%eax
ja     11a0 <main+0x20>
mov    %eax,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1090 <cry@plt>
jmp    11a0 <main+0x20>
mov    %r14,%rdi
mov    $0x80,%esi
call   1080 <bzero@plt>
xor    %eax,%eax
call   10a0 <setname@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x80,%edx
call   1060 <memcpy@plt>
jmp    11a0 <main+0x20>
mov    %r14,%rdi
call   1070 <cryname@plt>
jmp    11a0 <main+0x20>
lea    0xe1e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\0AGoodbye...\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 35, i32* %6
br label %8
8: ; preds = %25, %2
%9 = call i32 (...) @menu()
store i32 %9, i32* %6
%10 = load i32, i32* %6
switch i32 %10, label %24 [
i32 1, label %11
i32 2, label %13
i32 3, label %19
i32 4, label %22
]
11: ; preds = %8
%12 = call i32 (...) @cry()
br label %24
13: ; preds = %8
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%15 = call i32 @bzero(i8* %14, i32 128)
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%17 = call i32 (...) @setname()
%18 = call i32 @memcpy(i8* %16, i32 %17, i32 128)
br label %24
19: ; preds = %8
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%21 = call i32 @cryname(i8* %20)
br label %24
22: ; preds = %8
%23 = call i32 (...) @pwn()
br label %24
24: ; preds = %8, %22, %19, %13, %11
br label %25
25: ; preds = %24
%26 = load i32, i32* %6
%27 = icmp ne i32 %26, 0
br i1 %27, label %8, label %28
28: ; preds = %25
%29 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"\0AGoodbye...\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %17, %2
%6 = call i32 (...) @menu()
switch i32 %6, label %17 [
i32 1, label %7
i32 2, label %9
i32 3, label %13
i32 4, label %15
i32 0, label %18
]
7: ; preds = %5
%8 = call i32 (...) @cry()
br label %17
9: ; preds = %5
%10 = call i32 @bzero(i8* %4, i32 128)
%11 = call i32 (...) @setname()
%12 = call i32 @memcpy(i8* %4, i32 %11, i32 128)
br label %17
13: ; preds = %5
%14 = call i32 @cryname(i8* %4)
br label %17
15: ; preds = %5
%16 = call i32 (...) @pwn()
br label %17
17: ; preds = %15, %13, %9, %7, %5
br label %5
18: ; preds = %5
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}