void s6twoPminusI(double pg[6], double g[6], double gout[6]) {
  int i;
  for (i = 0; i < 6; i++) {
    gout[i] = 2. * pg[i] - g[i];
  }
}


x86 assembly (clang, -O0):
<s6twoPminusI>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jge    1175 <s6twoPminusI+0x75>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <s6twoPminusI+0x17>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @s6twoPminusI(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 = %28, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %31
11: ; preds = %8
%12 = load double*, double** %4
%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** %5
%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 = fneg double %21
%23 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %16, double %22)
%24 = load double*, double** %6
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
store double %23, double* %27
br label %28
28: ; preds = %11
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %8
31: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @s6twoPminusI(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = fneg double %5
%7 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double %6)
store double %7, double* %2
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = load double, double* %10
%12 = fneg double %11
%13 = tail call double @llvm.fmuladd.f64(double %9, double 2.000000e+00, double %12)
%14 = getelementptr inbounds double, double* %2, i64 1
store double %13, double* %14
%15 = getelementptr inbounds double, double* %0, i64 2
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %1, i64 2
%18 = load double, double* %17
%19 = fneg double %18
%20 = tail call double @llvm.fmuladd.f64(double %16, double 2.000000e+00, double %19)
%21 = getelementptr inbounds double, double* %2, i64 2
store double %20, double* %21
%22 = getelementptr inbounds double, double* %0, i64 3
%23 = load double, double* %22
%24 = getelementptr inbounds double, double* %1, i64 3
%25 = load double, double* %24
%26 = fneg double %25
%27 = tail call double @llvm.fmuladd.f64(double %23, double 2.000000e+00, double %26)
%28 = getelementptr inbounds double, double* %2, i64 3
store double %27, double* %28
%29 = getelementptr inbounds double, double* %0, i64 4
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %1, i64 4
%32 = load double, double* %31
%33 = fneg double %32
%34 = tail call double @llvm.fmuladd.f64(double %30, double 2.000000e+00, double %33)
%35 = getelementptr inbounds double, double* %2, i64 4
store double %34, double* %35
%36 = getelementptr inbounds double, double* %0, i64 5
%37 = load double, double* %36
%38 = getelementptr inbounds double, double* %1, i64 5
%39 = load double, double* %38
%40 = fneg double %39
%41 = tail call double @llvm.fmuladd.f64(double %37, double 2.000000e+00, double %40)
%42 = getelementptr inbounds double, double* %2, i64 5
store double %41, double* %42
ret void
}