#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 */
struct student {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ change_failed_names(struct student *);
double compute_average_grade(struct student *);
struct student *create_struct_table(char **, int *, float *);
int /*<<< orphan*/ free(struct student *);
int /*<<< orphan*/ print_failed_names(struct student *);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ show_struct_table(struct student *);
int main(void) {
  char *onoma[] = {
      "Georgios Georgiou",  "Vasilios Vasiliou",      "Ioanna Ioannidou",
      "Nikos Nikolaou",     "Kiriakos Kiriakidis",    "Kwstas Kwstantinidis",
      "Spyros Spyropoulos", "Dimitris Dimitropoulos", "Dimitra Dimitriadi",
      "Areti Aretidou",     "Ilias Iliopoulos",       "Kwstas Kwstoglou",
      "Aimilia Aimilianou", "Xristina Xristopoulou",  "Theodoros Theodorou"};
  int am[] = {120, 122, 142, 130, 156, 132, 145, 133,
              131, 140, 141, 150, 155, 134, 146};
  float vathmos[] = {12, 8.5,  15.5, 20, 7.5, 1,  19.5, 12,
                     17, 17.5, 15.5, 18, 19,  18, 19};
  struct student *studs = create_struct_table(onoma, am, vathmos);
  show_struct_table(studs);
  printf("\nAverage grade: %f\n", compute_average_grade(studs));
  print_failed_names(studs);
  change_failed_names(studs);
  show_struct_table(studs);
  free(studs);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2c03(%rip),%rsi
mov    $0x78,%edx
call   1070 <memcpy@plt>
lea    -0xc0(%rbp),%rdi
lea    0xf7b(%rip),%rsi
mov    $0x3c,%edx
call   1070 <memcpy@plt>
lea    -0x100(%rbp),%rdi
lea    0xfa3(%rip),%rsi
mov    $0x3c,%edx
call   1070 <memcpy@plt>
lea    -0x80(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
lea    -0x100(%rbp),%rdx
call   1050 <create_struct_table@plt>
mov    %rax,-0x108(%rbp)
mov    -0x108(%rbp),%rdi
call   1090 <show_struct_table@plt>
mov    -0x108(%rbp),%rdi
call   10a0 <compute_average_grade@plt>
lea    0xf04(%rip),%rdi
call   1060 <printf@plt>
mov    -0x108(%rbp),%rdi
call   1080 <print_failed_names@plt>
mov    -0x108(%rbp),%rdi
call   1040 <change_failed_names@plt>
mov    -0x108(%rbp),%rdi
call   1090 <show_struct_table@plt>
mov    -0x108(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
mov    0x2c91(%rip),%rax
mov    %rax,0xf0(%rsp)
movaps 0x2c72(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0x2c53(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0x2c34(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0x2c15(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0x2bf6(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0x2bd7(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0x2bb8(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movups 0xf65(%rip),%xmm0
movups %xmm0,0x6c(%rsp)
movaps 0xf4d(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xf31(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf15(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xf75(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xf5d(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf41(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xf25(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x80(%rsp),%rdi
lea    0x40(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <create_struct_table@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <show_struct_table@plt>
mov    %rbx,%rdi
call   1090 <compute_average_grade@plt>
lea    0xe9a(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1070 <print_failed_names@plt>
mov    %rbx,%rdi
call   1040 <change_failed_names@plt>
mov    %rbx,%rdi
call   1080 <show_struct_table@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.student = type { i32 }
@.str = [18 x i8] c"Georgios Georgiou\00"
@.str.1 = [18 x i8] c"Vasilios Vasiliou\00"
@.str.2 = [17 x i8] c"Ioanna Ioannidou\00"
@.str.3 = [15 x i8] c"Nikos Nikolaou\00"
@.str.4 = [20 x i8] c"Kiriakos Kiriakidis\00"
@.str.5 = [21 x i8] c"Kwstas Kwstantinidis\00"
@.str.6 = [19 x i8] c"Spyros Spyropoulos\00"
@.str.7 = [23 x i8] c"Dimitris Dimitropoulos\00"
@.str.8 = [19 x i8] c"Dimitra Dimitriadi\00"
@.str.9 = [15 x i8] c"Areti Aretidou\00"
@.str.10 = [17 x i8] c"Ilias Iliopoulos\00"
@.str.11 = [17 x i8] c"Kwstas Kwstoglou\00"
@.str.12 = [19 x i8] c"Aimilia Aimilianou\00"
@.str.13 = [22 x i8] c"Xristina Xristopoulou\00"
@.str.14 = [20 x i8] c"Theodoros Theodorou\00"
@__const.main.onoma = [15 x i8*] [i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i32 0, i32 0)]
@__const.main.am = [15 x i32] [i32 120, i32 122, i32 142, i32 130, i32 156, i32 132, i32 145, i32 133, i32 131, i32 140, i32 141, i32 150, i32 155, i32 134, i32 146]
@__const.main.vathmos = [15 x float] [float 1.200000e+01, float 8.500000e+00, float 1.550000e+01, float 2.000000e+01, float 7.500000e+00, float 1.000000e+00, float 1.950000e+01, float 1.200000e+01, float 1.700000e+01, float 1.750000e+01, float 1.550000e+01, float 1.800000e+01, float 1.900000e+01, float 1.800000e+01, float 1.900000e+01]
@.str.15 = [20 x i8] c"\0AAverage grade: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8*]
%3 = alloca [15 x i32]
%4 = alloca [15 x float]
%5 = alloca %struct.student*
store i32 0, i32* %1
%6 = bitcast [15 x i8*]* %2 to i8*
%7 = bitcast [15 x i32]* %3 to i8*
%8 = bitcast [15 x float]* %4 to i8*
%9 = getelementptr inbounds [15 x i8*], [15 x i8*]* %2, i64 0, i64 0
%10 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 0
%11 = getelementptr inbounds [15 x float], [15 x float]* %4, i64 0, i64 0
%12 = call %struct.student* @create_struct_table(i8** %9, i32* %10, float* %11)
store %struct.student* %12, %struct.student** %5
%13 = load %struct.student*, %struct.student** %5
%14 = call i32 @show_struct_table(%struct.student* %13)
%15 = load %struct.student*, %struct.student** %5
%16 = call double @compute_average_grade(%struct.student* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), double %16)
%18 = load %struct.student*, %struct.student** %5
%19 = call i32 @print_failed_names(%struct.student* %18)
%20 = load %struct.student*, %struct.student** %5
%21 = call i32 @change_failed_names(%struct.student* %20)
%22 = load %struct.student*, %struct.student** %5
%23 = call i32 @show_struct_table(%struct.student* %22)
%24 = load %struct.student*, %struct.student** %5
%25 = call i32 @free(%struct.student* %24)
ret i32 0
}

LLVM IR (-O2):
%struct.student = type { i32 }
@.str = [18 x i8] c"Georgios Georgiou\00"
@.str.1 = [18 x i8] c"Vasilios Vasiliou\00"
@.str.2 = [17 x i8] c"Ioanna Ioannidou\00"
@.str.3 = [15 x i8] c"Nikos Nikolaou\00"
@.str.4 = [20 x i8] c"Kiriakos Kiriakidis\00"
@.str.5 = [21 x i8] c"Kwstas Kwstantinidis\00"
@.str.6 = [19 x i8] c"Spyros Spyropoulos\00"
@.str.7 = [23 x i8] c"Dimitris Dimitropoulos\00"
@.str.8 = [19 x i8] c"Dimitra Dimitriadi\00"
@.str.9 = [15 x i8] c"Areti Aretidou\00"
@.str.10 = [17 x i8] c"Ilias Iliopoulos\00"
@.str.11 = [17 x i8] c"Kwstas Kwstoglou\00"
@.str.12 = [19 x i8] c"Aimilia Aimilianou\00"
@.str.13 = [22 x i8] c"Xristina Xristopoulou\00"
@.str.14 = [20 x i8] c"Theodoros Theodorou\00"
@__const.main.onoma = [15 x i8*] [i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i32 0, i32 0)]
@__const.main.am = [15 x i32] [i32 120, i32 122, i32 142, i32 130, i32 156, i32 132, i32 145, i32 133, i32 131, i32 140, i32 141, i32 150, i32 155, i32 134, i32 146]
@__const.main.vathmos = [15 x float] [float 1.200000e+01, float 8.500000e+00, float 1.550000e+01, float 2.000000e+01, float 7.500000e+00, float 1.000000e+00, float 1.950000e+01, float 1.200000e+01, float 1.700000e+01, float 1.750000e+01, float 1.550000e+01, float 1.800000e+01, float 1.900000e+01, float 1.800000e+01, float 1.900000e+01]
@.str.15 = [20 x i8] c"\0AAverage grade: %f\0A\00"
define i32 @main() {
%1 = alloca [15 x i8*]
%2 = alloca [15 x i32]
%3 = alloca [15 x float]
%4 = bitcast [15 x i8*]* %1 to i8*
%5 = bitcast [15 x i32]* %2 to i8*
%6 = bitcast [15 x float]* %3 to i8*
%7 = getelementptr inbounds [15 x i8*], [15 x i8*]* %1, i64 0, i64 0
%8 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds [15 x float], [15 x float]* %3, i64 0, i64 0
%10 = call %struct.student* @create_struct_table(i8** %7, i32* %8, float* %9)
%11 = call i32 @show_struct_table(%struct.student* %10)
%12 = call double @compute_average_grade(%struct.student* %10)
%13 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), double %12)
%14 = call i32 @print_failed_names(%struct.student* %10)
%15 = call i32 @change_failed_names(%struct.student* %10)
%16 = call i32 @show_struct_table(%struct.student* %10)
%17 = call i32 @free(%struct.student* %10)
ret i32 0
}