#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ stderr;
long sysconf(int /*<<< orphan*/);
void pr_times(clock_t real, struct tms *tmsstart, struct tms *tmsend) {
  static long clktck = 0;
  if (clktck == 0)
    if ((clktck = sysconf(_SC_CLK_TCK)) < 0)
      fprintf(stderr, "sysconf error");
  printf("  real:  %7.2f\n", real / (double)clktck);
  printf("  user:  %7.2f\n",
         (tmsend->tms_utime - tmsstart->tms_utime) / (double)clktck);
  printf("  sys:   %7.2f\n",
         (tmsend->tms_stime - tmsstart->tms_stime) / (double)clktck);
  printf("  child user:  %7.2f\n",
         (tmsend->tms_cutime - tmsstart->tms_cutime) / (double)clktck);
  printf("  child sys:   %7.2f\n",
         (tmsend->tms_cstime - tmsstart->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)
cmpq   $0x0,0x2ef3(%rip)
jne    118c <pr_times+0x5c>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %rax,0x2ed8(%rip)
cmp    $0x0,%rax
jge    1187 <pr_times+0x57>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
call   1040 <fprintf@plt>
jmp    118c <pr_times+0x5c>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdq 0x2ea6(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
cvtsi2sdq 0x2e7d(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
cvtsi2sdq 0x2e52(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
cvtsi2sdq 0x2e27(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x18(%rax),%xmm0
cvtsi2sdq 0x2dfc(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe05(%rip),%rdi
call   1030 <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
mov    0x2eff(%rip),%rax
test   %rax,%rax
jne    118b <pr_times+0x5b>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
movsd  %xmm0,(%rsp)
call   1050 <sysconf@plt>
movsd  (%rsp),%xmm0
mov    %rax,0x2edb(%rip)
test   %rax,%rax
jns    118b <pr_times+0x5b>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe86(%rip),%rsi
call   1040 <fprintf@plt>
movsd  (%rsp),%xmm0
mov    0x2eb5(%rip),%rax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
movsd  (%rbx),%xmm0
subsd  (%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e8b(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
movsd  0x8(%rbx),%xmm0
subsd  0x8(%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e64(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
movsd  0x10(%rbx),%xmm0
subsd  0x10(%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e3d(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
movsd  0x18(%rbx),%xmm0
subsd  0x18(%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e16(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe1f(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <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
@stderr = global i32 0
@.str = [14 x i8] c"sysconf error\00"
@.str.1 = [16 x i8] c" real: %7.2f\0A\00"
@.str.2 = [16 x i8] c" user: %7.2f\0A\00"
@.str.3 = [16 x i8] c" sys: %7.2f\0A\00"
@.str.4 = [22 x i8] c" child user: %7.2f\0A\00"
@.str.5 = [22 x i8] c" child sys: %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 i64, i64* @pr_times.clktck
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %3
%10 = load i32, i32* @_SC_CLK_TCK
%11 = call i64 @sysconf(i32 %10)
store i64 %11, i64* @pr_times.clktck
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %9
br label %17
17: ; preds = %16, %3
%18 = load double, double* %4
%19 = load i64, i64* @pr_times.clktck
%20 = sitofp i64 %19 to double
%21 = fdiv double %18, %20
%22 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = load %struct.tms*, %struct.tms** %6
%24 = getelementptr inbounds %struct.tms, %struct.tms* %23, i32 0, i32 0
%25 = load double, double* %24
%26 = load %struct.tms*, %struct.tms** %5
%27 = getelementptr inbounds %struct.tms, %struct.tms* %26, i32 0, i32 0
%28 = load double, double* %27
%29 = fsub double %25, %28
%30 = load i64, i64* @pr_times.clktck
%31 = sitofp i64 %30 to double
%32 = fdiv double %29, %31
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %32)
%34 = load %struct.tms*, %struct.tms** %6
%35 = getelementptr inbounds %struct.tms, %struct.tms* %34, i32 0, i32 1
%36 = load double, double* %35
%37 = load %struct.tms*, %struct.tms** %5
%38 = getelementptr inbounds %struct.tms, %struct.tms* %37, i32 0, i32 1
%39 = load double, double* %38
%40 = fsub double %36, %39
%41 = load i64, i64* @pr_times.clktck
%42 = sitofp i64 %41 to double
%43 = fdiv double %40, %42
%44 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %43)
%45 = load %struct.tms*, %struct.tms** %6
%46 = getelementptr inbounds %struct.tms, %struct.tms* %45, i32 0, i32 2
%47 = load double, double* %46
%48 = load %struct.tms*, %struct.tms** %5
%49 = getelementptr inbounds %struct.tms, %struct.tms* %48, i32 0, i32 2
%50 = load double, double* %49
%51 = fsub double %47, %50
%52 = load i64, i64* @pr_times.clktck
%53 = sitofp i64 %52 to double
%54 = fdiv double %51, %53
%55 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %54)
%56 = load %struct.tms*, %struct.tms** %6
%57 = getelementptr inbounds %struct.tms, %struct.tms* %56, i32 0, i32 3
%58 = load double, double* %57
%59 = load %struct.tms*, %struct.tms** %5
%60 = getelementptr inbounds %struct.tms, %struct.tms* %59, i32 0, i32 3
%61 = load double, double* %60
%62 = fsub double %58, %61
%63 = load i64, i64* @pr_times.clktck
%64 = sitofp i64 %63 to double
%65 = fdiv double %62, %64
%66 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %65)
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
@stderr = global i32 0
@.str = [14 x i8] c"sysconf error\00"
@.str.1 = [16 x i8] c" real: %7.2f\0A\00"
@.str.2 = [16 x i8] c" user: %7.2f\0A\00"
@.str.3 = [16 x i8] c" sys: %7.2f\0A\00"
@.str.4 = [22 x i8] c" child user: %7.2f\0A\00"
@.str.5 = [22 x i8] c" child sys: %7.2f\0A\00"
define void @pr_times(double %0, %struct.tms* nocapture %1, %struct.tms* nocapture %2) {
%4 = load i64, i64* @pr_times.clktck
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = load i32, i32* @_SC_CLK_TCK
%8 = tail call i64 @sysconf(i32 %7)
store i64 %8, i64* @pr_times.clktck
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%13 = load i64, i64* @pr_times.clktck
br label %14
14: ; preds = %6, %10, %3
%15 = phi i64 [ %8, %6 ], [ %13, %10 ], [ %4, %3 ]
%16 = sitofp i64 %15 to double
%17 = fdiv double %0, %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 0
%20 = load double, double* %19
%21 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 0
%22 = load double, double* %21
%23 = fsub double %20, %22
%24 = load i64, i64* @pr_times.clktck
%25 = sitofp i64 %24 to double
%26 = fdiv double %23, %25
%27 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %26)
%28 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 1
%29 = load double, double* %28
%30 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 1
%31 = load double, double* %30
%32 = fsub double %29, %31
%33 = load i64, i64* @pr_times.clktck
%34 = sitofp i64 %33 to double
%35 = fdiv double %32, %34
%36 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %35)
%37 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 2
%38 = load double, double* %37
%39 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 2
%40 = load double, double* %39
%41 = fsub double %38, %40
%42 = load i64, i64* @pr_times.clktck
%43 = sitofp i64 %42 to double
%44 = fdiv double %41, %43
%45 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %44)
%46 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 3
%47 = load double, double* %46
%48 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 3
%49 = load double, double* %48
%50 = fsub double %47, %49
%51 = load i64, i64* @pr_times.clktck
%52 = sitofp i64 %51 to double
%53 = fdiv double %50, %52
%54 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %53)
ret void
}