#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*/ RUSAGE_SELF;
int /*<<< orphan*/ error(char *, int /*<<< orphan*/);
int /*<<< orphan*/ getparam(char *);
int getrusage(int /*<<< orphan*/, struct rusage *);
double cputime(void) {
  struct rusage buf;
  if (getrusage(RUSAGE_SELF, &buf) == -1)
    error("%s.cputime: getrusage() call failed\n", (getparam("argv0")));
  return ((buf.ru_utime.tv_sec + buf.ru_utime.tv_usec / 1000000.0 +
           buf.ru_stime.tv_sec + buf.ru_stime.tv_usec / 1000000.0) /
          60.0);
}


x86 assembly (clang, -O0):
<cputime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1050 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    116d <cputime+0x3d>
lea    0xedb(%rip),%rdi
call   1030 <getparam@plt>
mov    %eax,%esi
lea    0xea8(%rip),%rdi
call   1040 <error@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xe89(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe6f(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xe57(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cputime>:
sub    $0x28,%rsp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1050 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    1166 <cputime+0x36>
lea    0xee2(%rip),%rdi
call   1030 <getparam@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1040 <error@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0xe86(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  0x18(%rsp),%xmm1
addsd  0x8(%rsp),%xmm1
divsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  0xe6e(%rip),%xmm0
add    $0x28,%rsp
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 }
@RUSAGE_SELF = global i32 0
@.str = [37 x i8] c"%s.cputime: getrusage() call failed\0A\00"
@.str.1 = [6 x i8] c"argv0\00"
define double @cputime() {
%1 = alloca %struct.rusage
%2 = load i32, i32* @RUSAGE_SELF
%3 = call i32 @getrusage(i32 %2, %struct.rusage* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i32 @getparam(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5, %0
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %9, i32 0, i32 0
%11 = load double, double* %10
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %12, i32 0, i32 1
%14 = load double, double* %13
%15 = fdiv double %14, 1.000000e+06
%16 = fadd double %11, %15
%17 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%18 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %17, i32 0, i32 0
%19 = load double, double* %18
%20 = fadd double %16, %19
%21 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%22 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %21, i32 0, i32 1
%23 = load double, double* %22
%24 = fdiv double %23, 1.000000e+06
%25 = fadd double %20, %24
%26 = fdiv double %25, 6.000000e+01
ret double %26
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { double, double }
%struct.TYPE_3__ = type { double, double }
@RUSAGE_SELF = global i32 0
@.str = [37 x i8] c"%s.cputime: getrusage() call failed\0A\00"
@.str.1 = [6 x i8] c"argv0\00"
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 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @getparam(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %0
%10 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 0
%11 = load double, double* %10
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 1
%13 = load double, double* %12
%14 = fdiv double %13, 1.000000e+06
%15 = fadd double %11, %14
%16 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 0
%17 = load double, double* %16
%18 = fadd double %17, %15
%19 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 1
%20 = load double, double* %19
%21 = fdiv double %20, 1.000000e+06
%22 = fadd double %18, %21
%23 = fdiv double %22, 6.000000e+01
ret double %23
}