#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*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void get_cputime(double *laptime, double *sprittime) {
  struct timeval x;
  double sec, microsec;
  gettimeofday(&x, NULL);
  sec = x.tv_sec;
  microsec = x.tv_usec;
  *laptime = sec + microsec / 1000000.0 - *sprittime;
  *sprittime = sec + microsec / 1000000.0;
}


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

x86 assembly (clang, -O2):
<get_cputime>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
divsd  0xec9(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
subsd  (%rbx),%xmm1
movsd  %xmm1,(%r14)
movsd  %xmm0,(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.timeval = type { double, double }
define void @get_cputime(double* nocapture writeonly %0, double* nocapture %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%7 = load double, double* %6
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%9 = load double, double* %8
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %7, %10
%12 = load double, double* %1
%13 = fsub double %11, %12
store double %13, double* %0
store double %11, double* %1
ret void
}