#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 /*<<< orphan*/ FILE;

/* Variables and functions */
double Matrix_Multiplication_Three(double **, double **, double **, int, int);
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(double **);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
main(int argc, char *argv[]) {
  int CLASS_SIZE, N_size, i, j, k, Total_threads, THREADS;
  double Total_overhead = 0.0;
  double **Matrix_A, **Matrix_B, **Result;
  double memoryused = 0.0;
  int iteration;
  FILE *fp;
  char *CLASS;
  printf("\n\t\t---------------------------------------------------------------"
         "------------");
  printf("\n\t\t Email : RarchK");
  printf("\n\t\t---------------------------------------------------------------"
         "------------");
  printf("\n\t\t Objective : Dense Matrix Computations (Floating Point "
         "Operations)\n ");
  printf("\n\t\t Matrix into Matrix Multiplication using ");
  printf("\n\t\t OpenMP three PARALLEL for directive and Private Clause;");
  printf("\n\t\t..............................................................."
         "...........\n");
  if (argc != 3) {
    printf("\t\t Very Few Arguments\n ");
    printf("\t\t Syntax : exec <Class-Size> <Threads>\n");
    printf("\t\t Where : Class-Size must be A or B or C \n");
    exit(-1);
  } else {
    CLASS = argv[1];
    THREADS = atoi(argv[2]);
  }
  if (strcmp(CLASS, "A") == 0) {
    CLASS_SIZE = 1024;
  } else if (strcmp(CLASS, "B") == 0) {
    CLASS_SIZE = 2048;
  } else if (strcmp(CLASS, "C") == 0) {
    CLASS_SIZE = 4096;
  } else {
    printf("\n\t\t Class-Size must be A or B or C \n");
    exit(-1);
  }
  N_size = CLASS_SIZE;
  Total_threads = THREADS;
  printf("\n\t\t Matrix Size :  %d", N_size);
  printf("\n\t\t Threads     :  %d", Total_threads);
  printf("\n");
  Matrix_A = (double **)malloc(sizeof(double *) * N_size);
  for (i = 0; i < N_size; i++) {
    Matrix_A[i] = (double *)malloc(sizeof(double) * N_size);
    for (j = 0; j < N_size; j++) {
      Matrix_A[i][j] = i + j;
    }
  }
  Matrix_B = (double **)malloc(sizeof(double *) * N_size);
  for (i = 0; i < N_size; i++) {
    Matrix_B[i] = (double *)malloc(sizeof(double) * N_size);
    for (j = 0; j < N_size; j++) {
      Matrix_B[i][j] = i + j;
    }
  }
  Result = (double **)malloc(sizeof(double *) * N_size);
  for (i = 0; i < N_size; i++)
    Result[i] = (double *)malloc(sizeof(double) * N_size);
  memoryused = (3 * (N_size * N_size)) * sizeof(double);
  Total_overhead = Matrix_Multiplication_Three(Matrix_A, Matrix_B, Result,
                                               N_size, Total_threads);
  printf("\n\t\t Memory Utilized            : %lf MB \n",
         (memoryused / (1024 * 1024)));
  printf("\n\t\t Time in Seconds (T)        : %lf Seconds \n", Total_overhead);
  printf("\n\t\t   ( T represents the Time taken for the computation )");
  printf("\n\t\t..............................................................."
         "...........\n");
  free(Matrix_A);
  free(Matrix_B);
  free(Result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf05(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
je     1236 <main+0xc6>
lea    0xf89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xfae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x70(%rbp),%rdi
lea    0xfa2(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1278 <main+0x108>
movl   $0x400,-0x14(%rbp)
jmp    12e6 <main+0x176>
mov    -0x70(%rbp),%rdi
lea    0xf7e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    129e <main+0x12e>
movl   $0x800,-0x14(%rbp)
jmp    12e1 <main+0x171>
mov    -0x70(%rbp),%rdi
lea    0xf5a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12c4 <main+0x154>
movl   $0x1000,-0x14(%rbp)
jmp    12dc <main+0x16c>
lea    0xf3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
jmp    12e1 <main+0x171>
jmp    12e6 <main+0x176>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%esi
lea    0xf2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xf33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    13b9 <main+0x249>
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    13a6 <main+0x236>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
cvtsi2sd %eax,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    136d <main+0x1fd>
jmp    13ab <main+0x23b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    133c <main+0x1cc>
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1450 <main+0x2e0>
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x48(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    143d <main+0x2cd>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
cvtsi2sd %eax,%xmm0
mov    -0x48(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1404 <main+0x294>
jmp    1442 <main+0x2d2>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13d3 <main+0x263>
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    14a2 <main+0x332>
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x50(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    146a <main+0x2fa>
mov    -0x18(%rbp),%ecx
imul   %ecx,%ecx
mov    %ecx,%eax
lea    (%rax,%rax,2),%eax
cltq
shl    $0x3,%rax
movq   %rax,%xmm0
movaps 0xb51(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xb55(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x28(%rbp),%r8d
call   1070 <Matrix_Multiplication_Three@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  0xaf7(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd42(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xd59(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0xe7d(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf0f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x103e(%rip),%rdi
call   1050 <puts@plt>
cmp    $0x3,%r14d
jne    14bc <main+0x32c>
mov    0x8(%rbx),%rbp
mov    0x10(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
lea    0xf2f(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     126a <main+0xda>
lea    0xf1d(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1271 <main+0xe1>
lea    0xf0b(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strcmp@plt>
mov    $0x1000,%ebp
test   %rax,%rax
je     1276 <main+0xe6>
lea    0xfb3(%rip),%rdi
jmp    14dd <main+0x34d>
mov    $0x400,%ebp
jmp    1276 <main+0xe6>
mov    $0x800,%ebp
lea    0xedc(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %r14d,0x8(%rsp)
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0x0(,%rbp,8),%r14d
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    %ebp,%ebp
nopl   (%rax)
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,(%r15,%rbx,8)
movq   %rbx,%xmm0
pshufd $0x44,%xmm0,%xmm0
lea    0x2(%rbx),%rcx
movq   %rcx,%xmm1
pshufd $0x44,%xmm1,%xmm1
xor    %ecx,%ecx
movdqa 0xd12(%rip),%xmm2
movdqa 0xd1a(%rip),%xmm5
cs nopw 0x0(%rax,%rax,1)
movdqa %xmm2,%xmm3
paddq  %xmm0,%xmm3
movdqa %xmm1,%xmm4
paddq  %xmm2,%xmm4
pshufd $0xe8,%xmm3,%xmm3
cvtdq2pd %xmm3,%xmm3
pshufd $0xe8,%xmm4,%xmm4
cvtdq2pd %xmm4,%xmm4
movups %xmm3,(%rax,%rcx,8)
movups %xmm4,0x10(%rax,%rcx,8)
add    $0x4,%rcx
paddq  %xmm5,%xmm2
cmp    %rcx,%rbp
jne    1300 <main+0x170>
add    $0x1,%rbx
cmp    %rbp,%rbx
jne    12c0 <main+0x130>
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,(%r12,%rbx,8)
movq   %rbx,%xmm0
pshufd $0x44,%xmm0,%xmm0
lea    0x2(%rbx),%rcx
movq   %rcx,%xmm1
pshufd $0x44,%xmm1,%xmm1
xor    %ecx,%ecx
movdqa 0xc72(%rip),%xmm2
movdqa 0xc7a(%rip),%xmm5
cs nopw 0x0(%rax,%rax,1)
movdqa %xmm2,%xmm3
paddq  %xmm0,%xmm3
movdqa %xmm1,%xmm4
paddq  %xmm2,%xmm4
pshufd $0xe8,%xmm3,%xmm3
cvtdq2pd %xmm3,%xmm3
pshufd $0xe8,%xmm4,%xmm4
cvtdq2pd %xmm4,%xmm4
movups %xmm3,(%rax,%rcx,8)
movups %xmm4,0x10(%rax,%rcx,8)
add    $0x4,%rcx
paddq  %xmm5,%xmm2
cmp    %rcx,%rbp
jne    13a0 <main+0x210>
add    $0x1,%rbx
cmp    %rbp,%rbx
jne    1360 <main+0x1d0>
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,0x0(%r13,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1400 <main+0x270>
mov    %ebp,%eax
imul   %eax,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
mov    0x8(%rsp),%r8d
call   1090 <Matrix_Multiplication_Three@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xbc9(%rip),%xmm0
lea    0xd27(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xd43(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xd5e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdae(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc78(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdb9(%rip),%rdi
call   1050 <puts@plt>
lea    0xdd5(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>

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 = [72 x i8] c"\0A\09\09 Objective : Dense Matrix Computations (Floating Point Operations)\0A \00"
@.str.3 = [45 x i8] c"\0A\09\09 Matrix into Matrix Multiplication using \00"
@.str.4 = [60 x i8] c"\0A\09\09 OpenMP three PARALLEL for directive and Private Clause;\00"
@.str.5 = [79 x i8] c"\0A\09\09..........................................................................\0A\00"
@.str.6 = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.7 = [41 x i8] c"\09\09 Syntax : exec <Class-Size> <Threads>\0A\00"
@.str.8 = [44 x i8] c"\09\09 Where : Class-Size must be A or B or C \0A\00"
@.str.9 = [2 x i8] c"A\00"
@.str.10 = [2 x i8] c"B\00"
@.str.11 = [2 x i8] c"C\00"
@.str.12 = [37 x i8] c"\0A\09\09 Class-Size must be A or B or C \0A\00"
@.str.13 = [22 x i8] c"\0A\09\09 Matrix Size : %d\00"
@.str.14 = [22 x i8] c"\0A\09\09 Threads : %d\00"
@.str.15 = [2 x i8] c"\0A\00"
@.str.16 = [42 x i8] c"\0A\09\09 Memory Utilized : %lf MB \0A\00"
@.str.17 = [47 x i8] c"\0A\09\09 Time in Seconds (T) : %lf Seconds \0A\00"
@.str.18 = [58 x i8] c"\0A\09\09 ( T represents the Time taken for the computation )\00"
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
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double**
%15 = alloca double**
%16 = alloca double**
%17 = alloca double
%18 = alloca i32
%19 = alloca i32*
%20 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %17
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.5, i64 0, i64 0))
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 3
br i1 %29, label %30, label %35
30: ; preds = %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
%34 = call i32 @exit(i32 -1)
unreachable
35: ; preds = %2
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
store i8* %38, i8** %20
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %12
br label %43
43: ; preds = %35
%44 = load i8*, i8** %20
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %43
store i32 1024, i32* %6
br label %63
48: ; preds = %43
%49 = load i8*, i8** %20
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %48
store i32 2048, i32* %6
br label %62
53: ; preds = %48
%54 = load i8*, i8** %20
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %53
store i32 4096, i32* %6
br label %61
58: ; preds = %53
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0))
%60 = call i32 @exit(i32 -1)
unreachable
61: ; preds = %57
br label %62
62: ; preds = %61, %52
br label %63
63: ; preds = %62, %47
%64 = load i32, i32* %6
store i32 %64, i32* %7
%65 = load i32, i32* %12
store i32 %65, i32* %11
%66 = load i32, i32* %7
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %11
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i32 %68)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%71 = load i32, i32* %7
%72 = sext i32 %71 to i64
%73 = mul i64 8, %72
%74 = trunc i64 %73 to i32
%75 = call i64 @malloc(i32 %74)
%76 = inttoptr i64 %75 to double**
store double** %76, double*** %14
store i32 0, i32* %8
br label %77
77: ; preds = %113, %63
%78 = load i32, i32* %8
%79 = load i32, i32* %7
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %116
81: ; preds = %77
%82 = load i32, i32* %7
%83 = sext i32 %82 to i64
%84 = mul i64 8, %83
%85 = trunc i64 %84 to i32
%86 = call i64 @malloc(i32 %85)
%87 = inttoptr i64 %86 to double*
%88 = load double**, double*** %14
%89 = load i32, i32* %8
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double*, double** %88, i64 %90
store double* %87, double** %91
store i32 0, i32* %9
br label %92
92: ; preds = %109, %81
%93 = load i32, i32* %9
%94 = load i32, i32* %7
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %112
96: ; preds = %92
%97 = load i32, i32* %8
%98 = load i32, i32* %9
%99 = add nsw i32 %97, %98
%100 = sitofp i32 %99 to double
%101 = load double**, double*** %14
%102 = load i32, i32* %8
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double*, double** %101, i64 %103
%105 = load double*, double** %104
%106 = load i32, i32* %9
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %105, i64 %107
store double %100, double* %108
br label %109
109: ; preds = %96
%110 = load i32, i32* %9
%111 = add nsw i32 %110, 1
store i32 %111, i32* %9
br label %92
112: ; preds = %92
br label %113
113: ; preds = %112
%114 = load i32, i32* %8
%115 = add nsw i32 %114, 1
store i32 %115, i32* %8
br label %77
116: ; preds = %77
%117 = load i32, i32* %7
%118 = sext i32 %117 to i64
%119 = mul i64 8, %118
%120 = trunc i64 %119 to i32
%121 = call i64 @malloc(i32 %120)
%122 = inttoptr i64 %121 to double**
store double** %122, double*** %15
store i32 0, i32* %8
br label %123
123: ; preds = %159, %116
%124 = load i32, i32* %8
%125 = load i32, i32* %7
%126 = icmp slt i32 %124, %125
br i1 %126, label %127, label %162
127: ; preds = %123
%128 = load i32, i32* %7
%129 = sext i32 %128 to i64
%130 = mul i64 8, %129
%131 = trunc i64 %130 to i32
%132 = call i64 @malloc(i32 %131)
%133 = inttoptr i64 %132 to double*
%134 = load double**, double*** %15
%135 = load i32, i32* %8
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double*, double** %134, i64 %136
store double* %133, double** %137
store i32 0, i32* %9
br label %138
138: ; preds = %155, %127
%139 = load i32, i32* %9
%140 = load i32, i32* %7
%141 = icmp slt i32 %139, %140
br i1 %141, label %142, label %158
142: ; preds = %138
%143 = load i32, i32* %8
%144 = load i32, i32* %9
%145 = add nsw i32 %143, %144
%146 = sitofp i32 %145 to double
%147 = load double**, double*** %15
%148 = load i32, i32* %8
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds double*, double** %147, i64 %149
%151 = load double*, double** %150
%152 = load i32, i32* %9
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %151, i64 %153
store double %146, double* %154
br label %155
155: ; preds = %142
%156 = load i32, i32* %9
%157 = add nsw i32 %156, 1
store i32 %157, i32* %9
br label %138
158: ; preds = %138
br label %159
159: ; preds = %158
%160 = load i32, i32* %8
%161 = add nsw i32 %160, 1
store i32 %161, i32* %8
br label %123
162: ; preds = %123
%163 = load i32, i32* %7
%164 = sext i32 %163 to i64
%165 = mul i64 8, %164
%166 = trunc i64 %165 to i32
%167 = call i64 @malloc(i32 %166)
%168 = inttoptr i64 %167 to double**
store double** %168, double*** %16
store i32 0, i32* %8
br label %169
169: ; preds = %184, %162
%170 = load i32, i32* %8
%171 = load i32, i32* %7
%172 = icmp slt i32 %170, %171
br i1 %172, label %173, label %187
173: ; preds = %169
%174 = load i32, i32* %7
%175 = sext i32 %174 to i64
%176 = mul i64 8, %175
%177 = trunc i64 %176 to i32
%178 = call i64 @malloc(i32 %177)
%179 = inttoptr i64 %178 to double*
%180 = load double**, double*** %16
%181 = load i32, i32* %8
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds double*, double** %180, i64 %182
store double* %179, double** %183
br label %184
184: ; preds = %173
%185 = load i32, i32* %8
%186 = add nsw i32 %185, 1
store i32 %186, i32* %8
br label %169
187: ; preds = %169
%188 = load i32, i32* %7
%189 = load i32, i32* %7
%190 = mul nsw i32 %188, %189
%191 = mul nsw i32 3, %190
%192 = sext i32 %191 to i64
%193 = mul i64 %192, 8
%194 = uitofp i64 %193 to double
store double %194, double* %17
%195 = load double**, double*** %14
%196 = load double**, double*** %15
%197 = load double**, double*** %16
%198 = load i32, i32* %7
%199 = load i32, i32* %11
%200 = call double @Matrix_Multiplication_Three(double** %195, double** %196, double** %197, i32 %198, i32 %199)
store double %200, double* %13
%201 = load double, double* %17
%202 = fdiv double %201, 0x4130000000000000
%203 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.16, i64 0, i64 0), double %202)
%204 = load double, double* %13
%205 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.17, i64 0, i64 0), double %204)
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.18, i64 0, i64 0))
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.5, i64 0, i64 0))
%208 = load double**, double*** %14
%209 = call i32 @free(double** %208)
%210 = load double**, double*** %15
%211 = call i32 @free(double** %210)
%212 = load double**, double*** %16
%213 = call i32 @free(double** %212)
%214 = load i32, i32* %3
ret i32 %214
}

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 = [72 x i8] c"\0A\09\09 Objective : Dense Matrix Computations (Floating Point Operations)\0A \00"
@.str.3 = [45 x i8] c"\0A\09\09 Matrix into Matrix Multiplication using \00"
@.str.4 = [60 x i8] c"\0A\09\09 OpenMP three PARALLEL for directive and Private Clause;\00"
@.str.6 = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.9 = [2 x i8] c"A\00"
@.str.10 = [2 x i8] c"B\00"
@.str.11 = [2 x i8] c"C\00"
@.str.13 = [22 x i8] c"\0A\09\09 Matrix Size : %d\00"
@.str.14 = [22 x i8] c"\0A\09\09 Threads : %d\00"
@.str.16 = [42 x i8] c"\0A\09\09 Memory Utilized : %lf MB \0A\00"
@.str.17 = [47 x i8] c"\0A\09\09 Time in Seconds (T) : %lf Seconds \0A\00"
@.str.18 = [58 x i8] c"\0A\09\09 ( T represents the Time taken for the computation )\00"
@str.19 = [36 x i8] c"\0A\09\09 Class-Size must be A or B or C \00"
@str.20 = [78 x i8] c"\0A\09\09..........................................................................\00"
@str.21 = [40 x i8] c"\09\09 Syntax : exec <Class-Size> <Threads>\00"
@str.22 = [43 x i8] c"\09\09 Where : Class-Size must be A or B or C \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 ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.20, i64 0, i64 0))
%10 = icmp eq i32 %0, 3
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.21, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.22, i64 0, i64 0))
%15 = tail call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %33, label %24
24: ; preds = %16
%25 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %24
%28 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.19, i64 0, i64 0))
%32 = tail call i32 @exit(i32 -1)
unreachable
33: ; preds = %27, %24, %16
%34 = phi i32 [ 1024, %16 ], [ 2048, %24 ], [ 4096, %27 ]
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0), i32 %34)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i32 %21)
%37 = tail call i32 @putchar(i32 10)
%38 = shl nuw nsw i32 %34, 3
%39 = tail call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to double**
%41 = zext i32 %34 to i64
br label %42
42: ; preds = %33, %68
%43 = phi i64 [ 0, %33 ], [ %69, %68 ]
%44 = tail call i64 @malloc(i32 %38)
%45 = inttoptr i64 %44 to double*
%46 = getelementptr inbounds double*, double** %40, i64 %43
store double* %45, double** %46
%47 = insertelement <2 x i64> poison, i64 %43, i64 0
%48 = shufflevector <2 x i64> %47, <2 x i64> poison, <2 x i32> zeroinitializer
%49 = add nuw i64 %43, 2
%50 = insertelement <2 x i64> poison, i64 %49, i64 0
%51 = shufflevector <2 x i64> %50, <2 x i64> poison, <2 x i32> zeroinitializer
br label %52
52: ; preds = %52, %42
%53 = phi i64 [ 0, %42 ], [ %65, %52 ]
%54 = phi <2 x i64> [ <i64 0, i64 1>, %42 ], [ %66, %52 ]
%55 = add nuw nsw <2 x i64> %54, %48
%56 = add <2 x i64> %51, %54
%57 = trunc <2 x i64> %55 to <2 x i32>
%58 = trunc <2 x i64> %56 to <2 x i32>
%59 = sitofp <2 x i32> %57 to <2 x double>
%60 = sitofp <2 x i32> %58 to <2 x double>
%61 = getelementptr inbounds double, double* %45, i64 %53
%62 = bitcast double* %61 to <2 x double>*
store <2 x double> %59, <2 x double>* %62
%63 = getelementptr inbounds double, double* %61, i64 2
%64 = bitcast double* %63 to <2 x double>*
store <2 x double> %60, <2 x double>* %64
%65 = add nuw i64 %53, 4
%66 = add <2 x i64> %54, <i64 4, i64 4>
%67 = icmp eq i64 %65, %41
br i1 %67, label %68, label %52
68: ; preds = %52
%69 = add nuw nsw i64 %43, 1
%70 = icmp eq i64 %69, %41
br i1 %70, label %71, label %42
71: ; preds = %68
%72 = tail call i64 @malloc(i32 %38)
%73 = inttoptr i64 %72 to double**
br label %74
74: ; preds = %71, %100
%75 = phi i64 [ 0, %71 ], [ %101, %100 ]
%76 = tail call i64 @malloc(i32 %38)
%77 = inttoptr i64 %76 to double*
%78 = getelementptr inbounds double*, double** %73, i64 %75
store double* %77, double** %78
%79 = insertelement <2 x i64> poison, i64 %75, i64 0
%80 = shufflevector <2 x i64> %79, <2 x i64> poison, <2 x i32> zeroinitializer
%81 = add nuw i64 %75, 2
%82 = insertelement <2 x i64> poison, i64 %81, i64 0
%83 = shufflevector <2 x i64> %82, <2 x i64> poison, <2 x i32> zeroinitializer
br label %84
84: ; preds = %84, %74
%85 = phi i64 [ 0, %74 ], [ %97, %84 ]
%86 = phi <2 x i64> [ <i64 0, i64 1>, %74 ], [ %98, %84 ]
%87 = add nuw nsw <2 x i64> %86, %80
%88 = add <2 x i64> %83, %86
%89 = trunc <2 x i64> %87 to <2 x i32>
%90 = trunc <2 x i64> %88 to <2 x i32>
%91 = sitofp <2 x i32> %89 to <2 x double>
%92 = sitofp <2 x i32> %90 to <2 x double>
%93 = getelementptr inbounds double, double* %77, i64 %85
%94 = bitcast double* %93 to <2 x double>*
store <2 x double> %91, <2 x double>* %94
%95 = getelementptr inbounds double, double* %93, i64 2
%96 = bitcast double* %95 to <2 x double>*
store <2 x double> %92, <2 x double>* %96
%97 = add nuw i64 %85, 4
%98 = add <2 x i64> %86, <i64 4, i64 4>
%99 = icmp eq i64 %97, %41
br i1 %99, label %100, label %84
100: ; preds = %84
%101 = add nuw nsw i64 %75, 1
%102 = icmp eq i64 %101, %41
br i1 %102, label %103, label %74
103: ; preds = %100
%104 = tail call i64 @malloc(i32 %38)
%105 = inttoptr i64 %104 to double**
br label %106
106: ; preds = %103, %106
%107 = phi i64 [ 0, %103 ], [ %111, %106 ]
%108 = tail call i64 @malloc(i32 %38)
%109 = inttoptr i64 %108 to double*
%110 = getelementptr inbounds double*, double** %105, i64 %107
store double* %109, double** %110
%111 = add nuw nsw i64 %107, 1
%112 = icmp eq i64 %111, %41
br i1 %112, label %113, label %106
113: ; preds = %106
%114 = mul nuw nsw i32 %34, 24
%115 = mul nuw i32 %114, %34
%116 = uitofp i32 %115 to double
%117 = tail call double @Matrix_Multiplication_Three(double** %40, double** %73, double** %105, i32 %34, i32 %21)
%118 = fmul double %116, 0x3EB0000000000000
%119 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.16, i64 0, i64 0), double %118)
%120 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.17, i64 0, i64 0), double %117)
%121 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.18, i64 0, i64 0))
%122 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.20, i64 0, i64 0))
%123 = tail call i32 @free(double** %40)
%124 = tail call i32 @free(double** %73)
%125 = tail call i32 @free(double** %105)
ret i32 0
}