float MinAngle(float vX, float vY, float vZ, float aX, float aY, float aZ,
               float bX, float bY, float bZ) {
  float vaX, vaY, vaZ;
  float vbX, vbY, vbZ;
  float vaMod, vbMod;
  float angle;
  vaX = aX - vX;
  vaY = aY - vY;
  vaZ = aZ - vZ;
  vaMod = (float)sqrt((vaX) * (vaX) + (vaY) * (vaY) + (vaZ) * (vaZ));
  if (vaMod < 0.0001f) {
    return 0.0f;
  }
  vbX = bX - vX;
  vbY = bY - vY;
  vbZ = bZ - vZ;
  vbMod = (float)sqrt((vbX) * (vbX) + (vbY) * (vbY) + (vbZ) * (vbZ));
  if (vbMod < 0.0001f) {
    return 0.0f;
  }
  angle = (float)acos((vaX * vbX + vaY * vbY + vaZ * vbZ) / (vaMod * vbMod));
  return angle;
}


x86 assembly (clang, -O0):
<MinAngle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  0x10(%rbp),%xmm8
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  %xmm4,-0x18(%rbp)
movss  %xmm5,-0x1c(%rbp)
movss  %xmm6,-0x20(%rbp)
movss  %xmm7,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x28(%rbp),%xmm1
movss  -0x28(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm0
mulss  -0x2c(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
movss  -0x30(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  0xe35(%rip),%xmm0
ucomiss -0x40(%rbp),%xmm0
jbe    11e2 <MinAngle+0xc2>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12c6 <MinAngle+0x1a6>
movss  -0x20(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x24(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  0x10(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x34(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
movss  -0x38(%rbp),%xmm0
mulss  -0x38(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x3c(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  0xda9(%rip),%xmm0
ucomiss -0x44(%rbp),%xmm0
jbe    126e <MinAngle+0x14e>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12c6 <MinAngle+0x1a6>
movss  -0x28(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm0
mulss  -0x38(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x40(%rbp),%xmm1
mulss  -0x44(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <acos@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MinAngle>:
sub    $0x28,%rsp
movaps %xmm0,%xmm8
subss  %xmm0,%xmm3
subss  %xmm1,%xmm4
subss  %xmm2,%xmm5
movss  %xmm4,0x1c(%rsp)
movaps %xmm4,%xmm0
mulss  %xmm4,%xmm0
movss  %xmm3,0x20(%rsp)
mulss  %xmm3,%xmm3
addss  %xmm0,%xmm3
movss  %xmm5,0x24(%rsp)
movaps %xmm5,%xmm0
mulss  %xmm5,%xmm0
addss  %xmm3,%xmm0
xorps  %xmm5,%xmm5
ucomiss %xmm5,%xmm0
jb     116f <MinAngle+0x4f>
sqrtss %xmm0,%xmm9
jmp    11b9 <MinAngle+0x99>
movss  %xmm6,0x14(%rsp)
movss  %xmm7,0x10(%rsp)
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
movss  %xmm8,0x18(%rsp)
call   1040 <sqrtf@plt>
movss  0x18(%rsp),%xmm8
movss  0x8(%rsp),%xmm1
xorps  %xmm5,%xmm5
movss  0xc(%rsp),%xmm2
movss  0x10(%rsp),%xmm7
movss  0x14(%rsp),%xmm6
movaps %xmm0,%xmm9
movss  0xe3f(%rip),%xmm3
ucomiss %xmm9,%xmm3
ja     129b <MinAngle+0x17b>
movss  0x30(%rsp),%xmm4
subss  %xmm8,%xmm6
subss  %xmm1,%xmm7
subss  %xmm2,%xmm4
movaps %xmm7,%xmm0
mulss  %xmm7,%xmm0
movaps %xmm6,%xmm1
mulss  %xmm6,%xmm1
addss  %xmm0,%xmm1
movaps %xmm4,%xmm0
mulss  %xmm4,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm5,%xmm5
ucomiss %xmm5,%xmm0
jb     1211 <MinAngle+0xf1>
sqrtss %xmm0,%xmm0
ucomiss %xmm0,%xmm3
jbe    1258 <MinAngle+0x138>
jmp    129b <MinAngle+0x17b>
movss  %xmm6,0x14(%rsp)
movss  %xmm7,0x10(%rsp)
movss  %xmm9,0xc(%rsp)
movss  %xmm4,0x8(%rsp)
call   1040 <sqrtf@plt>
movss  0xdc9(%rip),%xmm3
movss  0x8(%rsp),%xmm4
xorps  %xmm5,%xmm5
movss  0xc(%rsp),%xmm9
movss  0x10(%rsp),%xmm7
movss  0x14(%rsp),%xmm6
ucomiss %xmm0,%xmm3
ja     129b <MinAngle+0x17b>
movss  0x1c(%rsp),%xmm1
mulss  %xmm7,%xmm1
movss  0x20(%rsp),%xmm2
mulss  %xmm6,%xmm2
addss  %xmm1,%xmm2
movss  0x24(%rsp),%xmm1
mulss  %xmm4,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm0,%xmm9
divss  %xmm9,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
call   1030 <acos@plt>
xorps  %xmm5,%xmm5
cvtsd2ss %xmm0,%xmm5
movaps %xmm5,%xmm0
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define float @MinAngle(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, float %8) {
%10 = fsub float %3, %0
%11 = fsub float %4, %1
%12 = fsub float %5, %2
%13 = fmul float %11, %11
%14 = tail call float @llvm.fmuladd.f32(float %10, float %10, float %13)
%15 = tail call float @llvm.fmuladd.f32(float %12, float %12, float %14)
%16 = tail call float @sqrtf(float %15)
%17 = fcmp olt float %16, 0x3F1A36E2E0000000
br i1 %17, label %36, label %18
18: ; preds = %9
%19 = fsub float %6, %0
%20 = fsub float %7, %1
%21 = fsub float %8, %2
%22 = fmul float %20, %20
%23 = tail call float @llvm.fmuladd.f32(float %19, float %19, float %22)
%24 = tail call float @llvm.fmuladd.f32(float %21, float %21, float %23)
%25 = tail call float @sqrtf(float %24)
%26 = fcmp olt float %25, 0x3F1A36E2E0000000
br i1 %26, label %36, label %27
27: ; preds = %18
%28 = fmul float %11, %20
%29 = tail call float @llvm.fmuladd.f32(float %10, float %19, float %28)
%30 = tail call float @llvm.fmuladd.f32(float %12, float %21, float %29)
%31 = fmul float %16, %25
%32 = fdiv float %30, %31
%33 = fpext float %32 to double
%34 = tail call double @acos(double %33)
%35 = fptrunc double %34 to float
br label %36
36: ; preds = %18, %9, %27
%37 = phi float [ %35, %27 ], [ 0.000000e+00, %9 ], [ 0.000000e+00, %18 ]
ret float %37
}