double wcsdist1(x1, y1, x2, y2)
double x1, y1;
double x2, y2;
{
  double d1, d2, r;
  double pos1[3], pos2[3], w, diff;
  int i;
  r = 1.0;
  d2v3(x1, y1, r, pos1);
  d2v3(x2, y2, r, pos2);
  w = 0.0;
  d1 = 0.0;
  d2 = 0.0;
  for (i = 0; i < 3; i++) {
    w = w + (pos1[i] * pos2[i]);
    d1 = d1 + (pos1[i] * pos1[i]);
    d2 = d2 + (pos2[i] * pos2[i]);
  }
  diff = acosdeg(w / (sqrt(d1) * sqrt(d2)));
  return (diff);
}


x86 assembly (clang, -O0):
<wcsdist1>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  0xea9(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
lea    -0x50(%rbp),%rdi
mov    $0x3,%al
call   1040 <d2v3@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
lea    -0x70(%rbp),%rdi
mov    $0x3,%al
call   1040 <d2v3@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x84(%rbp)
cmpl   $0x3,-0x84(%rbp)
jge    1257 <wcsdist1+0x127>
movsd  -0x78(%rbp),%xmm1
movslq -0x84(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
movslq -0x84(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm1
movslq -0x84(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
movslq -0x84(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm1
movslq -0x84(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
movslq -0x84(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11b2 <wcsdist1+0x82>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  -0x98(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%al
call   1030 <acosdeg@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsdist1>:
sub    $0x58,%rsp
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  0xeb8(%rip),%xmm2
lea    0x40(%rsp),%rdi
mov    $0x3,%al
call   1040 <d2v3@plt>
lea    0x20(%rsp),%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0xe93(%rip),%xmm2
mov    $0x3,%al
call   1040 <d2v3@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x48(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm1
movapd %xmm0,%xmm4
mulsd  %xmm3,%xmm4
xorpd  %xmm5,%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm0,%xmm0
addsd  %xmm5,%xmm0
mulsd  %xmm3,%xmm3
addsd  %xmm5,%xmm3
movapd %xmm2,%xmm6
mulsd  %xmm1,%xmm6
addsd  %xmm4,%xmm6
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm3,%xmm1
movsd  0x50(%rsp),%xmm0
movsd  0x30(%rsp),%xmm4
movapd %xmm0,%xmm3
mulsd  %xmm4,%xmm3
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm4,%xmm4
addsd  %xmm1,%xmm4
ucomisd %xmm5,%xmm0
jb     11fb <wcsdist1+0xcb>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    122c <wcsdist1+0xfc>
movsd  %xmm3,0x10(%rsp)
movsd  %xmm6,0x8(%rsp)
movsd  %xmm4,0x18(%rsp)
call   1050 <sqrt@plt>
movsd  0x18(%rsp),%xmm4
movsd  0x8(%rsp),%xmm6
movsd  0x10(%rsp),%xmm3
xorpd  %xmm5,%xmm5
movapd %xmm0,%xmm1
addsd  %xmm6,%xmm3
ucomisd %xmm5,%xmm4
jb     123f <wcsdist1+0x10f>
xorps  %xmm0,%xmm0
sqrtsd %xmm4,%xmm0
jmp    1260 <wcsdist1+0x130>
movapd %xmm4,%xmm0
movsd  %xmm3,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1050 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm3
mulsd  %xmm0,%xmm1
divsd  %xmm1,%xmm3
movapd %xmm3,%xmm0
mov    $0x1,%al
call   1030 <acosdeg@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x58,%rsp
ret

LLVM IR (-O0):
define double @wcsdist1(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca [3 x double]
%13 = alloca [3 x double]
%14 = alloca double
%15 = alloca double
%16 = alloca i32
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
store double 1.000000e+00, double* %11
%17 = load double, double* %5
%18 = load double, double* %6
%19 = load double, double* %11
%20 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 0
%21 = call i32 (double, double, double, double*, ...) bitcast (i32 (...)* @d2v3 to i32 (double, double, double, double*, ...)*)(double %17, double %18, double %19, double* %20)
%22 = load double, double* %7
%23 = load double, double* %8
%24 = load double, double* %11
%25 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 0
%26 = call i32 (double, double, double, double*, ...) bitcast (i32 (...)* @d2v3 to i32 (double, double, double, double*, ...)*)(double %22, double %23, double %24, double* %25)
store double 0.000000e+00, double* %14
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %10
store i32 0, i32* %16
br label %27
27: ; preds = %61, %4
%28 = load i32, i32* %16
%29 = icmp slt i32 %28, 3
br i1 %29, label %30, label %64
30: ; preds = %27
%31 = load double, double* %14
%32 = load i32, i32* %16
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 %33
%35 = load double, double* %34
%36 = load i32, i32* %16
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 %37
%39 = load double, double* %38
%40 = call double @llvm.fmuladd.f64(double %35, double %39, double %31)
store double %40, double* %14
%41 = load double, double* %9
%42 = load i32, i32* %16
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 %43
%45 = load double, double* %44
%46 = load i32, i32* %16
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 %47
%49 = load double, double* %48
%50 = call double @llvm.fmuladd.f64(double %45, double %49, double %41)
store double %50, double* %9
%51 = load double, double* %10
%52 = load i32, i32* %16
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 %53
%55 = load double, double* %54
%56 = load i32, i32* %16
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 %57
%59 = load double, double* %58
%60 = call double @llvm.fmuladd.f64(double %55, double %59, double %51)
store double %60, double* %10
br label %61
61: ; preds = %30
%62 = load i32, i32* %16
%63 = add nsw i32 %62, 1
store i32 %63, i32* %16
br label %27
64: ; preds = %27
%65 = load double, double* %14
%66 = load double, double* %9
%67 = call double @sqrt(double %66)
%68 = load double, double* %10
%69 = call double @sqrt(double %68)
%70 = fmul double %67, %69
%71 = fdiv double %65, %70
%72 = call i32 (double, ...) bitcast (i32 (...)* @acosdeg to i32 (double, ...)*)(double %71)
%73 = sitofp i32 %72 to double
store double %73, double* %15
%74 = load double, double* %15
ret double %74
}

LLVM IR (-O2):
define double @wcsdist1(double %0, double %1, double %2, double %3) {
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %5 to i8*
%8 = bitcast [3 x double]* %6 to i8*
%9 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%10 = call i32 (double, double, double, double*, ...) bitcast (i32 (...)* @d2v3 to i32 (double, double, double, double*, ...)*)(double %0, double %1, double 1.000000e+00, double* %9)
%11 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%12 = call i32 (double, double, double, double*, ...) bitcast (i32 (...)* @d2v3 to i32 (double, double, double, double*, ...)*)(double %2, double %3, double 1.000000e+00, double* %11)
%13 = load double, double* %9
%14 = load double, double* %11
%15 = call double @llvm.fmuladd.f64(double %13, double %14, double 0.000000e+00)
%16 = call double @llvm.fmuladd.f64(double %13, double %13, double 0.000000e+00)
%17 = call double @llvm.fmuladd.f64(double %14, double %14, double 0.000000e+00)
%18 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%19 = load double, double* %18
%20 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%21 = load double, double* %20
%22 = call double @llvm.fmuladd.f64(double %19, double %21, double %15)
%23 = call double @llvm.fmuladd.f64(double %19, double %19, double %16)
%24 = call double @llvm.fmuladd.f64(double %21, double %21, double %17)
%25 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%26 = load double, double* %25
%27 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%28 = load double, double* %27
%29 = call double @llvm.fmuladd.f64(double %26, double %28, double %22)
%30 = call double @llvm.fmuladd.f64(double %26, double %26, double %23)
%31 = call double @llvm.fmuladd.f64(double %28, double %28, double %24)
%32 = call double @sqrt(double %30)
%33 = call double @sqrt(double %31)
%34 = fmul double %32, %33
%35 = fdiv double %29, %34
%36 = call i32 (double, ...) bitcast (i32 (...)* @acosdeg to i32 (double, ...)*)(double %35)
%37 = sitofp i32 %36 to double
ret double %37
}