#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 main(void) {
  double n1, soma = 0, i = 1;
  while (i <= 2) {
    if (n1 < 0 || n1 > 10) {
      printf("nota invalida\n");
    } else {
      soma += n1;
      i++;
    }
  }
  printf("media = %.2f\n", soma / 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xecc(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     11a5 <main+0x95>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     116c <main+0x5c>
movsd  -0x10(%rbp),%xmm0
movsd  0xeae(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    117f <main+0x6f>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a0 <main+0x90>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe6a(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1134 <main+0x24>
movsd  -0x18(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe6a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"nota invalida\0A\00"
@.str.1 = [14 x i8] c"media = %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %3
store double 1.000000e+00, double* %4
br label %5
5: ; preds = %22, %0
%6 = load double, double* %4
%7 = fcmp ole double %6, 2.000000e+00
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load double, double* %2
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load double, double* %2
%13 = fcmp ogt double %12, 1.000000e+01
br i1 %13, label %14, label %16
14: ; preds = %11, %8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %22
16: ; preds = %11
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fadd double %18, %17
store double %19, double* %3
%20 = load double, double* %4
%21 = fadd double %20, 1.000000e+00
store double %21, double* %4
br label %22
22: ; preds = %16, %14
br label %5
23: ; preds = %5
%24 = load double, double* %3
%25 = fdiv double %24, 2.000000e+00
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %25)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"media = %.2f\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double 0x7FF8000000000000)
ret i32 0
}