#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 /*<<< orphan*/ scanf(char *, int *);
main() {
  int i, n, n1, n2;
  float media;
  printf("Por favor, entre com o numero de alunos: ");
  scanf("%d", &n);
  printf("\n");
  for (i = 1; i <= n; i++) {
    printf("Entre com a nota n1: ");
    scanf("%d", &n1);
    printf("Entre com a nota n2: ");
    scanf("%d", &n2);
    media = (n1 * 0.3) + (n2 * 0.7);
    printf("Media = %.1f\n", media);
    if (media >= 60)
      printf("Aluno aprovado\n\n-");
    else
      printf("Aluno em prova final\n\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     123a <main+0x11a>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cvtsi2sdl -0x10(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe54(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe40(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe88(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
movss  0xe03(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1219 <main+0xf9>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1227 <main+0x107>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122c <main+0x10c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <main+0x42>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x8(%rsp)
jle    125d <main+0x11d>
lea    0xeb5(%rip),%rbx
lea    0x14(%rsp),%r15
lea    0xec2(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xecc(%rip),%rbp
xor    %r14d,%r14d
jmp    11cb <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r14d
cmp    0x8(%rsp),%r14d
jge    125d <main+0x11d>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x14(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x10(%rsp),%xmm1
mulsd  0xded(%rip),%xmm1
mulsd  0xded(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xdcc(%rip),%xmm0
jb     11b0 <main+0x70>
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11bc <main+0x7c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Por favor, entre com o numero de alunos: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [22 x i8] c"Entre com a nota n1: \00"
@.str.4 = [22 x i8] c"Entre com a nota n2: \00"
@.str.5 = [14 x i8] c"Media = %.1f\0A\00"
@.str.6 = [18 x i8] c"Aluno aprovado\0A\0A-\00"
@.str.7 = [23 x i8] c"Aluno em prova final\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %10
10: ; preds = %36, %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %39
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to double
%21 = load i32, i32* %5
%22 = sitofp i32 %21 to double
%23 = fmul double %22, 0x3FE6666666666666
%24 = call double @llvm.fmuladd.f64(double %20, double 3.000000e-01, double %23)
%25 = fptrunc double %24 to float
store float %25, float* %6
%26 = load float, float* %6
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %27)
%29 = load float, float* %6
%30 = fcmp oge float %29, 6.000000e+01
br i1 %30, label %31, label %33
31: ; preds = %14
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %35
33: ; preds = %14
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %35
35: ; preds = %33, %31
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %10
39: ; preds = %10
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [42 x i8] c"Por favor, entre com o numero de alunos: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"Entre com a nota n1: \00"
@.str.4 = [22 x i8] c"Entre com a nota n2: \00"
@.str.5 = [14 x i8] c"Media = %.1f\0A\00"
@.str.6 = [18 x i8] c"Aluno aprovado\0A\0A-\00"
@str = [22 x i8] c"Aluno em prova final\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 @putchar(i32 10)
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 1
br i1 %11, label %36, label %12
12: ; preds = %0, %32
%13 = phi i32 [ %33, %32 ], [ 1, %0 ]
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to double
%22 = fmul double %21, 0x3FE6666666666666
%23 = call double @llvm.fmuladd.f64(double %19, double 3.000000e-01, double %22)
%24 = fptrunc double %23 to float
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %25)
%27 = fcmp ult float %24, 6.000000e+01
br i1 %27, label %30, label %28
28: ; preds = %12
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %32
30: ; preds = %12
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %28, %30
%33 = add nuw nsw i32 %13, 1
%34 = load i32, i32* %1
%35 = icmp slt i32 %13, %34
br i1 %35, label %12, label %36
36: ; preds = %32, %0
ret i32 0
}