void multiply_array_number(double *out, double *a, double f, int ncol,
                           int nlns) {
  int i, j;
  double *ptr_a, *ptr_out;
  for (i = 0; i < ncol; i++) {
    ptr_out = (&(out[(i) * (nlns) + (0)]));
    ptr_a = (&(a[(i) * (nlns) + (0)]));
    for (j = 0; j < nlns; j++)
      ptr_out[j] = ptr_a[j] * f;
  }
}


x86 assembly (clang, -O0):
<multiply_array_number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b5 <multiply_array_number+0xb5>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x20(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x20(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11a2 <multiply_array_number+0xa2>
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1169 <multiply_array_number+0x69>
jmp    11a7 <multiply_array_number+0xa7>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111e <multiply_array_number+0x1e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply_array_number>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edx,%edx
jle    1377 <multiply_array_number+0x277>
mov    %rsi,%r11
movslq %ecx,%rbp
mov    %edx,%r8d
mov    %ebp,%r12d
mov    %r12d,%eax
and    $0xfffffffc,%eax
mov    %rax,-0x18(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x20(%rsp)
mov    %rax,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
mov    %rdx,%rax
mov    %rdx,-0x28(%rsp)
and    $0xfffffffffffffffe,%rdx
mov    %rdx,-0x30(%rsp)
mov    %r12d,%esi
and    $0x3,%esi
lea    0x30(%r11),%rdx
mov    %rbp,-0x8(%rsp)
lea    0x0(,%rbp,8),%r13
lea    0x30(%rdi),%rbx
xor    %r10d,%r10d
mov    %r11,%r15
mov    %rdi,%r14
mov    %rdi,-0x10(%rsp)
mov    %rsi,-0x38(%rsp)
jmp    11a9 <multiply_array_number+0xa9>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r10
add    %r13,%rdx
add    %r13,%rbx
add    %r13,%r14
add    %r13,%r15
cmp    %r8,%r10
je     1377 <multiply_array_number+0x277>
test   %ecx,%ecx
jle    1190 <multiply_array_number+0x90>
cmp    $0x4,%ecx
jae    11c0 <multiply_array_number+0xc0>
xor    %r9d,%r9d
jmp    12c0 <multiply_array_number+0x1c0>
nopw   0x0(%rax,%rax,1)
mov    %r8,%rsi
mov    %r10,%rbp
imul   -0x8(%rsp),%rbp
lea    (%r12,%rbp,1),%rax
lea    (%rdi,%rbp,8),%r9
lea    (%r11,%rbp,8),%r8
lea    (%r11,%rax,8),%rbp
cmp    %rbp,%r9
jae    11fa <multiply_array_number+0xfa>
lea    (%rdi,%rax,8),%rax
cmp    %rax,%r8
jae    11fa <multiply_array_number+0xfa>
xor    %r9d,%r9d
mov    %rsi,%r8
mov    -0x38(%rsp),%rsi
jmp    12c0 <multiply_array_number+0x1c0>
mov    %r11,%rax
cmpq   $0x0,-0x20(%rsp)
je     1364 <multiply_array_number+0x264>
mov    -0x30(%rsp),%rbp
xor    %r11d,%r11d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd -0x30(%rdx,%r11,8),%xmm2
movupd -0x20(%rdx,%r11,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,-0x30(%rbx,%r11,8)
movupd %xmm3,-0x20(%rbx,%r11,8)
movupd -0x10(%rdx,%r11,8),%xmm2
movupd (%rdx,%r11,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,-0x10(%rbx,%r11,8)
movupd %xmm3,(%rbx,%r11,8)
add    $0x8,%r11
add    $0xfffffffffffffffe,%rbp
jne    1220 <multiply_array_number+0x120>
testb  $0x1,-0x28(%rsp)
je     1299 <multiply_array_number+0x199>
movupd (%r8,%r11,8),%xmm2
movupd 0x10(%r8,%r11,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%r9,%r11,8)
movupd %xmm3,0x10(%r9,%r11,8)
mov    -0x18(%rsp),%rbp
mov    %rbp,%r9
cmp    %r12,%rbp
mov    %rax,%r11
mov    -0x10(%rsp),%rdi
mov    %rsi,%r8
mov    -0x38(%rsp),%rsi
je     1190 <multiply_array_number+0x90>
nopw   0x0(%rax,%rax,1)
mov    %r9,%rbp
not    %rbp
add    %r12,%rbp
test   %rsi,%rsi
je     12fa <multiply_array_number+0x1fa>
mov    %rsi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%r9,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%r14,%r9,8)
add    $0x1,%r9
add    $0xffffffffffffffff,%rax
jne    12e0 <multiply_array_number+0x1e0>
cmp    $0x3,%rbp
jb     1190 <multiply_array_number+0x90>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%r15,%r9,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%r14,%r9,8)
movsd  0x8(%r15,%r9,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%r14,%r9,8)
movsd  0x10(%r15,%r9,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%r14,%r9,8)
movsd  0x18(%r15,%r9,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x18(%r14,%r9,8)
add    $0x4,%r9
cmp    %r9,%r12
jne    1310 <multiply_array_number+0x210>
jmp    1190 <multiply_array_number+0x90>
xor    %r11d,%r11d
testb  $0x1,-0x28(%rsp)
jne    1277 <multiply_array_number+0x177>
jmp    1299 <multiply_array_number+0x199>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @multiply_array_number(double* nocapture writeonly %0, double* nocapture %1, double %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %136
7: ; preds = %5
%8 = icmp sgt i32 %4, 0
%9 = sext i32 %4 to i64
%10 = zext i32 %3 to i64
%11 = zext i32 %4 to i64
%12 = and i64 %11, 4294967292
%13 = add nsw i64 %12, -4
%14 = lshr exact i64 %13, 2
%15 = add nuw nsw i64 %14, 1
%16 = icmp ult i32 %4, 4
%17 = and i64 %11, 4294967292
%18 = insertelement <2 x double> poison, double %2, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = insertelement <2 x double> poison, double %2, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = and i64 %15, 1
%23 = icmp eq i64 %13, 0
%24 = and i64 %15, 9223372036854775806
%25 = icmp eq i64 %22, 0
%26 = icmp eq i64 %17, %11
%27 = and i64 %11, 3
%28 = icmp eq i64 %27, 0
br label %29
29: ; preds = %7, %133
%30 = phi i64 [ 0, %7 ], [ %134, %133 ]
%31 = mul i64 %30, %9
%32 = getelementptr double, double* %0, i64 %31
%33 = add i64 %31, %11
%34 = getelementptr double, double* %0, i64 %33
%35 = getelementptr double, double* %1, i64 %31
%36 = getelementptr double, double* %1, i64 %33
%37 = mul nsw i64 %30, %9
%38 = getelementptr inbounds double, double* %0, i64 %37
%39 = getelementptr inbounds double, double* %1, i64 %37
br i1 %8, label %40, label %133
40: ; preds = %29
br i1 %16, label %93, label %41
41: ; preds = %40
%42 = icmp ult double* %32, %36
%43 = icmp ult double* %35, %34
%44 = and i1 %42, %43
br i1 %44, label %93, label %45
45: ; preds = %41
br i1 %23, label %77, label %46
46: ; preds = %45, %46
%47 = phi i64 [ %74, %46 ], [ 0, %45 ]
%48 = phi i64 [ %75, %46 ], [ 0, %45 ]
%49 = getelementptr inbounds double, double* %39, i64 %47
%50 = bitcast double* %49 to <2 x double>*
%51 = load <2 x double>, <2 x double>* %50
%52 = getelementptr inbounds double, double* %49, i64 2
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = fmul <2 x double> %51, %19
%56 = fmul <2 x double> %54, %21
%57 = getelementptr inbounds double, double* %38, i64 %47
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %55, <2 x double>* %58
%59 = getelementptr inbounds double, double* %57, i64 2
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %56, <2 x double>* %60
%61 = or i64 %47, 4
%62 = getelementptr inbounds double, double* %39, i64 %61
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = getelementptr inbounds double, double* %62, i64 2
%66 = bitcast double* %65 to <2 x double>*
%67 = load <2 x double>, <2 x double>* %66
%68 = fmul <2 x double> %64, %19
%69 = fmul <2 x double> %67, %21
%70 = getelementptr inbounds double, double* %38, i64 %61
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> %68, <2 x double>* %71
%72 = getelementptr inbounds double, double* %70, i64 2
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> %69, <2 x double>* %73
%74 = add nuw i64 %47, 8
%75 = add i64 %48, 2
%76 = icmp eq i64 %75, %24
br i1 %76, label %77, label %46
77: ; preds = %46, %45
%78 = phi i64 [ 0, %45 ], [ %74, %46 ]
br i1 %25, label %92, label %79
79: ; preds = %77
%80 = getelementptr inbounds double, double* %39, i64 %78
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = getelementptr inbounds double, double* %80, i64 2
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = fmul <2 x double> %82, %19
%87 = fmul <2 x double> %85, %21
%88 = getelementptr inbounds double, double* %38, i64 %78
%89 = bitcast double* %88 to <2 x double>*
store <2 x double> %86, <2 x double>* %89
%90 = getelementptr inbounds double, double* %88, i64 2
%91 = bitcast double* %90 to <2 x double>*
store <2 x double> %87, <2 x double>* %91
br label %92
92: ; preds = %77, %79
br i1 %26, label %133, label %93
93: ; preds = %41, %40, %92
%94 = phi i64 [ 0, %41 ], [ 0, %40 ], [ %17, %92 ]
%95 = xor i64 %94, -1
%96 = add nsw i64 %95, %11
br i1 %28, label %107, label %97
97: ; preds = %93, %97
%98 = phi i64 [ %104, %97 ], [ %94, %93 ]
%99 = phi i64 [ %105, %97 ], [ 0, %93 ]
%100 = getelementptr inbounds double, double* %39, i64 %98
%101 = load double, double* %100
%102 = fmul double %101, %2
%103 = getelementptr inbounds double, double* %38, i64 %98
store double %102, double* %103
%104 = add nuw nsw i64 %98, 1
%105 = add i64 %99, 1
%106 = icmp eq i64 %105, %27
br i1 %106, label %107, label %97
107: ; preds = %97, %93
%108 = phi i64 [ %94, %93 ], [ %104, %97 ]
%109 = icmp ult i64 %96, 3
br i1 %109, label %133, label %110
110: ; preds = %107, %110
%111 = phi i64 [ %131, %110 ], [ %108, %107 ]
%112 = getelementptr inbounds double, double* %39, i64 %111
%113 = load double, double* %112
%114 = fmul double %113, %2
%115 = getelementptr inbounds double, double* %38, i64 %111
store double %114, double* %115
%116 = add nuw nsw i64 %111, 1
%117 = getelementptr inbounds double, double* %39, i64 %116
%118 = load double, double* %117
%119 = fmul double %118, %2
%120 = getelementptr inbounds double, double* %38, i64 %116
store double %119, double* %120
%121 = add nuw nsw i64 %111, 2
%122 = getelementptr inbounds double, double* %39, i64 %121
%123 = load double, double* %122
%124 = fmul double %123, %2
%125 = getelementptr inbounds double, double* %38, i64 %121
store double %124, double* %125
%126 = add nuw nsw i64 %111, 3
%127 = getelementptr inbounds double, double* %39, i64 %126
%128 = load double, double* %127
%129 = fmul double %128, %2
%130 = getelementptr inbounds double, double* %38, i64 %126
store double %129, double* %130
%131 = add nuw nsw i64 %111, 4
%132 = icmp eq i64 %131, %11
br i1 %132, label %133, label %110
133: ; preds = %107, %110, %92, %29
%134 = add nuw nsw i64 %30, 1
%135 = icmp eq i64 %134, %10
br i1 %135, label %136, label %29
136: ; preds = %133, %5
ret void
}