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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x4,-0x44(%rbp)
jge    11b3 <main+0x83>
mov    -0x44(%rbp),%esi
add    $0x1,%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rdx
imul   $0xc,%rax,%rax
add    %rax,%rdx
add    $0x4,%rdx
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rcx
imul   $0xc,%rax,%rax
add    %rax,%rcx
add    $0x8,%rcx
lea    0xe78(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1146 <main+0x16>
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0x4,-0x48(%rbp)
jge    1259 <main+0x129>
movslq -0x48(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%esi
movslq -0x48(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
movslq -0x48(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
movslq -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rax
imul   $0xc,%rdi,%rdi
add    %rdi,%rax
mov    0x4(%rax),%eax
movslq -0x48(%rbp),%r8
lea    -0x40(%rbp),%rdi
imul   $0xc,%r8,%r8
add    %r8,%rdi
add    0x8(%rdi),%eax
cvtsi2ss %eax,%xmm0
movss  0xdcb(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfa(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11c6 <main+0x96>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xec6(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xeba(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
lea    0x1c(%rsp),%rdx
lea    0x20(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x24(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x2c(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe3f(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    (%rcx,%rdx,1),%eax
cvtsi2ss %eax,%xmm0
mov    (%rsp),%esi
mulss  0xdff(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe32(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    (%rcx,%rdx,1),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0xc(%rsp),%esi
mulss  0xdcc(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x1c(%rsp),%edx
mov    0x20(%rsp),%ecx
lea    (%rcx,%rdx,1),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x18(%rsp),%esi
mulss  0xda0(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x28(%rsp),%edx
mov    0x2c(%rsp),%ecx
lea    (%rcx,%rdx,1),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x24(%rsp),%esi
mulss  0xd74(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

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