#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 *, float *, float *);
int main(void) {
  float n1, n2, n3 = 0, media;
  printf("Informe as duas notas: ");
  scanf("%f %f", &n1, &n2);
  media = (n1 + n2) / 2.0;
  if (media < 6)
    printf("Rapaz... Tu reprovou\n");
  if (media < 7.0)
    n3 = 1.0;
  while (media < 7.0) {
    media = (n1 + n2 + n3) / 3.0;
    n3++;
  }
  printf("A nota mínima é %.2f\n", n3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe99(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe7c(%rip),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    119c <main+0x7c>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe63(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c4 <main+0xa4>
movss  0xe45(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11c9 <main+0xa9>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe36(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1223 <main+0x103>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe19(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xdf0(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11c9 <main+0xa9>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe21(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm2
addss  0xc(%rsp),%xmm2
mulss  0xe94(%rip),%xmm2
movss  0xe90(%rip),%xmm0
ucomiss %xmm2,%xmm0
jbe    1191 <main+0x61>
lea    0xeca(%rip),%rdi
movss  %xmm2,0x14(%rsp)
call   1030 <puts@plt>
movss  0x14(%rsp),%xmm2
xorps  %xmm0,%xmm0
movss  0xe6c(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    11db <main+0xab>
movss  0x10(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
movss  0xe57(%rip),%xmm2
movss  0xe53(%rip),%xmm4
movaps %xmm2,%xmm3
movaps %xmm3,%xmm5
addss  %xmm0,%xmm5
divss  %xmm4,%xmm5
addss  %xmm2,%xmm3
ucomiss %xmm5,%xmm1
ja     11c0 <main+0x90>
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
lea    0xe50(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Informe as duas notas: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [22 x i8] c"Rapaz... Tu reprovou\0A\00"
@.str.3 = [24 x i8] c"A nota m\C3\ADnima \C3\A9 %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3)
%8 = load float, float* %2
%9 = load float, float* %3
%10 = fadd float %8, %9
%11 = fpext float %10 to double
%12 = fdiv double %11, 2.000000e+00
%13 = fptrunc double %12 to float
store float %13, float* %5
%14 = load float, float* %5
%15 = fcmp olt float %14, 6.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %0
%19 = load float, float* %5
%20 = fpext float %19 to double
%21 = fcmp olt double %20, 7.000000e+00
br i1 %21, label %22, label %23
22: ; preds = %18
store float 1.000000e+00, float* %4
br label %23
23: ; preds = %22, %18
br label %24
24: ; preds = %28, %23
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = fcmp olt double %26, 7.000000e+00
br i1 %27, label %28, label %39
28: ; preds = %24
%29 = load float, float* %2
%30 = load float, float* %3
%31 = fadd float %29, %30
%32 = load float, float* %4
%33 = fadd float %31, %32
%34 = fpext float %33 to double
%35 = fdiv double %34, 3.000000e+00
%36 = fptrunc double %35 to float
store float %36, float* %5
%37 = load float, float* %4
%38 = fadd float %37, 1.000000e+00
store float %38, float* %4
br label %24
39: ; preds = %24
%40 = load float, float* %4
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Informe as duas notas: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.3 = [24 x i8] c"A nota m\C3\ADnima \C3\A9 %.2f\0A\00"
@str = [21 x i8] c"Rapaz... Tu reprovou\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2)
%7 = load float, float* %1
%8 = load float, float* %2
%9 = fadd float %7, %8
%10 = fmul float %9, 5.000000e-01
%11 = fcmp olt float %10, 6.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %12, %0
%15 = fcmp olt float %10, 7.000000e+00
br i1 %15, label %16, label %28
16: ; preds = %14
%17 = load float, float* %1
%18 = load float, float* %2
%19 = fadd float %17, %18
br label %20
20: ; preds = %16, %20
%21 = phi float [ 1.000000e+00, %16 ], [ %24, %20 ]
%22 = fadd float %21, %19
%23 = fdiv float %22, 3.000000e+00
%24 = fadd float %21, 1.000000e+00
%25 = fcmp olt float %23, 7.000000e+00
br i1 %25, label %20, label %26
26: ; preds = %20
%27 = fpext float %24 to double
br label %28
28: ; preds = %26, %14
%29 = phi double [ 0.000000e+00, %14 ], [ %27, %26 ]
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %29)
ret i32 0
}