#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_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
double get_interval(struct timeval bt, struct timeval et) {
  double b, e;
  b = bt.tv_sec + (double)bt.tv_usec * 1e-6;
  e = et.tv_sec + (double)et.tv_usec * 1e-6;
  return e - b;
}


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

x86 assembly (clang, -O2):
<get_interval>:
cvtsi2sd %rdi,%xmm3
movsd  0xef3(%rip),%xmm4
mulsd  %xmm4,%xmm3
cvtsi2sd %rsi,%xmm2
addsd  %xmm0,%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm1,%xmm2
subsd  %xmm3,%xmm2
movapd %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define double @get_interval(double %0, i64 %1, double %2, i64 %3) {
%5 = sitofp i64 %1 to double
%6 = tail call double @llvm.fmuladd.f64(double %5, double 0x3EB0C6F7A0B5ED8D, double %0)
%7 = sitofp i64 %3 to double
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %2)
%9 = fsub double %8, %6
ret double %9
}