void glmAddMatrix3d(double result[9], const double m1[9], const double m2[9]) {
  int i;
  for (i = 0; i < 9; i++)
    result[i] = m1[i] + m2[i];
}


x86 assembly (clang, -O0):
<glmAddMatrix3d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jge    1156 <glmAddMatrix3d+0x56>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <glmAddMatrix3d+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmAddMatrix3d>:
movsd  (%rsi),%xmm0
addsd  (%rdx),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
addsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rsi),%xmm0
addsd  0x10(%rdx),%xmm0
movsd  %xmm0,0x10(%rdi)
movsd  0x18(%rsi),%xmm0
addsd  0x18(%rdx),%xmm0
movsd  %xmm0,0x18(%rdi)
movsd  0x20(%rsi),%xmm0
addsd  0x20(%rdx),%xmm0
movsd  %xmm0,0x20(%rdi)
movsd  0x28(%rsi),%xmm0
addsd  0x28(%rdx),%xmm0
movsd  %xmm0,0x28(%rdi)
movsd  0x30(%rsi),%xmm0
addsd  0x30(%rdx),%xmm0
movsd  %xmm0,0x30(%rdi)
movsd  0x38(%rsi),%xmm0
addsd  0x38(%rdx),%xmm0
movsd  %xmm0,0x38(%rdi)
movsd  0x40(%rsi),%xmm0
addsd  0x40(%rdx),%xmm0
movsd  %xmm0,0x40(%rdi)
ret

LLVM IR (-O0):
define void @glmAddMatrix3d(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
br label %8
8: ; preds = %27, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 9
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = load double*, double** %5
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = load double*, double** %6
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = fadd double %16, %21
%23 = load double*, double** %4
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
store double %22, double* %26
br label %27
27: ; preds = %11
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %8
30: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @glmAddMatrix3d(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = load double, double* %2
%6 = fadd double %4, %5
store double %6, double* %0
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %2, i64 1
%10 = load double, double* %9
%11 = fadd double %8, %10
%12 = getelementptr inbounds double, double* %0, i64 1
store double %11, double* %12
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %2, i64 2
%16 = load double, double* %15
%17 = fadd double %14, %16
%18 = getelementptr inbounds double, double* %0, i64 2
store double %17, double* %18
%19 = getelementptr inbounds double, double* %1, i64 3
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %2, i64 3
%22 = load double, double* %21
%23 = fadd double %20, %22
%24 = getelementptr inbounds double, double* %0, i64 3
store double %23, double* %24
%25 = getelementptr inbounds double, double* %1, i64 4
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %2, i64 4
%28 = load double, double* %27
%29 = fadd double %26, %28
%30 = getelementptr inbounds double, double* %0, i64 4
store double %29, double* %30
%31 = getelementptr inbounds double, double* %1, i64 5
%32 = load double, double* %31
%33 = getelementptr inbounds double, double* %2, i64 5
%34 = load double, double* %33
%35 = fadd double %32, %34
%36 = getelementptr inbounds double, double* %0, i64 5
store double %35, double* %36
%37 = getelementptr inbounds double, double* %1, i64 6
%38 = load double, double* %37
%39 = getelementptr inbounds double, double* %2, i64 6
%40 = load double, double* %39
%41 = fadd double %38, %40
%42 = getelementptr inbounds double, double* %0, i64 6
store double %41, double* %42
%43 = getelementptr inbounds double, double* %1, i64 7
%44 = load double, double* %43
%45 = getelementptr inbounds double, double* %2, i64 7
%46 = load double, double* %45
%47 = fadd double %44, %46
%48 = getelementptr inbounds double, double* %0, i64 7
store double %47, double* %48
%49 = getelementptr inbounds double, double* %1, i64 8
%50 = load double, double* %49
%51 = getelementptr inbounds double, double* %2, i64 8
%52 = load double, double* %51
%53 = fadd double %50, %52
%54 = getelementptr inbounds double, double* %0, i64 8
store double %53, double* %54
ret void
}