#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*/ findLargestProductInGrid(int);
int /*<<< orphan*/ printGrid();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  clock_t begin, end;
  double compute_time;
  printf("Locating the largest product in the below grid\n\n");
  printGrid();
  begin = clock();
  findLargestProductInGrid(4);
  end = clock();
  compute_time = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("Time it took for completetion: %f Seconds\n", compute_time);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <printGrid@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1050 <findLargestProductInGrid@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e49(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe7d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <printGrid@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1060 <findLargestProductInGrid@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %rbx,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e5a(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe67(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Locating the largest product in the below grid\0A\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.1 = [43 x i8] c"Time it took for completetion: %f Seconds\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @printGrid()
%11 = call i64 (...) @clock()
store i64 %11, i64* %6
%12 = call i32 @findLargestProductInGrid(i32 4)
%13 = call i64 (...) @clock()
store i64 %13, i64* %7
%14 = load i64, i64* %7
%15 = load i64, i64* %6
%16 = sub nsw i64 %14, %15
%17 = sitofp i64 %16 to double
%18 = load double, double* @CLOCKS_PER_SEC
%19 = fdiv double %17, %18
store double %19, double* %8
%20 = load double, double* %8
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), double %20)
ret i32 1
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.1 = [43 x i8] c"Time it took for completetion: %f Seconds\0A\00"
@str = [48 x i8] c"Locating the largest product in the below grid\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @printGrid()
%5 = tail call i64 (...) @clock()
%6 = tail call i32 @findLargestProductInGrid(i32 4)
%7 = tail call i64 (...) @clock()
%8 = sub nsw i64 %7, %5
%9 = sitofp i64 %8 to double
%10 = load double, double* @CLOCKS_PER_SEC
%11 = fdiv double %9, %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), double %11)
ret i32 1
}