void unscalex(int n, double x[], double xscale[], double xoffset[]) {
  int i;
  for (i = 0; i < n; i++)
    x[i] = x[i] * xscale[i] + xoffset[i];
}


x86 assembly (clang, -O0):
<unscalex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1170 <unscalex+0x70>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111a <unscalex+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<unscalex>:
test   %edi,%edi
jle    12b5 <unscalex+0x1b5>
mov    %edi,%r8d
cmp    $0x4,%edi
jae    117a <unscalex+0x7a>
xor    %edi,%edi
mov    %rdi,%rax
not    %rax
test   $0x1,%r8b
je     1136 <unscalex+0x36>
movsd  (%rsi,%rdi,8),%xmm0
mulsd  (%rdx,%rdi,8),%xmm0
addsd  (%rcx,%rdi,8),%xmm0
movsd  %xmm0,(%rsi,%rdi,8)
or     $0x1,%rdi
add    %r8,%rax
je     12b5 <unscalex+0x1b5>
nop
movsd  (%rsi,%rdi,8),%xmm0
mulsd  (%rdx,%rdi,8),%xmm0
movsd  0x8(%rsi,%rdi,8),%xmm1
addsd  (%rcx,%rdi,8),%xmm0
movsd  %xmm0,(%rsi,%rdi,8)
mulsd  0x8(%rdx,%rdi,8),%xmm1
addsd  0x8(%rcx,%rdi,8),%xmm1
movsd  %xmm1,0x8(%rsi,%rdi,8)
add    $0x2,%rdi
cmp    %rdi,%r8
jne    1140 <unscalex+0x40>
jmp    12b5 <unscalex+0x1b5>
lea    (%rsi,%r8,8),%rdi
lea    (%rdx,%r8,8),%rax
cmp    %rsi,%rax
seta   %r10b
lea    (%rcx,%r8,8),%rax
cmp    %rdx,%rdi
seta   %r11b
cmp    %rsi,%rax
seta   %al
cmp    %rcx,%rdi
seta   %r9b
xor    %edi,%edi
test   %r11b,%r10b
jne    1112 <unscalex+0x12>
and    %r9b,%al
jne    1112 <unscalex+0x12>
mov    %r8d,%edi
and    $0xfffffffc,%edi
lea    -0x4(%rdi),%rax
mov    %rax,%r9
shr    $0x2,%r9
add    $0x1,%r9
test   %rax,%rax
je     12b6 <unscalex+0x1b6>
mov    %r9,%r10
and    $0xfffffffffffffffe,%r10
xor    %eax,%eax
nopl   0x0(%rax)
movupd (%rdx,%rax,8),%xmm0
movupd 0x10(%rdx,%rax,8),%xmm1
movupd (%rcx,%rax,8),%xmm2
movupd 0x10(%rcx,%rax,8),%xmm3
movupd (%rsi,%rax,8),%xmm4
mulpd  %xmm0,%xmm4
addpd  %xmm2,%xmm4
movupd 0x10(%rsi,%rax,8),%xmm0
mulpd  %xmm1,%xmm0
addpd  %xmm3,%xmm0
movupd 0x20(%rsi,%rax,8),%xmm1
movupd 0x30(%rsi,%rax,8),%xmm2
movupd %xmm4,(%rsi,%rax,8)
movupd %xmm0,0x10(%rsi,%rax,8)
movupd 0x20(%rdx,%rax,8),%xmm0
mulpd  %xmm1,%xmm0
movupd 0x30(%rdx,%rax,8),%xmm1
mulpd  %xmm2,%xmm1
movupd 0x20(%rcx,%rax,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x30(%rcx,%rax,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,0x20(%rsi,%rax,8)
movupd %xmm0,0x30(%rsi,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%r10
jne    11e0 <unscalex+0xe0>
test   $0x1,%r9b
je     12ac <unscalex+0x1ac>
movupd (%rsi,%rax,8),%xmm0
movupd 0x10(%rsi,%rax,8),%xmm1
movupd (%rdx,%rax,8),%xmm2
mulpd  %xmm0,%xmm2
movupd 0x10(%rdx,%rax,8),%xmm0
mulpd  %xmm1,%xmm0
movupd (%rcx,%rax,8),%xmm1
addpd  %xmm2,%xmm1
movupd 0x10(%rcx,%rax,8),%xmm2
addpd  %xmm0,%xmm2
movupd %xmm1,(%rsi,%rax,8)
movupd %xmm2,0x10(%rsi,%rax,8)
cmp    %r8,%rdi
jne    1112 <unscalex+0x12>
ret
xor    %eax,%eax
test   $0x1,%r9b
jne    1270 <unscalex+0x170>
jmp    12ac <unscalex+0x1ac>

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

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