void addmm(double *result, const double *s) {
  int i;
  for (i = 0; i < 16; i++)
    result[i] += s[i];
}


x86 assembly (clang, -O0):
<addmm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    114a <addmm+0x4a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <addmm+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<addmm>:
movsd  (%rsi),%xmm0
addsd  (%rdi),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
addsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rsi),%xmm0
addsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x10(%rdi)
movsd  0x18(%rsi),%xmm0
addsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x18(%rdi)
movsd  0x20(%rsi),%xmm0
addsd  0x20(%rdi),%xmm0
movsd  %xmm0,0x20(%rdi)
movsd  0x28(%rsi),%xmm0
addsd  0x28(%rdi),%xmm0
movsd  %xmm0,0x28(%rdi)
movsd  0x30(%rsi),%xmm0
addsd  0x30(%rdi),%xmm0
movsd  %xmm0,0x30(%rdi)
movsd  0x38(%rsi),%xmm0
addsd  0x38(%rdi),%xmm0
movsd  %xmm0,0x38(%rdi)
movsd  0x40(%rsi),%xmm0
addsd  0x40(%rdi),%xmm0
movsd  %xmm0,0x40(%rdi)
movsd  0x48(%rsi),%xmm0
addsd  0x48(%rdi),%xmm0
movsd  %xmm0,0x48(%rdi)
movsd  0x50(%rsi),%xmm0
addsd  0x50(%rdi),%xmm0
movsd  %xmm0,0x50(%rdi)
movsd  0x58(%rsi),%xmm0
addsd  0x58(%rdi),%xmm0
movsd  %xmm0,0x58(%rdi)
movsd  0x60(%rsi),%xmm0
addsd  0x60(%rdi),%xmm0
movsd  %xmm0,0x60(%rdi)
movsd  0x68(%rsi),%xmm0
addsd  0x68(%rdi),%xmm0
movsd  %xmm0,0x68(%rdi)
movsd  0x70(%rsi),%xmm0
addsd  0x70(%rdi),%xmm0
movsd  %xmm0,0x70(%rdi)
movsd  0x78(%rsi),%xmm0
addsd  0x78(%rdi),%xmm0
movsd  %xmm0,0x78(%rdi)
ret

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

LLVM IR (-O2):
define void @addmm(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = load double, double* %0
%5 = fadd double %3, %4
store double %5, double* %0
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = fadd double %7, %9
store double %10, double* %8
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = fadd double %12, %14
store double %15, double* %13
%16 = getelementptr inbounds double, double* %1, i64 3
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %0, i64 3
%19 = load double, double* %18
%20 = fadd double %17, %19
store double %20, double* %18
%21 = getelementptr inbounds double, double* %1, i64 4
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %0, i64 4
%24 = load double, double* %23
%25 = fadd double %22, %24
store double %25, double* %23
%26 = getelementptr inbounds double, double* %1, i64 5
%27 = load double, double* %26
%28 = getelementptr inbounds double, double* %0, i64 5
%29 = load double, double* %28
%30 = fadd double %27, %29
store double %30, double* %28
%31 = getelementptr inbounds double, double* %1, i64 6
%32 = load double, double* %31
%33 = getelementptr inbounds double, double* %0, i64 6
%34 = load double, double* %33
%35 = fadd double %32, %34
store double %35, double* %33
%36 = getelementptr inbounds double, double* %1, i64 7
%37 = load double, double* %36
%38 = getelementptr inbounds double, double* %0, i64 7
%39 = load double, double* %38
%40 = fadd double %37, %39
store double %40, double* %38
%41 = getelementptr inbounds double, double* %1, i64 8
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %0, i64 8
%44 = load double, double* %43
%45 = fadd double %42, %44
store double %45, double* %43
%46 = getelementptr inbounds double, double* %1, i64 9
%47 = load double, double* %46
%48 = getelementptr inbounds double, double* %0, i64 9
%49 = load double, double* %48
%50 = fadd double %47, %49
store double %50, double* %48
%51 = getelementptr inbounds double, double* %1, i64 10
%52 = load double, double* %51
%53 = getelementptr inbounds double, double* %0, i64 10
%54 = load double, double* %53
%55 = fadd double %52, %54
store double %55, double* %53
%56 = getelementptr inbounds double, double* %1, i64 11
%57 = load double, double* %56
%58 = getelementptr inbounds double, double* %0, i64 11
%59 = load double, double* %58
%60 = fadd double %57, %59
store double %60, double* %58
%61 = getelementptr inbounds double, double* %1, i64 12
%62 = load double, double* %61
%63 = getelementptr inbounds double, double* %0, i64 12
%64 = load double, double* %63
%65 = fadd double %62, %64
store double %65, double* %63
%66 = getelementptr inbounds double, double* %1, i64 13
%67 = load double, double* %66
%68 = getelementptr inbounds double, double* %0, i64 13
%69 = load double, double* %68
%70 = fadd double %67, %69
store double %70, double* %68
%71 = getelementptr inbounds double, double* %1, i64 14
%72 = load double, double* %71
%73 = getelementptr inbounds double, double* %0, i64 14
%74 = load double, double* %73
%75 = fadd double %72, %74
store double %75, double* %73
%76 = getelementptr inbounds double, double* %1, i64 15
%77 = load double, double* %76
%78 = getelementptr inbounds double, double* %0, i64 15
%79 = load double, double* %78
%80 = fadd double %77, %79
store double %80, double* %78
ret void
}