#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 *, double);
int /*<<< orphan*/ printf(char *);
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)
      printf("sysconf error\n");
  fprintf(stderr, "real:  %7.2f\n", real / (double)clktck);
  fprintf(stderr, "user:  %7.2f\n",
          (tmsend->tms_utime - tmsstart->tms_utime) / (double)clktck);
  fprintf(stderr, "sys:   %7.2f\n",
          (tmsend->tms_stime - tmsstart->tms_stime) / (double)clktck);
  fprintf(stderr, "child user:  %7.2f\n",
          (tmsend->tms_cutime - tmsstart->tms_cutime) / (double)clktck);
  fprintf(stderr, "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    1183 <pr_times+0x53>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %rax,0x2ed8(%rip)
cmp    $0x0,%rax
jge    117e <pr_times+0x4e>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
jmp    1183 <pr_times+0x53>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
movsd  -0x8(%rbp),%xmm0
cvtsi2sdq 0x2ea6(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe6a(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
cvtsi2sdq 0x2e74(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe4c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
cvtsi2sdq 0x2e40(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe2c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
cvtsi2sdq 0x2e0c(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdde(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x18(%rax),%xmm0
cvtsi2sdq 0x2dd8(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdbe(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_times>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x2efa(%rip),%rax
test   %rax,%rax
jne    118a <pr_times+0x5a>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
movsd  %xmm0,0x8(%rsp)
call   1050 <sysconf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rax,0x2ed4(%rip)
test   %rax,%rax
jns    118a <pr_times+0x5a>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
movsd  0x8(%rsp),%xmm0
mov    0x2eb6(%rip),%rax
mov    0x2e47(%rip),%r15
mov    (%r15),%edi
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
lea    0xe5c(%rip),%rsi
call   1040 <fprintf@plt>
movsd  (%rbx),%xmm0
subsd  (%r14),%xmm0
mov    (%r15),%edi
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e7f(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe48(%rip),%rsi
call   1040 <fprintf@plt>
movsd  0x8(%rbx),%xmm0
subsd  0x8(%r14),%xmm0
mov    (%r15),%edi
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e55(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe32(%rip),%rsi
call   1040 <fprintf@plt>
movsd  0x10(%rbx),%xmm0
subsd  0x10(%r14),%xmm0
mov    (%r15),%edi
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e2b(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdee(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%r15),%edi
movsd  0x18(%rbx),%xmm0
subsd  0x18(%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq 0x2e01(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdd8(%rip),%rsi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fprintf@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 = [15 x i8] c"sysconf error\0A\00"
@stderr = global i32 0
@.str.1 = [14 x i8] c"real: %7.2f\0A\00"
@.str.2 = [14 x i8] c"user: %7.2f\0A\00"
@.str.3 = [14 x i8] c"sys: %7.2f\0A\00"
@.str.4 = [20 x i8] c"child user: %7.2f\0A\00"
@.str.5 = [20 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 %16
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 %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
br label %16
16: ; preds = %15, %3
%17 = load i32, i32* @stderr
%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 @fprintf(i32 %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = load i32, i32* @stderr
%24 = load %struct.tms*, %struct.tms** %6
%25 = getelementptr inbounds %struct.tms, %struct.tms* %24, i32 0, i32 0
%26 = load double, double* %25
%27 = load %struct.tms*, %struct.tms** %5
%28 = getelementptr inbounds %struct.tms, %struct.tms* %27, i32 0, i32 0
%29 = load double, double* %28
%30 = fsub double %26, %29
%31 = load i64, i64* @pr_times.clktck
%32 = sitofp i64 %31 to double
%33 = fdiv double %30, %32
%34 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %33)
%35 = load i32, i32* @stderr
%36 = load %struct.tms*, %struct.tms** %6
%37 = getelementptr inbounds %struct.tms, %struct.tms* %36, i32 0, i32 1
%38 = load double, double* %37
%39 = load %struct.tms*, %struct.tms** %5
%40 = getelementptr inbounds %struct.tms, %struct.tms* %39, i32 0, i32 1
%41 = load double, double* %40
%42 = fsub double %38, %41
%43 = load i64, i64* @pr_times.clktck
%44 = sitofp i64 %43 to double
%45 = fdiv double %42, %44
%46 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %45)
%47 = load i32, i32* @stderr
%48 = load %struct.tms*, %struct.tms** %6
%49 = getelementptr inbounds %struct.tms, %struct.tms* %48, i32 0, i32 2
%50 = load double, double* %49
%51 = load %struct.tms*, %struct.tms** %5
%52 = getelementptr inbounds %struct.tms, %struct.tms* %51, i32 0, i32 2
%53 = load double, double* %52
%54 = fsub double %50, %53
%55 = load i64, i64* @pr_times.clktck
%56 = sitofp i64 %55 to double
%57 = fdiv double %54, %56
%58 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), double %57)
%59 = load i32, i32* @stderr
%60 = load %struct.tms*, %struct.tms** %6
%61 = getelementptr inbounds %struct.tms, %struct.tms* %60, i32 0, i32 3
%62 = load double, double* %61
%63 = load %struct.tms*, %struct.tms** %5
%64 = getelementptr inbounds %struct.tms, %struct.tms* %63, i32 0, i32 3
%65 = load double, double* %64
%66 = fsub double %62, %65
%67 = load i64, i64* @pr_times.clktck
%68 = sitofp i64 %67 to double
%69 = fdiv double %66, %68
%70 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %69)
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.1 = [14 x i8] c"real: %7.2f\0A\00"
@.str.2 = [14 x i8] c"user: %7.2f\0A\00"
@.str.3 = [14 x i8] c"sys: %7.2f\0A\00"
@.str.4 = [20 x i8] c"child user: %7.2f\0A\00"
@.str.5 = [20 x i8] c"child sys: %7.2f\0A\00"
@str = [14 x i8] c"sysconf error\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 %13
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 %13
10: ; preds = %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%12 = load i64, i64* @pr_times.clktck
br label %13
13: ; preds = %6, %10, %3
%14 = phi i64 [ %8, %6 ], [ %12, %10 ], [ %4, %3 ]
%15 = load i32, i32* @stderr
%16 = sitofp i64 %14 to double
%17 = fdiv double %0, %16
%18 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = load i32, i32* @stderr
%20 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 0
%21 = load double, double* %20
%22 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 0
%23 = load double, double* %22
%24 = fsub double %21, %23
%25 = load i64, i64* @pr_times.clktck
%26 = sitofp i64 %25 to double
%27 = fdiv double %24, %26
%28 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %27)
%29 = load i32, i32* @stderr
%30 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 1
%31 = load double, double* %30
%32 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 1
%33 = load double, double* %32
%34 = fsub double %31, %33
%35 = load i64, i64* @pr_times.clktck
%36 = sitofp i64 %35 to double
%37 = fdiv double %34, %36
%38 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %37)
%39 = load i32, i32* @stderr
%40 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 2
%41 = load double, double* %40
%42 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 2
%43 = load double, double* %42
%44 = fsub double %41, %43
%45 = load i64, i64* @pr_times.clktck
%46 = sitofp i64 %45 to double
%47 = fdiv double %44, %46
%48 = tail call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), double %47)
%49 = load i32, i32* @stderr
%50 = getelementptr inbounds %struct.tms, %struct.tms* %2, i64 0, i32 3
%51 = load double, double* %50
%52 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 3
%53 = load double, double* %52
%54 = fsub double %51, %53
%55 = load i64, i64* @pr_times.clktck
%56 = sitofp i64 %55 to double
%57 = fdiv double %54, %56
%58 = tail call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %57)
ret void
}