#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*/ Controller_displayAllStudentInfo();
int /*<<< orphan*/ Controller_displayStudentInfo(char *);
scalar_t__ Controller_studentPresent(char *);
int GetInt();
int /*<<< orphan*/ GetString();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
void HandleInputView_inputAdminDisplayStudentInfo() {
  printf("Display all student info (1) or specify student (2)? ");
  int opt = GetInt();
  if (opt == 1) {
    printf("Display all Student info.\n");
    Controller_displayAllStudentInfo();
    printf("Press Enter key to continue...");
    getchar();
  } else if (opt == 2) {
    printf("Display Student Info.\n");
    printf("Student Number: ");
    char studentNumber[256];
    strcpy(studentNumber, GetString());
    if (Controller_studentPresent(studentNumber)) {
      Controller_displayStudentInfo(studentNumber);
    } else {
      printf("Student %s does not exist.\n", studentNumber);
    }
    printf("Press Enter key to continue...");
    getchar();
  }
}


x86 assembly (clang, -O0):
<HandleInputView_inputAdminDisplayStudentInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   10a0 <GetInt@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    11dc <HandleInputView_inputAdminDisplayStudentInfo+0x5c>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1080 <Controller_displayAllStudentInfo@plt>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
jmp    127b <HandleInputView_inputAdminDisplayStudentInfo+0xfb>
cmpl   $0x2,-0x4(%rbp)
jne    1276 <HandleInputView_inputAdminDisplayStudentInfo+0xf6>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x110(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    $0x0,%al
call   1040 <GetString@plt>
mov    -0x118(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x110(%rbp),%rdi
call   1050 <Controller_studentPresent@plt>
cmp    $0x0,%rax
je     124c <HandleInputView_inputAdminDisplayStudentInfo+0xcc>
lea    -0x110(%rbp),%rdi
call   1060 <Controller_displayStudentInfo@plt>
jmp    1261 <HandleInputView_inputAdminDisplayStudentInfo+0xe1>
lea    -0x110(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
jmp    127b <HandleInputView_inputAdminDisplayStudentInfo+0xfb>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HandleInputView_inputAdminDisplayStudentInfo>:
push   %rbx
sub    $0x100,%rsp
lea    0xe61(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
call   10b0 <GetInt@plt>
cmp    $0x2,%eax
je     11eb <HandleInputView_inputAdminDisplayStudentInfo+0x5b>
cmp    $0x1,%eax
jne    1256 <HandleInputView_inputAdminDisplayStudentInfo+0xc6>
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1090 <Controller_displayAllStudentInfo@plt>
lea    0xe61(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
jmp    10a0 <getchar@plt>
lea    0xe90(%rip),%rdi
call   1040 <puts@plt>
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
call   1050 <GetString@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <Controller_studentPresent@plt>
test   %rax,%rax
je     1230 <HandleInputView_inputAdminDisplayStudentInfo+0xa0>
mov    %rsp,%rdi
call   1070 <Controller_displayStudentInfo@plt>
jmp    1241 <HandleInputView_inputAdminDisplayStudentInfo+0xb1>
lea    0xe2f(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Display all student info (1) or specify student (2)? \00"
@.str.1 = [27 x i8] c"Display all Student info.\0A\00"
@.str.2 = [31 x i8] c"Press Enter key to continue...\00"
@.str.3 = [23 x i8] c"Display Student Info.\0A\00"
@.str.4 = [17 x i8] c"Student Number: \00"
@.str.5 = [28 x i8] c"Student %s does not exist.\0A\00"
define void @HandleInputView_inputAdminDisplayStudentInfo() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @GetInt()
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (...) @Controller_displayAllStudentInfo()
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (...) @getchar()
br label %34
12: ; preds = %0
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %33
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%19 = call i32 (...) @GetString()
%20 = call i32 @strcpy(i8* %18, i32 %19)
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%22 = call i64 @Controller_studentPresent(i8* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %15
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%26 = call i32 @Controller_displayStudentInfo(i8* %25)
br label %30
27: ; preds = %15
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %27, %24
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 (...) @getchar()
br label %33
33: ; preds = %30, %12
br label %34
34: ; preds = %33, %7
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"Display all student info (1) or specify student (2)? \00"
@.str.2 = [31 x i8] c"Press Enter key to continue...\00"
@.str.4 = [17 x i8] c"Student Number: \00"
@.str.5 = [28 x i8] c"Student %s does not exist.\0A\00"
@str = [22 x i8] c"Display Student Info.\00"
@str.6 = [26 x i8] c"Display all Student info.\00"
define void @HandleInputView_inputAdminDisplayStudentInfo() {
%1 = alloca [256 x i8]
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @GetInt()
switch i32 %3, label %24 [
i32 1, label %4
i32 2, label %9
]
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 (...) @Controller_displayAllStudentInfo()
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (...) @getchar()
br label %24
9: ; preds = %0
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%13 = tail call i32 (...) @GetString()
%14 = call i32 @strcpy(i8* %12, i32 %13)
%15 = call i64 @Controller_studentPresent(i8* %12)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %9
%18 = call i32 @Controller_displayStudentInfo(i8* %12)
br label %21
19: ; preds = %9
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %12)
br label %21
21: ; preds = %19, %17
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 (...) @getchar()
br label %24
24: ; preds = %0, %21, %4
ret void
}