#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 get_cpu_time(void) {
  static struct rusage ru_buffer;
  getrusage(RUSAGE_SELF, &ru_buffer);
  return ru_buffer.ru_utime.tv_sec + ru_buffer.ru_stime.tv_sec +
         (ru_buffer.ru_utime.tv_usec + ru_buffer.ru_stime.tv_usec) * 1e-6;
}


x86 assembly (clang, -O0):
<get_cpu_time>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0x2f0c(%rip),%rsi
call   1030 <getrusage@plt>
movsd  0x2f0f(%rip),%xmm1
addsd  0x2ef7(%rip),%xmm1
mov    0x2f09(%rip),%eax
add    0x2ef3(%rip),%eax
cvtsi2sd %eax,%xmm0
movsd  0xeaf(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cpu_time>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0x2f0f(%rip),%rsi
call   1030 <getrusage@plt>
movsd  0x2f12(%rip),%xmm1
addsd  0x2efa(%rip),%xmm1
mov    0x2efc(%rip),%eax
add    0x2f06(%rip),%eax
cvtsi2sd %eax,%xmm0
mulsd  0xeb2(%rip),%xmm0
addsd  %xmm1,%xmm0
pop    %rax
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 }
@get_cpu_time.ru_buffer = internal global %struct.rusage zeroinitializer
@RUSAGE_SELF = global i32 0
define double @get_cpu_time() {
%1 = load i32, i32* @RUSAGE_SELF
%2 = call i32 @getrusage(i32 %1, %struct.rusage* @get_cpu_time.ru_buffer)
%3 = load double, double* getelementptr inbounds (%struct.rusage, %struct.rusage* @get_cpu_time.ru_buffer, i32 0, i32 1, i32 0)
%4 = load double, double* getelementptr inbounds (%struct.rusage, %struct.rusage* @get_cpu_time.ru_buffer, i32 0, i32 0, i32 0)
%5 = fadd double %3, %4
%6 = load i32, i32* getelementptr inbounds (%struct.rusage, %struct.rusage* @get_cpu_time.ru_buffer, i32 0, i32 1, i32 1)
%7 = load i32, i32* getelementptr inbounds (%struct.rusage, %struct.rusage* @get_cpu_time.ru_buffer, i32 0, i32 0, i32 1)
%8 = add nsw i32 %6, %7
%9 = sitofp i32 %8 to double
%10 = call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %10
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { double, i32 }
%struct.TYPE_3__ = type { double, i32 }
@get_cpu_time.ru_buffer = internal global %struct.rusage zeroinitializer
@RUSAGE_SELF = global i32 0
define double @get_cpu_time() {
%1 = load i32, i32* @RUSAGE_SELF
%2 = tail call i32 @getrusage(i32 %1, %struct.rusage* @get_cpu_time.ru_buffer)
%3 = load double, double* getelementptr inbounds (%struct.rusage, %struct.rusage* @get_cpu_time.ru_buffer, i64 0, i32 1, i32 0)
%4 = load double, double* getelementptr inbounds (%struct.rusage, %struct.rusage* @get_cpu_time.ru_buffer, i64 0, i32 0, i32 0)
%5 = fadd double %3, %4
%6 = load i32, i32* getelementptr inbounds (%struct.rusage, %struct.rusage* @get_cpu_time.ru_buffer, i64 0, i32 1, i32 1)
%7 = load i32, i32* getelementptr inbounds (%struct.rusage, %struct.rusage* @get_cpu_time.ru_buffer, i64 0, i32 0, i32 1)
%8 = add nsw i32 %7, %6
%9 = sitofp i32 %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %10
}