#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 scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  clock_t tic, toc;
  printf("\n\n*****************************************************************"
         "************");
  printf("\n  C-Profiler by shkrajat");
  printf("\n  find me at - http://sf.net/users/shkrajat/");
  printf("\n*******************************************************************"
         "**********\n");
  if (argc == 2) {
    tic = clock();
    system(argv[1]);
    toc = clock();
    printf("\n\n***************************************************************"
           "**************");
    printf("\n   Elapsed Actual CPU ticks : %f seconds",
           (double)(toc - tic) / CLOCKS_PER_SEC);
    printf("\n*****************************************************************"
           "************\n");
  } else {
    printf("\n\n***************************************************************"
           "**************");
    printf("\n  Usage : >> \"%s <program name>\" <enter>", argv[0]);
    printf("\n*****************************************************************"
           "************\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11f2 <main+0xc2>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <system@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x20(%rbp)
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e1b(%rip),%rax
divsd  (%rax),%xmm0
lea    0xf10(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1223 <main+0xf3>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xef3(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeff(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%ebp
jne    11d1 <main+0x91>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rbp
mov    0x8(%rbx),%rdi
call   1050 <system@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rbx
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
sub    %rbp,%rbx
cvtsi2sd %rbx,%xmm0
mov    0x2e2b(%rip),%rax
divsd  (%rax),%xmm0
lea    0xed0(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
jmp    11f0 <main+0xb0>
lea    0xe28(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%rsi
lea    0xed9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [80 x i8] c"\0A\0A*****************************************************************************\00"
@.str.1 = [26 x i8] c"\0A C-Profiler by shkrajat\00"
@.str.2 = [46 x i8] c"\0A find me at - http://sf.net/users/shkrajat/\00"
@.str.3 = [80 x i8] c"\0A*****************************************************************************\0A\00"
@.str.4 = [42 x i8] c"\0A Elapsed Actual CPU ticks : %f seconds\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.5 = [42 x i8] c"\0A Usage : >> \22%s <program name>\22 <enter>\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %30
14: ; preds = %2
%15 = call i64 (...) @clock()
store i64 %15, i64* %6
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @system(i8* %18)
%20 = call i64 (...) @clock()
store i64 %20, i64* %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%22 = load i64, i64* %7
%23 = load i64, i64* %6
%24 = sub nsw i64 %22, %23
%25 = sitofp i64 %24 to double
%26 = load double, double* @CLOCKS_PER_SEC
%27 = fdiv double %25, %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), double %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.3, i64 0, i64 0))
br label %37
30: ; preds = %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %30, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [80 x i8] c"\0A\0A*****************************************************************************\00"
@.str.1 = [26 x i8] c"\0A C-Profiler by shkrajat\00"
@.str.2 = [46 x i8] c"\0A find me at - http://sf.net/users/shkrajat/\00"
@.str.4 = [42 x i8] c"\0A Elapsed Actual CPU ticks : %f seconds\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.5 = [42 x i8] c"\0A Usage : >> \22%s <program name>\22 <enter>\00"
@str.7 = [79 x i8] c"\0A*****************************************************************************\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str.7, i64 0, i64 0))
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %20
8: ; preds = %2
%9 = tail call i64 (...) @clock()
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @system(i8* %11)
%13 = tail call i64 (...) @clock()
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%15 = sub nsw i64 %13, %9
%16 = sitofp i64 %15 to double
%17 = load double, double* @CLOCKS_PER_SEC
%18 = fdiv double %16, %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), double %18)
br label %24
20: ; preds = %2
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%22 = load i8*, i8** %1
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %20, %8
%25 = phi i8* [ getelementptr inbounds ([79 x i8], [79 x i8]* @str.7, i64 0, i64 0), %20 ], [ getelementptr inbounds ([79 x i8], [79 x i8]* @str.7, i64 0, i64 0), %8 ]
%26 = tail call i32 @puts(i8* dereferenceable(1) %25)
ret i32 0
}