#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 */
double CLOCKS_PER_SEC;
double calCpuTime(double, double);
long calcWallTime(long, long);
double getCpuTime();
long getWallTime();
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ sleep(int);
void main() {
  long w1, w2, rc;
  double c1, c2, r, r2;
  w1 = getWallTime();
  c1 = getCpuTime();
  sleep(60);
  w2 = getWallTime();
  c2 = getCpuTime();
  r = calCpuTime(c1, c2);
  rc = calcWallTime(w1, w2);
  r2 = r / CLOCKS_PER_SEC;
  printf("%f\n", r);
  printf("%f\n", r2);
  printf("%li\n", rc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x0,%al
call   1060 <getWallTime@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getCpuTime@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0x3c,%edi
call   1080 <sleep@plt>
mov    $0x0,%al
call   1060 <getWallTime@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getCpuTime@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1070 <calCpuTime@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calcWallTime@plt>
mov    %rax,-0x18(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    0x2e17(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvttsd2si -0x30(%rbp),%rsi
lea    0xe19(%rip),%rdi
call   1040 <printf@plt>
cvttsd2si -0x38(%rbp),%rsi
lea    0xe07(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xdfb(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <getWallTime@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1050 <getCpuTime@plt>
movsd  %xmm0,(%rsp)
mov    $0x3c,%edi
call   1080 <sleep@plt>
xor    %eax,%eax
call   1060 <getWallTime@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <getCpuTime@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
call   1070 <calCpuTime@plt>
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <calcWallTime@plt>
mov    %rax,%r14
mov    0x2e2c(%rip),%rax
movsd  (%rsp),%xmm0
cvttsd2si %xmm0,%rsi
divsd  (%rax),%xmm0
movsd  %xmm0,(%rsp)
lea    0xe2a(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
cvttsd2si (%rsp),%rsi
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0xe11(%rip),%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [5 x i8] c"%li\0A\00"
define void @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = call i64 (...) @getWallTime()
store i64 %8, i64* %1
%9 = call double (...) @getCpuTime()
store double %9, double* %4
%10 = call i32 @sleep(i32 60)
%11 = call i64 (...) @getWallTime()
store i64 %11, i64* %2
%12 = call double (...) @getCpuTime()
store double %12, double* %5
%13 = load double, double* %4
%14 = load double, double* %5
%15 = call double @calCpuTime(double %13, double %14)
store double %15, double* %6
%16 = load i64, i64* %1
%17 = load i64, i64* %2
%18 = call i64 @calcWallTime(i64 %16, i64 %17)
store i64 %18, i64* %3
%19 = load double, double* %6
%20 = load double, double* @CLOCKS_PER_SEC
%21 = fdiv double %19, %20
store double %21, double* %7
%22 = load double, double* %6
%23 = fptosi double %22 to i64
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %23)
%25 = load double, double* %7
%26 = fptosi double %25 to i64
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %26)
%28 = load i64, i64* %3
%29 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %28)
ret void
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [5 x i8] c"%li\0A\00"
define void @main() {
%1 = tail call i64 (...) @getWallTime()
%2 = tail call double (...) @getCpuTime()
%3 = tail call i32 @sleep(i32 60)
%4 = tail call i64 (...) @getWallTime()
%5 = tail call double (...) @getCpuTime()
%6 = tail call double @calCpuTime(double %2, double %5)
%7 = tail call i64 @calcWallTime(i64 %1, i64 %4)
%8 = load double, double* @CLOCKS_PER_SEC
%9 = fdiv double %6, %8
%10 = fptosi double %6 to i64
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = fptosi double %9 to i64
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %7)
ret void
}