#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_3__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct TYPE_4__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct rusage {
  TYPE_1__ ru_stime;
  TYPE_2__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
double endTimeFari(double *iniTime) {
  double usertime, systime;
  struct rusage usage;
  double currtime;
  getrusage(RUSAGE_SELF, &usage);
  usertime =
      (double)usage.ru_utime.tv_sec * ((double)1.0) +
      (double)usage.ru_utime.tv_usec / (((double)1000000.0) / ((double)1.0));
  systime =
      (double)usage.ru_stime.tv_sec * ((double)1.0) +
      (double)usage.ru_stime.tv_usec / (((double)1000000.0) / ((double)1.0));
  currtime = usertime;
  return (currtime - *iniTime);
}


x86 assembly (clang, -O0):
<endTimeFari>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
call   1030 <getrusage@plt>
cvtsi2sdq -0x20(%rbp),%xmm0
cvtsi2sdq -0x28(%rbp),%xmm1
movsd  0xebe(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdq -0x30(%rbp),%xmm0
cvtsi2sdq -0x38(%rbp),%xmm1
movsd  0xe9d(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endTimeFari>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <getrusage@plt>
cvtsi2sdq 0x18(%rsp),%xmm1
cvtsi2sdq 0x10(%rsp),%xmm0
divsd  0xec1(%rip),%xmm0
addsd  %xmm1,%xmm0
subsd  (%rbx),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_3__, %struct.TYPE_4__ }
%struct.TYPE_3__ = type { i64, i64 }
%struct.TYPE_4__ = type { i64, i64 }
@RUSAGE_SELF = global i32 0
define double @endTimeFari(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
%5 = alloca %struct.rusage
%6 = alloca double
store double* %0, double** %2
%7 = load i32, i32* @RUSAGE_SELF
%8 = call i32 @getrusage(i32 %7, %struct.rusage* %5)
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %5, i32 0, i32 1
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %9, i32 0, i32 1
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = getelementptr inbounds %struct.rusage, %struct.rusage* %5, i32 0, i32 1
%14 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = sitofp i64 %15 to double
%17 = fdiv double %16, 1.000000e+06
%18 = call double @llvm.fmuladd.f64(double %12, double 1.000000e+00, double %17)
store double %18, double* %3
%19 = getelementptr inbounds %struct.rusage, %struct.rusage* %5, i32 0, i32 0
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %19, i32 0, i32 1
%21 = load i64, i64* %20
%22 = sitofp i64 %21 to double
%23 = getelementptr inbounds %struct.rusage, %struct.rusage* %5, i32 0, i32 0
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %23, i32 0, i32 0
%25 = load i64, i64* %24
%26 = sitofp i64 %25 to double
%27 = fdiv double %26, 1.000000e+06
%28 = call double @llvm.fmuladd.f64(double %22, double 1.000000e+00, double %27)
store double %28, double* %4
%29 = load double, double* %3
store double %29, double* %6
%30 = load double, double* %6
%31 = load double*, double** %2
%32 = load double, double* %31
%33 = fsub double %30, %32
ret double %33
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_3__, %struct.TYPE_4__ }
%struct.TYPE_3__ = type { i64, i64 }
%struct.TYPE_4__ = type { i64, i64 }
@RUSAGE_SELF = global i32 0
define double @endTimeFari(double* nocapture %0) {
%2 = alloca %struct.rusage
%3 = bitcast %struct.rusage* %2 to i8*
%4 = load i32, i32* @RUSAGE_SELF
%5 = call i32 @getrusage(i32 %4, %struct.rusage* %2)
%6 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1, i32 0
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = fdiv double %11, 1.000000e+06
%13 = fadd double %12, %8
%14 = load double, double* %0
%15 = fsub double %13, %14
ret double %15
}