#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 timespec {
  long double tv_sec;
  long double tv_nsec;
};
struct TYPE_4__ {
  long double tv_sec;
  long double tv_usec;
};
struct TYPE_3__ {
  long double tv_sec;
  long double tv_usec;
};
struct rusage {
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ EX_OSERR;
int /*<<< orphan*/ RUSAGE_SELF;
int clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           long double, long double, long double);
int getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ stderr;
void deltaof(void (*thecall)(), const char *name) {
  long double delta_t, delta_user, delta_sys;
  struct rusage use_before, use_after;
  struct timespec before, after;
  if (getrusage(RUSAGE_SELF, &use_before) == -1)
    err(EX_OSERR, "getrusage() failed");
  if (clock_gettime(CLOCK_REALTIME, &before) == -1)
    err(EX_OSERR, "clock_gettime() failed");
  thecall();
  if (clock_gettime(CLOCK_REALTIME, &after) == -1)
    err(EX_OSERR, "clock_gettime() failed");
  if (getrusage(RUSAGE_SELF, &use_after) == -1)
    err(EX_OSERR, "getrusage() failed");
  delta_t = (after.tv_sec - before.tv_sec) +
            (after.tv_nsec - before.tv_nsec) / (long double)1000000000;
  delta_user = (use_after.ru_utime.tv_sec - use_before.ru_utime.tv_sec) +
               (use_after.ru_utime.tv_usec - use_before.ru_utime.tv_usec) /
                   (long double)1000000;
  delta_sys = (use_after.ru_stime.tv_sec - use_before.ru_stime.tv_sec) +
              (use_after.ru_stime.tv_usec - use_before.ru_stime.tv_usec) /
                  (long double)1000000;
  fprintf(stderr, "%s\t%.6Lf real %.6Lf user %.6Lf system\n", name, delta_t,
          delta_user, delta_sys);
}


x86 assembly (clang, -O0):
<deltaof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rsi
call   1060 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    1183 <deltaof+0x43>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1050 <err@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    -0xe0(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    11b6 <deltaof+0x76>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe6a(%rip),%rsi
call   1050 <err@plt>
mov    $0x0,%al
call   *-0x8(%rbp)
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    -0x100(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    11ee <deltaof+0xae>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
lea    0xe32(%rip),%rsi
call   1050 <err@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
lea    -0xc0(%rbp),%rsi
call   1060 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    1221 <deltaof+0xe1>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
lea    0xdec(%rip),%rsi
call   1050 <err@plt>
fldt   -0x100(%rbp)
fldt   -0xe0(%rbp)
fsubrp %st,%st(1)
fldt   -0xf0(%rbp)
fldt   -0xd0(%rbp)
fsubrp %st,%st(1)
flds   0xdbd(%rip)
fdivrp %st,%st(1)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x60(%rbp)
fsubrp %st,%st(1)
fldt   -0x90(%rbp)
fldt   -0x50(%rbp)
fsubrp %st,%st(1)
flds   0xd9e(%rip)
fdivr  %st,%st(1)
fxch   %st(2)
faddp  %st,%st(1)
fstpt  -0x30(%rbp)
fldt   -0xc0(%rbp)
fldt   -0x80(%rbp)
fsubrp %st,%st(1)
fldt   -0xb0(%rbp)
fldt   -0x70(%rbp)
fsubrp %st,%st(1)
fdivp  %st,%st(2)
faddp  %st,%st(1)
fstpt  -0x40(%rbp)
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xd7e(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deltaof>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
mov    0x2e7d(%rip),%r15
mov    (%r15),%edi
lea    0xb0(%rsp),%rsi
call   1060 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    1185 <deltaof+0x45>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1050 <err@plt>
mov    0x2e44(%rip),%rbx
mov    (%rbx),%edi
lea    0x50(%rsp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    11b2 <deltaof+0x72>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
call   1050 <err@plt>
xor    %eax,%eax
call   *%r12
mov    (%rbx),%edi
lea    0x30(%rsp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    11dd <deltaof+0x9d>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
call   1050 <err@plt>
mov    (%r15),%edi
lea    0x70(%rsp),%rsi
call   1060 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    1204 <deltaof+0xc4>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
lea    0xe09(%rip),%rsi
call   1050 <err@plt>
fldt   0x30(%rsp)
fldt   0x50(%rsp)
fsubrp %st,%st(1)
fldt   0x40(%rsp)
fldt   0x60(%rsp)
fsubrp %st,%st(1)
fdivs  0xde2(%rip)
faddp  %st,%st(1)
fldt   0x90(%rsp)
fldt   0xd0(%rsp)
fsubrp %st,%st(1)
fldt   0xa0(%rsp)
fldt   0xe0(%rsp)
fsubrp %st,%st(1)
flds   0xdbe(%rip)
fdivr  %st,%st(1)
fxch   %st(2)
faddp  %st,%st(1)
fldt   0x70(%rsp)
fldt   0xb0(%rsp)
fsubrp %st,%st(1)
fldt   0x80(%rsp)
fldt   0xc0(%rsp)
fsubrp %st,%st(1)
fdivp  %st,%st(3)
faddp  %st,%st(2)
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
fxch   %st(1)
fstpt  0x20(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
lea    0xda8(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { x86_fp80, x86_fp80 }
%struct.TYPE_3__ = type { x86_fp80, x86_fp80 }
%struct.timespec = type { x86_fp80, x86_fp80 }
@RUSAGE_SELF = global i32 0
@EX_OSERR = global i32 0
@.str = [19 x i8] c"getrusage() failed\00"
@CLOCK_REALTIME = global i32 0
@.str.1 = [23 x i8] c"clock_gettime() failed\00"
@stderr = global i32 0
@.str.2 = [39 x i8] c"%s\09%.6Lf real %.6Lf user %.6Lf system\0A\00"
define void @deltaof(void (...)* %0, i8* %1) {
%3 = alloca void (...)*
%4 = alloca i8*
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca %struct.rusage
%9 = alloca %struct.rusage
%10 = alloca %struct.timespec
%11 = alloca %struct.timespec
store void (...)* %0, void (...)** %3
store i8* %1, i8** %4
%12 = load i32, i32* @RUSAGE_SELF
%13 = call i32 @getrusage(i32 %12, %struct.rusage* %8)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* @EX_OSERR
%17 = call i32 @err(i32 %16, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %15, %2
%19 = load i32, i32* @CLOCK_REALTIME
%20 = call i32 @clock_gettime(i32 %19, %struct.timespec* %10)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* @EX_OSERR
%24 = call i32 @err(i32 %23, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %22, %18
%26 = load void (...)*, void (...)** %3
%27 = load i32, i32* @CLOCK_REALTIME
%28 = call i32 @clock_gettime(i32 %27, %struct.timespec* %11)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = load i32, i32* @EX_OSERR
%32 = call i32 @err(i32 %31, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %30, %25
%34 = load i32, i32* @RUSAGE_SELF
%35 = call i32 @getrusage(i32 %34, %struct.rusage* %9)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* @EX_OSERR
%39 = call i32 @err(i32 %38, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %40
40: ; preds = %37, %33
%41 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
%42 = load x86_fp80, x86_fp80* %41
%43 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%44 = load x86_fp80, x86_fp80* %43
%45 = fsub x86_fp80 %42, %44
%46 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 1
%47 = load x86_fp80, x86_fp80* %46
%48 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%49 = load x86_fp80, x86_fp80* %48
%50 = fsub x86_fp80 %47, %49
%51 = fdiv x86_fp80 %50, 0xK401CEE6B280000000000
%52 = fadd x86_fp80 %45, %51
store x86_fp80 %52, x86_fp80* %5
%53 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 1
%54 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %53, i32 0, i32 0
%55 = load x86_fp80, x86_fp80* %54
%56 = getelementptr inbounds %struct.rusage, %struct.rusage* %8, i32 0, i32 1
%57 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %56, i32 0, i32 0
%58 = load x86_fp80, x86_fp80* %57
%59 = fsub x86_fp80 %55, %58
%60 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 1
%61 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %60, i32 0, i32 1
%62 = load x86_fp80, x86_fp80* %61
%63 = getelementptr inbounds %struct.rusage, %struct.rusage* %8, i32 0, i32 1
%64 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %63, i32 0, i32 1
%65 = load x86_fp80, x86_fp80* %64
%66 = fsub x86_fp80 %62, %65
%67 = fdiv x86_fp80 %66, 0xK4012F424000000000000
%68 = fadd x86_fp80 %59, %67
store x86_fp80 %68, x86_fp80* %6
%69 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 0
%70 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %69, i32 0, i32 0
%71 = load x86_fp80, x86_fp80* %70
%72 = getelementptr inbounds %struct.rusage, %struct.rusage* %8, i32 0, i32 0
%73 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %72, i32 0, i32 0
%74 = load x86_fp80, x86_fp80* %73
%75 = fsub x86_fp80 %71, %74
%76 = getelementptr inbounds %struct.rusage, %struct.rusage* %9, i32 0, i32 0
%77 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %76, i32 0, i32 1
%78 = load x86_fp80, x86_fp80* %77
%79 = getelementptr inbounds %struct.rusage, %struct.rusage* %8, i32 0, i32 0
%80 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %79, i32 0, i32 1
%81 = load x86_fp80, x86_fp80* %80
%82 = fsub x86_fp80 %78, %81
%83 = fdiv x86_fp80 %82, 0xK4012F424000000000000
%84 = fadd x86_fp80 %75, %83
store x86_fp80 %84, x86_fp80* %7
%85 = load i32, i32* @stderr
%86 = load i8*, i8** %4
%87 = load x86_fp80, x86_fp80* %5
%88 = load x86_fp80, x86_fp80* %6
%89 = load x86_fp80, x86_fp80* %7
%90 = call i32 @fprintf(i32 %85, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %86, x86_fp80 %87, x86_fp80 %88, x86_fp80 %89)
ret void
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { x86_fp80, x86_fp80 }
%struct.TYPE_3__ = type { x86_fp80, x86_fp80 }
%struct.timespec = type { x86_fp80, x86_fp80 }
@RUSAGE_SELF = global i32 0
@EX_OSERR = global i32 0
@.str = [19 x i8] c"getrusage() failed\00"
@CLOCK_REALTIME = global i32 0
@.str.1 = [23 x i8] c"clock_gettime() failed\00"
@stderr = global i32 0
@.str.2 = [39 x i8] c"%s\09%.6Lf real %.6Lf user %.6Lf system\0A\00"
define void @deltaof(void (...)* nocapture %0, i8* %1) {
%3 = alloca %struct.rusage
%4 = alloca %struct.rusage
%5 = alloca %struct.timespec
%6 = alloca %struct.timespec
%7 = bitcast %struct.rusage* %3 to i8*
%8 = bitcast %struct.rusage* %4 to i8*
%9 = bitcast %struct.timespec* %5 to i8*
%10 = bitcast %struct.timespec* %6 to i8*
%11 = load i32, i32* @RUSAGE_SELF
%12 = call i32 @getrusage(i32 %11, %struct.rusage* %3)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* @EX_OSERR
%16 = call i32 @err(i32 %15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %14, %2
%18 = load i32, i32* @CLOCK_REALTIME
%19 = call i32 @clock_gettime(i32 %18, %struct.timespec* %5)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* @EX_OSERR
%23 = call i32 @err(i32 %22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %21, %17
%25 = load i32, i32* @CLOCK_REALTIME
%26 = call i32 @clock_gettime(i32 %25, %struct.timespec* %6)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* @EX_OSERR
%30 = call i32 @err(i32 %29, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %28, %24
%32 = load i32, i32* @RUSAGE_SELF
%33 = call i32 @getrusage(i32 %32, %struct.rusage* %4)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* @EX_OSERR
%37 = call i32 @err(i32 %36, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %38
38: ; preds = %35, %31
%39 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i64 0, i32 0
%40 = load x86_fp80, x86_fp80* %39
%41 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 0
%42 = load x86_fp80, x86_fp80* %41
%43 = fsub x86_fp80 %40, %42
%44 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i64 0, i32 1
%45 = load x86_fp80, x86_fp80* %44
%46 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 1
%47 = load x86_fp80, x86_fp80* %46
%48 = fsub x86_fp80 %45, %47
%49 = fdiv x86_fp80 %48, 0xK401CEE6B280000000000
%50 = fadd x86_fp80 %43, %49
%51 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i64 0, i32 1, i32 0
%52 = load x86_fp80, x86_fp80* %51
%53 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 1, i32 0
%54 = load x86_fp80, x86_fp80* %53
%55 = fsub x86_fp80 %52, %54
%56 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i64 0, i32 1, i32 1
%57 = load x86_fp80, x86_fp80* %56
%58 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 1, i32 1
%59 = load x86_fp80, x86_fp80* %58
%60 = fsub x86_fp80 %57, %59
%61 = fdiv x86_fp80 %60, 0xK4012F424000000000000
%62 = fadd x86_fp80 %55, %61
%63 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i64 0, i32 0, i32 0
%64 = load x86_fp80, x86_fp80* %63
%65 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0, i32 0
%66 = load x86_fp80, x86_fp80* %65
%67 = fsub x86_fp80 %64, %66
%68 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i64 0, i32 0, i32 1
%69 = load x86_fp80, x86_fp80* %68
%70 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0, i32 1
%71 = load x86_fp80, x86_fp80* %70
%72 = fsub x86_fp80 %69, %71
%73 = fdiv x86_fp80 %72, 0xK4012F424000000000000
%74 = fadd x86_fp80 %67, %73
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %1, x86_fp80 %50, x86_fp80 %62, x86_fp80 %74)
ret void
}