#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*/ printf(char *, double, double);
int /*<<< orphan*/ start();
double stop();
double stub1(int);
double stub2(int);
void parVsSeq(int arg, double (*func)(int), double (*seqFunc)(int)) {
  double par_result, par_time;
  double seq_result, seq_time;
  start();
  par_result = (*func)(arg);
  par_time = stop();
  start();
  seq_result = (*seqFunc)(arg);
  seq_time = stop();
  printf("Parallel approach - result: %.9f, time elapsed: %.9f\n", par_result,
         par_time);
  printf("Sequential approach - result: %.9f, time elapsed: %.9f\n", seq_result,
         seq_time);
}


x86 assembly (clang, -O0):
<parVsSeq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1050 <start@plt>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1040 <stop@plt>
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1050 <start@plt>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
movsd  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   1040 <stop@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parVsSeq>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <start@plt>
mov    %ebp,%edi
call   *%rbx
movsd  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   1040 <stop@plt>
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1050 <start@plt>
mov    %ebp,%edi
call   *%r14
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <stop@plt>
movsd  %xmm0,(%rsp)
lea    0xe7d(%rip),%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"Parallel approach - result: %.9f, time elapsed: %.9f\0A\00"
@.str.1 = [56 x i8] c"Sequential approach - result: %.9f, time elapsed: %.9f\0A\00"
define void @parVsSeq(i32 %0, double (i32)* %1, double (i32)* %2) {
%4 = alloca i32
%5 = alloca double (i32)*
%6 = alloca double (i32)*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %4
store double (i32)* %1, double (i32)** %5
store double (i32)* %2, double (i32)** %6
%11 = call i32 (...) @start()
%12 = load double (i32)*, double (i32)** %5
%13 = load i32, i32* %4
%14 = call double %12(i32 %13)
store double %14, double* %7
%15 = call double (...) @stop()
store double %15, double* %8
%16 = call i32 (...) @start()
%17 = load double (i32)*, double (i32)** %6
%18 = load i32, i32* %4
%19 = call double %17(i32 %18)
store double %19, double* %9
%20 = call double (...) @stop()
store double %20, double* %10
%21 = load double, double* %7
%22 = load double, double* %8
%23 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), double %21, double %22)
%24 = load double, double* %9
%25 = load double, double* %10
%26 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), double %24, double %25)
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"Parallel approach - result: %.9f, time elapsed: %.9f\0A\00"
@.str.1 = [56 x i8] c"Sequential approach - result: %.9f, time elapsed: %.9f\0A\00"
define void @parVsSeq(i32 %0, double (i32)* nocapture %1, double (i32)* nocapture %2) {
%4 = tail call i32 (...) @start()
%5 = tail call double %1(i32 %0)
%6 = tail call double (...) @stop()
%7 = tail call i32 (...) @start()
%8 = tail call double %2(i32 %0)
%9 = tail call double (...) @stop()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), double %5, double %6)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), double %8, double %9)
ret void
}