#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 timespec {
  double tv_sec;
  double tv_nsec;
};

/* Variables and functions */
double clock_elapsed(struct timespec *stop, struct timespec *start) {
  return (stop->tv_sec + stop->tv_nsec / 1000000000.0) -
         (start->tv_sec + start->tv_nsec / 1000000000.0);
}


x86 assembly (clang, -O0):
<clock_elapsed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  0xedb(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%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):
<clock_elapsed>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movhpd 0x8(%rsi),%xmm1
divpd  0xeea(%rip),%xmm1
movhpd (%rsi),%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
%struct.timespec = type { double, double }
define double @clock_elapsed(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, 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+09, double 1.000000e+09>
%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
}