#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*/ getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int strtol(char *, int /*<<< orphan*/ *, int);
int menu() {
  char choiceStr[2];
  int choice = 0;
  puts("");
  puts("1. Add Student");
  puts("2. Delete Student");
  puts("3. Display Students");
  puts("4. Search Student");
  puts("5. Save");
  puts("6. Exit");
  printf("%s", "Choice: ");
  scanf("%1s", choiceStr);
  getchar();
  choice = strtol(choiceStr, NULL, 10);
  return (int)choice;
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rdi
lea    0xe99(%rip),%rsi
call   1040 <printf@plt>
lea    -0x2(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    -0x2(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbx
sub    $0x10,%rsp
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe93(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe99(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1050 <printf@plt>
lea    0xe92(%rip),%rdi
lea    0xe(%rsp),%rbx
mov    %rbx,%rsi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [15 x i8] c"1. Add Student\00"
@.str.2 = [18 x i8] c"2. Delete Student\00"
@.str.3 = [20 x i8] c"3. Display Students\00"
@.str.4 = [18 x i8] c"4. Search Student\00"
@.str.5 = [8 x i8] c"5. Save\00"
@.str.6 = [8 x i8] c"6. Exit\00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [9 x i8] c"Choice: \00"
@.str.9 = [4 x i8] c"%1s\00"
define i32 @menu() {
%1 = alloca [2 x i8]
%2 = alloca i32
store i32 0, i32* %2
%3 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %11)
%13 = call i32 (...) @getchar()
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%15 = call i32 @strtol(i8* %14, i32* null, i32 10)
store i32 %15, i32* %2
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"1. Add Student\00"
@.str.2 = [18 x i8] c"2. Delete Student\00"
@.str.3 = [20 x i8] c"3. Display Students\00"
@.str.4 = [18 x i8] c"4. Search Student\00"
@.str.5 = [8 x i8] c"5. Save\00"
@.str.6 = [8 x i8] c"6. Exit\00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [9 x i8] c"Choice: \00"
@.str.9 = [4 x i8] c"%1s\00"
define i32 @menu() {
%1 = alloca [2 x i8]
%2 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %2)
%12 = call i32 (...) @getchar()
%13 = call i32 @strtol(i8* nocapture %2, i32* null, i32 10)
ret i32 %13
}