#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*/ nrerror(char *);
void multi_vec_matrix(double *a, long n, double **b, long nr, long nc,
                      double *o) {
  long i, j;
  if (n != nr)
    nrerror("vector and matrix do not conform");
  for (i = 1; i <= nc; i++) {
    o[i] = 0.0;
    for (j = 1; j <= n; j++)
      o[i] += a[j] * b[j][i];
  }
}


x86 assembly (clang, -O0):
<multi_vec_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     114a <multi_vec_matrix+0x3a>
lea    0xebb(%rip),%rdi
call   1030 <nrerror@plt>
movq   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     11e9 <multi_vec_matrix+0xd9>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movq   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     11d3 <multi_vec_matrix+0xc3>
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1178 <multi_vec_matrix+0x68>
jmp    11d8 <multi_vec_matrix+0xc8>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1152 <multi_vec_matrix+0x42>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multi_vec_matrix>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,%rbx
mov    %r8,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
cmp    %rcx,%rsi
je     1139 <multi_vec_matrix+0x29>
lea    0xecc(%rip),%rdi
call   1030 <nrerror@plt>
test   %r14,%r14
jle    11f9 <multi_vec_matrix+0xe9>
mov    %r12,%rax
and    $0xfffffffffffffffe,%rax
neg    %rax
mov    $0x1,%ecx
jmp    1170 <multi_vec_matrix+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rcx),%rdx
cmp    %r14,%rcx
mov    %rdx,%rcx
je     11f9 <multi_vec_matrix+0xe9>
movq   $0x0,(%rbx,%rcx,8)
test   %r12,%r12
jle    1160 <multi_vec_matrix+0x50>
mov    $0x1,%edx
xorpd  %xmm0,%xmm0
cmp    $0x1,%r12
je     11d5 <multi_vec_matrix+0xc5>
nopl   0x0(%rax)
movsd  0x0(%r13,%rdx,8),%xmm1
mov    (%r15,%rdx,8),%rsi
mulsd  (%rsi,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
movsd  0x8(%r13,%rdx,8),%xmm0
mov    0x8(%r15,%rdx,8),%rsi
mulsd  (%rsi,%rcx,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
lea    (%rax,%rdx,1),%rsi
add    $0x2,%rsi
add    $0x2,%rdx
cmp    $0x1,%rsi
jne    1190 <multi_vec_matrix+0x80>
test   $0x1,%r12b
je     1160 <multi_vec_matrix+0x50>
movsd  0x0(%r13,%rdx,8),%xmm1
mov    (%r15,%rdx,8),%rdx
mulsd  (%rdx,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
jmp    1160 <multi_vec_matrix+0x50>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"vector and matrix do not conform\00"
define void @multi_vec_matrix(double* %0, i64 %1, double** %2, i64 %3, i64 %4, double* %5) {
%7 = alloca double*
%8 = alloca i64
%9 = alloca double**
%10 = alloca i64
%11 = alloca i64
%12 = alloca double*
%13 = alloca i64
%14 = alloca i64
store double* %0, double** %7
store i64 %1, i64* %8
store double** %2, double*** %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store double* %5, double** %12
%15 = load i64, i64* %8
%16 = load i64, i64* %10
%17 = icmp ne i64 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %6
%19 = call i32 @nrerror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %6
store i64 1, i64* %13
br label %21
21: ; preds = %54, %20
%22 = load i64, i64* %13
%23 = load i64, i64* %11
%24 = icmp sle i64 %22, %23
br i1 %24, label %25, label %57
25: ; preds = %21
%26 = load double*, double** %12
%27 = load i64, i64* %13
%28 = getelementptr inbounds double, double* %26, i64 %27
store double 0.000000e+00, double* %28
store i64 1, i64* %14
br label %29
29: ; preds = %50, %25
%30 = load i64, i64* %14
%31 = load i64, i64* %8
%32 = icmp sle i64 %30, %31
br i1 %32, label %33, label %53
33: ; preds = %29
%34 = load double*, double** %7
%35 = load i64, i64* %14
%36 = getelementptr inbounds double, double* %34, i64 %35
%37 = load double, double* %36
%38 = load double**, double*** %9
%39 = load i64, i64* %14
%40 = getelementptr inbounds double*, double** %38, i64 %39
%41 = load double*, double** %40
%42 = load i64, i64* %13
%43 = getelementptr inbounds double, double* %41, i64 %42
%44 = load double, double* %43
%45 = load double*, double** %12
%46 = load i64, i64* %13
%47 = getelementptr inbounds double, double* %45, i64 %46
%48 = load double, double* %47
%49 = call double @llvm.fmuladd.f64(double %37, double %44, double %48)
store double %49, double* %47
br label %50
50: ; preds = %33
%51 = load i64, i64* %14
%52 = add nsw i64 %51, 1
store i64 %52, i64* %14
br label %29
53: ; preds = %29
br label %54
54: ; preds = %53
%55 = load i64, i64* %13
%56 = add nsw i64 %55, 1
store i64 %56, i64* %13
br label %21
57: ; preds = %21
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"vector and matrix do not conform\00"
define void @multi_vec_matrix(double* nocapture %0, i64 %1, double** nocapture %2, i64 %3, i64 %4, double* nocapture %5) {
%7 = icmp eq i64 %1, %3
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @nrerror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = icmp slt i64 %4, 1
br i1 %11, label %58, label %12
12: ; preds = %10
%13 = icmp slt i64 %1, 1
%14 = and i64 %1, 1
%15 = icmp eq i64 %1, 1
%16 = and i64 %1, -2
%17 = icmp eq i64 %14, 0
br label %18
18: ; preds = %12, %55
%19 = phi i64 [ 1, %12 ], [ %56, %55 ]
%20 = getelementptr inbounds double, double* %5, i64 %19
store double 0.000000e+00, double* %20
br i1 %13, label %55, label %21
21: ; preds = %18
br i1 %15, label %44, label %22
22: ; preds = %21, %22
%23 = phi double [ %40, %22 ], [ 0.000000e+00, %21 ]
%24 = phi i64 [ %41, %22 ], [ 1, %21 ]
%25 = phi i64 [ %42, %22 ], [ 0, %21 ]
%26 = getelementptr inbounds double, double* %0, i64 %24
%27 = load double, double* %26
%28 = getelementptr inbounds double*, double** %2, i64 %24
%29 = load double*, double** %28
%30 = getelementptr inbounds double, double* %29, i64 %19
%31 = load double, double* %30
%32 = tail call double @llvm.fmuladd.f64(double %27, double %31, double %23)
store double %32, double* %20
%33 = add nuw i64 %24, 1
%34 = getelementptr inbounds double, double* %0, i64 %33
%35 = load double, double* %34
%36 = getelementptr inbounds double*, double** %2, i64 %33
%37 = load double*, double** %36
%38 = getelementptr inbounds double, double* %37, i64 %19
%39 = load double, double* %38
%40 = tail call double @llvm.fmuladd.f64(double %35, double %39, double %32)
store double %40, double* %20
%41 = add nuw i64 %24, 2
%42 = add i64 %25, 2
%43 = icmp eq i64 %42, %16
br i1 %43, label %44, label %22
44: ; preds = %22, %21
%45 = phi double [ 0.000000e+00, %21 ], [ %40, %22 ]
%46 = phi i64 [ 1, %21 ], [ %41, %22 ]
br i1 %17, label %55, label %47
47: ; preds = %44
%48 = getelementptr inbounds double, double* %0, i64 %46
%49 = load double, double* %48
%50 = getelementptr inbounds double*, double** %2, i64 %46
%51 = load double*, double** %50
%52 = getelementptr inbounds double, double* %51, i64 %19
%53 = load double, double* %52
%54 = tail call double @llvm.fmuladd.f64(double %49, double %53, double %45)
store double %54, double* %20
br label %55
55: ; preds = %47, %44, %18
%56 = add nuw i64 %19, 1
%57 = icmp eq i64 %19, %4
br i1 %57, label %58, label %18
58: ; preds = %55, %10
ret void
}