#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 int32_t;
typedef int clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
int clock();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ run(char *);
int32_t main(int32_t argc, char **argv) {
  clock_t begin_time = clock();
  if (argc == 2)
    run(argv[1]);
  else {
    printf("\n Conceptum \n");
    printf("Usage: ./cvm <code_file_path>\n");
    printf("Err: No input file specified. Exiting...");
  }
  clock_t end_time = clock();
  clock_t time_diff = end_time - begin_time;
  printf("\x1b[0m"
         "\x1b[32m"
         "\nFULL RUNTIME: \t %lu"
         "\x1b[0m"
         "\x1b[32m",
         time_diff * 1000000000 / CLOCKS_PER_SEC);
  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)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <run@plt>
jmp    1196 <main+0x66>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
imul   $0x3b9aca00,-0x1c(%rbp),%eax
mov    0x2e31(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,%esi
lea    0xe93(%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   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <clock@plt>
mov    %eax,%r14d
cmp    $0x2,%ebp
jne    1163 <main+0x23>
mov    0x8(%rbx),%rdi
call   1050 <run@plt>
jmp    1189 <main+0x49>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %r14d,%eax
imul   $0x3b9aca00,%eax,%eax
mov    0x2e48(%rip),%rcx
cltd
idivl  (%rcx)
lea    0xe7f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\0A Conceptum \0A\00"
@.str.1 = [31 x i8] c"Usage: ./cvm <code_file_path>\0A\00"
@.str.2 = [41 x i8] c"Err: No input file specified. Exiting...\00"
@.str.3 = [39 x i8] c"\1B[0m\1B[32m\0AFULL RUNTIME: \09 %lu\1B[0m\1B[32m\00"
@CLOCKS_PER_SEC = global i32 0
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @clock()
store i32 %9, i32* %6
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @run(i8* %15)
br label %21
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %17, %12
%22 = call i32 (...) @clock()
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = sub nsw i32 %23, %24
store i32 %25, i32* %8
%26 = load i32, i32* %8
%27 = mul nsw i32 %26, 1000000000
%28 = load i32, i32* @CLOCKS_PER_SEC
%29 = sdiv i32 %27, %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [41 x i8] c"Err: No input file specified. Exiting...\00"
@.str.3 = [39 x i8] c"\1B[0m\1B[32m\0AFULL RUNTIME: \09 %lu\1B[0m\1B[32m\00"
@CLOCKS_PER_SEC = global i32 0
@str = [13 x i8] c"\0A Conceptum \00"
@str.4 = [30 x i8] c"Usage: ./cvm <code_file_path>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @clock()
%4 = icmp eq i32 %0, 2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @run(i8* %7)
br label %13
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %9, %5
%14 = tail call i32 (...) @clock()
%15 = sub nsw i32 %14, %3
%16 = mul nsw i32 %15, 1000000000
%17 = load i32, i32* @CLOCKS_PER_SEC
%18 = sdiv i32 %16, %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %18)
ret i32 0
}