#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 */
int /*<<< orphan*/ assert(int);
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;
  assert(b <= e);
  return e - b;
}


x86 assembly (clang, -O0):
<get_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
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  0xec3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
cvtsi2sdq -0x18(%rbp),%xmm0
movsd  0xea3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_interval>:
sub    $0x18,%rsp
cvtsi2sd %rdi,%xmm3
movsd  0xedf(%rip),%xmm2
mulsd  %xmm2,%xmm3
addsd  %xmm0,%xmm3
movsd  %xmm3,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rsi,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %edi,%edi
ucomisd %xmm3,%xmm0
setae  %dil
call   1030 <assert@plt>
movsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
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* %7
%28 = load double, double* %8
%29 = fcmp ole double %27, %28
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load double, double* %8
%33 = load double, double* %7
%34 = fsub double %32, %33
ret double %34
}

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 = fcmp ole double %6, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = fsub double %8, %6
ret double %12
}