void 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,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <ordran@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%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>
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 void @locate(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
%10 = load i32, i32* %5
%11 = load double*, double** %8
%12 = call i32 (i32, double*, ...) bitcast (i32 (...)* @ordran to i32 (i32, double*, ...)*)(i32 %10, double* %11)
store i32 0, i32* %9
br label %13
13: ; preds = %30, %4
%14 = load i32, i32* %9
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %33
17: ; preds = %13
%18 = load double, double* %6
%19 = load double*, double** %8
%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 = load double, double* %7
%25 = call double @llvm.fmuladd.f64(double %23, double %24, double %18)
%26 = load double*, double** %8
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
store double %25, double* %29
br label %30
30: ; preds = %17
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
br label %13
33: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @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 void
}