#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 {
  float tv_sec;
  float tv_usec;
};

/* Variables and functions */
float delta(struct timeval *b, struct timeval *a) {
  float dt = (b->tv_sec - a->tv_sec) + (b->tv_usec / 1000000.0f) -
             (a->tv_usec / 1000000.0f);
  return dt;
}


x86 assembly (clang, -O0):
<delta>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
movss  0xed3(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
movss  0xeba(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<delta>:
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
movss  0x4(%rsi),%xmm1
movss  0x4(%rdi),%xmm2
unpcklps %xmm1,%xmm2
divps  0xee4(%rip),%xmm2
addss  %xmm2,%xmm0
shufps $0x55,%xmm2,%xmm2
subss  %xmm2,%xmm0
ret

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

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