void fn_5(double *a, double *b, double *sum, double *prod) {
  int i = 0;
  for (i = 0; i < 10; i++)
    sum[i] = a[i] * b[i];
  prod[i] = a[i] * b[i];
}


x86 assembly (clang, -O0):
<fn_5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0xa,-0x24(%rbp)
jge    1161 <fn_5+0x61>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1122 <fn_5+0x22>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_5>:
movsd  (%rdi),%xmm0
mulsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rdi),%xmm0
mulsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdx)
movsd  0x18(%rdi),%xmm0
mulsd  0x18(%rsi),%xmm0
movsd  %xmm0,0x18(%rdx)
movsd  0x20(%rdi),%xmm0
mulsd  0x20(%rsi),%xmm0
movsd  %xmm0,0x20(%rdx)
movsd  0x28(%rdi),%xmm0
mulsd  0x28(%rsi),%xmm0
movsd  %xmm0,0x28(%rdx)
movsd  0x30(%rdi),%xmm0
mulsd  0x30(%rsi),%xmm0
movsd  %xmm0,0x30(%rdx)
movsd  0x38(%rdi),%xmm0
mulsd  0x38(%rsi),%xmm0
movsd  %xmm0,0x38(%rdx)
movsd  0x40(%rdi),%xmm0
mulsd  0x40(%rsi),%xmm0
movsd  %xmm0,0x40(%rdx)
movsd  0x48(%rdi),%xmm0
mulsd  0x48(%rsi),%xmm0
movsd  %xmm0,0x48(%rdx)
movsd  0x50(%rdi),%xmm0
mulsd  0x50(%rsi),%xmm0
movsd  %xmm0,0x50(%rcx)
ret

LLVM IR (-O0):
define void @fn_5(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = 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* %9
store i32 0, i32* %9
br label %10
10: ; preds = %29, %4
%11 = load i32, i32* %9
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %32
13: ; preds = %10
%14 = load double*, double** %5
%15 = load i32, i32* %9
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = fmul double %18, %23
%25 = load double*, double** %7
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %25, i64 %27
store double %24, double* %28
br label %29
29: ; preds = %13
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 1
store i32 %31, i32* %9
br label %10
32: ; preds = %10
%33 = load double*, double** %5
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double*, double** %6
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = fmul double %37, %42
%44 = load double*, double** %8
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %43, double* %47
ret void
}

LLVM IR (-O2):
define void @fn_5(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = load double, double* %0
%6 = load double, double* %1
%7 = fmul double %5, %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 = fmul double %9, %11
%13 = getelementptr inbounds double, double* %2, i64 1
store double %12, double* %13
%14 = getelementptr inbounds double, double* %0, i64 2
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %1, i64 2
%17 = load double, double* %16
%18 = fmul double %15, %17
%19 = getelementptr inbounds double, double* %2, i64 2
store double %18, double* %19
%20 = getelementptr inbounds double, double* %0, i64 3
%21 = load double, double* %20
%22 = getelementptr inbounds double, double* %1, i64 3
%23 = load double, double* %22
%24 = fmul double %21, %23
%25 = getelementptr inbounds double, double* %2, i64 3
store double %24, double* %25
%26 = getelementptr inbounds double, double* %0, i64 4
%27 = load double, double* %26
%28 = getelementptr inbounds double, double* %1, i64 4
%29 = load double, double* %28
%30 = fmul double %27, %29
%31 = getelementptr inbounds double, double* %2, i64 4
store double %30, double* %31
%32 = getelementptr inbounds double, double* %0, i64 5
%33 = load double, double* %32
%34 = getelementptr inbounds double, double* %1, i64 5
%35 = load double, double* %34
%36 = fmul double %33, %35
%37 = getelementptr inbounds double, double* %2, i64 5
store double %36, double* %37
%38 = getelementptr inbounds double, double* %0, i64 6
%39 = load double, double* %38
%40 = getelementptr inbounds double, double* %1, i64 6
%41 = load double, double* %40
%42 = fmul double %39, %41
%43 = getelementptr inbounds double, double* %2, i64 6
store double %42, double* %43
%44 = getelementptr inbounds double, double* %0, i64 7
%45 = load double, double* %44
%46 = getelementptr inbounds double, double* %1, i64 7
%47 = load double, double* %46
%48 = fmul double %45, %47
%49 = getelementptr inbounds double, double* %2, i64 7
store double %48, double* %49
%50 = getelementptr inbounds double, double* %0, i64 8
%51 = load double, double* %50
%52 = getelementptr inbounds double, double* %1, i64 8
%53 = load double, double* %52
%54 = fmul double %51, %53
%55 = getelementptr inbounds double, double* %2, i64 8
store double %54, double* %55
%56 = getelementptr inbounds double, double* %0, i64 9
%57 = load double, double* %56
%58 = getelementptr inbounds double, double* %1, i64 9
%59 = load double, double* %58
%60 = fmul double %57, %59
%61 = getelementptr inbounds double, double* %2, i64 9
store double %60, double* %61
%62 = getelementptr inbounds double, double* %0, i64 10
%63 = load double, double* %62
%64 = getelementptr inbounds double, double* %1, i64 10
%65 = load double, double* %64
%66 = fmul double %63, %65
%67 = getelementptr inbounds double, double* %3, i64 10
store double %66, double* %67
ret void
}