#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 *);
int main() {
  int volta = 0, tempo = 0, i = 1, melhor_volta = 0;
  float tempo_medio = 0, melhor_tempo = 0;
  printf("Digite o numero de voltas: ");
  scanf("%d", &volta);
  for (i; i <= volta; i++) {
    printf("Digite o tempo da %d° volta: ", i);
    scanf("%d", &tempo);
    tempo_medio += tempo;
    if (i == 1) {
      melhor_tempo = tempo;
    }
    if (melhor_tempo > tempo) {
      melhor_tempo = tempo;
      melhor_volta = i;
    }
  }
  printf("a. Melhor tempo: %.2f\nb. Volta do melhor tempo %d\nc. Tempo médio "
         "%.2f\n",
         melhor_tempo, melhor_volta, tempo_medio / volta);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ff <main+0xdf>
mov    -0x10(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11c9 <main+0xa9>
cvtsi2ssl -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    11ec <main+0xcc>
cvtsi2ssl -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11f1 <main+0xd1>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1179 <main+0x59>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x14(%rbp),%esi
movss  -0x18(%rbp),%xmm1
cvtsi2ssl -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe1a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
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
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xebb(%rip),%rdi
xor    %r13d,%r13d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    11f6 <main+0xd6>
xorps  %xmm1,%xmm1
lea    0xea9(%rip),%r14
lea    0xe9f(%rip),%r15
lea    0xc(%rsp),%r12
xor    %ebp,%ebp
xorps  %xmm2,%xmm2
xor    %r13d,%r13d
jmp    11b0 <main+0x90>
nopl   0x0(%rax)
ucomiss %xmm0,%xmm1
cmova  %ebp,%r13d
movss  0x14(%rsp),%xmm2
addss  %xmm0,%xmm2
minss  %xmm1,%xmm0
mov    0x8(%rsp),%eax
movaps %xmm0,%xmm1
cmp    %eax,%ebp
jge    11f0 <main+0xd0>
movss  %xmm1,0x10(%rsp)
movss  %xmm2,0x14(%rsp)
mov    %ebp,%ebx
lea    0x1(%rbx),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
cvtsi2ssl 0xc(%rsp),%xmm0
movaps %xmm0,%xmm1
test   %ebx,%ebx
je     1190 <main+0x70>
movss  0x10(%rsp),%xmm1
jmp    1190 <main+0x70>
cvtss2sd %xmm0,%xmm0
jmp    11fc <main+0xdc>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
lea    0xe29(%rip),%rdi
mov    %r13d,%esi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Digite o numero de voltas: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"Digite o tempo da %d\C2\B0 volta: \00"
@.str.3 = [72 x i8] c"a. Melhor tempo: %.2f\0Ab. Volta do melhor tempo %d\0Ac. Tempo m\C3\A9dio %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 1, i32* %4
store i32 0, i32* %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %4
br label %11
11: ; preds = %38, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %41
15: ; preds = %11
%16 = load i32, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = sitofp i32 %19 to float
%21 = load float, float* %6
%22 = fadd float %21, %20
store float %22, float* %6
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %15
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to float
store float %27, float* %7
br label %28
28: ; preds = %25, %15
%29 = load float, float* %7
%30 = load i32, i32* %3
%31 = sitofp i32 %30 to float
%32 = fcmp ogt float %29, %31
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load i32, i32* %3
%35 = sitofp i32 %34 to float
store float %35, float* %7
%36 = load i32, i32* %4
store i32 %36, i32* %5
br label %37
37: ; preds = %33, %28
br label %38
38: ; preds = %37
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %11
41: ; preds = %11
%42 = load float, float* %7
%43 = fpext float %42 to double
%44 = load i32, i32* %5
%45 = load float, float* %6
%46 = load i32, i32* %2
%47 = sitofp i32 %46 to float
%48 = fdiv float %45, %47
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), double %43, i32 %44, double %49)
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [28 x i8] c"Digite o numero de voltas: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"Digite o tempo da %d\C2\B0 volta: \00"
@.str.3 = [72 x i8] c"a. Melhor tempo: %.2f\0Ab. Volta do melhor tempo %d\0Ac. Tempo m\C3\A9dio %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %29, label %9
9: ; preds = %0, %9
%10 = phi float [ %23, %9 ], [ 0.000000e+00, %0 ]
%11 = phi float [ %18, %9 ], [ 0.000000e+00, %0 ]
%12 = phi i32 [ %22, %9 ], [ 0, %0 ]
%13 = phi i32 [ %24, %9 ], [ 1, %0 ]
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %2
%17 = sitofp i32 %16 to float
%18 = fadd float %11, %17
%19 = icmp eq i32 %13, 1
%20 = select i1 %19, float %17, float %10
%21 = fcmp ogt float %20, %17
%22 = select i1 %21, i32 %13, i32 %12
%23 = select i1 %21, float %17, float %20
%24 = add nuw nsw i32 %13, 1
%25 = load i32, i32* %1
%26 = icmp slt i32 %13, %25
br i1 %26, label %9, label %27
27: ; preds = %9
%28 = fpext float %23 to double
br label %29
29: ; preds = %27, %0
%30 = phi i32 [ 0, %0 ], [ %22, %27 ]
%31 = phi float [ 0.000000e+00, %0 ], [ %18, %27 ]
%32 = phi double [ 0.000000e+00, %0 ], [ %28, %27 ]
%33 = phi i32 [ %7, %0 ], [ %25, %27 ]
%34 = sitofp i32 %33 to float
%35 = fdiv float %31, %34
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), double %32, i32 %30, double %36)
ret i32 0
}