#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 average(int **);
int /*<<< orphan*/ insert_student(int **);
int max_degree(int **);
int min_degree(int **);
int /*<<< orphan*/ print_students(int **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int student[3][4], max, min, choise, j;
  max = min = j = choise = 0;
  while (choise != 6) {
    printf("\nThe progmam allows you to insert the degrees and the age of some "
           "students and count their performance.You can choose from the menu "
           "as follow:\n\n");
    printf("\nChoises to select:\n1.Insert students, 2.Print students, 3.High "
           "scored student, 4.Low scored student, 5.Degrees Average, "
           "6.Exit\nYou select :");
    scanf("%d", &choise);
    switch (choise) {
    case 1:
      insert_student(student);
      continue;
    case 2:
      print_students(student);
      continue;
    case 3:
      max = max_degree(student);
      printf("\nHigh scored student=");
      printf(" ID:%d, Age:%d, Sex:%d, Degree:%d\n ", student[max][j],
             student[max][j + 1], student[max][j + 2], student[max][j + 3]);
      continue;
    case 4:
      min = min_degree(student);
      printf("\nLow scored student=");
      printf(" ID:%d, Age:%d, Sex:%d, Degree:%d\n ", student[min][j],
             student[min][j + 1], student[min][j + 2], student[min][j + 3]);
      continue;
    case 5:
      printf("\nThe degrees average is =%d\n", average(student));
    }
  }
  printf("\nBye Bye..");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x6,-0x4c(%rbp)
je     1362 <main+0x1f2>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x59(%rbp)
call   1050 <printf@plt>
mov    -0x59(%rbp),%al
lea    0xee5(%rip),%rdi
call   1050 <printf@plt>
lea    0xf66(%rip),%rdi
lea    -0x4c(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x4c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x4,%eax
ja     135d <main+0x1ed>
mov    -0x58(%rbp),%rax
lea    0xe0b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x40(%rbp),%rdi
call   1070 <insert_student@plt>
jmp    119b <main+0x2b>
lea    -0x40(%rbp),%rdi
call   1040 <print_students@plt>
jmp    119b <main+0x2b>
lea    -0x40(%rbp),%rdi
call   1080 <max_degree@plt>
mov    %eax,-0x44(%rbp)
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x50(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    -0x50(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x44(%rbp),%rdi
lea    -0x40(%rbp),%rax
shl    $0x4,%rdi
add    %rdi,%rax
mov    -0x50(%rbp),%edi
add    $0x3,%edi
movslq %edi,%rdi
mov    (%rax,%rdi,4),%r8d
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    119b <main+0x2b>
lea    -0x40(%rbp),%rdi
call   1030 <min_degree@plt>
mov    %eax,-0x48(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x48(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x50(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
movslq -0x48(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x48(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    -0x50(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rax
shl    $0x4,%rdi
add    %rdi,%rax
mov    -0x50(%rbp),%edi
add    $0x3,%edi
movslq %edi,%rdi
mov    (%rax,%rdi,4),%r8d
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    119b <main+0x2b>
lea    -0x40(%rbp),%rdi
call   1060 <average@plt>
mov    %eax,%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    119b <main+0x2b>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movl   $0x0,0xc(%rsp)
lea    0xf7e(%rip),%r14
lea    0xe70(%rip),%r15
lea    0xef6(%rip),%r12
lea    0xc(%rsp),%rbx
lea    0xe49(%rip),%r13
lea    0x10(%rsp),%rbp
jmp    120a <main+0x8a>
mov    %rbp,%rdi
call   1090 <max_degree@plt>
mov    %eax,%ebp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movslq %ebp,%rax
lea    0x10(%rsp),%rbp
shl    $0x4,%rax
mov    0x10(%rsp,%rax,1),%esi
mov    0x14(%rsp,%rax,1),%edx
mov    0x18(%rsp,%rax,1),%ecx
mov    0x1c(%rsp,%rax,1),%r8d
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%eax
cmp    $0x6,%eax
je     1281 <main+0x101>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x4,%ecx
ja     1205 <main+0x85>
movslq 0x0(%r13,%rcx,4),%rax
add    %r13,%rax
jmp    *%rax
mov    %rbp,%rdi
call   1080 <insert_student@plt>
jmp    1201 <main+0x81>
mov    %rbp,%rdi
call   1050 <print_students@plt>
jmp    1201 <main+0x81>
mov    %rbp,%rdi
call   1030 <min_degree@plt>
mov    %eax,%ebp
lea    0xe7c(%rip),%rdi
jmp    11cf <main+0x4f>
mov    %rbp,%rdi
call   1070 <average@plt>
lea    0xe7d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1201 <main+0x81>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [145 x i8] c"\0AThe progmam allows you to insert the degrees and the age of some students and count their performance.You can choose from the menu as follow:\0A\0A\00"
@.str.1 = [141 x i8] c"\0AChoises to select:\0A1.Insert students, 2.Print students, 3.High scored student, 4.Low scored student, 5.Degrees Average, 6.Exit\0AYou select :\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"\0AHigh scored student=\00"
@.str.4 = [36 x i8] c" ID:%d, Age:%d, Sex:%d, Degree:%d\0A \00"
@.str.5 = [21 x i8] c"\0ALow scored student=\00"
@.str.6 = [29 x i8] c"\0AThe degrees average is =%d\0A\00"
@.str.7 = [11 x i8] c"\0ABye Bye..\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [4 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %4
store i32 0, i32* %3
br label %7
7: ; preds = %102, %60, %23, %19, %15, %0
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 6
br i1 %9, label %10, label %103
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%14 = load i32, i32* %5
switch i32 %14, label %102 [
i32 1, label %15
i32 2, label %19
i32 3, label %23
i32 4, label %60
i32 5, label %97
]
15: ; preds = %10
%16 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%17 = bitcast [4 x i32]* %16 to i32**
%18 = call i32 @insert_student(i32** %17)
br label %7
19: ; preds = %10
%20 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%21 = bitcast [4 x i32]* %20 to i32**
%22 = call i32 @print_students(i32** %21)
br label %7
23: ; preds = %10
%24 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%25 = bitcast [4 x i32]* %24 to i32**
%26 = call i32 @max_degree(i32** %25)
store i32 %26, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 %29
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4 x i32], [4 x i32]* %30, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 %36
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %37, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 %44
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 2
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [4 x i32], [4 x i32]* %45, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 %52
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [4 x i32], [4 x i32]* %53, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %34, i32 %42, i32 %50, i32 %58)
br label %7
60: ; preds = %10
%61 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%62 = bitcast [4 x i32]* %61 to i32**
%63 = call i32 @min_degree(i32** %62)
store i32 %63, i32* %4
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 %66
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [4 x i32], [4 x i32]* %67, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 %73
%75 = load i32, i32* %6
%76 = add nsw i32 %75, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [4 x i32], [4 x i32]* %74, i64 0, i64 %77
%79 = load i32, i32* %78
%80 = load i32, i32* %4
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 %81
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 2
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [4 x i32], [4 x i32]* %82, i64 0, i64 %85
%87 = load i32, i32* %86
%88 = load i32, i32* %4
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 %89
%91 = load i32, i32* %6
%92 = add nsw i32 %91, 3
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [4 x i32], [4 x i32]* %90, i64 0, i64 %93
%95 = load i32, i32* %94
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %71, i32 %79, i32 %87, i32 %95)
br label %7
97: ; preds = %10
%98 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%99 = bitcast [4 x i32]* %98 to i32**
%100 = call i32 @average(i32** %99)
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %100)
br label %102
102: ; preds = %97, %10
br label %7
103: ; preds = %7
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [141 x i8] c"\0AChoises to select:\0A1.Insert students, 2.Print students, 3.High scored student, 4.Low scored student, 5.Degrees Average, 6.Exit\0AYou select :\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"\0AHigh scored student=\00"
@.str.4 = [36 x i8] c" ID:%d, Age:%d, Sex:%d, Degree:%d\0A \00"
@.str.5 = [21 x i8] c"\0ALow scored student=\00"
@.str.6 = [29 x i8] c"\0AThe degrees average is =%d\0A\00"
@.str.7 = [11 x i8] c"\0ABye Bye..\00"
@str = [144 x i8] c"\0AThe progmam allows you to insert the degrees and the age of some students and count their performance.You can choose from the menu as follow:\0A\00"
define i32 @main() {
%1 = alloca [3 x [4 x i32]]
%2 = alloca i32
%3 = bitcast [3 x [4 x i32]]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast [3 x [4 x i32]]* %1 to i32**
br label %11
6: ; preds = %33, %20, %18, %16, %46
%7 = load i32, i32* %2
br label %8
8: ; preds = %6, %11
%9 = phi i32 [ %7, %6 ], [ %15, %11 ]
%10 = icmp eq i32 %9, 6
br i1 %10, label %49, label %11
11: ; preds = %0, %8
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([144 x i8], [144 x i8]* @str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
switch i32 %15, label %8 [
i32 1, label %16
i32 2, label %18
i32 3, label %20
i32 4, label %33
i32 5, label %46
]
16: ; preds = %11
%17 = call i32 @insert_student(i32** %5)
br label %6
18: ; preds = %11
%19 = call i32 @print_students(i32** %5)
br label %6
20: ; preds = %11
%21 = call i32 @max_degree(i32** %5)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 %23, i64 0
%25 = load i32, i32* %24
%26 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 %23, i64 1
%27 = load i32, i32* %26
%28 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 %23, i64 2
%29 = load i32, i32* %28
%30 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 %23, i64 3
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %25, i32 %27, i32 %29, i32 %31)
br label %6
33: ; preds = %11
%34 = call i32 @min_degree(i32** %5)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%36 = sext i32 %34 to i64
%37 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 %36, i64 0
%38 = load i32, i32* %37
%39 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 %36, i64 1
%40 = load i32, i32* %39
%41 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 %36, i64 2
%42 = load i32, i32* %41
%43 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 %36, i64 3
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %38, i32 %40, i32 %42, i32 %44)
br label %6
46: ; preds = %11
%47 = call i32 @average(i32** %5)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %47)
br label %6
49: ; preds = %8
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}