#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, float *);
void main() {
  char nome[50];
  float nota1, nota2;
  printf("Nome do aluno: ");
  gets(nome);
  printf("Nota da primeira prova: ");
  scanf("%f", &nota1);
  printf("Nota da segunda prova: ");
  scanf("%f", &nota2);
  if (nota1 > nota2)
    printf("\nRefaca a segunda prova.\n");
  else {
    nota1 = nota2;
    printf("Nota da terceira prova: ");
    scanf("%f", &nota2);
    if (nota1 > nota2)
      printf("\nRefaca a terceira prova.\n");
    else {
      nota1 = nota2;
      printf("Nota da quarta prova: ");
      scanf("%f", &nota2);
      if (nota1 > nota2)
        printf("\nRefaca a quarta prova.\n");
      else {
        nota1 = nota2;
        printf("Nota da quinta prova: ");
        scanf("%f", &nota2);
        if (nota1 > nota2)
          printf("\nRefaca a quinta prova.\n");
        else
          printf("\nNao eh necessario refazer nenhuma prova.\n");
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <gets@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x44(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
lea    -0x48(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x44(%rbp),%xmm0
ucomiss -0x48(%rbp),%xmm0
jbe    11a5 <main+0x75>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1292 <main+0x162>
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
lea    0xe67(%rip),%rdi
lea    -0x48(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x44(%rbp),%xmm0
ucomiss -0x48(%rbp),%xmm0
jbe    11eb <main+0xbb>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    128d <main+0x15d>
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
lea    0xe21(%rip),%rdi
lea    -0x48(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x44(%rbp),%xmm0
ucomiss -0x48(%rbp),%xmm0
jbe    1231 <main+0x101>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
jmp    1288 <main+0x158>
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
lea    0xddb(%rip),%rdi
lea    -0x48(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x44(%rbp),%xmm0
ucomiss -0x48(%rbp),%xmm0
jbe    1277 <main+0x147>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
jmp    1283 <main+0x153>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    1288 <main+0x158>
jmp    128d <main+0x15d>
jmp    1292 <main+0x162>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
call   1050 <gets@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    0xebb(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
ucomiss %xmm0,%xmm1
jbe    11b1 <main+0x71>
lea    0xf53(%rip),%rdi
jmp    126b <main+0x12b>
movss  %xmm0,0xc(%rsp)
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
ucomiss %xmm0,%xmm1
jbe    11ee <main+0xae>
lea    0xef9(%rip),%rdi
jmp    126b <main+0x12b>
movss  %xmm0,0xc(%rsp)
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
lea    0xe22(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
ucomiss %xmm0,%xmm1
jbe    122b <main+0xeb>
lea    0xea4(%rip),%rdi
jmp    126b <main+0x12b>
movss  %xmm0,0xc(%rsp)
lea    0xe3c(%rip),%rdi
call   1040 <printf@plt>
lea    0xde5(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0x8(%rsp),%xmm0
lea    0xe55(%rip),%rax
lea    0xe24(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Nome do aluno: \00"
@.str.1 = [25 x i8] c"Nota da primeira prova: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [24 x i8] c"Nota da segunda prova: \00"
@.str.4 = [26 x i8] c"\0ARefaca a segunda prova.\0A\00"
@.str.5 = [25 x i8] c"Nota da terceira prova: \00"
@.str.6 = [27 x i8] c"\0ARefaca a terceira prova.\0A\00"
@.str.7 = [23 x i8] c"Nota da quarta prova: \00"
@.str.8 = [25 x i8] c"\0ARefaca a quarta prova.\0A\00"
@.str.9 = [23 x i8] c"Nota da quinta prova: \00"
@.str.10 = [25 x i8] c"\0ARefaca a quinta prova.\0A\00"
@.str.11 = [43 x i8] c"\0ANao eh necessario refazer nenhuma prova.\0A\00"
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca float
%3 = alloca float
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%11 = load float, float* %2
%12 = load float, float* %3
%13 = fcmp ogt float %11, %12
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %48
16: ; preds = %0
%17 = load float, float* %3
store float %17, float* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%20 = load float, float* %2
%21 = load float, float* %3
%22 = fcmp ogt float %20, %21
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %47
25: ; preds = %16
%26 = load float, float* %3
store float %26, float* %2
%27 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%29 = load float, float* %2
%30 = load float, float* %3
%31 = fcmp ogt float %29, %30
br i1 %31, label %32, label %34
32: ; preds = %25
%33 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
br label %46
34: ; preds = %25
%35 = load float, float* %3
store float %35, float* %2
%36 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%38 = load float, float* %2
%39 = load float, float* %3
%40 = fcmp ogt float %38, %39
br i1 %40, label %41, label %43
41: ; preds = %34
%42 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
br label %45
43: ; preds = %34
%44 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0))
br label %45
45: ; preds = %43, %41
br label %46
46: ; preds = %45, %32
br label %47
47: ; preds = %46, %23
br label %48
48: ; preds = %47, %14
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Nome do aluno: \00"
@.str.1 = [25 x i8] c"Nota da primeira prova: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [24 x i8] c"Nota da segunda prova: \00"
@.str.5 = [25 x i8] c"Nota da terceira prova: \00"
@.str.7 = [23 x i8] c"Nota da quarta prova: \00"
@.str.9 = [23 x i8] c"Nota da quinta prova: \00"
@str = [42 x i8] c"\0ANao eh necessario refazer nenhuma prova.\00"
@str.12 = [24 x i8] c"\0ARefaca a quinta prova.\00"
@str.13 = [24 x i8] c"\0ARefaca a quarta prova.\00"
@str.14 = [26 x i8] c"\0ARefaca a terceira prova.\00"
@str.15 = [25 x i8] c"\0ARefaca a segunda prova.\00"
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca float
%3 = alloca float
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%13 = load float, float* %2
%14 = load float, float* %3
%15 = fcmp ogt float %13, %14
br i1 %15, label %35, label %16
16: ; preds = %0
store float %14, float* %2
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%19 = load float, float* %2
%20 = load float, float* %3
%21 = fcmp ogt float %19, %20
br i1 %21, label %35, label %22
22: ; preds = %16
store float %20, float* %2
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%25 = load float, float* %2
%26 = load float, float* %3
%27 = fcmp ogt float %25, %26
br i1 %27, label %35, label %28
28: ; preds = %22
store float %26, float* %2
%29 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%31 = load float, float* %2
%32 = load float, float* %3
%33 = fcmp ogt float %31, %32
%34 = select i1 %33, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0)
br label %35
35: ; preds = %28, %22, %16, %0
%36 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.15, i64 0, i64 0), %0 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.14, i64 0, i64 0), %16 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @str.13, i64 0, i64 0), %22 ], [ %34, %28 ]
%37 = call i32 @puts(i8* dereferenceable(1) %36)
ret void
}