#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 *);
void main() {
  float dist, tempo, media = 1;
  for (tempo = 0, dist = 0; tempo != -1 && dist != -1;) {
    scanf("%f%f", &dist, &tempo);
    if ((tempo != 0 && tempo != -1) && (dist != 0 && dist != -1)) {
      media += (dist / tempo) * 3.6;
    }
    if (tempo == 0 && dist == 0) {
      printf("Saida: %.2f\n", media);
      media = 0;
    }
  }
  printf("Saiu!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xed0(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
xor    %eax,%eax
movss  0xeb0(%rip),%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0xd(%rbp)
jne    116b <main+0x4b>
jp     116b <main+0x4b>
jmp    1186 <main+0x66>
movss  -0x4(%rbp),%xmm0
movss  0xe8c(%rip),%xmm1
ucomiss %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1196 <main+0x76>
jmp    12a6 <main+0x186>
lea    0xe73(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11c6 <main+0xa6>
jp     11c6 <main+0xa6>
jmp    1254 <main+0x134>
movss  -0x8(%rbp),%xmm0
movss  0xe31(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11e7 <main+0xc7>
jp     11e7 <main+0xc7>
jmp    1254 <main+0x134>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1203 <main+0xe3>
jp     1203 <main+0xe3>
jmp    1254 <main+0x134>
movss  -0x4(%rbp),%xmm0
movss  0xdf4(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1224 <main+0x104>
jp     1224 <main+0x104>
jmp    1254 <main+0x134>
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xdc5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12a1 <main+0x181>
jp     12a1 <main+0x181>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12a1 <main+0x181>
jp     12a1 <main+0x181>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd83(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1145 <main+0x25>
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
movss  0xead(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0xec8(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xebc(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm1
movss  0x14(%rsp),%xmm0
movaps %xmm1,%xmm2
shufps $0x0,%xmm0,%xmm2
cmpeqps 0xe67(%rip),%xmm2
movmskps %xmm2,%eax
test   %eax,%eax
jne    11db <main+0xab>
movaps %xmm0,%xmm2
divss  %xmm1,%xmm2
cvtss2sd %xmm2,%xmm2
movss  0xc(%rsp),%xmm3
cvtss2sd %xmm3,%xmm3
mulsd  0xe53(%rip),%xmm2
addsd  %xmm3,%xmm2
cvtsd2ss %xmm2,%xmm2
movss  %xmm2,0xc(%rsp)
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jne    1215 <main+0xe5>
jp     1215 <main+0xe5>
ucomiss %xmm2,%xmm0
jne    1215 <main+0xe5>
jp     1215 <main+0xe5>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x14(%rsp),%xmm0
movss  0xde7(%rip),%xmm2
ucomiss %xmm2,%xmm1
jne    1224 <main+0xf4>
jnp    1236 <main+0x106>
movaps %xmm2,%xmm1
ucomiss %xmm2,%xmm0
jne    1180 <main+0x50>
jp     1180 <main+0x50>
lea    0xdfd(%rip),%rdi
call   1030 <puts@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%f%f\00"
@.str.1 = [13 x i8] c"Saida: %.2f\0A\00"
@.str.2 = [7 x i8] c"Saiu!\0A\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
store float 1.000000e+00, float* %3
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %1
br label %4
4: ; preds = %44, %0
%5 = load float, float* %2
%6 = fcmp une float %5, -1.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load float, float* %1
%9 = fcmp une float %8, -1.000000e+00
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ false, %4 ], [ %9, %7 ]
br i1 %11, label %12, label %45
12: ; preds = %10
%13 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float* %1, float* %2)
%14 = load float, float* %2
%15 = fcmp une float %14, 0.000000e+00
br i1 %15, label %16, label %34
16: ; preds = %12
%17 = load float, float* %2
%18 = fcmp une float %17, -1.000000e+00
br i1 %18, label %19, label %34
19: ; preds = %16
%20 = load float, float* %1
%21 = fcmp une float %20, 0.000000e+00
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = load float, float* %1
%24 = fcmp une float %23, -1.000000e+00
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load float, float* %1
%27 = load float, float* %2
%28 = fdiv float %26, %27
%29 = fpext float %28 to double
%30 = load float, float* %3
%31 = fpext float %30 to double
%32 = call double @llvm.fmuladd.f64(double %29, double 3.600000e+00, double %31)
%33 = fptrunc double %32 to float
store float %33, float* %3
br label %34
34: ; preds = %25, %22, %19, %16, %12
%35 = load float, float* %2
%36 = fcmp oeq float %35, 0.000000e+00
br i1 %36, label %37, label %44
37: ; preds = %34
%38 = load float, float* %1
%39 = fcmp oeq float %38, 0.000000e+00
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %42)
store float 0.000000e+00, float* %3
br label %44
44: ; preds = %40, %37, %34
br label %4
45: ; preds = %10
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%f%f\00"
@.str.1 = [13 x i8] c"Saida: %.2f\0A\00"
@str = [6 x i8] c"Saiu!\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %1
br label %5
5: ; preds = %0, %33
%6 = phi float [ %36, %33 ], [ 1.000000e+00, %0 ]
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float* %1, float* %2)
%8 = load float, float* %2
%9 = load float, float* %1
%10 = insertelement <4 x float> poison, float %8, i64 0
%11 = insertelement <4 x float> %10, float %9, i64 1
%12 = shufflevector <4 x float> %11, <4 x float> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
%13 = freeze <4 x float> %12
%14 = fcmp oeq <4 x float> %13, <float 0.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00>
%15 = bitcast <4 x i1> %14 to i4
%16 = icmp eq i4 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %5
%18 = fdiv float %9, %8
%19 = fpext float %18 to double
%20 = fpext float %6 to double
%21 = call double @llvm.fmuladd.f64(double %19, double 3.600000e+00, double %20)
%22 = fptrunc double %21 to float
br label %23
23: ; preds = %17, %5
%24 = phi float [ %22, %17 ], [ %6, %5 ]
%25 = fcmp oeq float %8, 0.000000e+00
%26 = fcmp oeq float %9, 0.000000e+00
%27 = select i1 %25, i1 %26, i1 false
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = fpext float %24 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %29)
%31 = load float, float* %2
%32 = load float, float* %1
br label %33
33: ; preds = %28, %23
%34 = phi float [ %32, %28 ], [ %9, %23 ]
%35 = phi float [ %31, %28 ], [ %8, %23 ]
%36 = phi float [ 0.000000e+00, %28 ], [ %24, %23 ]
%37 = fcmp une float %35, -1.000000e+00
%38 = fcmp une float %34, -1.000000e+00
%39 = select i1 %37, i1 %38, i1 false
br i1 %39, label %5, label %40
40: ; preds = %33
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}