#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 scanf(char *, float *, float *);
int lernotas(float *notas) {
  float nt, np;
  int i = 0;
  while (scanf("%f %f", &nt, &np) == 2) {
    notas[i] = (float)((nt * 0.6) + (np * 0.4));
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<lernotas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xee6(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1030 <scanf@plt>
cmp    $0x2,%eax
jne    118d <lernotas+0x7d>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xeae(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe9a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <lernotas+0x13>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lernotas>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
lea    0xee9(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <scanf@plt>
xor    %ebx,%ebx
cmp    $0x2,%eax
jne    1199 <lernotas+0x89>
xor    %ebx,%ebx
lea    0xeca(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xe94(%rip),%xmm1
mulsd  0xe94(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1030 <scanf@plt>
cmp    $0x2,%eax
je     1150 <lernotas+0x40>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%f %f\00"
define i32 @lernotas(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float* %0, float** %2
store i32 0, i32* %5
br label %6
6: ; preds = %9, %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %3, float* %4)
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = fmul double %13, 4.000000e-01
%15 = call double @llvm.fmuladd.f64(double %11, double 6.000000e-01, double %14)
%16 = fptrunc double %15 to float
%17 = load float*, float** %2
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds float, float* %17, i64 %19
store float %16, float* %20
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %6
23: ; preds = %6
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
@.str = [6 x i8] c"%f %f\00"
define i32 @lernotas(float* nocapture writeonly %0) {
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %2 to i8*
%5 = bitcast float* %3 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %2, float* %3)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %23
8: ; preds = %1, %8
%9 = phi i64 [ %18, %8 ], [ 0, %1 ]
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = fmul double %13, 4.000000e-01
%15 = call double @llvm.fmuladd.f64(double %11, double 6.000000e-01, double %14)
%16 = fptrunc double %15 to float
%17 = getelementptr inbounds float, float* %0, i64 %9
store float %16, float* %17
%18 = add nuw i64 %9, 1
%19 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %2, float* %3)
%20 = icmp eq i32 %19, 2
br i1 %20, label %8, label %21
21: ; preds = %8
%22 = trunc i64 %18 to i32
br label %23
23: ; preds = %21, %1
%24 = phi i32 [ 0, %1 ], [ %22, %21 ]
ret i32 %24
}