#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 */
struct timeval {
  double tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
double getTempo(struct timeval start, struct timeval stop) {
  double t =
      (((double)(stop.tv_sec) * 1000.0 + (double)(stop.tv_usec / 1000.0)) -
       ((double)(start.tv_sec) * 1000.0 + (double)(start.tv_usec / 1000.0)));
  return (t);
}


x86 assembly (clang, -O0):
<getTempo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x8(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
cvtsi2sdq -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xed7(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xecb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdq -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  0xeb0(%rip),%xmm3
divsd  %xmm3,%xmm2
movsd  0xea4(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTempo>:
cvtsi2sd %rdi,%xmm3
cvtsi2sd %rsi,%xmm2
unpcklpd %xmm3,%xmm2
unpcklpd %xmm0,%xmm1
movapd 0xee6(%rip),%xmm0
divpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { double, i64 }
define double @getTempo(double %0, i64 %1, double %2, i64 %3) {
%5 = alloca %struct.timeval
%6 = alloca %struct.timeval
%7 = alloca double
%8 = bitcast %struct.timeval* %5 to { double, i64 }*
%9 = getelementptr inbounds { double, i64 }, { double, i64 }* %8, i32 0, i32 0
store double %0, double* %9
%10 = getelementptr inbounds { double, i64 }, { double, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = bitcast %struct.timeval* %6 to { double, i64 }*
%12 = getelementptr inbounds { double, i64 }, { double, i64 }* %11, i32 0, i32 0
store double %2, double* %12
%13 = getelementptr inbounds { double, i64 }, { double, i64 }* %11, i32 0, i32 1
store i64 %3, i64* %13
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%15 = load i64, i64* %14
%16 = sitofp i64 %15 to double
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%18 = load double, double* %17
%19 = fdiv double %18, 1.000000e+03
%20 = call double @llvm.fmuladd.f64(double %16, double 1.000000e+03, double %19)
%21 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%22 = load i64, i64* %21
%23 = sitofp i64 %22 to double
%24 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%25 = load double, double* %24
%26 = fdiv double %25, 1.000000e+03
%27 = call double @llvm.fmuladd.f64(double %23, double 1.000000e+03, double %26)
%28 = fsub double %20, %27
store double %28, double* %7
%29 = load double, double* %7
ret double %29
}

LLVM IR (-O2):
define double @getTempo(double %0, i64 %1, double %2, i64 %3) {
%5 = insertelement <2 x i64> poison, i64 %3, i64 0
%6 = insertelement <2 x i64> %5, i64 %1, i64 1
%7 = sitofp <2 x i64> %6 to <2 x double>
%8 = insertelement <2 x double> poison, double %2, i64 0
%9 = insertelement <2 x double> %8, double %0, i64 1
%10 = fdiv <2 x double> %9, <double 1.000000e+03, double 1.000000e+03>
%11 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %7, <2 x double> <double 1.000000e+03, double 1.000000e+03>, <2 x double> %10)
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%13 = fsub <2 x double> %11, %12
%14 = extractelement <2 x double> %13, i64 0
ret double %14
}