float distance_between(float lat1, float long1, float lat2, float long2) {
  float delta = ((long1 - long2) * 0.017453292519943295769236907684886);
  float sdlong = sin(delta);
  float cdlong = cos(delta);
  lat1 = ((lat1)*0.017453292519943295769236907684886);
  lat2 = ((lat2)*0.017453292519943295769236907684886);
  float slat1 = sin(lat1);
  float clat1 = cos(lat1);
  float slat2 = sin(lat2);
  float clat2 = cos(lat2);
  delta = (clat1 * slat2) - (slat1 * clat2 * cdlong);
  delta = ((delta) * (delta));
  delta += ((clat2 * sdlong) * (clat2 * sdlong));
  delta = sqrt(delta);
  float denom = (slat1 * slat2) + (clat1 * clat2 * cdlong);
  delta = atan2(delta, denom);
  return delta * 6372795;
}


x86 assembly (clang, -O0):
<distance_between>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe96(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <sin@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1050 <cos@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4a(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe2c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <sin@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1050 <cos@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <sin@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1050 <cos@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm2
movss  -0x20(%rbp),%xmm1
mulss  -0x2c(%rbp),%xmm1
mulss  -0x1c(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x2c(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm2
mulss  -0x18(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1060 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x28(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  -0x2c(%rbp),%xmm1
mulss  -0x1c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
call   1030 <atan2@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xcee(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance_between>:
sub    $0x28,%rsp
movss  %xmm2,0x8(%rsp)
movss  %xmm0,0x10(%rsp)
subss  %xmm3,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mulsd  0xe9d(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
call   1040 <sin@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
movsd  0x18(%rsp),%xmm0
call   1060 <cos@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe59(%rip),%xmm2
mulsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
call   1040 <sin@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
call   1040 <sin@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
movsd  0x20(%rsp),%xmm0
call   1060 <cos@plt>
xorps  %xmm3,%xmm3
cvtsd2ss %xmm0,%xmm3
movss  0x8(%rsp),%xmm0
mulss  %xmm3,%xmm0
mulss  0x18(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
mulss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
mulss  %xmm1,%xmm1
movss  0xc(%rsp),%xmm2
mulss  %xmm3,%xmm2
mulss  %xmm2,%xmm2
addss  %xmm1,%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
movaps %xmm2,%xmm0
jb     126d <distance_between+0x12d>
sqrtss %xmm0,%xmm0
jmp    127e <distance_between+0x13e>
movss  %xmm3,0xc(%rsp)
call   1050 <sqrtf@plt>
movss  0xc(%rsp),%xmm3
movss  0x10(%rsp),%xmm2
mulss  %xmm3,%xmm2
mulss  0x18(%rsp),%xmm2
movss  0x8(%rsp),%xmm1
mulss  0x4(%rsp),%xmm1
addss  %xmm2,%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
call   1030 <atan2@plt>
cvtsd2ss %xmm0,%xmm0
mulss  0xd51(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @distance_between(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%17 = load float, float* %6
%18 = load float, float* %8
%19 = fsub float %17, %18
%20 = fpext float %19 to double
%21 = fmul double %20, 0x3F91DF46A2529D39
%22 = fptrunc double %21 to float
store float %22, float* %9
%23 = load float, float* %9
%24 = fpext float %23 to double
%25 = call double @sin(double %24)
%26 = fptrunc double %25 to float
store float %26, float* %10
%27 = load float, float* %9
%28 = fpext float %27 to double
%29 = call double @cos(double %28)
%30 = fptrunc double %29 to float
store float %30, float* %11
%31 = load float, float* %5
%32 = fpext float %31 to double
%33 = fmul double %32, 0x3F91DF46A2529D39
%34 = fptrunc double %33 to float
store float %34, float* %5
%35 = load float, float* %7
%36 = fpext float %35 to double
%37 = fmul double %36, 0x3F91DF46A2529D39
%38 = fptrunc double %37 to float
store float %38, float* %7
%39 = load float, float* %5
%40 = fpext float %39 to double
%41 = call double @sin(double %40)
%42 = fptrunc double %41 to float
store float %42, float* %12
%43 = load float, float* %5
%44 = fpext float %43 to double
%45 = call double @cos(double %44)
%46 = fptrunc double %45 to float
store float %46, float* %13
%47 = load float, float* %7
%48 = fpext float %47 to double
%49 = call double @sin(double %48)
%50 = fptrunc double %49 to float
store float %50, float* %14
%51 = load float, float* %7
%52 = fpext float %51 to double
%53 = call double @cos(double %52)
%54 = fptrunc double %53 to float
store float %54, float* %15
%55 = load float, float* %13
%56 = load float, float* %14
%57 = load float, float* %12
%58 = load float, float* %15
%59 = fmul float %57, %58
%60 = load float, float* %11
%61 = fmul float %59, %60
%62 = fneg float %61
%63 = call float @llvm.fmuladd.f32(float %55, float %56, float %62)
store float %63, float* %9
%64 = load float, float* %9
%65 = load float, float* %9
%66 = fmul float %64, %65
store float %66, float* %9
%67 = load float, float* %15
%68 = load float, float* %10
%69 = fmul float %67, %68
%70 = load float, float* %15
%71 = load float, float* %10
%72 = fmul float %70, %71
%73 = load float, float* %9
%74 = call float @llvm.fmuladd.f32(float %69, float %72, float %73)
store float %74, float* %9
%75 = load float, float* %9
%76 = fpext float %75 to double
%77 = call double @sqrt(double %76)
%78 = fptrunc double %77 to float
store float %78, float* %9
%79 = load float, float* %12
%80 = load float, float* %14
%81 = load float, float* %13
%82 = load float, float* %15
%83 = fmul float %81, %82
%84 = load float, float* %11
%85 = fmul float %83, %84
%86 = call float @llvm.fmuladd.f32(float %79, float %80, float %85)
store float %86, float* %16
%87 = load float, float* %9
%88 = fpext float %87 to double
%89 = load float, float* %16
%90 = fpext float %89 to double
%91 = call double @atan2(double %88, double %90)
%92 = fptrunc double %91 to float
store float %92, float* %9
%93 = load float, float* %9
%94 = fmul float %93, 0x41584F6EC0000000
ret float %94
}

LLVM IR (-O2):
define float @distance_between(float %0, float %1, float %2, float %3) {
%5 = fsub float %1, %3
%6 = fpext float %5 to double
%7 = fmul double %6, 0x3F91DF46A2529D39
%8 = fptrunc double %7 to float
%9 = fpext float %8 to double
%10 = tail call double @sin(double %9)
%11 = fptrunc double %10 to float
%12 = tail call double @cos(double %9)
%13 = fptrunc double %12 to float
%14 = fpext float %0 to double
%15 = fmul double %14, 0x3F91DF46A2529D39
%16 = fptrunc double %15 to float
%17 = fpext float %2 to double
%18 = fmul double %17, 0x3F91DF46A2529D39
%19 = fptrunc double %18 to float
%20 = fpext float %16 to double
%21 = tail call double @sin(double %20)
%22 = fptrunc double %21 to float
%23 = tail call double @cos(double %20)
%24 = fptrunc double %23 to float
%25 = fpext float %19 to double
%26 = tail call double @sin(double %25)
%27 = fptrunc double %26 to float
%28 = tail call double @cos(double %25)
%29 = fptrunc double %28 to float
%30 = fneg float %22
%31 = fmul float %30, %29
%32 = fmul float %31, %13
%33 = tail call float @llvm.fmuladd.f32(float %24, float %27, float %32)
%34 = fmul float %33, %33
%35 = fmul float %11, %29
%36 = tail call float @llvm.fmuladd.f32(float %35, float %35, float %34)
%37 = tail call float @sqrtf(float %36)
%38 = fmul float %24, %29
%39 = fmul float %38, %13
%40 = tail call float @llvm.fmuladd.f32(float %22, float %27, float %39)
%41 = fpext float %37 to double
%42 = fpext float %40 to double
%43 = tail call double @atan2(double %41, double %42)
%44 = fptrunc double %43 to float
%45 = fmul float %44, 0x41584F6EC0000000
ret float %45
}