#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ omp_set_num_threads(int);
double pow(double const, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  const double up = 1.1;
  double Sn, origSn = 1000.0;
  double *opt, *dependency_opt, *no_dependency_opt;
  int n, Noofthreads, N;
  printf("\n\t\t---------------------------------------------------------------"
         "------------");
  printf("\n\t\t Email : RarchK");
  printf("\n\t\t---------------------------------------------------------------"
         "------------");
  printf("\n\t\t Objective :  OpenMP Program to demonstrate Loop-Carried "
         "Dependency  ");
  printf("\n\t\t..............................................................."
         "...........\n");
  if (argc != 3) {
    printf("\t\t Very Few Arguments\n ");
    printf("\t\t Syntax : exec <Threads> <array-size>\n");
    exit(-1);
  }
  N = atoi(argv[2]);
  Noofthreads = atoi(argv[1]);
  if ((Noofthreads != 1) && (Noofthreads != 2) && (Noofthreads != 4) &&
      (Noofthreads != 8) && (Noofthreads != 16)) {
    printf("\n Number of threads should be 1,2,4,8 or 16 for the execution of "
           "program. \n\n");
    exit(-1);
  }
  printf("\n\t\t Threads : %d ", Noofthreads);
  printf("\n\t\t Array Size  : %d  \n  ", N);
  opt = (double *)malloc((N + 1) * sizeof(double));
  dependency_opt = (double *)malloc((N + 1) * sizeof(double));
  no_dependency_opt = (double *)malloc((N + 1) * sizeof(double));
  Sn = 1000.0;
  for (n = 0; n <= N; ++n) {
    opt[n] = Sn;
    Sn *= up;
  }
  Sn = 1000.0;
  omp_set_num_threads(Noofthreads);
#pragma omp parallel for private(n)
  for (n = 0; n <= N; ++n) {
    dependency_opt[n] = Sn;
    Sn *= up;
  }
  for (n = 0; n <= N; ++n) {
    if (opt[n] == dependency_opt[n]) {
    } else {
      printf(
          "\n\t\tIncorrect results found when Serial computation results & "
          "Parallel computation\n\t\twith Dependency results are compared\n");
      break;
    }
  }
  Sn = 1000.0;
  no_dependency_opt[0] = origSn;
  omp_set_num_threads(Noofthreads);
#pragma omp parallel for private(n) lastprivate(Sn)
  for (n = 1; n <= N; ++n) {
    Sn = origSn * pow(up, n);
    no_dependency_opt[n] = Sn;
  }
  Sn *= up;
  for (n = 0; n <= N; ++n) {
    if ((int)(opt[n]) == (int)(no_dependency_opt[n])) {
    } else {
      printf("%lf != %lf\n", opt[n], no_dependency_opt[n]);
      printf("\n\t\t Incorrect results found when Serial computation results & "
             "Parallel computation \n\t\twithout Dependency results are "
             "compared\n");
      break;
    }
  }
  printf("\n\t\t..............................................................."
         "...........\n");
  free(opt);
  free(dependency_opt);
  free(no_dependency_opt);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe65(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
je     1216 <main+0xa6>
lea    0xf13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x1,-0x48(%rbp)
je     1280 <main+0x110>
cmpl   $0x2,-0x48(%rbp)
je     1280 <main+0x110>
cmpl   $0x4,-0x48(%rbp)
je     1280 <main+0x110>
cmpl   $0x8,-0x48(%rbp)
je     1280 <main+0x110>
cmpl   $0x10,-0x48(%rbp)
je     1280 <main+0x110>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x48(%rbp),%esi
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%esi
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
movsd  0xd11(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jg     1339 <main+0x1c9>
movsd  -0x20(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xce7(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12fb <main+0x18b>
movsd  0xcbf(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x48(%rbp),%edi
call   1060 <omp_set_num_threads@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jg     1393 <main+0x223>
movsd  -0x20(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xc8d(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1355 <main+0x1e5>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jg     13f7 <main+0x287>
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jne    13d1 <main+0x261>
jp     13d1 <main+0x261>
jmp    13e4 <main+0x274>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13f7 <main+0x287>
jmp    13e9 <main+0x279>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    139a <main+0x22a>
movsd  0xc01(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%edi
call   1060 <omp_set_num_threads@plt>
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jg     1477 <main+0x307>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x44(%rbp),%edi
movsd  0xbc7(%rip),%xmm0
call   1070 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1420 <main+0x2b0>
movsd  0xb89(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jg     1511 <main+0x3a1>
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%eax
mov    -0x40(%rbp),%rcx
movslq -0x44(%rbp),%rdx
cvttsd2si (%rcx,%rdx,8),%ecx
cmp    %ecx,%eax
jne    14c3 <main+0x353>
jmp    14fe <main+0x38e>
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xd5a(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1511 <main+0x3a1>
jmp    1503 <main+0x393>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1490 <main+0x320>
lea    0xba3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0xe75(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf39(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x3,%r14d
jne    15d5 <main+0x455>
mov    0x10(%rbx),%rdi
call   1090 <atoi@plt>
mov    %rax,0x18(%rsp)
mov    0x8(%rbx),%rdi
call   1090 <atoi@plt>
cmp    $0x10,%eax
ja     15f9 <main+0x479>
mov    %eax,%r13d
mov    $0x10116,%eax
bt     %r13d,%eax
jae    15f9 <main+0x479>
lea    0xeb9(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeba(%rip),%rdi
mov    0x18(%rsp),%r14
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(,%r14,8),%ebp
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
test   %r14d,%r14d
js     1288 <main+0x108>
mov    %r14d,%eax
mov    %rax,0x10(%rsp)
lea    0x1(%rax),%rbp
mov    %ebp,%eax
and    $0x3,%eax
cmp    $0x3,%r14d
jae    1295 <main+0x115>
movsd  0xd7c(%rip),%xmm0
xor    %ecx,%ecx
jmp    12e4 <main+0x164>
mov    %r13d,%edi
call   1070 <omp_set_num_threads@plt>
jmp    13fa <main+0x27a>
mov    %ebp,%edx
and    $0xfffffffc,%edx
movsd  0xd5e(%rip),%xmm0
xor    %ecx,%ecx
movsd  0xd5c(%rip),%xmm1
nopl   0x0(%rax)
movsd  %xmm0,(%r12,%rcx,8)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r12,%rcx,8)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r12,%rcx,8)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%r12,%rcx,8)
mulsd  %xmm1,%xmm0
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    12b0 <main+0x130>
test   %rax,%rax
je     1312 <main+0x192>
lea    (%r12,%rcx,8),%rcx
xor    %edx,%edx
movsd  0xd11(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,(%rcx,%rdx,8)
mulsd  %xmm1,%xmm0
add    $0x1,%rdx
cmp    %rdx,%rax
jne    1300 <main+0x180>
mov    %r13d,%edi
call   1070 <omp_set_num_threads@plt>
test   %r14d,%r14d
js     13fa <main+0x27a>
mov    %ebp,%eax
and    $0x3,%eax
cmpl   $0x3,0x10(%rsp)
jae    133b <main+0x1bb>
movsd  0xcc9(%rip),%xmm0
xor    %ecx,%ecx
jmp    1390 <main+0x210>
mov    %ebp,%edx
and    $0xfffffffc,%edx
movsd  0xcb8(%rip),%xmm0
xor    %ecx,%ecx
movsd  0xcb6(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,(%rbx,%rcx,8)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rbx,%rcx,8)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rbx,%rcx,8)
mulsd  %xmm1,%xmm0
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    1360 <main+0x1e0>
test   %rax,%rax
je     13c2 <main+0x242>
lea    (%rbx,%rcx,8),%rcx
xor    %edx,%edx
movsd  0xc65(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,(%rcx,%rdx,8)
mulsd  %xmm1,%xmm0
add    $0x1,%rdx
cmp    %rdx,%rax
jne    13b0 <main+0x230>
test   %r14d,%r14d
js     13fa <main+0x27a>
lea    0x1(%r14),%eax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rax,8),%xmm0
ucomisd (%rbx,%rax,8),%xmm0
jne    1444 <main+0x2c4>
jp     1444 <main+0x2c4>
add    $0x1,%rax
cmp    %rax,%rbp
jne    13e0 <main+0x260>
jmp    1450 <main+0x2d0>
movabs $0x408f400000000000,%rax
40 8f 40
mov    %rax,(%r15)
mov    %r13d,%edi
call   1070 <omp_set_num_threads@plt>
lea    0xcf5(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd8c(%rip),%rdi
call   1040 <puts@plt>
movabs $0x408f400000000000,%rax
40 8f 40
mov    %rax,(%r15)
mov    %r13d,%edi
call   1070 <omp_set_num_threads@plt>
test   %r14d,%r14d
jle    1577 <main+0x3f7>
mov    %rbx,0x20(%rsp)
mov    0x8(%rsp),%rax
add    $0xfffffffffffffffe,%rax
mov    0x10(%rsp),%r14
mov    %r14d,%r13d
and    $0x3,%r13d
mov    $0x1,%ebp
cmp    $0x3,%rax
jb     153f <main+0x3bf>
and    $0xfffffffc,%r14d
mov    $0x1,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0xb50(%rip),%xmm0
mov    %ebp,%edi
call   1080 <pow@plt>
movsd  0xb39(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r15,%rbp,8)
lea    0x1(%rbp),%edi
movsd  0xb2c(%rip),%xmm0
call   1080 <pow@plt>
mulsd  0xb17(%rip),%xmm0
movsd  %xmm0,0x8(%r15,%rbp,8)
lea    0x2(%rbp),%edi
movsd  0xb0d(%rip),%xmm0
call   1080 <pow@plt>
mulsd  0xaf8(%rip),%xmm0
movsd  %xmm0,0x10(%r15,%rbp,8)
lea    0x3(%rbp),%edi
movsd  0xaee(%rip),%xmm0
call   1080 <pow@plt>
mulsd  0xad9(%rip),%xmm0
movsd  %xmm0,0x18(%r15,%rbp,8)
add    $0x4,%rbp
add    $0x4,%rbx
cmp    %r14,%rbx
jne    14b0 <main+0x330>
test   %r13,%r13
mov    0x18(%rsp),%r14
mov    0x20(%rsp),%rbx
je     1577 <main+0x3f7>
xchg   %ax,%ax
movsd  0xab0(%rip),%xmm0
mov    %ebp,%edi
call   1080 <pow@plt>
mulsd  0xa99(%rip),%xmm0
movsd  %xmm0,(%r15,%rbp,8)
add    $0x1,%rbp
add    $0xffffffffffffffff,%r13
jne    1550 <main+0x3d0>
test   %r14d,%r14d
mov    0x8(%rsp),%rsi
js     140f <main+0x28f>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%rax,8),%xmm0
cvttsd2si %xmm0,%ecx
movsd  (%r15,%rax,8),%xmm1
cvttsd2si %xmm1,%edx
cmp    %edx,%ecx
jne    15b6 <main+0x436>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1590 <main+0x410>
jmp    140f <main+0x28f>
lea    0xb42(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
lea    0xb8e(%rip),%rdi
call   1040 <puts@plt>
jmp    140f <main+0x28f>
lea    0xadf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcb2(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    0xc50(%rip),%rdi
jmp    15ea <main+0x46a>

LLVM IR (-O0):
@.str = [79 x i8] c"\0A\09\09---------------------------------------------------------------------------\00"
@.str.1 = [19 x i8] c"\0A\09\09 Email : RarchK\00"
@.str.2 = [73 x i8] c"\0A\09\09 Objective : OpenMP Program to demonstrate Loop-Carried Dependency \00"
@.str.3 = [79 x i8] c"\0A\09\09..........................................................................\0A\00"
@.str.4 = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.5 = [41 x i8] c"\09\09 Syntax : exec <Threads> <array-size>\0A\00"
@.str.6 = [77 x i8] c"\0A Number of threads should be 1,2,4,8 or 16 for the execution of program. \0A\0A\00"
@.str.7 = [18 x i8] c"\0A\09\09 Threads : %d \00"
@.str.8 = [26 x i8] c"\0A\09\09 Array Size : %d \0A \00"
@.str.9 = [122 x i8] c"\0A\09\09Incorrect results found when Serial computation results & Parallel computation\0A\09\09with Dependency results are compared\0A\00"
@.str.10 = [12 x i8] c"%lf != %lf\0A\00"
@.str.11 = [127 x i8] c"\0A\09\09 Incorrect results found when Serial computation results & Parallel computation \0A\09\09without Dependency results are compared\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.100000e+00, double* %6
store double 1.000000e+03, double* %8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 3
br i1 %21, label %22, label %26
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 @exit(i32 -1)
unreachable
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %14
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %13
%35 = load i32, i32* %13
%36 = icmp ne i32 %35, 1
br i1 %36, label %37, label %52
37: ; preds = %26
%38 = load i32, i32* %13
%39 = icmp ne i32 %38, 2
br i1 %39, label %40, label %52
40: ; preds = %37
%41 = load i32, i32* %13
%42 = icmp ne i32 %41, 4
br i1 %42, label %43, label %52
43: ; preds = %40
%44 = load i32, i32* %13
%45 = icmp ne i32 %44, 8
br i1 %45, label %46, label %52
46: ; preds = %43
%47 = load i32, i32* %13
%48 = icmp ne i32 %47, 16
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.6, i64 0, i64 0))
%51 = call i32 @exit(i32 -1)
unreachable
52: ; preds = %46, %43, %40, %37, %26
%53 = load i32, i32* %13
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %14
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %14
%58 = add nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = mul i64 %59, 8
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to double*
store double* %63, double** %9
%64 = load i32, i32* %14
%65 = add nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = mul i64 %66, 8
%68 = trunc i64 %67 to i32
%69 = call i64 @malloc(i32 %68)
%70 = inttoptr i64 %69 to double*
store double* %70, double** %10
%71 = load i32, i32* %14
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = mul i64 %73, 8
%75 = trunc i64 %74 to i32
%76 = call i64 @malloc(i32 %75)
%77 = inttoptr i64 %76 to double*
store double* %77, double** %11
store double 1.000000e+03, double* %7
store i32 0, i32* %12
br label %78
78: ; preds = %90, %52
%79 = load i32, i32* %12
%80 = load i32, i32* %14
%81 = icmp sle i32 %79, %80
br i1 %81, label %82, label %93
82: ; preds = %78
%83 = load double, double* %7
%84 = load double*, double** %9
%85 = load i32, i32* %12
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
store double %83, double* %87
%88 = load double, double* %7
%89 = fmul double %88, 1.100000e+00
store double %89, double* %7
br label %90
90: ; preds = %82
%91 = load i32, i32* %12
%92 = add nsw i32 %91, 1
store i32 %92, i32* %12
br label %78
93: ; preds = %78
store double 1.000000e+03, double* %7
%94 = load i32, i32* %13
%95 = call i32 @omp_set_num_threads(i32 %94)
store i32 0, i32* %12
br label %96
96: ; preds = %108, %93
%97 = load i32, i32* %12
%98 = load i32, i32* %14
%99 = icmp sle i32 %97, %98
br i1 %99, label %100, label %111
100: ; preds = %96
%101 = load double, double* %7
%102 = load double*, double** %10
%103 = load i32, i32* %12
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %102, i64 %104
store double %101, double* %105
%106 = load double, double* %7
%107 = fmul double %106, 1.100000e+00
store double %107, double* %7
br label %108
108: ; preds = %100
%109 = load i32, i32* %12
%110 = add nsw i32 %109, 1
store i32 %110, i32* %12
br label %96
111: ; preds = %96
store i32 0, i32* %12
br label %112
112: ; preds = %132, %111
%113 = load i32, i32* %12
%114 = load i32, i32* %14
%115 = icmp sle i32 %113, %114
br i1 %115, label %116, label %135
116: ; preds = %112
%117 = load double*, double** %9
%118 = load i32, i32* %12
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %117, i64 %119
%121 = load double, double* %120
%122 = load double*, double** %10
%123 = load i32, i32* %12
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double, double* %122, i64 %124
%126 = load double, double* %125
%127 = fcmp oeq double %121, %126
br i1 %127, label %128, label %129
128: ; preds = %116
br label %131
129: ; preds = %116
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.9, i64 0, i64 0))
br label %135
131: ; preds = %128
br label %132
132: ; preds = %131
%133 = load i32, i32* %12
%134 = add nsw i32 %133, 1
store i32 %134, i32* %12
br label %112
135: ; preds = %129, %112
store double 1.000000e+03, double* %7
%136 = load double, double* %8
%137 = load double*, double** %11
%138 = getelementptr inbounds double, double* %137, i64 0
store double %136, double* %138
%139 = load i32, i32* %13
%140 = call i32 @omp_set_num_threads(i32 %139)
store i32 1, i32* %12
br label %141
141: ; preds = %155, %135
%142 = load i32, i32* %12
%143 = load i32, i32* %14
%144 = icmp sle i32 %142, %143
br i1 %144, label %145, label %158
145: ; preds = %141
%146 = load double, double* %8
%147 = load i32, i32* %12
%148 = call double @pow(double 1.100000e+00, i32 %147)
%149 = fmul double %146, %148
store double %149, double* %7
%150 = load double, double* %7
%151 = load double*, double** %11
%152 = load i32, i32* %12
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %151, i64 %153
store double %150, double* %154
br label %155
155: ; preds = %145
%156 = load i32, i32* %12
%157 = add nsw i32 %156, 1
store i32 %157, i32* %12
br label %141
158: ; preds = %141
%159 = load double, double* %7
%160 = fmul double %159, 1.100000e+00
store double %160, double* %7
store i32 0, i32* %12
br label %161
161: ; preds = %194, %158
%162 = load i32, i32* %12
%163 = load i32, i32* %14
%164 = icmp sle i32 %162, %163
br i1 %164, label %165, label %197
165: ; preds = %161
%166 = load double*, double** %9
%167 = load i32, i32* %12
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds double, double* %166, i64 %168
%170 = load double, double* %169
%171 = fptosi double %170 to i32
%172 = load double*, double** %11
%173 = load i32, i32* %12
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = fptosi double %176 to i32
%178 = icmp eq i32 %171, %177
br i1 %178, label %179, label %180
179: ; preds = %165
br label %193
180: ; preds = %165
%181 = load double*, double** %9
%182 = load i32, i32* %12
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds double, double* %181, i64 %183
%185 = load double, double* %184
%186 = load double*, double** %11
%187 = load i32, i32* %12
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds double, double* %186, i64 %188
%190 = load double, double* %189
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), double %185, double %190)
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str.11, i64 0, i64 0))
br label %197
193: ; preds = %179
br label %194
194: ; preds = %193
%195 = load i32, i32* %12
%196 = add nsw i32 %195, 1
store i32 %196, i32* %12
br label %161
197: ; preds = %180, %161
%198 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0))
%199 = load double*, double** %9
%200 = call i32 @free(double* %199)
%201 = load double*, double** %10
%202 = call i32 @free(double* %201)
%203 = load double*, double** %11
%204 = call i32 @free(double* %203)
%205 = load i32, i32* %3
ret i32 %205
}

LLVM IR (-O2):
@.str = [79 x i8] c"\0A\09\09---------------------------------------------------------------------------\00"
@.str.1 = [19 x i8] c"\0A\09\09 Email : RarchK\00"
@.str.2 = [73 x i8] c"\0A\09\09 Objective : OpenMP Program to demonstrate Loop-Carried Dependency \00"
@.str.4 = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.7 = [18 x i8] c"\0A\09\09 Threads : %d \00"
@.str.8 = [26 x i8] c"\0A\09\09 Array Size : %d \0A \00"
@.str.10 = [12 x i8] c"%lf != %lf\0A\00"
@str.12 = [78 x i8] c"\0A\09\09..........................................................................\00"
@str.13 = [126 x i8] c"\0A\09\09 Incorrect results found when Serial computation results & Parallel computation \0A\09\09without Dependency results are compared\00"
@str.14 = [121 x i8] c"\0A\09\09Incorrect results found when Serial computation results & Parallel computation\0A\09\09with Dependency results are compared\00"
@str.15 = [76 x i8] c"\0A Number of threads should be 1,2,4,8 or 16 for the execution of program. \0A\00"
@str.16 = [40 x i8] c"\09\09 Syntax : exec <Threads> <array-size>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.12, i64 0, i64 0))
%8 = icmp eq i32 %0, 3
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.16, i64 0, i64 0))
%12 = tail call i32 @exit(i32 -1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
switch i32 %19, label %20 [
i32 16, label %23
i32 8, label %23
i32 4, label %23
i32 2, label %23
i32 1, label %23
]
20: ; preds = %13
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str.15, i64 0, i64 0))
%22 = tail call i32 @exit(i32 -1)
unreachable
23: ; preds = %13, %13, %13, %13, %13
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %19)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %16)
%26 = shl i32 %16, 3
%27 = add i32 %26, 8
%28 = tail call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to double*
%30 = tail call i64 @malloc(i32 %27)
%31 = inttoptr i64 %30 to double*
%32 = tail call i64 @malloc(i32 %27)
%33 = inttoptr i64 %32 to double*
%34 = icmp slt i32 %16, 0
br i1 %34, label %35, label %37
35: ; preds = %23
%36 = tail call i32 @omp_set_num_threads(i32 %19)
br label %130
37: ; preds = %23
%38 = add nuw i32 %16, 1
%39 = zext i32 %38 to i64
%40 = add nsw i64 %39, -1
%41 = and i64 %39, 3
%42 = icmp ult i64 %40, 3
br i1 %42, label %63, label %43
43: ; preds = %37
%44 = and i64 %39, 4294967292
br label %45
45: ; preds = %45, %43
%46 = phi i64 [ 0, %43 ], [ %60, %45 ]
%47 = phi double [ 1.000000e+03, %43 ], [ %59, %45 ]
%48 = phi i64 [ 0, %43 ], [ %61, %45 ]
%49 = getelementptr inbounds double, double* %29, i64 %46
store double %47, double* %49
%50 = fmul double %47, 1.100000e+00
%51 = or i64 %46, 1
%52 = getelementptr inbounds double, double* %29, i64 %51
store double %50, double* %52
%53 = fmul double %50, 1.100000e+00
%54 = or i64 %46, 2
%55 = getelementptr inbounds double, double* %29, i64 %54
store double %53, double* %55
%56 = fmul double %53, 1.100000e+00
%57 = or i64 %46, 3
%58 = getelementptr inbounds double, double* %29, i64 %57
store double %56, double* %58
%59 = fmul double %56, 1.100000e+00
%60 = add nuw nsw i64 %46, 4
%61 = add i64 %48, 4
%62 = icmp eq i64 %61, %44
br i1 %62, label %63, label %45
63: ; preds = %45, %37
%64 = phi i64 [ 0, %37 ], [ %60, %45 ]
%65 = phi double [ 1.000000e+03, %37 ], [ %59, %45 ]
%66 = icmp eq i64 %41, 0
br i1 %66, label %76, label %67
67: ; preds = %63, %67
%68 = phi i64 [ %73, %67 ], [ %64, %63 ]
%69 = phi double [ %72, %67 ], [ %65, %63 ]
%70 = phi i64 [ %74, %67 ], [ 0, %63 ]
%71 = getelementptr inbounds double, double* %29, i64 %68
store double %69, double* %71
%72 = fmul double %69, 1.100000e+00
%73 = add nuw nsw i64 %68, 1
%74 = add i64 %70, 1
%75 = icmp eq i64 %74, %41
br i1 %75, label %76, label %67
76: ; preds = %67, %63
%77 = tail call i32 @omp_set_num_threads(i32 %19)
br i1 %34, label %130, label %78
78: ; preds = %76
%79 = and i64 %39, 3
%80 = icmp ult i64 %40, 3
br i1 %80, label %83, label %81
81: ; preds = %78
%82 = and i64 %39, 4294967292
br label %100
83: ; preds = %100, %78
%84 = phi i64 [ 0, %78 ], [ %115, %100 ]
%85 = phi double [ 1.000000e+03, %78 ], [ %114, %100 ]
%86 = icmp eq i64 %79, 0
br i1 %86, label %96, label %87
87: ; preds = %83, %87
%88 = phi i64 [ %93, %87 ], [ %84, %83 ]
%89 = phi double [ %92, %87 ], [ %85, %83 ]
%90 = phi i64 [ %94, %87 ], [ 0, %83 ]
%91 = getelementptr inbounds double, double* %31, i64 %88
store double %89, double* %91
%92 = fmul double %89, 1.100000e+00
%93 = add nuw nsw i64 %88, 1
%94 = add i64 %90, 1
%95 = icmp eq i64 %94, %79
br i1 %95, label %96, label %87
96: ; preds = %87, %83
br i1 %34, label %130, label %97
97: ; preds = %96
%98 = add nuw i32 %16, 1
%99 = zext i32 %98 to i64
br label %121
100: ; preds = %100, %81
%101 = phi i64 [ 0, %81 ], [ %115, %100 ]
%102 = phi double [ 1.000000e+03, %81 ], [ %114, %100 ]
%103 = phi i64 [ 0, %81 ], [ %116, %100 ]
%104 = getelementptr inbounds double, double* %31, i64 %101
store double %102, double* %104
%105 = fmul double %102, 1.100000e+00
%106 = or i64 %101, 1
%107 = getelementptr inbounds double, double* %31, i64 %106
store double %105, double* %107
%108 = fmul double %105, 1.100000e+00
%109 = or i64 %101, 2
%110 = getelementptr inbounds double, double* %31, i64 %109
store double %108, double* %110
%111 = fmul double %108, 1.100000e+00
%112 = or i64 %101, 3
%113 = getelementptr inbounds double, double* %31, i64 %112
store double %111, double* %113
%114 = fmul double %111, 1.100000e+00
%115 = add nuw nsw i64 %101, 4
%116 = add i64 %103, 4
%117 = icmp eq i64 %116, %82
br i1 %117, label %83, label %100
118: ; preds = %121
%119 = add nuw nsw i64 %122, 1
%120 = icmp eq i64 %119, %99
br i1 %120, label %132, label %121
121: ; preds = %97, %118
%122 = phi i64 [ 0, %97 ], [ %119, %118 ]
%123 = getelementptr inbounds double, double* %29, i64 %122
%124 = load double, double* %123
%125 = getelementptr inbounds double, double* %31, i64 %122
%126 = load double, double* %125
%127 = fcmp oeq double %124, %126
br i1 %127, label %118, label %128
128: ; preds = %121
%129 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([121 x i8], [121 x i8]* @str.14, i64 0, i64 0))
br label %132
130: ; preds = %76, %35, %96
store double 1.000000e+03, double* %33
%131 = tail call i32 @omp_set_num_threads(i32 %19)
br label %198
132: ; preds = %118, %128
store double 1.000000e+03, double* %33
%133 = tail call i32 @omp_set_num_threads(i32 %19)
%134 = icmp slt i32 %16, 1
br i1 %134, label %154, label %135
135: ; preds = %132
%136 = add nsw i64 %99, -2
%137 = and i64 %40, 3
%138 = icmp ult i64 %136, 3
br i1 %138, label %141, label %139
139: ; preds = %135
%140 = and i64 %40, -4
br label %158
141: ; preds = %158, %135
%142 = phi i64 [ 1, %135 ], [ %180, %158 ]
%143 = icmp eq i64 %137, 0
br i1 %143, label %154, label %144
144: ; preds = %141, %144
%145 = phi i64 [ %151, %144 ], [ %142, %141 ]
%146 = phi i64 [ %152, %144 ], [ 0, %141 ]
%147 = trunc i64 %145 to i32
%148 = tail call double @pow(double 1.100000e+00, i32 %147)
%149 = fmul double %148, 1.000000e+03
%150 = getelementptr inbounds double, double* %33, i64 %145
store double %149, double* %150
%151 = add nuw nsw i64 %145, 1
%152 = add i64 %146, 1
%153 = icmp eq i64 %152, %137
br i1 %153, label %154, label %144
154: ; preds = %141, %144, %132
br i1 %34, label %198, label %155
155: ; preds = %154
%156 = add nuw i32 %16, 1
%157 = zext i32 %156 to i64
br label %186
158: ; preds = %158, %139
%159 = phi i64 [ 1, %139 ], [ %180, %158 ]
%160 = phi i64 [ 0, %139 ], [ %181, %158 ]
%161 = trunc i64 %159 to i32
%162 = tail call double @pow(double 1.100000e+00, i32 %161)
%163 = fmul double %162, 1.000000e+03
%164 = getelementptr inbounds double, double* %33, i64 %159
store double %163, double* %164
%165 = add nuw nsw i64 %159, 1
%166 = trunc i64 %165 to i32
%167 = tail call double @pow(double 1.100000e+00, i32 %166)
%168 = fmul double %167, 1.000000e+03
%169 = getelementptr inbounds double, double* %33, i64 %165
store double %168, double* %169
%170 = add nuw nsw i64 %159, 2
%171 = trunc i64 %170 to i32
%172 = tail call double @pow(double 1.100000e+00, i32 %171)
%173 = fmul double %172, 1.000000e+03
%174 = getelementptr inbounds double, double* %33, i64 %170
store double %173, double* %174
%175 = add nuw nsw i64 %159, 3
%176 = trunc i64 %175 to i32
%177 = tail call double @pow(double 1.100000e+00, i32 %176)
%178 = fmul double %177, 1.000000e+03
%179 = getelementptr inbounds double, double* %33, i64 %175
store double %178, double* %179
%180 = add nuw nsw i64 %159, 4
%181 = add i64 %160, 4
%182 = icmp eq i64 %181, %140
br i1 %182, label %141, label %158
183: ; preds = %186
%184 = add nuw nsw i64 %187, 1
%185 = icmp eq i64 %184, %157
br i1 %185, label %198, label %186
186: ; preds = %155, %183
%187 = phi i64 [ 0, %155 ], [ %184, %183 ]
%188 = getelementptr inbounds double, double* %29, i64 %187
%189 = load double, double* %188
%190 = fptosi double %189 to i32
%191 = getelementptr inbounds double, double* %33, i64 %187
%192 = load double, double* %191
%193 = fptosi double %192 to i32
%194 = icmp eq i32 %190, %193
br i1 %194, label %183, label %195
195: ; preds = %186
%196 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), double %189, double %192)
%197 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([126 x i8], [126 x i8]* @str.13, i64 0, i64 0))
br label %198
198: ; preds = %183, %130, %154, %195
%199 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.12, i64 0, i64 0))
%200 = tail call i32 @free(double* %29)
%201 = tail call i32 @free(double* %31)
%202 = tail call i32 @free(double* %33)
ret i32 0
}