#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 */
int /*<<< orphan*/ print_data();
float print_exec_timer();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ run(char **);
int /*<<< orphan*/ setup(int, char **);
int /*<<< orphan*/ start_exec_timer();
int main(int argc, char **argv) {
  float totalTime;
  printf("\n\n\n---------------------------------------------------------------"
         "------------------------------------------------\n");
  printf("cs 546 HW 2 Shared Memory Programming.\n");
  printf("\nStep 1: initializing.\n");
  setup(argc, argv);
  printf("\tGenerated data: [A|b] =\n");
  print_data();
  printf("\tStarting Timer\n");
  start_exec_timer();
  printf("\nStep 2: running...\n");
  run(argv);
  totalTime = print_exec_timer();
  printf("\nTotal Time Spent: %15.6f s\n", totalTime);
  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    0xe83(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xf03(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <setup@plt>
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <print_data@plt>
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1050 <start_exec_timer@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <run@plt>
mov    $0x0,%al
call   1030 <print_exec_timer@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeeb(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1060 <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    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1090 <setup@plt>
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <print_data@plt>
lea    0xf27(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <start_exec_timer@plt>
lea    0xf24(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <run@plt>
xor    %eax,%eax
call   1040 <print_exec_timer@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe0e(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xe1f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [116 x i8] c"\0A\0A\0A---------------------------------------------------------------------------------------------------------------\0A\00"
@.str.1 = [40 x i8] c"cs 546 HW 2 Shared Memory Programming.\0A\00"
@.str.2 = [24 x i8] c"\0AStep 1: initializing.\0A\00"
@.str.3 = [26 x i8] c"\09Generated data: [A|b] =\0A\00"
@.str.4 = [17 x i8] c"\09Starting Timer\0A\00"
@.str.5 = [21 x i8] c"\0AStep 2: running...\0A\00"
@.str.6 = [29 x i8] c"\0ATotal Time Spent: %15.6f s\0A\00"
@.str.7 = [114 x i8] c"\0A---------------------------------------------------------------------------------------------------------------\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @setup(i32 %10, i8** %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (...) @print_data()
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (...) @start_exec_timer()
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%18 = load i8**, i8*** %5
%19 = call i32 @run(i8** %18)
%20 = call float (...) @print_exec_timer()
store float %20, float* %6
%21 = load float, float* %6
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), double %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.6 = [29 x i8] c"\0ATotal Time Spent: %15.6f s\0A\00"
@str = [115 x i8] c"\0A\0A\0A---------------------------------------------------------------------------------------------------------------\00"
@str.8 = [39 x i8] c"cs 546 HW 2 Shared Memory Programming.\00"
@str.9 = [23 x i8] c"\0AStep 1: initializing.\00"
@str.10 = [25 x i8] c"\09Generated data: [A|b] =\00"
@str.11 = [16 x i8] c"\09Starting Timer\00"
@str.12 = [20 x i8] c"\0AStep 2: running...\00"
@str.13 = [113 x i8] c"\0A---------------------------------------------------------------------------------------------------------------\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([115 x i8], [115 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @setup(i32 %0, i8** %1)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0))
%8 = tail call i32 (...) @print_data()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.11, i64 0, i64 0))
%10 = tail call i32 (...) @start_exec_timer()
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.12, i64 0, i64 0))
%12 = tail call i32 @run(i8** %1)
%13 = tail call float (...) @print_exec_timer()
%14 = fpext float %13 to double
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), double %14)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([113 x i8], [113 x i8]* @str.13, i64 0, i64 0))
ret i32 0
}