#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 */
typedef scalar_t__ uint32_t;
typedef float uint16_t;

/* Variables and functions */
float epsVectorSpeed(uint32_t last_time, uint32_t currentTime, float distance) {
  if (last_time == currentTime || distance == 0)
    return 0;
  uint16_t vartime;
  float speed;
  vartime = currentTime - last_time;
  speed = distance / (vartime / 1000.0f);
  return speed;
}


x86 assembly (clang, -O0):
<epsVectorSpeed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1136 <epsVectorSpeed+0x36>
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1143 <epsVectorSpeed+0x43>
jp     1143 <epsVectorSpeed+0x43>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    117e <epsVectorSpeed+0x7e>
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
movss  0xe99(%rip),%xmm2
divss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<epsVectorSpeed>:
xorps  %xmm1,%xmm1
sub    %rdi,%rsi
je     1129 <epsVectorSpeed+0x29>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jne    1112 <epsVectorSpeed+0x12>
jnp    1129 <epsVectorSpeed+0x29>
xorps  %xmm1,%xmm1
cvtsi2ss %rsi,%xmm1
divss  0xede(%rip),%xmm1
divss  %xmm1,%xmm0
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @epsVectorSpeed(i64 %0, i64 %1, float %2) {
%4 = alloca float
%5 = alloca i64
%6 = alloca i64
%7 = alloca float
%8 = alloca float
%9 = alloca float
store i64 %0, i64* %5
store i64 %1, i64* %6
store float %2, float* %7
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = icmp eq i64 %10, %11
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load float, float* %7
%15 = fcmp oeq float %14, 0.000000e+00
br i1 %15, label %16, label %17
16: ; preds = %13, %3
store float 0.000000e+00, float* %4
br label %27
17: ; preds = %13
%18 = load i64, i64* %6
%19 = load i64, i64* %5
%20 = sub nsw i64 %18, %19
%21 = sitofp i64 %20 to float
store float %21, float* %8
%22 = load float, float* %7
%23 = load float, float* %8
%24 = fdiv float %23, 1.000000e+03
%25 = fdiv float %22, %24
store float %25, float* %9
%26 = load float, float* %9
store float %26, float* %4
br label %27
27: ; preds = %17, %16
%28 = load float, float* %4
ret float %28
}

LLVM IR (-O2):
define float @epsVectorSpeed(i64 %0, i64 %1, float %2) {
%4 = icmp eq i64 %1, %0
%5 = fcmp oeq float %2, 0.000000e+00
%6 = or i1 %4, %5
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = sub nsw i64 %1, %0
%9 = sitofp i64 %8 to float
%10 = fdiv float %9, 1.000000e+03
%11 = fdiv float %2, %10
br label %12
12: ; preds = %3, %7
%13 = phi float [ %11, %7 ], [ 0.000000e+00, %3 ]
ret float %13
}