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

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void igraph_get_cpu_time(double *data) {
  struct rusage self;
  struct timeval real;
  gettimeofday(&real, NULL);
  getrusage(RUSAGE_SELF, &self);
  data[0] = (double)real.tv_sec + 1e-6 * real.tv_usec;
  data[1] = (double)self.ru_utime.tv_sec + 1e-6 * self.ru_utime.tv_usec;
  data[2] = (double)self.ru_stime.tv_sec + 1e-6 * self.ru_stime.tv_usec;
}


x86 assembly (clang, -O0):
<igraph_get_cpu_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x38(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1040 <getrusage@plt>
cvtsi2sdq -0x30(%rbp),%xmm1
cvtsi2sdl -0x38(%rbp),%xmm0
movsd  0xea2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
cvtsi2sdq -0x10(%rbp),%xmm1
cvtsi2sdl -0x18(%rbp),%xmm0
movsd  0xe7f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
cvtsi2sdq -0x20(%rbp),%xmm1
cvtsi2sdl -0x28(%rbp),%xmm0
movsd  0xe5b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<igraph_get_cpu_time>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
call   1040 <getrusage@plt>
cvtsi2sdq 0x8(%rsp),%xmm0
cvtsi2sdl (%rsp),%xmm1
movsd  0xea7(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
xorps  %xmm0,%xmm0
cvtsi2sdq 0x28(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x20(%rsp),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rbx)
xorps  %xmm0,%xmm0
cvtsi2sdq 0x18(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x10(%rsp),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

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

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