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

/* Variables and functions */
int /*<<< orphan*/ _SC_CLK_TCK;
int /*<<< orphan*/ _time_error(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, long,
                           long);
int /*<<< orphan*/ stderr;
long sysconf(int /*<<< orphan*/);
int _time_print(long real, long user, long sys) {
  static const char *args[3] = {"real", "user", "sys"};
  long *argl[3];
  int i;
  long l;
  long r;
  argl[0] = &real;
  argl[1] = &user;
  argl[2] = &sys;
  if ((r = sysconf(_SC_CLK_TCK)) == -1) {
    _time_error("sysconf", 0);
    r = 100;
  }
  for (i = 0; i < 3; i++) {
    l = *argl[i] / r;
    if (l * r > *argl[i])
      l--;
    fprintf(stderr, "%s %ld.%02lds\n", args[i], l, *argl[i] % r);
  }
  return 0;
}


x86 assembly (clang, -O0):
<_time_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %rax,-0x48(%rbp)
cmp    $0xffffffffffffffff,%rax
jne    118e <_time_print+0x5e>
lea    0xe8f(%rip),%rdi
xor    %esi,%esi
call   1030 <_time_error@plt>
movq   $0x64,-0x48(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x3,-0x34(%rbp)
jge    122f <_time_print+0xff>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    (%rax),%rax
cqto
idivq  -0x48(%rbp)
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
imul   -0x48(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    -0x30(%rbp,%rcx,8),%rcx
cmp    (%rcx),%rax
jle    11dc <_time_print+0xac>
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
movslq -0x34(%rbp),%rcx
lea    0x2e50(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rcx
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    (%rax),%rax
cqto
idivq  -0x48(%rbp)
mov    %rdx,%r8
mov    -0x50(%rbp),%rdx
lea    0xdfa(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1195 <_time_print+0x65>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_time_print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %rax,%rbx
cmp    $0xffffffffffffffff,%rax
jne    116b <_time_print+0x3b>
lea    0xeaf(%rip),%rdi
xor    %esi,%esi
call   1030 <_time_error@plt>
mov    $0x64,%ebx
mov    %r12,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     1184 <_time_print+0x54>
mov    %r12,%rax
cqto
idiv   %rbx
mov    %rdx,%r8
jmp    118e <_time_print+0x5e>
mov    %r12d,%eax
xor    %edx,%edx
div    %ebx
mov    %edx,%r8d
mov    %rax,%rcx
imul   %rbx,%rcx
xor    %edx,%edx
cmp    %r12,%rcx
setg   %dl
sub    %rdx,%rax
mov    0x2e31(%rip),%r12
mov    (%r12),%edi
lea    0xe64(%rip),%rsi
lea    0xe47(%rip),%rdx
mov    %rax,%rcx
call   1040 <fprintf@plt>
mov    %r15,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     11da <_time_print+0xaa>
mov    %r15,%rax
cqto
idiv   %rbx
mov    %rdx,%r8
jmp    11e4 <_time_print+0xb4>
mov    %r15d,%eax
xor    %edx,%edx
div    %ebx
mov    %edx,%r8d
mov    %rax,%rcx
imul   %rbx,%rcx
xor    %edx,%edx
cmp    %r15,%rcx
setg   %dl
sub    %rdx,%rax
mov    (%r12),%edi
lea    0xe15(%rip),%rsi
lea    0xdfd(%rip),%rdx
mov    %rax,%rcx
call   1040 <fprintf@plt>
mov    %r14,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     1229 <_time_print+0xf9>
mov    %r14,%rax
cqto
idiv   %rbx
mov    %rdx,%r8
jmp    1233 <_time_print+0x103>
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
mov    %edx,%r8d
imul   %rax,%rbx
xor    %ecx,%ecx
cmp    %r14,%rbx
setg   %cl
sub    %rcx,%rax
mov    (%r12),%edi
lea    0xdc9(%rip),%rsi
lea    0xdb6(%rip),%rdx
mov    %rax,%rcx
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@_time_print.args = internal global [3 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0)]
@.str = [5 x i8] c"real\00"
@.str.1 = [5 x i8] c"user\00"
@.str.2 = [4 x i8] c"sys\00"
@_SC_CLK_TCK = global i32 0
@.str.3 = [8 x i8] c"sysconf\00"
@stderr = global i32 0
@.str.4 = [15 x i8] c"%s %ld.%02lds\0A\00"
define i32 @_time_print(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca [3 x i64*]
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%11 = getelementptr inbounds [3 x i64*], [3 x i64*]* %7, i64 0, i64 0
store i64* %4, i64** %11
%12 = getelementptr inbounds [3 x i64*], [3 x i64*]* %7, i64 0, i64 1
store i64* %5, i64** %12
%13 = getelementptr inbounds [3 x i64*], [3 x i64*]* %7, i64 0, i64 2
store i64* %6, i64** %13
%14 = load i32, i32* @_SC_CLK_TCK
%15 = call i64 @sysconf(i32 %14)
store i64 %15, i64* %10
%16 = icmp eq i64 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = call i32 @_time_error(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 0)
store i64 100, i64* %10
br label %19
19: ; preds = %17, %3
store i32 0, i32* %8
br label %20
20: ; preds = %58, %19
%21 = load i32, i32* %8
%22 = icmp slt i32 %21, 3
br i1 %22, label %23, label %61
23: ; preds = %20
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [3 x i64*], [3 x i64*]* %7, i64 0, i64 %25
%27 = load i64*, i64** %26
%28 = load i64, i64* %27
%29 = load i64, i64* %10
%30 = sdiv i64 %28, %29
store i64 %30, i64* %9
%31 = load i64, i64* %9
%32 = load i64, i64* %10
%33 = mul nsw i64 %31, %32
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [3 x i64*], [3 x i64*]* %7, i64 0, i64 %35
%37 = load i64*, i64** %36
%38 = load i64, i64* %37
%39 = icmp sgt i64 %33, %38
br i1 %39, label %40, label %43
40: ; preds = %23
%41 = load i64, i64* %9
%42 = add nsw i64 %41, -1
store i64 %42, i64* %9
br label %43
43: ; preds = %40, %23
%44 = load i32, i32* @stderr
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [3 x i8*], [3 x i8*]* @_time_print.args, i64 0, i64 %46
%48 = load i8*, i8** %47
%49 = load i64, i64* %9
%50 = load i32, i32* %8
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [3 x i64*], [3 x i64*]* %7, i64 0, i64 %51
%53 = load i64*, i64** %52
%54 = load i64, i64* %53
%55 = load i64, i64* %10
%56 = srem i64 %54, %55
%57 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %48, i64 %49, i64 %56)
br label %58
58: ; preds = %43
%59 = load i32, i32* %8
%60 = add nsw i32 %59, 1
store i32 %60, i32* %8
br label %20
61: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"real\00"
@.str.1 = [5 x i8] c"user\00"
@.str.2 = [4 x i8] c"sys\00"
@_SC_CLK_TCK = global i32 0
@.str.3 = [8 x i8] c"sysconf\00"
@stderr = global i32 0
@.str.4 = [15 x i8] c"%s %ld.%02lds\0A\00"
define i32 @_time_print(i64 %0, i64 %1, i64 %2) {
%4 = load i32, i32* @_SC_CLK_TCK
%5 = call i64 @sysconf(i32 %4)
%6 = icmp eq i64 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @_time_error(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 0)
br label %9
9: ; preds = %7, %3
%10 = phi i64 [ 100, %7 ], [ %5, %3 ]
%11 = sdiv i64 %0, %10
%12 = mul nsw i64 %11, %10
%13 = icmp sgt i64 %12, %0
%14 = sext i1 %13 to i64
%15 = add nsw i64 %11, %14
%16 = load i32, i32* @stderr
%17 = srem i64 %0, %10
%18 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %15, i64 %17)
%19 = sdiv i64 %1, %10
%20 = mul nsw i64 %19, %10
%21 = icmp sgt i64 %20, %1
%22 = sext i1 %21 to i64
%23 = add nsw i64 %19, %22
%24 = load i32, i32* @stderr
%25 = srem i64 %1, %10
%26 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %23, i64 %25)
%27 = sdiv i64 %2, %10
%28 = mul nsw i64 %27, %10
%29 = icmp sgt i64 %28, %2
%30 = sext i1 %29 to i64
%31 = add nsw i64 %27, %30
%32 = load i32, i32* @stderr
%33 = srem i64 %2, %10
%34 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 %31, i64 %33)
ret i32 0
}