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

/* Variables and functions */
int /*<<< orphan*/ assert(struct timespec const *);
double get_time_diff_sec(const struct timespec *start,
                         const struct timespec *end) {
  assert(start);
  assert(end);
  return (((end->tv_nsec - start->tv_nsec) * 0.000000001)) + end->tv_sec -
         start->tv_sec;
}


x86 assembly (clang, -O0):
<get_time_diff_sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  0xead(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time_diff_sec>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1030 <assert@plt>
movsd  (%rbx),%xmm0
subsd  (%r14),%xmm0
mulsd  0xec8(%rip),%xmm0
addsd  0x8(%rbx),%xmm0
subsd  0x8(%r14),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { double, double }
define double @get_time_diff_sec(%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 = call i32 @assert(%struct.timespec* %5)
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = call i32 @assert(%struct.timespec* %7)
%9 = load %struct.timespec*, %struct.timespec** %4
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%11 = load double, double* %10
%12 = load %struct.timespec*, %struct.timespec** %3
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 0
%14 = load double, double* %13
%15 = fsub double %11, %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 = call double @llvm.fmuladd.f64(double %15, double 1.000000e-09, double %18)
%20 = load %struct.timespec*, %struct.timespec** %3
%21 = getelementptr inbounds %struct.timespec, %struct.timespec* %20, i32 0, i32 1
%22 = load double, double* %21
%23 = fsub double %19, %22
ret double %23
}

LLVM IR (-O2):
%struct.timespec = type { double, double }
define double @get_time_diff_sec(%struct.timespec* %0, %struct.timespec* %1) {
%3 = tail call i32 @assert(%struct.timespec* %0)
%4 = tail call i32 @assert(%struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%8 = load double, double* %7
%9 = fsub double %6, %8
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%11 = load double, double* %10
%12 = tail call double @llvm.fmuladd.f64(double %9, double 1.000000e-09, double %11)
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%14 = load double, double* %13
%15 = fsub double %12, %14
ret double %15
}