#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 {
  int tv_sec;
  scalar_t__ tv_nsec;
};
typedef double int64_t;

/* Variables and functions */
float throughput(struct timespec *start, struct timespec *end, size_t size) {
  int64_t diff;
  diff = (end->tv_sec - start->tv_sec) * 1000000000;
  diff += end->tv_nsec - start->tv_nsec;
  return (float)size / ((diff / 1000000000.0) * 1024 * 1024);
}


x86 assembly (clang, -O0):
<throughput>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
sub    %ecx,%eax
imul   $0x3b9aca00,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
sub    %rcx,%rax
cvtsi2sd %rax,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x28(%rbp)
test   %rax,%rax
movss  %xmm0,-0x24(%rbp)
js     1190 <throughput+0x90>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe62(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe4e(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe42(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<throughput>:
mov    (%rsi),%eax
sub    (%rdi),%eax
imul   $0x3b9aca00,%eax,%eax
cvtsi2sd %eax,%xmm1
mov    0x8(%rsi),%rax
sub    0x8(%rdi),%rax
cvtsi2sd %rax,%xmm0
addsd  %xmm1,%xmm0
test   %rdx,%rdx
js     112e <throughput+0x2e>
xorps  %xmm1,%xmm1
cvtsi2ss %rdx,%xmm1
jmp    1146 <throughput+0x46>
mov    %rdx,%rax
shr    %rax
and    $0x1,%edx
or     %rax,%rdx
xorps  %xmm1,%xmm1
cvtsi2ss %rdx,%xmm1
addss  %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
divsd  0xeae(%rip),%xmm0
movsd  0xeae(%rip),%xmm2
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define float @throughput(%struct.timespec* %0, %struct.timespec* %1, i64 %2) {
%4 = alloca %struct.timespec*
%5 = alloca %struct.timespec*
%6 = alloca i64
%7 = alloca double
store %struct.timespec* %0, %struct.timespec** %4
store %struct.timespec* %1, %struct.timespec** %5
store i64 %2, i64* %6
%8 = load %struct.timespec*, %struct.timespec** %5
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = load %struct.timespec*, %struct.timespec** %4
%12 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = sub nsw i32 %10, %13
%15 = mul nsw i32 %14, 1000000000
%16 = sitofp i32 %15 to double
store double %16, double* %7
%17 = load %struct.timespec*, %struct.timespec** %5
%18 = getelementptr inbounds %struct.timespec, %struct.timespec* %17, i32 0, i32 1
%19 = load i64, i64* %18
%20 = load %struct.timespec*, %struct.timespec** %4
%21 = getelementptr inbounds %struct.timespec, %struct.timespec* %20, i32 0, i32 1
%22 = load i64, i64* %21
%23 = sub nsw i64 %19, %22
%24 = sitofp i64 %23 to double
%25 = load double, double* %7
%26 = fadd double %25, %24
store double %26, double* %7
%27 = load i64, i64* %6
%28 = uitofp i64 %27 to float
%29 = fpext float %28 to double
%30 = load double, double* %7
%31 = fdiv double %30, 1.000000e+09
%32 = fmul double %31, 1.024000e+03
%33 = fmul double %32, 1.024000e+03
%34 = fdiv double %29, %33
%35 = fptrunc double %34 to float
ret float %35
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define float @throughput(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1, i64 %2) {
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = sub nsw i32 %5, %7
%9 = mul nsw i32 %8, 1000000000
%10 = sitofp i32 %9 to double
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%14 = load i64, i64* %13
%15 = sub nsw i64 %12, %14
%16 = sitofp i64 %15 to double
%17 = fadd double %10, %16
%18 = uitofp i64 %2 to float
%19 = fpext float %18 to double
%20 = fdiv double %17, 1.000000e+09
%21 = fmul double %20, 1.024000e+03
%22 = fmul double %21, 1.024000e+03
%23 = fdiv double %19, %22
%24 = fptrunc double %23 to float
ret float %24
}