#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*/ append();
int /*<<< orphan*/ del();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ list();
int /*<<< orphan*/ modify();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ search();
int /*<<< orphan*/ stdin;
int main() {
  int a;
  char ch;
  printf("STUDENT MANAGEMENT 1.0\n");
  do {
    printf("\nOptions Menu\n");
    printf("1. Append Student Information\n");
    printf("2. List Student Information\n");
    printf("3. Modify Student Information\n");
    printf("4. Delete Student Information\n");
    printf("5. Search Student Information\n");
    printf("Enter choice: ");
    scanf("%d", &a);
    switch (a) {
    case 1:
      append();
      break;
    case 2:
      list();
      break;
    case 3:
      modify();
      break;
    case 4:
      del();
      break;
    case 5:
      search();
      break;
    default:
      printf("Invalid choice");
    }
    printf("More actions? (Y/N): ");
    fflush(stdin);
    scanf("%c", &ch);
  } while (ch == 'y' || ch == 'Y');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7e(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
lea    0xea0(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
lea    0xec4(%rip),%rdi
call   1050 <printf@plt>
lea    0xed7(%rip),%rdi
call   1050 <printf@plt>
lea    0xeea(%rip),%rdi
call   1050 <printf@plt>
lea    0xeed(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     1266 <main+0xe6>
mov    -0x18(%rbp),%rax
lea    0xddf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <append@plt>
jmp    1272 <main+0xf2>
mov    $0x0,%al
call   1070 <list@plt>
jmp    1272 <main+0xf2>
mov    $0x0,%al
call   1040 <modify@plt>
jmp    1272 <main+0xf2>
mov    $0x0,%al
call   10a0 <del@plt>
jmp    1272 <main+0xf2>
mov    $0x0,%al
call   1060 <search@plt>
jmp    1272 <main+0xf2>
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
lea    0xe78(%rip),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x79,%ecx
mov    %al,-0x19(%rbp)
je     12bd <main+0x13d>
movsbl -0x9(%rbp),%eax
cmp    $0x59,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    119b <main+0x1b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeac(%rip),%rdi
call   1050 <puts@plt>
lea    0x4(%rsp),%r12
lea    0xe82(%rip),%r13
mov    0x2e2e(%rip),%r14
lea    0xe8a(%rip),%rbx
lea    0x3(%rsp),%rbp
lea    0xe33(%rip),%r15
jmp    120c <main+0x7c>
lea    0xe50(%rip),%rdi
call   1060 <printf@plt>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1060 <printf@plt>
mov    (%r14),%edi
call   1090 <fflush@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
movzbl 0x3(%rsp),%eax
and    $0xdf,%al
cmp    $0x59,%al
jne    12c6 <main+0x136>
lea    0xe52(%rip),%rdi
call   1050 <puts@plt>
lea    0xe54(%rip),%rdi
call   1050 <puts@plt>
lea    0xe66(%rip),%rdi
call   1050 <puts@plt>
lea    0xe76(%rip),%rdi
call   1050 <puts@plt>
lea    0xe88(%rip),%rdi
call   1050 <puts@plt>
lea    0xe9a(%rip),%rdi
call   1050 <puts@plt>
lea    0xdb9(%rip),%rdi
call   1060 <printf@plt>
lea    0xdbc(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11cf <main+0x3f>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
xor    %eax,%eax
call   1030 <append@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
call   1080 <list@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
call   1040 <modify@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
call   10b0 <del@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
call   1070 <search@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"STUDENT MANAGEMENT 1.0\0A\00"
@.str.1 = [15 x i8] c"\0AOptions Menu\0A\00"
@.str.2 = [31 x i8] c"1. Append Student Information\0A\00"
@.str.3 = [29 x i8] c"2. List Student Information\0A\00"
@.str.4 = [31 x i8] c"3. Modify Student Information\0A\00"
@.str.5 = [31 x i8] c"4. Delete Student Information\0A\00"
@.str.6 = [31 x i8] c"5. Search Student Information\0A\00"
@.str.7 = [15 x i8] c"Enter choice: \00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [15 x i8] c"Invalid choice\00"
@.str.10 = [22 x i8] c"More actions? (Y/N): \00"
@stdin = global i32 0
@.str.11 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %40, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
switch i32 %14, label %25 [
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
i32 5, label %23
]
15: ; preds = %5
%16 = call i32 (...) @append()
br label %27
17: ; preds = %5
%18 = call i32 (...) @list()
br label %27
19: ; preds = %5
%20 = call i32 (...) @modify()
br label %27
21: ; preds = %5
%22 = call i32 (...) @del()
br label %27
23: ; preds = %5
%24 = call i32 (...) @search()
br label %27
25: ; preds = %5
%26 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %27
27: ; preds = %25, %23, %21, %19, %17, %15
%28 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%29 = load i32, i32* @stdin
%30 = call i32 @fflush(i32 %29)
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* %3)
br label %32
32: ; preds = %27
%33 = load i8, i8* %3
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 121
br i1 %35, label %40, label %36
36: ; preds = %32
%37 = load i8, i8* %3
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 89
br label %40
40: ; preds = %36, %32
%41 = phi i1 [ true, %32 ], [ %39, %36 ]
br i1 %41, label %5, label %42
42: ; preds = %40
ret i32 0
}

LLVM IR (-O2):
@.str.7 = [15 x i8] c"Enter choice: \00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [15 x i8] c"Invalid choice\00"
@.str.10 = [22 x i8] c"More actions? (Y/N): \00"
@stdin = global i32 0
@.str.11 = [3 x i8] c"%c\00"
@str = [23 x i8] c"STUDENT MANAGEMENT 1.0\00"
@str.12 = [14 x i8] c"\0AOptions Menu\00"
@str.13 = [30 x i8] c"1. Append Student Information\00"
@str.14 = [28 x i8] c"2. List Student Information\00"
@str.15 = [30 x i8] c"3. Modify Student Information\00"
@str.16 = [30 x i8] c"4. Delete Student Information\00"
@str.17 = [30 x i8] c"5. Search Student Information\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %27, %0
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.12, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.13, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.14, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.15, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.16, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.17, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
switch i32 %14, label %25 [
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
i32 5, label %23
]
15: ; preds = %5
%16 = call i32 (...) @append()
br label %27
17: ; preds = %5
%18 = call i32 (...) @list()
br label %27
19: ; preds = %5
%20 = call i32 (...) @modify()
br label %27
21: ; preds = %5
%22 = call i32 (...) @del()
br label %27
23: ; preds = %5
%24 = call i32 (...) @search()
br label %27
25: ; preds = %5
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %27
27: ; preds = %25, %23, %21, %19, %17, %15
%28 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%29 = load i32, i32* @stdin
%30 = call i32 @fflush(i32 %29)
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* %2)
%32 = load i8, i8* %2
%33 = and i8 %32, -33
%34 = icmp eq i8 %33, 89
br i1 %34, label %5, label %35
35: ; preds = %27
ret i32 0
}