#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  double tv_sec;
  double tv_usec;
};
struct TYPE_3__ {
  double tv_sec;
  double tv_usec;
};
struct rusage {
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
float cputime(float *this_time) {
  float last_time;
  struct rusage scratch;
  last_time = *this_time;
  getrusage(0, &scratch);
  *this_time = scratch.ru_utime.tv_sec + scratch.ru_stime.tv_sec +
               (scratch.ru_utime.tv_usec + scratch.ru_stime.tv_usec) * 1.0e-06;
  return *this_time - last_time;
}


x86 assembly (clang, -O0):
<cputime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
xor    %edi,%edi
lea    -0x30(%rbp),%rsi
call   1030 <getrusage@plt>
movsd  -0x20(%rbp),%xmm1
addsd  -0x30(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xeb0(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
subss  -0xc(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cputime>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movss  (%rdi),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x10(%rsp),%rsi
xor    %edi,%edi
call   1030 <getrusage@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
addsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm1
mulsd  0xeb2(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,(%rbx)
subss  0xc(%rsp),%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { double, double }
%struct.TYPE_3__ = type { double, double }
define float @cputime(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca %struct.rusage
store float* %0, float** %2
%5 = load float*, float** %2
%6 = load float, float* %5
store float %6, float* %3
%7 = call i32 @getrusage(i32 0, %struct.rusage* %4)
%8 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 1
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%10 = load double, double* %9
%11 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %11, i32 0, i32 0
%13 = load double, double* %12
%14 = fadd double %10, %13
%15 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 1
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 1
%17 = load double, double* %16
%18 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 0
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 1
%20 = load double, double* %19
%21 = fadd double %17, %20
%22 = call double @llvm.fmuladd.f64(double %21, double 0x3EB0C6F7A0B5ED8D, double %14)
%23 = fptrunc double %22 to float
%24 = load float*, float** %2
store float %23, float* %24
%25 = load float*, float** %2
%26 = load float, float* %25
%27 = load float, float* %3
%28 = fsub float %26, %27
ret float %28
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { double, double }
%struct.TYPE_3__ = type { double, double }
define float @cputime(float* nocapture %0) {
%2 = alloca %struct.rusage
%3 = bitcast %struct.rusage* %2 to i8*
%4 = load float, float* %0
%5 = call i32 @getrusage(i32 0, %struct.rusage* %2)
%6 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1, i32 0
%7 = load double, double* %6
%8 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 0, i32 0
%9 = load double, double* %8
%10 = fadd double %7, %9
%11 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1, i32 1
%12 = load double, double* %11
%13 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 0, i32 1
%14 = load double, double* %13
%15 = fadd double %12, %14
%16 = call double @llvm.fmuladd.f64(double %15, double 0x3EB0C6F7A0B5ED8D, double %10)
%17 = fptrunc double %16 to float
store float %17, float* %0
%18 = fsub float %17, %4
ret float %18
}