#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 */

/* Type definitions */
struct tms {
  double tms_utime;
  double tms_stime;
  double tms_cutime;
  double tms_cstime;
};
typedef double clock_t;

/* Variables and functions */
int /*<<< orphan*/ _SC_CLK_TCK;
int /*<<< orphan*/ err_sys(char *);
int /*<<< orphan*/ printf(char *, double);
long sysconf(int /*<<< orphan*/);
void pr_times(clock_t elapsed, struct tms *start, struct tms *end) {
  static long clktck = 0;
  if ((clktck = sysconf(_SC_CLK_TCK)) < 0) {
    err_sys("error on sysconf _SC_CLK_TCK");
  }
  printf("real: %7.2f\n", elapsed / (double)clktck);
  printf("user: %7.2f\n", (end->tms_utime - start->tms_utime) / (double)clktck);
  printf("system: %7.2f\n",
         (end->tms_stime - start->tms_stime) / (double)clktck);
  printf("child user: %7.2f\n",
         (end->tms_cutime - start->tms_cutime) / (double)clktck);
  printf("child system: %7.2f\n",
         (end->tms_cstime - start->tms_cstime) / (double)clktck);
}


x86 assembly (clang, -O0):
<pr_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %rax,0x2ee6(%rip)
cmp    $0x0,%rax
jge    1170 <pr_times+0x40>
lea    0xe95(%rip),%rdi
call   1030 <err_sys@plt>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdq 0x2ec2(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
cvtsi2sdq 0x2e99(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
cvtsi2sdq 0x2e6e(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
cvtsi2sdq 0x2e43(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x18(%rax),%xmm0
cvtsi2sdq 0x2e18(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_times>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  %xmm0,(%rsp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %rax,0x2eec(%rip)
test   %rax,%rax
jns    116c <pr_times+0x3c>
lea    0xea0(%rip),%rdi
call   1030 <err_sys@plt>
mov    0x2ed4(%rip),%rax
cvtsi2sd %rax,%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
movsd  (%rbx),%xmm0
subsd  (%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2ea5(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
movsd  0x8(%rbx),%xmm0
subsd  0x8(%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e7e(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
movsd  0x10(%rbx),%xmm0
subsd  0x10(%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e57(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe36(%rip),%rdi
call   1040 <printf@plt>
movsd  0x18(%rbx),%xmm0
subsd  0x18(%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e30(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe22(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.tms = type { double, double, double, double }
@pr_times.clktck = internal global i64 0
@_SC_CLK_TCK = global i32 0
@.str = [29 x i8] c"error on sysconf _SC_CLK_TCK\00"
@.str.1 = [13 x i8] c"real: %7.2f\0A\00"
@.str.2 = [13 x i8] c"user: %7.2f\0A\00"
@.str.3 = [15 x i8] c"system: %7.2f\0A\00"
@.str.4 = [19 x i8] c"child user: %7.2f\0A\00"
@.str.5 = [21 x i8] c"child system: %7.2f\0A\00"
define void @pr_times(double %0, %struct.tms* %1, %struct.tms* %2) {
%4 = alloca double
%5 = alloca %struct.tms*
%6 = alloca %struct.tms*
store double %0, double* %4
store %struct.tms* %1, %struct.tms** %5
store %struct.tms* %2, %struct.tms** %6
%7 = load i32, i32* @_SC_CLK_TCK
%8 = call i64 @sysconf(i32 %7)
store i64 %8, i64* @pr_times.clktck
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @err_sys(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %3
%13 = load double, double* %4
%14 = load i64, i64* @pr_times.clktck
%15 = sitofp i64 %14 to double
%16 = fdiv double %13, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %16)
%18 = load %struct.tms*, %struct.tms** %6
%19 = getelementptr inbounds %struct.tms, %struct.tms* %18, i32 0, i32 0
%20 = load double, double* %19
%21 = load %struct.tms*, %struct.tms** %5
%22 = getelementptr inbounds %struct.tms, %struct.tms* %21, i32 0, i32 0
%23 = load double, double* %22
%24 = fsub double %20, %23
%25 = load i64, i64* @pr_times.clktck
%26 = sitofp i64 %25 to double
%27 = fdiv double %24, %26
%28 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %27)
%29 = load %struct.tms*, %struct.tms** %6
%30 = getelementptr inbounds %struct.tms, %struct.tms* %29, i32 0, i32 1
%31 = load double, double* %30
%32 = load %struct.tms*, %struct.tms** %5
%33 = getelementptr inbounds %struct.tms, %struct.tms* %32, i32 0, i32 1
%34 = load double, double* %33
%35 = fsub double %31, %34
%36 = load i64, i64* @pr_times.clktck
%37 = sitofp i64 %36 to double
%38 = fdiv double %35, %37
%39 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %38)
%40 = load %struct.tms*, %struct.tms** %6
%41 = getelementptr inbounds %struct.tms, %struct.tms* %40, i32 0, i32 2
%42 = load double, double* %41
%43 = load %struct.tms*, %struct.tms** %5
%44 = getelementptr inbounds %struct.tms, %struct.tms* %43, i32 0, i32 2
%45 = load double, double* %44
%46 = fsub double %42, %45
%47 = load i64, i64* @pr_times.clktck
%48 = sitofp i64 %47 to double
%49 = fdiv double %46, %48
%50 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %49)
%51 = load %struct.tms*, %struct.tms** %6
%52 = getelementptr inbounds %struct.tms, %struct.tms* %51, i32 0, i32 3
%53 = load double, double* %52
%54 = load %struct.tms*, %struct.tms** %5
%55 = getelementptr inbounds %struct.tms, %struct.tms* %54, i32 0, i32 3
%56 = load double, double* %55
%57 = fsub double %53, %56
%58 = load i64, i64* @pr_times.clktck
%59 = sitofp i64 %58 to double
%60 = fdiv double %57, %59
%61 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %60)
ret void
}

LLVM IR (-O2):
%struct.tms = type { double, double, double, double }
@pr_times.clktck = internal unnamed_addr global i64 0
@_SC_CLK_TCK = global i32 0
@.str = [29 x i8] c"error on sysconf _SC_CLK_TCK\00"
@.str.1 = [13 x i8] c"real: %7.2f\0A\00"
@.str.2 = [13 x i8] c"user: %7.2f\0A\00"
@.str.3 = [15 x i8] c"system: %7.2f\0A\00"
@.str.4 = [19 x i8] c"child user: %7.2f\0A\00"
@.str.5 = [21 x i8] c"child system: %7.2f\0A\00"
define void @pr_times(double %0, %struct.tms* nocapture %1, %struct.tms* nocapture %2) {
%4 = load i32, i32* @_SC_CLK_TCK
%5 = tail call i64 @sysconf(i32 %4)
store i64 %5, i64* @pr_times.clktck
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 @err_sys(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%9 = load i64, i64* @pr_times.clktck
br label %10
10: ; preds = %7, %3
%11 = phi i64 [ %9, %7 ], [ %5, %3 ]
%12 = sitofp i64 %11 to double
%13 = fdiv double %0, %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %13)
%15 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 0
%16 = load double, double* %15
%17 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 0
%18 = load double, double* %17
%19 = fsub double %16, %18
%20 = load i64, i64* @pr_times.clktck
%21 = sitofp i64 %20 to double
%22 = fdiv double %19, %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %22)
%24 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 1
%25 = load double, double* %24
%26 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 1
%27 = load double, double* %26
%28 = fsub double %25, %27
%29 = load i64, i64* @pr_times.clktck
%30 = sitofp i64 %29 to double
%31 = fdiv double %28, %30
%32 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %31)
%33 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 2
%34 = load double, double* %33
%35 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 2
%36 = load double, double* %35
%37 = fsub double %34, %36
%38 = load i64, i64* @pr_times.clktck
%39 = sitofp i64 %38 to double
%40 = fdiv double %37, %39
%41 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %40)
%42 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 3
%43 = load double, double* %42
%44 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 3
%45 = load double, double* %44
%46 = fsub double %43, %45
%47 = load i64, i64* @pr_times.clktck
%48 = sitofp i64 %47 to double
%49 = fdiv double %46, %48
%50 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %49)
ret void
}