#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double acos(double);
double sqrt(double);
double spherical_angle(const double *v1, const double *v2, const double *v3) {
  double angle;
  double px, py, pz, qx, qy, qz, ddd;
  px = v1[1] * v2[2] - v1[2] * v2[1];
  py = v1[2] * v2[0] - v1[0] * v2[2];
  pz = v1[0] * v2[1] - v1[1] * v2[0];
  qx = v1[1] * v3[2] - v1[2] * v3[1];
  qy = v1[2] * v3[0] - v1[0] * v3[2];
  qz = v1[0] * v3[1] - v1[1] * v3[0];
  ddd = sqrt((px * px + py * py + pz * pz) * (qx * qx + qy * qy + qz * qz));
  if (ddd > 0) {
    angle = acos((px * qx + py * qy + pz * qz) / ddd);
  } else
    angle = 0.;
  return angle;
}


x86 assembly (clang, -O0):
<spherical_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x50(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    139a <spherical_angle+0x27a>
movsd  -0x28(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x58(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    13a2 <spherical_angle+0x282>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spherical_angle>:
sub    $0x38,%rsp
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm2
movsd  0x10(%rsi),%xmm1
movhpd 0x8(%rdx),%xmm2
movsd  (%rdi),%xmm4
movsd  0x8(%rdi),%xmm3
movsd  0x10(%rdi),%xmm5
unpcklpd %xmm5,%xmm5
unpcklpd %xmm3,%xmm3
movhpd 0x10(%rdx),%xmm1
movapd %xmm3,%xmm6
mulpd  %xmm1,%xmm6
unpcklpd %xmm4,%xmm4
mulpd  %xmm4,%xmm1
mulpd  %xmm2,%xmm4
mulpd  %xmm5,%xmm2
subpd  %xmm2,%xmm6
movhpd (%rdx),%xmm0
mulpd  %xmm0,%xmm5
subpd  %xmm1,%xmm5
mulpd  %xmm3,%xmm0
subpd  %xmm0,%xmm4
movapd %xmm5,%xmm0
mulpd  %xmm5,%xmm0
movapd %xmm6,%xmm1
mulpd  %xmm6,%xmm1
addpd  %xmm0,%xmm1
movapd %xmm4,%xmm2
mulpd  %xmm4,%xmm2
addpd  %xmm1,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11cb <spherical_angle+0xab>
sqrtsd %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     11fc <spherical_angle+0xdc>
xorpd  %xmm0,%xmm0
add    $0x38,%rsp
ret
movapd %xmm4,0x20(%rsp)
movapd %xmm5,0x10(%rsp)
movapd %xmm6,(%rsp)
call   1040 <sqrt@plt>
xorpd  %xmm1,%xmm1
movapd (%rsp),%xmm6
movapd 0x10(%rsp),%xmm5
movapd 0x20(%rsp),%xmm4
ucomisd %xmm1,%xmm0
jbe    11c2 <spherical_angle+0xa2>
movapd %xmm5,%xmm1
unpckhpd %xmm5,%xmm1
mulsd  %xmm5,%xmm1
movapd %xmm6,%xmm2
unpckhpd %xmm6,%xmm2
mulsd  %xmm6,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm4,%xmm1
unpckhpd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
jmp    1030 <acos@plt>

LLVM IR (-O0):
define double @spherical_angle(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = load double*, double** %5
%19 = getelementptr inbounds double, double* %18, i64 2
%20 = load double, double* %19
%21 = load double*, double** %4
%22 = getelementptr inbounds double, double* %21, i64 2
%23 = load double, double* %22
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = fmul double %23, %26
%28 = fneg double %27
%29 = call double @llvm.fmuladd.f64(double %17, double %20, double %28)
store double %29, double* %8
%30 = load double*, double** %4
%31 = getelementptr inbounds double, double* %30, i64 2
%32 = load double, double* %31
%33 = load double*, double** %5
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
%36 = load double*, double** %4
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = load double*, double** %5
%40 = getelementptr inbounds double, double* %39, i64 2
%41 = load double, double* %40
%42 = fmul double %38, %41
%43 = fneg double %42
%44 = call double @llvm.fmuladd.f64(double %32, double %35, double %43)
store double %44, double* %9
%45 = load double*, double** %4
%46 = getelementptr inbounds double, double* %45, i64 0
%47 = load double, double* %46
%48 = load double*, double** %5
%49 = getelementptr inbounds double, double* %48, i64 1
%50 = load double, double* %49
%51 = load double*, double** %4
%52 = getelementptr inbounds double, double* %51, i64 1
%53 = load double, double* %52
%54 = load double*, double** %5
%55 = getelementptr inbounds double, double* %54, i64 0
%56 = load double, double* %55
%57 = fmul double %53, %56
%58 = fneg double %57
%59 = call double @llvm.fmuladd.f64(double %47, double %50, double %58)
store double %59, double* %10
%60 = load double*, double** %4
%61 = getelementptr inbounds double, double* %60, i64 1
%62 = load double, double* %61
%63 = load double*, double** %6
%64 = getelementptr inbounds double, double* %63, i64 2
%65 = load double, double* %64
%66 = load double*, double** %4
%67 = getelementptr inbounds double, double* %66, i64 2
%68 = load double, double* %67
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 1
%71 = load double, double* %70
%72 = fmul double %68, %71
%73 = fneg double %72
%74 = call double @llvm.fmuladd.f64(double %62, double %65, double %73)
store double %74, double* %11
%75 = load double*, double** %4
%76 = getelementptr inbounds double, double* %75, i64 2
%77 = load double, double* %76
%78 = load double*, double** %6
%79 = getelementptr inbounds double, double* %78, i64 0
%80 = load double, double* %79
%81 = load double*, double** %4
%82 = getelementptr inbounds double, double* %81, i64 0
%83 = load double, double* %82
%84 = load double*, double** %6
%85 = getelementptr inbounds double, double* %84, i64 2
%86 = load double, double* %85
%87 = fmul double %83, %86
%88 = fneg double %87
%89 = call double @llvm.fmuladd.f64(double %77, double %80, double %88)
store double %89, double* %12
%90 = load double*, double** %4
%91 = getelementptr inbounds double, double* %90, i64 0
%92 = load double, double* %91
%93 = load double*, double** %6
%94 = getelementptr inbounds double, double* %93, i64 1
%95 = load double, double* %94
%96 = load double*, double** %4
%97 = getelementptr inbounds double, double* %96, i64 1
%98 = load double, double* %97
%99 = load double*, double** %6
%100 = getelementptr inbounds double, double* %99, i64 0
%101 = load double, double* %100
%102 = fmul double %98, %101
%103 = fneg double %102
%104 = call double @llvm.fmuladd.f64(double %92, double %95, double %103)
store double %104, double* %13
%105 = load double, double* %8
%106 = load double, double* %8
%107 = load double, double* %9
%108 = load double, double* %9
%109 = fmul double %107, %108
%110 = call double @llvm.fmuladd.f64(double %105, double %106, double %109)
%111 = load double, double* %10
%112 = load double, double* %10
%113 = call double @llvm.fmuladd.f64(double %111, double %112, double %110)
%114 = load double, double* %11
%115 = load double, double* %11
%116 = load double, double* %12
%117 = load double, double* %12
%118 = fmul double %116, %117
%119 = call double @llvm.fmuladd.f64(double %114, double %115, double %118)
%120 = load double, double* %13
%121 = load double, double* %13
%122 = call double @llvm.fmuladd.f64(double %120, double %121, double %119)
%123 = fmul double %113, %122
%124 = call double @sqrt(double %123)
store double %124, double* %14
%125 = load double, double* %14
%126 = fcmp ogt double %125, 0.000000e+00
br i1 %126, label %127, label %140
127: ; preds = %3
%128 = load double, double* %8
%129 = load double, double* %11
%130 = load double, double* %9
%131 = load double, double* %12
%132 = fmul double %130, %131
%133 = call double @llvm.fmuladd.f64(double %128, double %129, double %132)
%134 = load double, double* %10
%135 = load double, double* %13
%136 = call double @llvm.fmuladd.f64(double %134, double %135, double %133)
%137 = load double, double* %14
%138 = fdiv double %136, %137
%139 = call double @acos(double %138)
store double %139, double* %7
br label %141
140: ; preds = %3
store double 0.000000e+00, double* %7
br label %141
141: ; preds = %140, %127
%142 = load double, double* %7
ret double %142
}

LLVM IR (-O2):
define double @spherical_angle(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %1, i64 2
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 2
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = load double, double* %10
%12 = fneg double %9
%13 = load double, double* %1
%14 = load double, double* %0
%15 = fneg double %14
%16 = fneg double %5
%17 = getelementptr inbounds double, double* %2, i64 2
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %2, i64 1
%20 = load double, double* %19
%21 = insertelement <2 x double> poison, double %11, i64 0
%22 = insertelement <2 x double> %21, double %20, i64 1
%23 = insertelement <2 x double> poison, double %12, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = fmul <2 x double> %22, %24
%26 = insertelement <2 x double> poison, double %5, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = insertelement <2 x double> poison, double %7, i64 0
%29 = insertelement <2 x double> %28, double %18, i64 1
%30 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %27, <2 x double> %29, <2 x double> %25)
%31 = load double, double* %2
%32 = insertelement <2 x double> poison, double %15, i64 0
%33 = shufflevector <2 x double> %32, <2 x double> poison, <2 x i32> zeroinitializer
%34 = fmul <2 x double> %29, %33
%35 = insertelement <2 x double> poison, double %9, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = insertelement <2 x double> poison, double %13, i64 0
%38 = insertelement <2 x double> %37, double %31, i64 1
%39 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %36, <2 x double> %38, <2 x double> %34)
%40 = insertelement <2 x double> poison, double %16, i64 0
%41 = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> zeroinitializer
%42 = fmul <2 x double> %38, %41
%43 = insertelement <2 x double> poison, double %14, i64 0
%44 = shufflevector <2 x double> %43, <2 x double> poison, <2 x i32> zeroinitializer
%45 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %44, <2 x double> %22, <2 x double> %42)
%46 = fmul <2 x double> %39, %39
%47 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %30, <2 x double> %30, <2 x double> %46)
%48 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %45, <2 x double> %45, <2 x double> %47)
%49 = shufflevector <2 x double> %48, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%50 = fmul <2 x double> %48, %49
%51 = extractelement <2 x double> %50, i64 0
%52 = tail call double @sqrt(double %51)
%53 = fcmp ogt double %52, 0.000000e+00
br i1 %53, label %54, label %66
54: ; preds = %3
%55 = shufflevector <2 x double> %39, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%56 = fmul <2 x double> %39, %55
%57 = extractelement <2 x double> %56, i64 0
%58 = extractelement <2 x double> %30, i64 0
%59 = extractelement <2 x double> %30, i64 1
%60 = tail call double @llvm.fmuladd.f64(double %58, double %59, double %57)
%61 = extractelement <2 x double> %45, i64 0
%62 = extractelement <2 x double> %45, i64 1
%63 = tail call double @llvm.fmuladd.f64(double %61, double %62, double %60)
%64 = fdiv double %63, %52
%65 = tail call double @acos(double %64)
br label %66
66: ; preds = %3, %54
%67 = phi double [ %65, %54 ], [ 0.000000e+00, %3 ]
ret double %67
}