#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 runtime(void) {
  struct rusage used;
  getrusage(RUSAGE_SELF, &used);
  return (used.ru_utime.tv_sec + used.ru_stime.tv_sec +
          (used.ru_utime.tv_usec + used.ru_stime.tv_usec) / 1e6);
}


x86 assembly (clang, -O0):
<runtime>:
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),%xmm0
addsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%eax
add    -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xeba(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runtime>:
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
divsd  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 @runtime() {
%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 = fdiv double %18, 1.000000e+06
%20 = fadd double %10, %19
ret double %20
}

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 @runtime() {
%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 = fdiv double %15, 1.000000e+06
%17 = fadd double %9, %16
ret double %17
}