#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 {
  long ru_maxrss;
  long ru_minflt;
  long ru_majflt;
  long ru_nswap;
  long ru_inblock;
  long ru_oublock;
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int nresources_(double *ut, double *st, long *mem, long *par, long *paf,
                long *swa, long *dr, long *dw) {
  struct rusage ru;
  getrusage(RUSAGE_SELF, &ru);
  *ut = ru.ru_utime.tv_sec + 0.000001 * ru.ru_utime.tv_usec;
  *st = ru.ru_stime.tv_sec + 0.000001 * ru.ru_stime.tv_usec;
  *mem = ru.ru_maxrss;
  *par = ru.ru_minflt;
  *paf = ru.ru_majflt;
  *swa = ru.ru_nswap;
  *dr = ru.ru_inblock;
  *dw = ru.ru_oublock;
  return 1;
}


x86 assembly (clang, -O0):
<nresources_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rsi
call   1030 <getrusage@plt>
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xea1(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xe7f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x80(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x78(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x70(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x68(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x60(%rbp),%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x58(%rbp),%rcx
mov    0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x1,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nresources_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <getrusage@plt>
movsd  0xeb5(%rip),%xmm0
movsd  0x50(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x48(%rsp),%xmm1
movsd  %xmm1,0x0(%rbp)
mulsd  0x40(%rsp),%xmm0
addsd  0x38(%rsp),%xmm0
movsd  %xmm0,(%rbx)
mov    0x8(%rsp),%rax
mov    %rax,0x0(%r13)
mov    0x10(%rsp),%rax
mov    %rax,(%r12)
mov    0x18(%rsp),%rax
mov    %rax,(%r15)
mov    0x20(%rsp),%rax
mov    %rax,(%r14)
mov    0x28(%rsp),%rax
mov    0x90(%rsp),%rcx
mov    %rax,(%rcx)
mov    0x30(%rsp),%rax
mov    0x98(%rsp),%rcx
mov    %rax,(%rcx)
mov    $0x1,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.rusage = type { i64, i64, i64, i64, i64, i64, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { double, double }
%struct.TYPE_3__ = type { double, double }
@RUSAGE_SELF = global i32 0
define i32 @nresources_(double* %0, double* %1, i64* %2, i64* %3, i64* %4, i64* %5, i64* %6, i64* %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca i64*
%12 = alloca i64*
%13 = alloca i64*
%14 = alloca i64*
%15 = alloca i64*
%16 = alloca i64*
%17 = alloca %struct.rusage
store double* %0, double** %9
store double* %1, double** %10
store i64* %2, i64** %11
store i64* %3, i64** %12
store i64* %4, i64** %13
store i64* %5, i64** %14
store i64* %6, i64** %15
store i64* %7, i64** %16
%18 = load i32, i32* @RUSAGE_SELF
%19 = call i32 @getrusage(i32 %18, %struct.rusage* %17)
%20 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 7
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %20, i32 0, i32 0
%22 = load double, double* %21
%23 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 7
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %23, i32 0, i32 1
%25 = load double, double* %24
%26 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %25, double %22)
%27 = load double*, double** %9
store double %26, double* %27
%28 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 6
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %28, i32 0, i32 0
%30 = load double, double* %29
%31 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 6
%32 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %31, i32 0, i32 1
%33 = load double, double* %32
%34 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %33, double %30)
%35 = load double*, double** %10
store double %34, double* %35
%36 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 0
%37 = load i64, i64* %36
%38 = load i64*, i64** %11
store i64 %37, i64* %38
%39 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 1
%40 = load i64, i64* %39
%41 = load i64*, i64** %12
store i64 %40, i64* %41
%42 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 2
%43 = load i64, i64* %42
%44 = load i64*, i64** %13
store i64 %43, i64* %44
%45 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 3
%46 = load i64, i64* %45
%47 = load i64*, i64** %14
store i64 %46, i64* %47
%48 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 4
%49 = load i64, i64* %48
%50 = load i64*, i64** %15
store i64 %49, i64* %50
%51 = getelementptr inbounds %struct.rusage, %struct.rusage* %17, i32 0, i32 5
%52 = load i64, i64* %51
%53 = load i64*, i64** %16
store i64 %52, i64* %53
ret i32 1
}

LLVM IR (-O2):
%struct.rusage = type { i64, i64, i64, i64, i64, i64, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { double, double }
%struct.TYPE_3__ = type { double, double }
@RUSAGE_SELF = global i32 0
define i32 @nresources_(double* nocapture writeonly %0, double* nocapture writeonly %1, i64* nocapture writeonly %2, i64* nocapture writeonly %3, i64* nocapture writeonly %4, i64* nocapture writeonly %5, i64* nocapture writeonly %6, i64* nocapture writeonly %7) {
%9 = alloca %struct.rusage
%10 = bitcast %struct.rusage* %9 to i8*
%11 = load i32, i32* @RUSAGE_SELF
%12 = call i32 @getrusage(i32 %11, %struct.rusage* %9)
%13 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 7, i32 0
%14 = load double, double* %13
%15 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 7, i32 1
%16 = load double, double* %15
%17 = call double @llvm.fmuladd.f64(double %16, double 0x3EB0C6F7A0B5ED8D, double %14)
store double %17, double* %0
%18 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 6, i32 0
%19 = load double, double* %18
%20 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 6, i32 1
%21 = load double, double* %20
%22 = call double @llvm.fmuladd.f64(double %21, double 0x3EB0C6F7A0B5ED8D, double %19)
store double %22, double* %1
%23 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 0
%24 = load i64, i64* %23
store i64 %24, i64* %2
%25 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 1
%26 = load i64, i64* %25
store i64 %26, i64* %3
%27 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 2
%28 = load i64, i64* %27
store i64 %28, i64* %4
%29 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 3
%30 = load i64, i64* %29
store i64 %30, i64* %5
%31 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 4
%32 = load i64, i64* %31
store i64 %32, i64* %6
%33 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i64 0, i32 5
%34 = load i64, i64* %33
store i64 %34, i64* %7
ret i32 1
}