#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;
};

/* Variables and functions */
double mb_sec(unsigned long bytes, struct timeval *delta) {
  unsigned long us = delta->tv_sec * 1000000 + delta->tv_usec;
  return (double)bytes * 1000000.0 / 1048576.0 / (double)us;
}


x86 assembly (clang, -O0):
<mb_sec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%eax
mov    0x4(%rcx),%ecx
imul   $0xf4240,%eax,%eax
add    %ecx,%eax
cltq
mov    %rax,-0x18(%rbp)
movaps 0xed6(%rip),%xmm3
movq   -0x8(%rbp),%xmm0
punpckldq %xmm3,%xmm0
movapd 0xed5(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xece(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeca(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   -0x18(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mb_sec>:
movslq (%rsi),%rax
imul   $0xf4240,%rax,%rax
movslq 0x4(%rsi),%rcx
add    %rax,%rcx
movq   %rdi,%xmm1
movdqa 0xee2(%rip),%xmm2
punpckldq %xmm2,%xmm1
movapd 0xee6(%rip),%xmm3
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xede(%rip),%xmm0
mulsd  0xede(%rip),%xmm0
movq   %rcx,%xmm1
punpckldq %xmm2,%xmm1
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define double @mb_sec(i64 %0, %struct.timeval* %1) {
%3 = alloca i64
%4 = alloca %struct.timeval*
%5 = alloca i64
store i64 %0, i64* %3
store %struct.timeval* %1, %struct.timeval** %4
%6 = load %struct.timeval*, %struct.timeval** %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000000
%10 = load %struct.timeval*, %struct.timeval** %4
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
%12 = load i32, i32* %11
%13 = add nsw i32 %9, %12
%14 = sext i32 %13 to i64
store i64 %14, i64* %5
%15 = load i64, i64* %3
%16 = uitofp i64 %15 to double
%17 = fmul double %16, 1.000000e+06
%18 = fdiv double %17, 0x4130000000000000
%19 = load i64, i64* %5
%20 = uitofp i64 %19 to double
%21 = fdiv double %18, %20
ret double %21
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define double @mb_sec(i64 %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = add nsw i32 %5, %7
%9 = sext i32 %8 to i64
%10 = uitofp i64 %0 to double
%11 = fmul double %10, 1.000000e+06
%12 = fmul double %11, 0x3EB0000000000000
%13 = uitofp i64 %9 to double
%14 = fdiv double %12, %13
ret double %14
}