#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 */
char *fgetln(int /*<<< orphan*/, size_t *);
int jump(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int prompt() {
  puts("Choose an option: ");
  puts("");
  puts("1. Function a()");
  puts("2. Function b()");
  puts("3. Function c()");
  puts("4. Function d()");
  puts("5. Function e()");
  puts("Q. Quit.");
  printf(">> ");
  char *response;
  size_t numchars = 1;
  response = fgetln(stdin, &numchars);
  return jump(response);
}


x86 assembly (clang, -O0):
<prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
movq   $0x1,-0x10(%rbp)
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1050 <fgetln@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <jump@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt>:
push   %rax
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb6(%rip),%rdi
call   1050 <printf@plt>
movq   $0x1,(%rsp)
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1060 <fgetln@plt>
mov    %rax,%rdi
call   1070 <jump@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Choose an option: \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [16 x i8] c"1. Function a()\00"
@.str.3 = [16 x i8] c"2. Function b()\00"
@.str.4 = [16 x i8] c"3. Function c()\00"
@.str.5 = [16 x i8] c"4. Function d()\00"
@.str.6 = [16 x i8] c"5. Function e()\00"
@.str.7 = [9 x i8] c"Q. Quit.\00"
@.str.8 = [4 x i8] c">> \00"
@stdin = global i32 0
define i32 @prompt() {
%1 = alloca i8*
%2 = alloca i64
%3 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
store i64 1, i64* %2
%12 = load i32, i32* @stdin
%13 = call i8* @fgetln(i32 %12, i64* %2)
store i8* %13, i8** %1
%14 = load i8*, i8** %1
%15 = call i32 @jump(i8* %14)
ret i32 %15
}

LLVM IR (-O2):
@.str = [19 x i8] c"Choose an option: \00"
@.str.2 = [16 x i8] c"1. Function a()\00"
@.str.3 = [16 x i8] c"2. Function b()\00"
@.str.4 = [16 x i8] c"3. Function c()\00"
@.str.5 = [16 x i8] c"4. Function d()\00"
@.str.6 = [16 x i8] c"5. Function e()\00"
@.str.7 = [9 x i8] c"Q. Quit.\00"
@.str.8 = [4 x i8] c">> \00"
@stdin = global i32 0
define i32 @prompt() {
%1 = alloca i64
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%11 = bitcast i64* %1 to i8*
store i64 1, i64* %1
%12 = load i32, i32* @stdin
%13 = call i8* @fgetln(i32 %12, i64* %1)
%14 = call i32 @jump(i8* %13)
ret i32 %14
}