void boost_factor_high(double *phi, unsigned long nvox, double limit,
                       double scale) {
  unsigned long m;
  for (m = 0; m < nvox; m++)
    if (*(phi + m) > limit)
      *(phi + m) *= scale;
}


x86 assembly (clang, -O0):
<boost_factor_high>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1171 <boost_factor_high+0x71>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    115b <boost_factor_high+0x5b>
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1160 <boost_factor_high+0x60>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111e <boost_factor_high+0x1e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<boost_factor_high>:
test   %rsi,%rsi
je     1127 <boost_factor_high+0x27>
cmp    $0x1,%rsi
jne    1128 <boost_factor_high+0x28>
xor    %eax,%eax
test   $0x1,%sil
je     1127 <boost_factor_high+0x27>
movsd  (%rdi,%rax,8),%xmm2
ucomisd %xmm0,%xmm2
jbe    1127 <boost_factor_high+0x27>
mulsd  %xmm1,%xmm2
movsd  %xmm2,(%rdi,%rax,8)
ret
mov    %rsi,%rcx
and    $0xfffffffffffffffe,%rcx
xor    %eax,%eax
jmp    1149 <boost_factor_high+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x2,%rax
cmp    %rax,%rcx
je     110d <boost_factor_high+0xd>
movsd  (%rdi,%rax,8),%xmm2
ucomisd %xmm0,%xmm2
jbe    115d <boost_factor_high+0x5d>
mulsd  %xmm1,%xmm2
movsd  %xmm2,(%rdi,%rax,8)
movsd  0x8(%rdi,%rax,8),%xmm2
ucomisd %xmm0,%xmm2
jbe    1140 <boost_factor_high+0x40>
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rdi,%rax,8)
jmp    1140 <boost_factor_high+0x40>

LLVM IR (-O0):
define void @boost_factor_high(double* %0, i64 %1, double %2, double %3) {
%5 = alloca double*
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca i64
store double* %0, double** %5
store i64 %1, i64* %6
store double %2, double* %7
store double %3, double* %8
store i64 0, i64* %9
br label %10
10: ; preds = %29, %4
%11 = load i64, i64* %9
%12 = load i64, i64* %6
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %32
14: ; preds = %10
%15 = load double*, double** %5
%16 = load i64, i64* %9
%17 = getelementptr inbounds double, double* %15, i64 %16
%18 = load double, double* %17
%19 = load double, double* %7
%20 = fcmp ogt double %18, %19
br i1 %20, label %21, label %28
21: ; preds = %14
%22 = load double, double* %8
%23 = load double*, double** %5
%24 = load i64, i64* %9
%25 = getelementptr inbounds double, double* %23, i64 %24
%26 = load double, double* %25
%27 = fmul double %26, %22
store double %27, double* %25
br label %28
28: ; preds = %21, %14
br label %29
29: ; preds = %28
%30 = load i64, i64* %9
%31 = add i64 %30, 1
store i64 %31, i64* %9
br label %10
32: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @boost_factor_high(double* nocapture %0, i64 %1, double %2, double %3) {
%5 = icmp eq i64 %1, 0
br i1 %5, label %39, label %6
6: ; preds = %4
%7 = and i64 %1, 1
%8 = icmp eq i64 %1, 1
br i1 %8, label %30, label %9
9: ; preds = %6
%10 = and i64 %1, -2
br label %11
11: ; preds = %26, %9
%12 = phi i64 [ 0, %9 ], [ %27, %26 ]
%13 = phi i64 [ 0, %9 ], [ %28, %26 ]
%14 = getelementptr inbounds double, double* %0, i64 %12
%15 = load double, double* %14
%16 = fcmp ogt double %15, %2
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = fmul double %15, %3
store double %18, double* %14
br label %19
19: ; preds = %11, %17
%20 = or i64 %12, 1
%21 = getelementptr inbounds double, double* %0, i64 %20
%22 = load double, double* %21
%23 = fcmp ogt double %22, %2
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = fmul double %22, %3
store double %25, double* %21
br label %26
26: ; preds = %24, %19
%27 = add nuw i64 %12, 2
%28 = add i64 %13, 2
%29 = icmp eq i64 %28, %10
br i1 %29, label %30, label %11
30: ; preds = %26, %6
%31 = phi i64 [ 0, %6 ], [ %27, %26 ]
%32 = icmp eq i64 %7, 0
br i1 %32, label %39, label %33
33: ; preds = %30
%34 = getelementptr inbounds double, double* %0, i64 %31
%35 = load double, double* %34
%36 = fcmp ogt double %35, %2
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = fmul double %35, %3
store double %38, double* %34
br label %39
39: ; preds = %30, %37, %33, %4
ret void
}