#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*/ add_bias_to_activations(double *, double *, int);
void matrix_vector_product_with_bias_input_layer(double biases[64],
                                                 double weights[13 * 64],
                                                 double activations[64],
                                                 double input_sample[13]) {
  int i, j;
  for (j = 0; j < 64; j++) {
    activations[j] = (double)0.0;
    for (i = 0; i < 13; i++) {
      activations[j] += weights[j * 13 + i] * input_sample[i];
    }
  }
  add_bias_to_activations(biases, activations, 64);
}


x86 assembly (clang, -O0):
<matrix_vector_product_with_bias_input_layer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x40,-0x28(%rbp)
jge    11b5 <matrix_vector_product_with_bias_input_layer+0xa5>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x24(%rbp)
cmpl   $0xd,-0x24(%rbp)
jge    11a2 <matrix_vector_product_with_bias_input_layer+0x92>
mov    -0x10(%rbp),%rax
imul   $0xd,-0x28(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1150 <matrix_vector_product_with_bias_input_layer+0x40>
jmp    11a7 <matrix_vector_product_with_bias_input_layer+0x97>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    112f <matrix_vector_product_with_bias_input_layer+0x1f>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x40,%edx
call   1030 <add_bias_to_activations@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_vector_product_with_bias_input_layer>:
add    $0x60,%rsi
xor    %eax,%eax
xorpd  %xmm0,%xmm0
nopw   0x0(%rax,%rax,1)
movq   $0x0,(%rdx,%rax,8)
movsd  -0x60(%rsi),%xmm1
mulsd  (%rcx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
movsd  -0x58(%rsi),%xmm2
mulsd  0x8(%rcx),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rdx,%rax,8)
movsd  -0x50(%rsi),%xmm1
mulsd  0x10(%rcx),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
movsd  -0x48(%rsi),%xmm2
mulsd  0x18(%rcx),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rdx,%rax,8)
movsd  -0x40(%rsi),%xmm1
mulsd  0x20(%rcx),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
movsd  -0x38(%rsi),%xmm2
mulsd  0x28(%rcx),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rdx,%rax,8)
movsd  -0x30(%rsi),%xmm1
mulsd  0x30(%rcx),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
movsd  -0x28(%rsi),%xmm2
mulsd  0x38(%rcx),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rdx,%rax,8)
movsd  -0x20(%rsi),%xmm1
mulsd  0x40(%rcx),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
movsd  -0x18(%rsi),%xmm2
mulsd  0x48(%rcx),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rdx,%rax,8)
movsd  -0x10(%rsi),%xmm1
mulsd  0x50(%rcx),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
movsd  -0x8(%rsi),%xmm2
mulsd  0x58(%rcx),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rdx,%rax,8)
movsd  (%rsi),%xmm1
mulsd  0x60(%rcx),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
add    $0x1,%rax
add    $0x68,%rsi
cmp    $0x40,%rax
jne    1120 <matrix_vector_product_with_bias_input_layer+0x10>
mov    %rdx,%rsi
mov    $0x40,%edx
jmp    1030 <add_bias_to_activations@plt>

LLVM IR (-O0):
define void @matrix_vector_product_with_bias_input_layer(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
store i32 0, i32* %10
br label %11
11: ; preds = %46, %4
%12 = load i32, i32* %10
%13 = icmp slt i32 %12, 64
br i1 %13, label %14, label %49
14: ; preds = %11
%15 = load double*, double** %7
%16 = load i32, i32* %10
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
store double 0.000000e+00, double* %18
store i32 0, i32* %9
br label %19
19: ; preds = %42, %14
%20 = load i32, i32* %9
%21 = icmp slt i32 %20, 13
br i1 %21, label %22, label %45
22: ; preds = %19
%23 = load double*, double** %6
%24 = load i32, i32* %10
%25 = mul nsw i32 %24, 13
%26 = load i32, i32* %9
%27 = add nsw i32 %25, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %23, i64 %28
%30 = load double, double* %29
%31 = load double*, double** %8
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = load double*, double** %7
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = call double @llvm.fmuladd.f64(double %30, double %35, double %40)
store double %41, double* %39
br label %42
42: ; preds = %22
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %19
45: ; preds = %19
br label %46
46: ; preds = %45
%47 = load i32, i32* %10
%48 = add nsw i32 %47, 1
store i32 %48, i32* %10
br label %11
49: ; preds = %11
%50 = load double*, double** %5
%51 = load double*, double** %7
%52 = call i32 @add_bias_to_activations(double* %50, double* %51, i32 64)
ret void
}

LLVM IR (-O2):
define void @matrix_vector_product_with_bias_input_layer(double* %0, double* nocapture %1, double* %2, double* nocapture %3) {
%5 = getelementptr inbounds double, double* %3, i64 1
%6 = getelementptr inbounds double, double* %3, i64 2
%7 = getelementptr inbounds double, double* %3, i64 3
%8 = getelementptr inbounds double, double* %3, i64 4
%9 = getelementptr inbounds double, double* %3, i64 5
%10 = getelementptr inbounds double, double* %3, i64 6
%11 = getelementptr inbounds double, double* %3, i64 7
%12 = getelementptr inbounds double, double* %3, i64 8
%13 = getelementptr inbounds double, double* %3, i64 9
%14 = getelementptr inbounds double, double* %3, i64 10
%15 = getelementptr inbounds double, double* %3, i64 11
%16 = getelementptr inbounds double, double* %3, i64 12
br label %17
17: ; preds = %4, %17
%18 = phi i64 [ 0, %4 ], [ %85, %17 ]
%19 = getelementptr inbounds double, double* %2, i64 %18
store double 0.000000e+00, double* %19
%20 = mul nuw nsw i64 %18, 13
%21 = getelementptr inbounds double, double* %1, i64 %20
%22 = load double, double* %21
%23 = load double, double* %3
%24 = tail call double @llvm.fmuladd.f64(double %22, double %23, double 0.000000e+00)
store double %24, double* %19
%25 = add nuw nsw i64 %20, 1
%26 = getelementptr inbounds double, double* %1, i64 %25
%27 = load double, double* %26
%28 = load double, double* %5
%29 = tail call double @llvm.fmuladd.f64(double %27, double %28, double %24)
store double %29, double* %19
%30 = add nuw nsw i64 %20, 2
%31 = getelementptr inbounds double, double* %1, i64 %30
%32 = load double, double* %31
%33 = load double, double* %6
%34 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %29)
store double %34, double* %19
%35 = add nuw nsw i64 %20, 3
%36 = getelementptr inbounds double, double* %1, i64 %35
%37 = load double, double* %36
%38 = load double, double* %7
%39 = tail call double @llvm.fmuladd.f64(double %37, double %38, double %34)
store double %39, double* %19
%40 = add nuw nsw i64 %20, 4
%41 = getelementptr inbounds double, double* %1, i64 %40
%42 = load double, double* %41
%43 = load double, double* %8
%44 = tail call double @llvm.fmuladd.f64(double %42, double %43, double %39)
store double %44, double* %19
%45 = add nuw nsw i64 %20, 5
%46 = getelementptr inbounds double, double* %1, i64 %45
%47 = load double, double* %46
%48 = load double, double* %9
%49 = tail call double @llvm.fmuladd.f64(double %47, double %48, double %44)
store double %49, double* %19
%50 = add nuw nsw i64 %20, 6
%51 = getelementptr inbounds double, double* %1, i64 %50
%52 = load double, double* %51
%53 = load double, double* %10
%54 = tail call double @llvm.fmuladd.f64(double %52, double %53, double %49)
store double %54, double* %19
%55 = add nuw nsw i64 %20, 7
%56 = getelementptr inbounds double, double* %1, i64 %55
%57 = load double, double* %56
%58 = load double, double* %11
%59 = tail call double @llvm.fmuladd.f64(double %57, double %58, double %54)
store double %59, double* %19
%60 = add nuw nsw i64 %20, 8
%61 = getelementptr inbounds double, double* %1, i64 %60
%62 = load double, double* %61
%63 = load double, double* %12
%64 = tail call double @llvm.fmuladd.f64(double %62, double %63, double %59)
store double %64, double* %19
%65 = add nuw nsw i64 %20, 9
%66 = getelementptr inbounds double, double* %1, i64 %65
%67 = load double, double* %66
%68 = load double, double* %13
%69 = tail call double @llvm.fmuladd.f64(double %67, double %68, double %64)
store double %69, double* %19
%70 = add nuw nsw i64 %20, 10
%71 = getelementptr inbounds double, double* %1, i64 %70
%72 = load double, double* %71
%73 = load double, double* %14
%74 = tail call double @llvm.fmuladd.f64(double %72, double %73, double %69)
store double %74, double* %19
%75 = add nuw nsw i64 %20, 11
%76 = getelementptr inbounds double, double* %1, i64 %75
%77 = load double, double* %76
%78 = load double, double* %15
%79 = tail call double @llvm.fmuladd.f64(double %77, double %78, double %74)
store double %79, double* %19
%80 = add nuw nsw i64 %20, 12
%81 = getelementptr inbounds double, double* %1, i64 %80
%82 = load double, double* %81
%83 = load double, double* %16
%84 = tail call double @llvm.fmuladd.f64(double %82, double %83, double %79)
store double %84, double* %19
%85 = add nuw nsw i64 %18, 1
%86 = icmp eq i64 %85, 64
br i1 %86, label %87, label %17
87: ; preds = %17
%88 = tail call i32 @add_bias_to_activations(double* %0, double* %2, i32 64)
ret void
}