#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 {
  int tms_utime;
  int tms_stime;
};

/* Variables and functions */
int /*<<< orphan*/ _SC_CLK_TCK;
int /*<<< orphan*/ printf(char *, int, int, int, int, ...);
int sysconf(int /*<<< orphan*/);
int times(struct tms *);
int main(int argc, char **argv) {
  int ticks, days, hours, minutes, seconds, tick_rate;
  struct tms tbuf;
  ticks = times(&tbuf);
  tick_rate = sysconf(_SC_CLK_TCK);
  seconds = ticks / tick_rate;
  minutes = seconds / 60;
  hours = minutes / 60;
  days = hours / 24;
  seconds %= 60;
  minutes %= 60;
  hours %= 24;
  printf("Uptime is %dd %dh %dm %d.%02ds\n", days, hours, minutes, seconds,
         ticks % tick_rate);
  printf("user time %d.%d seconds, system time %d.%02d seconds\n",
         tbuf.tms_utime / tick_rate, (tbuf.tms_utime) % tick_rate,
         tbuf.tms_stime / tick_rate, (tbuf.tms_stime) % tick_rate);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <times@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x28(%rbp)
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x14(%rbp),%eax
cltd
idivl  -0x28(%rbp)
mov    %edx,%r9d
mov    -0x38(%rbp),%edx
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
cltd
idivl  -0x28(%rbp)
mov    %eax,%esi
mov    -0x30(%rbp),%eax
cltd
idivl  -0x28(%rbp)
mov    %edx,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
cltd
idivl  -0x28(%rbp)
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cltd
idivl  -0x28(%rbp)
mov    %edx,%r8d
mov    -0x34(%rbp),%edx
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsp,%rdi
call   1040 <times@plt>
mov    %eax,%ebp
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %eax,%ebx
mov    %ebp,%eax
cltd
idiv   %ebx
mov    %edx,%r9d
movslq %eax,%r8
imul   $0xffffffff91a2b3c5,%r8,%rax
shr    $0x20,%rax
add    %r8d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0xb,%eax
add    %ecx,%eax
imul   $0xffffffffc22e4507,%r8,%rsi
shr    $0x20,%rsi
add    %r8d,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0x10,%esi
add    %ecx,%esi
imul   $0xffffffff88888889,%r8,%rcx
shr    $0x20,%rcx
add    %r8d,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%edx
sub    %edx,%r8d
movslq %ecx,%rcx
imul   $0xffffffff88888889,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%edi
shr    $0x1f,%edi
sar    $0x5,%edx
add    %edi,%edx
imul   $0x3c,%edx,%edx
sub    %edx,%ecx
movslq %eax,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rdi
shr    $0x3f,%rdi
shr    $0x22,%rax
add    %edi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xe15(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
cltd
idiv   %ebx
mov    %edx,%ebp
mov    %eax,%esi
mov    %ecx,%eax
cltd
idiv   %ebx
mov    %edx,%r8d
lea    0xe11(%rip),%rdi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tms = type { i32, i32 }
@_SC_CLK_TCK = global i32 0
@.str = [32 x i8] c"Uptime is %dd %dh %dm %d.%02ds\0A\00"
@.str.1 = [54 x i8] c"user time %d.%d seconds, system time %d.%02d seconds\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.tms
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 @times(%struct.tms* %12)
store i32 %13, i32* %6
%14 = load i32, i32* @_SC_CLK_TCK
%15 = call i32 @sysconf(i32 %14)
store i32 %15, i32* %11
%16 = load i32, i32* %6
%17 = load i32, i32* %11
%18 = sdiv i32 %16, %17
store i32 %18, i32* %10
%19 = load i32, i32* %10
%20 = sdiv i32 %19, 60
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = sdiv i32 %21, 60
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = sdiv i32 %23, 24
store i32 %24, i32* %7
%25 = load i32, i32* %10
%26 = srem i32 %25, 60
store i32 %26, i32* %10
%27 = load i32, i32* %9
%28 = srem i32 %27, 60
store i32 %28, i32* %9
%29 = load i32, i32* %8
%30 = srem i32 %29, 24
store i32 %30, i32* %8
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = load i32, i32* %9
%34 = load i32, i32* %10
%35 = load i32, i32* %6
%36 = load i32, i32* %11
%37 = srem i32 %35, %36
%38 = call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %32, i32 %33, i32 %34, i32 %37)
%39 = getelementptr inbounds %struct.tms, %struct.tms* %12, i32 0, i32 0
%40 = load i32, i32* %39
%41 = load i32, i32* %11
%42 = sdiv i32 %40, %41
%43 = getelementptr inbounds %struct.tms, %struct.tms* %12, i32 0, i32 0
%44 = load i32, i32* %43
%45 = load i32, i32* %11
%46 = srem i32 %44, %45
%47 = getelementptr inbounds %struct.tms, %struct.tms* %12, i32 0, i32 1
%48 = load i32, i32* %47
%49 = load i32, i32* %11
%50 = sdiv i32 %48, %49
%51 = getelementptr inbounds %struct.tms, %struct.tms* %12, i32 0, i32 1
%52 = load i32, i32* %51
%53 = load i32, i32* %11
%54 = srem i32 %52, %53
%55 = call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %46, i32 %50, i32 %54)
ret i32 0
}

LLVM IR (-O2):
%struct.tms = type { i32, i32 }
@_SC_CLK_TCK = global i32 0
@.str = [32 x i8] c"Uptime is %dd %dh %dm %d.%02ds\0A\00"
@.str.1 = [54 x i8] c"user time %d.%d seconds, system time %d.%02d seconds\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.tms
%4 = bitcast %struct.tms* %3 to i8*
%5 = call i32 @times(%struct.tms* %3)
%6 = load i32, i32* @_SC_CLK_TCK
%7 = tail call i32 @sysconf(i32 %6)
%8 = sdiv i32 %5, %7
%9 = sdiv i32 %8, 60
%10 = sdiv i32 %8, 3600
%11 = sdiv i32 %8, 86400
%12 = srem i32 %8, 60
%13 = srem i32 %9, 60
%14 = srem i32 %10, 24
%15 = srem i32 %5, %7
%16 = tail call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14, i32 %13, i32 %12, i32 %15)
%17 = getelementptr inbounds %struct.tms, %struct.tms* %3, i64 0, i32 0
%18 = load i32, i32* %17
%19 = sdiv i32 %18, %7
%20 = srem i32 %18, %7
%21 = getelementptr inbounds %struct.tms, %struct.tms* %3, i64 0, i32 1
%22 = load i32, i32* %21
%23 = sdiv i32 %22, %7
%24 = srem i32 %22, %7
%25 = tail call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20, i32 %23, i32 %24)
ret i32 0
}