#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 {
  float tv_sec;
  double tv_usec;
};

/* Variables and functions */
float wallclock_timing(struct timeval from, struct timeval to) {
  return ((to.tv_sec + to.tv_usec * 1.e-6) -
          (from.tv_sec + from.tv_usec * 1.e-6));
}


x86 assembly (clang, -O0):
<wallclock_timing>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movss  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x18(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xed2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  -0x8(%rbp),%xmm1
movsd  0xeb4(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<wallclock_timing>:
unpcklps %xmm0,%xmm2
cvtps2pd %xmm2,%xmm0
unpcklpd %xmm1,%xmm3
mulpd  0xeee(%rip),%xmm3
addpd  %xmm0,%xmm3
movapd %xmm3,%xmm0
unpckhpd %xmm3,%xmm0
subsd  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtsd2ss %xmm3,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { float, double }
define float @wallclock_timing(float %0, double %1, float %2, double %3) {
%5 = alloca %struct.timeval
%6 = alloca %struct.timeval
%7 = bitcast %struct.timeval* %5 to { float, double }*
%8 = getelementptr inbounds { float, double }, { float, double }* %7, i32 0, i32 0
store float %0, float* %8
%9 = getelementptr inbounds { float, double }, { float, double }* %7, i32 0, i32 1
store double %1, double* %9
%10 = bitcast %struct.timeval* %6 to { float, double }*
%11 = getelementptr inbounds { float, double }, { float, double }* %10, i32 0, i32 0
store float %2, float* %11
%12 = getelementptr inbounds { float, double }, { float, double }* %10, i32 0, i32 1
store double %3, double* %12
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%14 = load float, float* %13
%15 = fpext float %14 to double
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%17 = load double, double* %16
%18 = call double @llvm.fmuladd.f64(double %17, double 0x3EB0C6F7A0B5ED8D, double %15)
%19 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%23 = load double, double* %22
%24 = call double @llvm.fmuladd.f64(double %23, double 0x3EB0C6F7A0B5ED8D, double %21)
%25 = fsub double %18, %24
%26 = fptrunc double %25 to float
ret float %26
}

LLVM IR (-O2):
define float @wallclock_timing(float %0, double %1, float %2, double %3) {
%5 = insertelement <2 x float> poison, float %2, i64 0
%6 = insertelement <2 x float> %5, float %0, i64 1
%7 = fpext <2 x float> %6 to <2 x double>
%8 = insertelement <2 x double> poison, double %3, i64 0
%9 = insertelement <2 x double> %8, double %1, i64 1
%10 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %9, <2 x double> <double 0x3EB0C6F7A0B5ED8D, double 0x3EB0C6F7A0B5ED8D>, <2 x double> %7)
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%12 = fsub <2 x double> %10, %11
%13 = extractelement <2 x double> %12, i64 0
%14 = fptrunc double %13 to float
ret float %14
}