#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t start_t, end_t;
  double diff_t;
  printf("Starting of the program...\n");
  time(&start_t);
  printf("Sleeping for 5 seconds...\n");
  sleep(5);
  time(&end_t);
  diff_t = difftime(end_t, start_t);
  printf("Execution time = %f\n", diff_t);
  printf("Exiting of the program...\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   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1050 <time@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x5,%edi
call   1060 <sleep@plt>
lea    -0xc(%rbp),%rdi
call   1050 <time@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <difftime@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe94(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdi
call   1060 <time@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1070 <sleep@plt>
mov    %rsp,%rdi
call   1060 <time@plt>
mov    (%rsp),%edi
mov    0x4(%rsp),%esi
call   1050 <difftime@plt>
lea    0xe68(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Starting of the program...\0A\00"
@.str.1 = [27 x i8] c"Sleeping for 5 seconds...\0A\00"
@.str.2 = [21 x i8] c"Execution time = %f\0A\00"
@.str.3 = [27 x i8] c"Exiting of the program...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @time(i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @sleep(i32 5)
%9 = call i32 @time(i32* %3)
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = call double @difftime(i32 %10, i32 %11)
store double %12, double* %4
%13 = load double, double* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [21 x i8] c"Execution time = %f\0A\00"
@str = [27 x i8] c"Starting of the program...\00"
@str.4 = [26 x i8] c"Sleeping for 5 seconds...\00"
@str.5 = [26 x i8] c"Exiting of the program...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%6 = call i32 @time(i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 @sleep(i32 5)
%9 = call i32 @time(i32* %2)
%10 = load i32, i32* %2
%11 = load i32, i32* %1
%12 = call double @difftime(i32 %10, i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}