#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*/ ordena(float **, int);
int /*<<< orphan*/ printf(char *, float, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, float *, float *, float *);
int main() {
  float data[4][2];
  for (int i = 0; i < 4; ++i) {
    printf("Dados do aluno %d: ", i + 1);
    float mark1, mark2;
    scanf("%f %f %f", data[i], &mark1, &mark2);
    data[i][1] = (mark1 + mark2) / 2.0f;
  }
  ordena(data, 4);
  puts("Número\tMédia");
  for (int i = 0; i < 4; ++i) {
    printf("%05.f\t%.1f\n", data[i][0], data[i][1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    11c9 <main+0x89>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
lea    0xe93(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe8a(%rip),%rdi
lea    -0x38(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1060 <scanf@plt>
movss  -0x38(%rbp),%xmm0
addss  -0x3c(%rbp),%xmm0
movss  0xe53(%rip),%xmm1
divss  %xmm1,%xmm0
movslq -0x34(%rbp),%rax
movss  %xmm0,-0x2c(%rbp,%rax,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1156 <main+0x16>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
call   1050 <ordena@plt>
lea    0xe43(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x40(%rbp)
cmpl   $0x4,-0x40(%rbp)
jge    1228 <main+0xe8>
movslq -0x40(%rbp),%rax
movss  -0x30(%rbp,%rax,8),%xmm0
movslq -0x40(%rbp),%rax
movss  -0x2c(%rbp,%rax,8),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe1d(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11ea <main+0xaa>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xec0(%rip),%r15
movss  0xea4(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xebb(%rip),%rbx
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
mulss  0xe63(%rip),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0xe59(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r13,%rcx
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
mulss  0xe24(%rip),%xmm0
movss  %xmm0,0x1c(%rsp)
movss  0xe1e(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r13,%rcx
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
mulss  0xde5(%rip),%xmm0
movss  %xmm0,0x24(%rsp)
movss  0xde3(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r13,%rcx
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
mulss  0xda6(%rip),%xmm0
movss  %xmm0,0x2c(%rsp)
mov    %r14,%rdi
mov    $0x4,%esi
call   1050 <ordena@plt>
lea    0xdb9(%rip),%rdi
call   1030 <puts@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdac(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x20(%rsp),%xmm0
movss  0x24(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x28(%rsp),%xmm0
movss  0x2c(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Dados do aluno %d: \00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [15 x i8] c"N\C3\BAmero\09M\C3\A9dia\00"
@.str.3 = [12 x i8] c"%05.f\09%.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x [2 x float]]
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %7
7: ; preds = %28, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
%13 = sitofp i32 %12 to float
%14 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float %13)
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %2, i64 0, i64 %16
%18 = getelementptr inbounds [2 x float], [2 x float]* %17, i64 0, i64 0
%19 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %18, float* %4, float* %5)
%20 = load float, float* %4
%21 = load float, float* %5
%22 = fadd float %20, %21
%23 = fdiv float %22, 2.000000e+00
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %2, i64 0, i64 %25
%27 = getelementptr inbounds [2 x float], [2 x float]* %26, i64 0, i64 1
store float %23, float* %27
br label %28
28: ; preds = %10
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %7
31: ; preds = %7
%32 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %2, i64 0, i64 0
%33 = bitcast [2 x float]* %32 to float**
%34 = call i32 @ordena(float** %33, i32 4)
%35 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %36
36: ; preds = %52, %31
%37 = load i32, i32* %6
%38 = icmp slt i32 %37, 4
br i1 %38, label %39, label %55
39: ; preds = %36
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %2, i64 0, i64 %41
%43 = getelementptr inbounds [2 x float], [2 x float]* %42, i64 0, i64 0
%44 = load float, float* %43
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %2, i64 0, i64 %46
%48 = getelementptr inbounds [2 x float], [2 x float]* %47, i64 0, i64 1
%49 = load float, float* %48
%50 = fpext float %49 to double
%51 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float %44, double %50)
br label %52
52: ; preds = %39
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %36
55: ; preds = %36
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Dados do aluno %d: \00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [15 x i8] c"N\C3\BAmero\09M\C3\A9dia\00"
@.str.3 = [12 x i8] c"%05.f\09%.1f\0A\00"
define i32 @main() {
%1 = alloca [4 x [2 x float]]
%2 = alloca float
%3 = alloca float
%4 = bitcast [4 x [2 x float]]* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float 1.000000e+00)
%8 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %1, i64 0, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %8, float* %2, float* %3)
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fadd float %10, %11
%13 = fmul float %12, 5.000000e-01
%14 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %1, i64 0, i64 0, i64 1
store float %13, float* %14
%15 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float 2.000000e+00)
%16 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %1, i64 0, i64 1, i64 0
%17 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %16, float* %2, float* %3)
%18 = load float, float* %2
%19 = load float, float* %3
%20 = fadd float %18, %19
%21 = fmul float %20, 5.000000e-01
%22 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %1, i64 0, i64 1, i64 1
store float %21, float* %22
%23 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float 3.000000e+00)
%24 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %1, i64 0, i64 2, i64 0
%25 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %24, float* %2, float* %3)
%26 = load float, float* %2
%27 = load float, float* %3
%28 = fadd float %26, %27
%29 = fmul float %28, 5.000000e-01
%30 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %1, i64 0, i64 2, i64 1
store float %29, float* %30
%31 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float 4.000000e+00)
%32 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %1, i64 0, i64 3, i64 0
%33 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %32, float* %2, float* %3)
%34 = load float, float* %2
%35 = load float, float* %3
%36 = fadd float %34, %35
%37 = fmul float %36, 5.000000e-01
%38 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %1, i64 0, i64 3, i64 1
store float %37, float* %38
%39 = bitcast [4 x [2 x float]]* %1 to float**
%40 = call i32 @ordena(float** %39, i32 4)
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%42 = load float, float* %8
%43 = load float, float* %14
%44 = fpext float %43 to double
%45 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float %42, double %44)
%46 = load float, float* %16
%47 = load float, float* %22
%48 = fpext float %47 to double
%49 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float %46, double %48)
%50 = load float, float* %24
%51 = load float, float* %30
%52 = fpext float %51 to double
%53 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float %50, double %52)
%54 = load float, float* %32
%55 = load float, float* %38
%56 = fpext float %55 to double
%57 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float %54, double %56)
ret i32 0
}