#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*/ dgemm_(char *, char *, int *, int *, int *, double *,
                          double *, int *, double *, int *, double *, double *,
                          int *);
int round(int);
void ParallelVectorMatrixT(double *m1, int size, double *m2, double *result,
                           int numThreads) {
  int i;
  char transN = 'N';
  char transY = 'T';
  int aux = 1;
  double aux2 = 0;
  double factor = 1.0;
#pragma omp parallel default(shared) private(i)
  {
#pragma omp for schedule(static)
    for (i = 0; i < numThreads; i++) {
      int InitCol = round(i * size / numThreads);
      int FinalCol = round((i + 1) * size / numThreads) - 1;
      int lenghtCol = FinalCol - InitCol + 1;
      if (lenghtCol > 0) {
        dgemm_(&transN, &transN, &(lenghtCol), &(aux), &(size), &factor,
               &m2[InitCol], &(size), m1, &size, &aux2, &result[InitCol],
               &(size));
      }
    }
  }
}


x86 assembly (clang, -O0):
<ParallelVectorMatrixT>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
movb   $0x4e,-0x39(%rbp)
movb   $0x54,-0x3a(%rbp)
movl   $0x1,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xea0(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1238 <ParallelVectorMatrixT+0x118>
mov    -0x38(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltd
idivl  -0x34(%rbp)
mov    %eax,%edi
call   1040 <round@plt>
mov    %eax,-0x54(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
imul   -0x1c(%rbp),%eax
cltd
idivl  -0x34(%rbp)
mov    %eax,%edi
call   1040 <round@plt>
sub    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
sub    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
jle    1225 <ParallelVectorMatrixT+0x105>
mov    -0x28(%rbp),%r14
movslq -0x54(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r14
mov    -0x18(%rbp),%rbx
mov    -0x30(%rbp),%r10
movslq -0x54(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r10
lea    -0x39(%rbp),%rsi
lea    -0x5c(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    -0x1c(%rbp),%rax
lea    -0x50(%rbp),%r9
lea    -0x48(%rbp),%r11
mov    %rsi,%rdi
mov    %rax,%r8
mov    %r14,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <dgemm_@plt>
jmp    122a <ParallelVectorMatrixT+0x10a>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    116c <ParallelVectorMatrixT+0x4c>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParallelVectorMatrixT>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,0x20(%rsp)
mov    %rdx,0x18(%rsp)
mov    %rdi,0x10(%rsp)
mov    %esi,0x4(%rsp)
movb   $0x4e,0x3(%rsp)
movl   $0x1,0xc(%rsp)
movq   $0x0,0x30(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x28(%rsp)
test   %r8d,%r8d
jle    121f <ParallelVectorMatrixT+0xff>
mov    %r8d,%ebx
mov    $0x1,%r15d
lea    0x4(%rsp),%r13
lea    0x3(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%r15),%eax
imul   %esi,%eax
cltd
idiv   %ebx
mov    %eax,%edi
call   1040 <round@plt>
mov    %eax,%r14d
mov    0x4(%rsp),%eax
imul   %r15d,%eax
cltd
idiv   %ebx
mov    %eax,%edi
call   1040 <round@plt>
sub    %r14d,%eax
mov    %eax,0x8(%rsp)
test   %eax,%eax
jle    120d <ParallelVectorMatrixT+0xed>
movslq %r14d,%rax
mov    0x18(%rsp),%rcx
lea    (%rcx,%rax,8),%rbp
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
sub    $0x8,%rsp
mov    %r12,%rdi
mov    %r12,%rsi
lea    0x10(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %r13,%r8
lea    0x30(%rsp),%r9
push   %r13
push   %rax
lea    0x48(%rsp),%rax
push   %rax
push   %r13
push   0x38(%rsp)
push   %r13
push   %rbp
call   1030 <dgemm_@plt>
add    $0x40,%rsp
cmp    %r15d,%ebx
je     121f <ParallelVectorMatrixT+0xff>
mov    0x4(%rsp),%esi
add    $0x1,%r15d
jmp    1190 <ParallelVectorMatrixT+0x70>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ParallelVectorMatrixT(double* %0, i32 %1, double* %2, double* %3, i32 %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i8
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store double* %0, double** %6
store i32 %1, i32* %7
store double* %2, double** %8
store double* %3, double** %9
store i32 %4, i32* %10
store i8 78, i8* %12
store i8 84, i8* %13
store i32 1, i32* %14
store double 0.000000e+00, double* %15
store double 1.000000e+00, double* %16
store i32 0, i32* %11
br label %20
20: ; preds = %57, %5
%21 = load i32, i32* %11
%22 = load i32, i32* %10
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %60
24: ; preds = %20
%25 = load i32, i32* %11
%26 = load i32, i32* %7
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %10
%29 = sdiv i32 %27, %28
%30 = call i32 @round(i32 %29)
store i32 %30, i32* %17
%31 = load i32, i32* %11
%32 = add nsw i32 %31, 1
%33 = load i32, i32* %7
%34 = mul nsw i32 %32, %33
%35 = load i32, i32* %10
%36 = sdiv i32 %34, %35
%37 = call i32 @round(i32 %36)
%38 = sub nsw i32 %37, 1
store i32 %38, i32* %18
%39 = load i32, i32* %18
%40 = load i32, i32* %17
%41 = sub nsw i32 %39, %40
%42 = add nsw i32 %41, 1
store i32 %42, i32* %19
%43 = load i32, i32* %19
%44 = icmp sgt i32 %43, 0
br i1 %44, label %45, label %56
45: ; preds = %24
%46 = load double*, double** %8
%47 = load i32, i32* %17
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
%50 = load double*, double** %6
%51 = load double*, double** %9
%52 = load i32, i32* %17
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %51, i64 %53
%55 = call i32 @dgemm_(i8* %12, i8* %12, i32* %19, i32* %14, i32* %7, double* %16, double* %49, i32* %7, double* %50, i32* %7, double* %15, double* %54, i32* %7)
br label %56
56: ; preds = %45, %24
br label %57
57: ; preds = %56
%58 = load i32, i32* %11
%59 = add nsw i32 %58, 1
store i32 %59, i32* %11
br label %20
60: ; preds = %20
ret void
}

LLVM IR (-O2):
define void @ParallelVectorMatrixT(double* %0, i32 %1, double* %2, double* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca i32
store i32 %1, i32* %6
store i8 78, i8* %7
%12 = bitcast i32* %8 to i8*
store i32 1, i32* %8
%13 = bitcast double* %9 to i8*
store double 0.000000e+00, double* %9
%14 = bitcast double* %10 to i8*
store double 1.000000e+00, double* %10
%15 = icmp sgt i32 %4, 0
br i1 %15, label %16, label %40
16: ; preds = %5
%17 = bitcast i32* %11 to i8*
br label %18
18: ; preds = %38, %16
%19 = phi i32 [ %1, %16 ], [ %39, %38 ]
%20 = phi i32 [ 0, %16 ], [ %24, %38 ]
%21 = mul nsw i32 %19, %20
%22 = sdiv i32 %21, %4
%23 = call i32 @round(i32 %22)
%24 = add nuw nsw i32 %20, 1
%25 = load i32, i32* %6
%26 = mul nsw i32 %25, %24
%27 = sdiv i32 %26, %4
%28 = call i32 @round(i32 %27)
%29 = sub i32 %28, %23
store i32 %29, i32* %11
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %18
%32 = sext i32 %23 to i64
%33 = getelementptr inbounds double, double* %2, i64 %32
%34 = getelementptr inbounds double, double* %3, i64 %32
%35 = call i32 @dgemm_(i8* %7, i8* %7, i32* %11, i32* %8, i32* %6, double* %10, double* %33, i32* %6, double* %0, i32* %6, double* %9, double* %34, i32* %6)
br label %36
36: ; preds = %31, %18
%37 = icmp eq i32 %24, %4
br i1 %37, label %40, label %38
38: ; preds = %36
%39 = load i32, i32* %6
br label %18
40: ; preds = %36, %5
ret void
}