int locate(n, beg, len, ptr)
int n;
double beg, len, *ptr;
{
  int i;
  ordran(n, ptr);
  for (i = 0; i < n; i++)
    ptr[i] = beg + ptr[i] * len;
}


x86 assembly (clang, -O0):
<locate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ordran@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1184 <locate+0x74>
movsd  -0x10(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113e <locate+0x2e>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<locate>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
movapd %xmm1,0x10(%rsp)
movapd %xmm0,(%rsp)
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <ordran@plt>
movapd (%rsp),%xmm7
movapd 0x10(%rsp),%xmm6
test   %ebp,%ebp
jle    123b <locate+0x12b>
mov    %ebp,%eax
cmp    $0x4,%ebp
jae    114e <locate+0x3e>
xor    %ecx,%ecx
jmp    1220 <locate+0x110>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm6,%xmm0
unpcklpd %xmm6,%xmm0
movapd %xmm7,%xmm1
unpcklpd %xmm7,%xmm1
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1242 <locate+0x132>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd (%rbx,%rdx,8),%xmm2
movupd 0x10(%rbx,%rdx,8),%xmm3
movupd 0x20(%rbx,%rdx,8),%xmm4
movupd 0x30(%rbx,%rdx,8),%xmm5
mulpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rdx,8)
movupd %xmm3,0x10(%rbx,%rdx,8)
mulpd  %xmm0,%xmm4
addpd  %xmm1,%xmm4
mulpd  %xmm0,%xmm5
addpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rbx,%rdx,8)
movupd %xmm5,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1190 <locate+0x80>
test   $0x1,%sil
je     1214 <locate+0x104>
movupd (%rbx,%rdx,8),%xmm2
movupd 0x10(%rbx,%rdx,8),%xmm3
mulpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rdx,8)
movupd %xmm3,0x10(%rbx,%rdx,8)
cmp    %rax,%rcx
je     123b <locate+0x12b>
nopl   0x0(%rax)
movsd  (%rbx,%rcx,8),%xmm0
mulsd  %xmm6,%xmm0
addsd  %xmm7,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1220 <locate+0x110>
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    11ee <locate+0xde>
jmp    1214 <locate+0x104>

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

LLVM IR (-O2):
define i32 @locate(i32 %0, double %1, double %2, double* %3) {
%5 = tail call i32 (i32, double*, ...) bitcast (i32 (...)* @ordran to i32 (i32, double*, ...)*)(i32 %0, double* %3)
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %79
7: ; preds = %4
%8 = zext i32 %0 to i64
%9 = icmp ult i32 %0, 4
br i1 %9, label %70, label %10
10: ; preds = %7
%11 = and i64 %8, 4294967292
%12 = insertelement <2 x double> poison, double %2, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %1, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = insertelement <2 x double> poison, double %2, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = insertelement <2 x double> poison, double %1, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = add nsw i64 %11, -4
%21 = lshr exact i64 %20, 2
%22 = add nuw nsw i64 %21, 1
%23 = and i64 %22, 1
%24 = icmp eq i64 %20, 0
br i1 %24, label %54, label %25
25: ; preds = %10
%26 = and i64 %22, 9223372036854775806
br label %27
27: ; preds = %27, %25
%28 = phi i64 [ 0, %25 ], [ %51, %27 ]
%29 = phi i64 [ 0, %25 ], [ %52, %27 ]
%30 = getelementptr inbounds double, double* %3, i64 %28
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = getelementptr inbounds double, double* %30, i64 2
%34 = bitcast double* %33 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %32, <2 x double> %13, <2 x double> %15)
%37 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %35, <2 x double> %17, <2 x double> %19)
%38 = bitcast double* %30 to <2 x double>*
store <2 x double> %36, <2 x double>* %38
%39 = bitcast double* %33 to <2 x double>*
store <2 x double> %37, <2 x double>* %39
%40 = or i64 %28, 4
%41 = getelementptr inbounds double, double* %3, i64 %40
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = getelementptr inbounds double, double* %41, i64 2
%45 = bitcast double* %44 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %43, <2 x double> %13, <2 x double> %15)
%48 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %46, <2 x double> %17, <2 x double> %19)
%49 = bitcast double* %41 to <2 x double>*
store <2 x double> %47, <2 x double>* %49
%50 = bitcast double* %44 to <2 x double>*
store <2 x double> %48, <2 x double>* %50
%51 = add nuw i64 %28, 8
%52 = add i64 %29, 2
%53 = icmp eq i64 %52, %26
br i1 %53, label %54, label %27
54: ; preds = %27, %10
%55 = phi i64 [ 0, %10 ], [ %51, %27 ]
%56 = icmp eq i64 %23, 0
br i1 %56, label %68, label %57
57: ; preds = %54
%58 = getelementptr inbounds double, double* %3, i64 %55
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = getelementptr inbounds double, double* %58, i64 2
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %60, <2 x double> %13, <2 x double> %15)
%65 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %63, <2 x double> %17, <2 x double> %19)
%66 = bitcast double* %58 to <2 x double>*
store <2 x double> %64, <2 x double>* %66
%67 = bitcast double* %61 to <2 x double>*
store <2 x double> %65, <2 x double>* %67
br label %68
68: ; preds = %54, %57
%69 = icmp eq i64 %11, %8
br i1 %69, label %79, label %70
70: ; preds = %7, %68
%71 = phi i64 [ 0, %7 ], [ %11, %68 ]
br label %72
72: ; preds = %70, %72
%73 = phi i64 [ %77, %72 ], [ %71, %70 ]
%74 = getelementptr inbounds double, double* %3, i64 %73
%75 = load double, double* %74
%76 = tail call double @llvm.fmuladd.f64(double %75, double %2, double %1)
store double %76, double* %74
%77 = add nuw nsw i64 %73, 1
%78 = icmp eq i64 %77, %8
br i1 %78, label %79, label %72
79: ; preds = %72, %68, %4
ret i32 undef
}