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

/* Variables and functions */
int /*<<< orphan*/ benchAllocator_core(unsigned long);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double benchAllocator(unsigned long bufferSize) {
  struct timeval t0, t1;
  gettimeofday(&t0, NULL);
  benchAllocator_core(bufferSize);
  gettimeofday(&t1, NULL);
  return (t1.tv_sec - t0.tv_sec) +
         ((double)t1.tv_usec - t0.tv_usec) / 1000000.0;
}


x86 assembly (clang, -O0):
<benchAllocator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rdi
call   1040 <benchAllocator_core@plt>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xe95(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchAllocator>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    %rbx,%rdi
call   1040 <benchAllocator_core@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movapd (%rsp),%xmm1
subpd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  0xe9f(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @benchAllocator(i64 %0) {
%2 = alloca <2 x double>
%3 = bitcast <2 x double>* %2 to %struct.timeval*
%4 = alloca <2 x double>
%5 = bitcast <2 x double>* %4 to %struct.timeval*
%6 = bitcast <2 x double>* %2 to i8*
%7 = bitcast <2 x double>* %4 to i8*
%8 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%9 = tail call i32 @benchAllocator_core(i64 %0)
%10 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%11 = load <2 x double>, <2 x double>* %4
%12 = load <2 x double>, <2 x double>* %2
%13 = fsub <2 x double> %11, %12
%14 = extractelement <2 x double> %13, i64 1
%15 = fdiv double %14, 1.000000e+06
%16 = extractelement <2 x double> %13, i64 0
%17 = fadd double %16, %15
ret double %17
}