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

/* Variables and functions */
double ts_delta(struct timeval *start, struct timeval *stop) {
  return (stop->tv_sec + stop->tv_usec / 1000000.0) -
         (start->tv_sec + start->tv_usec / 1000000.0);
}


x86 assembly (clang, -O0):
<ts_delta>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  0xedb(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
movsd  0xeba(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_delta>:
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
movhpd 0x8(%rdi),%xmm1
divpd  0xeea(%rip),%xmm1
movhpd (%rdi),%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @ts_delta(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timeval*, %struct.timeval** %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%7 = load double, double* %6
%8 = load %struct.timeval*, %struct.timeval** %4
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%10 = load double, double* %9
%11 = fdiv double %10, 1.000000e+06
%12 = fadd double %7, %11
%13 = load %struct.timeval*, %struct.timeval** %3
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%15 = load double, double* %14
%16 = load %struct.timeval*, %struct.timeval** %3
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 1
%18 = load double, double* %17
%19 = fdiv double %18, 1.000000e+06
%20 = fadd double %15, %19
%21 = fsub double %12, %20
ret double %21
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @ts_delta(%struct.timeval* nocapture %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%10 = load double, double* %9
%11 = insertelement <2 x double> poison, double %6, i64 0
%12 = insertelement <2 x double> %11, double %10, i64 1
%13 = fdiv <2 x double> %12, <double 1.000000e+06, double 1.000000e+06>
%14 = insertelement <2 x double> poison, double %4, i64 0
%15 = insertelement <2 x double> %14, double %8, i64 1
%16 = fadd <2 x double> %15, %13
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%18 = fsub <2 x double> %16, %17
%19 = extractelement <2 x double> %18, i64 0
ret double %19
}