#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 */
float cpu();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
float wall();
int main(void) {
  printf("start\n");
  float t1_wall = wall();
  float t1_cpu = cpu();
  sleep(5);
  float t2_wall = wall();
  float t2_cpu = cpu();
  printf("     creation time (wall):   %2.2f\n", t2_wall - t1_wall);
  printf("     creation time (cpu):    %2.2f\n", t2_cpu - t1_cpu);
  printf("end\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <wall@plt>
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <cpu@plt>
movss  %xmm0,-0xc(%rbp)
mov    $0x5,%edi
call   1060 <sleep@plt>
mov    $0x0,%al
call   1050 <wall@plt>
movss  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <cpu@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x14(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <wall@plt>
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1040 <cpu@plt>
movss  %xmm0,0x14(%rsp)
mov    $0x5,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
call   1060 <wall@plt>
movss  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <cpu@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
subss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xc(%rsp),%xmm0
subss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"start\0A\00"
@.str.1 = [36 x i8] c" creation time (wall): %2.2f\0A\00"
@.str.2 = [36 x i8] c" creation time (cpu): %2.2f\0A\00"
@.str.3 = [5 x i8] c"end\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = call float (...) @wall()
store float %7, float* %2
%8 = call float (...) @cpu()
store float %8, float* %3
%9 = call i32 @sleep(i32 5)
%10 = call float (...) @wall()
store float %10, float* %4
%11 = call float (...) @cpu()
store float %11, float* %5
%12 = load float, float* %4
%13 = load float, float* %2
%14 = fsub float %12, %13
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double %15)
%17 = load float, float* %5
%18 = load float, float* %3
%19 = fsub float %17, %18
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c" creation time (wall): %2.2f\0A\00"
@.str.2 = [36 x i8] c" creation time (cpu): %2.2f\0A\00"
@str = [6 x i8] c"start\00"
@str.4 = [4 x i8] c"end\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call float (...) @wall()
%3 = tail call float (...) @cpu()
%4 = tail call i32 @sleep(i32 5)
%5 = tail call float (...) @wall()
%6 = tail call float (...) @cpu()
%7 = fsub float %5, %2
%8 = fpext float %7 to double
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = fsub float %6, %3
%11 = fpext float %10 to double
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %11)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}