#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;
  int tv_usec;
};
struct TYPE_3__ {
  double tv_sec;
  int tv_usec;
};
struct rusage {
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
double cputime() {
  struct rusage r;
  getrusage(RUSAGE_SELF, &r);
  return r.ru_utime.tv_sec + r.ru_stime.tv_sec +
         1e-6 * (r.ru_utime.tv_usec + r.ru_stime.tv_usec);
}


x86 assembly (clang, -O0):
<cputime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1030 <getrusage@plt>
movsd  -0x10(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%eax
add    -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xeba(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cputime>:
sub    $0x28,%rsp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <getrusage@plt>
movsd  0x18(%rsp),%xmm1
addsd  0x8(%rsp),%xmm1
mov    0x10(%rsp),%eax
add    0x20(%rsp),%eax
cvtsi2sd %eax,%xmm0
mulsd  0xeb9(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { double, i32 }
%struct.TYPE_3__ = type { double, i32 }
@RUSAGE_SELF = global i32 0
define double @cputime() {
%1 = alloca %struct.rusage
%2 = load i32, i32* @RUSAGE_SELF
%3 = call i32 @getrusage(i32 %2, %struct.rusage* %1)
%4 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 0
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = load double, double* %8
%10 = fadd double %6, %9
%11 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%15 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %14, i32 0, i32 1
%16 = load i32, i32* %15
%17 = add nsw i32 %13, %16
%18 = sitofp i32 %17 to double
%19 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %18, double %10)
ret double %19
}

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