#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 {
  int tv_sec;
  int tv_usec;
};
typedef int clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
float compute_diff(struct timeval start, struct timeval end, float compare) {
  clock_t delta;
  int seconds, hundreths;
  float diff;
  delta = (end.tv_sec - start.tv_sec) * CLOCKS_PER_SEC +
          (end.tv_usec - start.tv_usec) * CLOCKS_PER_SEC / 1000000;
  seconds = (int)(delta / CLOCKS_PER_SEC);
  hundreths = (int)(delta * 100 / CLOCKS_PER_SEC) - (seconds * 100);
  diff = seconds + (hundreths / 100.0);
  diff -= compare;
  if (diff < 0)
    diff *= -1;
  return diff;
}


x86 assembly (clang, -O0):
<compute_diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    0x2eca(%rip),%rcx
imul   (%rcx),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    0x2eb7(%rip),%rcx
imul   (%rcx),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2e98(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x1c(%rbp)
imul   $0x64,-0x18(%rbp),%eax
mov    0x2e87(%rip),%rcx
cltd
idivl  (%rcx)
imul   $0x64,-0x1c(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
movsd  0xe81(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm1
movss  -0x24(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    11c2 <compute_diff+0xc2>
movss  0xe50(%rip),%xmm0
mulss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_diff>:
mov    %rsi,%rax
sub    %edi,%esi
shr    $0x20,%rdi
shr    $0x20,%rax
mov    0x2ed4(%rip),%rcx
mov    (%rcx),%r8d
imul   %r8d,%esi
sub    %edi,%eax
imul   %r8d,%eax
cltq
imul   $0x431bde83,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x32,%rcx
add    %eax,%ecx
add    %esi,%ecx
mov    %ecx,%eax
cltd
idiv   %r8d
mov    %eax,%esi
imul   $0x64,%ecx,%eax
cltd
idiv   %r8d
imul   $0xffffff9c,%esi,%ecx
add    %eax,%ecx
cvtsi2sd %esi,%xmm1
cvtsi2sd %ecx,%xmm2
divsd  0xea3(%rip),%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm1
subss  %xmm0,%xmm1
movaps 0xe9d(%rip),%xmm2
xorps  %xmm1,%xmm2
xorps  %xmm3,%xmm3
movaps %xmm1,%xmm0
cmpltss %xmm3,%xmm0
andps  %xmm0,%xmm2
andnps %xmm1,%xmm0
orps   %xmm2,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@CLOCKS_PER_SEC = global i32 0
define float @compute_diff(i64 %0, i64 %1, float %2) {
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
%11 = bitcast %struct.timeval* %4 to i64*
store i64 %0, i64* %11
%12 = bitcast %struct.timeval* %5 to i64*
store i64 %1, i64* %12
store float %2, float* %6
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%16 = load i32, i32* %15
%17 = sub nsw i32 %14, %16
%18 = load i32, i32* @CLOCKS_PER_SEC
%19 = mul nsw i32 %17, %18
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 1
%23 = load i32, i32* %22
%24 = sub nsw i32 %21, %23
%25 = load i32, i32* @CLOCKS_PER_SEC
%26 = mul nsw i32 %24, %25
%27 = sdiv i32 %26, 1000000
%28 = add nsw i32 %19, %27
store i32 %28, i32* %7
%29 = load i32, i32* %7
%30 = load i32, i32* @CLOCKS_PER_SEC
%31 = sdiv i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %7
%33 = mul nsw i32 %32, 100
%34 = load i32, i32* @CLOCKS_PER_SEC
%35 = sdiv i32 %33, %34
%36 = load i32, i32* %8
%37 = mul nsw i32 %36, 100
%38 = sub nsw i32 %35, %37
store i32 %38, i32* %9
%39 = load i32, i32* %8
%40 = sitofp i32 %39 to double
%41 = load i32, i32* %9
%42 = sitofp i32 %41 to double
%43 = fdiv double %42, 1.000000e+02
%44 = fadd double %40, %43
%45 = fptrunc double %44 to float
store float %45, float* %10
%46 = load float, float* %6
%47 = load float, float* %10
%48 = fsub float %47, %46
store float %48, float* %10
%49 = load float, float* %10
%50 = fcmp olt float %49, 0.000000e+00
br i1 %50, label %51, label %54
51: ; preds = %3
%52 = load float, float* %10
%53 = fmul float %52, -1.000000e+00
store float %53, float* %10
br label %54
54: ; preds = %51, %3
%55 = load float, float* %10
ret float %55
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
define float @compute_diff(i64 %0, i64 %1, float %2) {
%4 = trunc i64 %0 to i32
%5 = lshr i64 %0, 32
%6 = trunc i64 %5 to i32
%7 = trunc i64 %1 to i32
%8 = lshr i64 %1, 32
%9 = trunc i64 %8 to i32
%10 = sub nsw i32 %7, %4
%11 = load i32, i32* @CLOCKS_PER_SEC
%12 = mul nsw i32 %11, %10
%13 = sub nsw i32 %9, %6
%14 = mul nsw i32 %11, %13
%15 = sdiv i32 %14, 1000000
%16 = add nsw i32 %15, %12
%17 = sdiv i32 %16, %11
%18 = mul nsw i32 %16, 100
%19 = sdiv i32 %18, %11
%20 = mul i32 %17, -100
%21 = add i32 %20, %19
%22 = sitofp i32 %17 to double
%23 = sitofp i32 %21 to double
%24 = fdiv double %23, 1.000000e+02
%25 = fadd double %24, %22
%26 = fptrunc double %25 to float
%27 = fsub float %26, %2
%28 = fcmp olt float %27, 0.000000e+00
%29 = fneg float %27
%30 = select i1 %28, float %29, float %27
ret float %30
}