#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 NAN;
double atan2(double, double);
double fabs(double);
double sqrt(double);
void _calc_dihedral_angle(double *va, double *vb, double *vc, double *result) {
  double n1[3], n2[3];
  double xp[3], vb_norm;
  double x, y;
  n1[0] = -va[1] * vb[2] + va[2] * vb[1];
  n1[1] = va[0] * vb[2] - va[2] * vb[0];
  n1[2] = -va[0] * vb[1] + va[1] * vb[0];
  n2[0] = -vb[1] * vc[2] + vb[2] * vc[1];
  n2[1] = vb[0] * vc[2] - vb[2] * vc[0];
  n2[2] = -vb[0] * vc[1] + vb[1] * vc[0];
  x = (n1[0] * n2[0] + n1[1] * n2[1] + n1[2] * n2[2]);
  xp[0] = n1[1] * n2[2] - n1[2] * n2[1];
  xp[1] = -n1[0] * n2[2] + n1[2] * n2[0];
  xp[2] = n1[0] * n2[1] - n1[1] * n2[0];
  vb_norm = sqrt(vb[0] * vb[0] + vb[1] * vb[1] + vb[2] * vb[2]);
  y = (xp[0] * vb[0] + xp[1] * vb[1] + xp[2] * vb[2]) / vb_norm;
  if ((fabs(x) == 0.0) && (fabs(y) == 0.0)) {
    *result = NAN;
    return;
  }
  *result = atan2(y, x);
}


x86 assembly (clang, -O0):
<_calc_dihedral_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %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
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x10(%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  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %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
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%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,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x80(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x78(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movaps 0xb96(%rip),%xmm1
pand   %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    14bf <_calc_dihedral_angle+0x39f>
jp     14bf <_calc_dihedral_angle+0x39f>
movsd  -0x98(%rbp),%xmm0
ff
movaps 0xb70(%rip),%xmm1
pand   %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    14bf <_calc_dihedral_angle+0x39f>
jp     14bf <_calc_dihedral_angle+0x39f>
mov    0x2b4a(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    14dc <_calc_dihedral_angle+0x3bc>
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm1
ff
call   1030 <atan2@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_calc_dihedral_angle>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%r14
mov    %rsi,%rbx
movsd  0x8(%rdi),%xmm5
movsd  0x10(%rsi),%xmm0
movsd  0x10(%rdi),%xmm6
movsd  (%rsi),%xmm12
movsd  0x8(%rsi),%xmm8
movapd %xmm6,%xmm9
mulsd  %xmm8,%xmm9
movapd %xmm5,%xmm4
mulsd  %xmm0,%xmm4
subsd  %xmm4,%xmm9
movsd  (%rdi),%xmm3
movapd %xmm3,%xmm2
unpcklpd %xmm8,%xmm2
movsd  (%rdx),%xmm13
movsd  0x8(%rdx),%xmm11
unpcklpd %xmm0,%xmm5
movapd %xmm12,%xmm7
unpcklpd %xmm11,%xmm7
mulpd  %xmm5,%xmm7
movsd  0x10(%rdx),%xmm10
movapd %xmm8,%xmm5
unpcklpd %xmm10,%xmm5
mulpd  %xmm2,%xmm5
subpd  %xmm5,%xmm7
unpcklpd %xmm0,%xmm6
movapd %xmm12,%xmm2
unpcklpd %xmm13,%xmm2
mulpd  %xmm6,%xmm2
unpcklpd %xmm12,%xmm3
movapd %xmm0,%xmm5
unpcklpd %xmm10,%xmm5
mulpd  %xmm3,%xmm5
subpd  %xmm2,%xmm5
mulsd  %xmm8,%xmm13
mulsd  %xmm12,%xmm11
subsd  %xmm11,%xmm13
movapd %xmm5,%xmm6
unpckhpd %xmm5,%xmm6
movapd %xmm7,%xmm2
unpckhpd %xmm7,%xmm2
movapd %xmm9,%xmm3
mulsd  %xmm2,%xmm3
movapd %xmm7,%xmm1
movapd %xmm6,%xmm10
mulsd  %xmm7,%xmm10
movapd %xmm5,%xmm4
mulsd  %xmm2,%xmm7
mulsd  %xmm5,%xmm2
mulsd  %xmm6,%xmm5
addsd  %xmm5,%xmm3
mulsd  %xmm13,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm13,%xmm4
subsd  %xmm10,%xmm4
mulsd  %xmm9,%xmm13
subsd  %xmm13,%xmm7
mulsd  %xmm9,%xmm6
subsd  %xmm2,%xmm6
mulsd  %xmm8,%xmm8
mulsd  %xmm12,%xmm12
addsd  %xmm8,%xmm12
mulsd  %xmm0,%xmm0
addsd  %xmm12,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     1260 <_calc_dihedral_angle+0x140>
sqrtsd %xmm0,%xmm0
jmp    1297 <_calc_dihedral_angle+0x177>
movapd %xmm7,0x30(%rsp)
movapd %xmm6,0x20(%rsp)
movapd %xmm1,0x10(%rsp)
movapd %xmm4,(%rsp)
call   1040 <sqrt@plt>
xorpd  %xmm2,%xmm2
movapd (%rsp),%xmm4
movapd 0x10(%rsp),%xmm1
movapd 0x20(%rsp),%xmm6
movapd 0x30(%rsp),%xmm7
mulsd  0x8(%rbx),%xmm7
mulsd  (%rbx),%xmm4
addsd  %xmm7,%xmm4
mulsd  0x10(%rbx),%xmm6
addsd  %xmm4,%xmm6
divsd  %xmm0,%xmm6
ucomisd %xmm2,%xmm1
jne    12d2 <_calc_dihedral_angle+0x1b2>
jp     12d2 <_calc_dihedral_angle+0x1b2>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm6
jne    12d2 <_calc_dihedral_angle+0x1b2>
jp     12d2 <_calc_dihedral_angle+0x1b2>
mov    0x2d2c(%rip),%rax
movsd  (%rax),%xmm0
jmp    12db <_calc_dihedral_angle+0x1bb>
movapd %xmm6,%xmm0
call   1030 <atan2@plt>
movsd  %xmm0,(%r14)
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@NAN = global double 0.000000e+00
define void @_calc_dihedral_angle(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca [3 x double]
%10 = alloca [3 x double]
%11 = alloca [3 x double]
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = fneg double %17
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
%22 = load double*, double** %5
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = load double*, double** %6
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = fmul double %24, %27
%29 = call double @llvm.fmuladd.f64(double %18, double %21, double %28)
%30 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
store double %29, double* %30
%31 = load double*, double** %5
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = load double, double* %32
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 2
%36 = load double, double* %35
%37 = load double*, double** %5
%38 = getelementptr inbounds double, double* %37, i64 2
%39 = load double, double* %38
%40 = load double*, double** %6
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
%43 = fmul double %39, %42
%44 = fneg double %43
%45 = call double @llvm.fmuladd.f64(double %33, double %36, double %44)
%46 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
store double %45, double* %46
%47 = load double*, double** %5
%48 = getelementptr inbounds double, double* %47, i64 0
%49 = load double, double* %48
%50 = fneg double %49
%51 = load double*, double** %6
%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 1
%56 = load double, double* %55
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 0
%59 = load double, double* %58
%60 = fmul double %56, %59
%61 = call double @llvm.fmuladd.f64(double %50, double %53, double %60)
%62 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
store double %61, double* %62
%63 = load double*, double** %6
%64 = getelementptr inbounds double, double* %63, i64 1
%65 = load double, double* %64
%66 = fneg double %65
%67 = load double*, double** %7
%68 = getelementptr inbounds double, double* %67, i64 2
%69 = load double, double* %68
%70 = load double*, double** %6
%71 = getelementptr inbounds double, double* %70, i64 2
%72 = load double, double* %71
%73 = load double*, double** %7
%74 = getelementptr inbounds double, double* %73, i64 1
%75 = load double, double* %74
%76 = fmul double %72, %75
%77 = call double @llvm.fmuladd.f64(double %66, double %69, double %76)
%78 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
store double %77, double* %78
%79 = load double*, double** %6
%80 = getelementptr inbounds double, double* %79, i64 0
%81 = load double, double* %80
%82 = load double*, double** %7
%83 = getelementptr inbounds double, double* %82, i64 2
%84 = load double, double* %83
%85 = load double*, double** %6
%86 = getelementptr inbounds double, double* %85, i64 2
%87 = load double, double* %86
%88 = load double*, double** %7
%89 = getelementptr inbounds double, double* %88, i64 0
%90 = load double, double* %89
%91 = fmul double %87, %90
%92 = fneg double %91
%93 = call double @llvm.fmuladd.f64(double %81, double %84, double %92)
%94 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
store double %93, double* %94
%95 = load double*, double** %6
%96 = getelementptr inbounds double, double* %95, i64 0
%97 = load double, double* %96
%98 = fneg double %97
%99 = load double*, double** %7
%100 = getelementptr inbounds double, double* %99, i64 1
%101 = load double, double* %100
%102 = load double*, double** %6
%103 = getelementptr inbounds double, double* %102, i64 1
%104 = load double, double* %103
%105 = load double*, double** %7
%106 = getelementptr inbounds double, double* %105, i64 0
%107 = load double, double* %106
%108 = fmul double %104, %107
%109 = call double @llvm.fmuladd.f64(double %98, double %101, double %108)
%110 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
store double %109, double* %110
%111 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%112 = load double, double* %111
%113 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%114 = load double, double* %113
%115 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
%116 = load double, double* %115
%117 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
%118 = load double, double* %117
%119 = fmul double %116, %118
%120 = call double @llvm.fmuladd.f64(double %112, double %114, double %119)
%121 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%122 = load double, double* %121
%123 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
%124 = load double, double* %123
%125 = call double @llvm.fmuladd.f64(double %122, double %124, double %120)
store double %125, double* %13
%126 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
%127 = load double, double* %126
%128 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
%129 = load double, double* %128
%130 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%131 = load double, double* %130
%132 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
%133 = load double, double* %132
%134 = fmul double %131, %133
%135 = fneg double %134
%136 = call double @llvm.fmuladd.f64(double %127, double %129, double %135)
%137 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
store double %136, double* %137
%138 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%139 = load double, double* %138
%140 = fneg double %139
%141 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
%142 = load double, double* %141
%143 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%144 = load double, double* %143
%145 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%146 = load double, double* %145
%147 = fmul double %144, %146
%148 = call double @llvm.fmuladd.f64(double %140, double %142, double %147)
%149 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
store double %148, double* %149
%150 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%151 = load double, double* %150
%152 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
%153 = load double, double* %152
%154 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
%155 = load double, double* %154
%156 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%157 = load double, double* %156
%158 = fmul double %155, %157
%159 = fneg double %158
%160 = call double @llvm.fmuladd.f64(double %151, double %153, double %159)
%161 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
store double %160, double* %161
%162 = load double*, double** %6
%163 = getelementptr inbounds double, double* %162, i64 0
%164 = load double, double* %163
%165 = load double*, double** %6
%166 = getelementptr inbounds double, double* %165, i64 0
%167 = load double, double* %166
%168 = load double*, double** %6
%169 = getelementptr inbounds double, double* %168, i64 1
%170 = load double, double* %169
%171 = load double*, double** %6
%172 = getelementptr inbounds double, double* %171, i64 1
%173 = load double, double* %172
%174 = fmul double %170, %173
%175 = call double @llvm.fmuladd.f64(double %164, double %167, double %174)
%176 = load double*, double** %6
%177 = getelementptr inbounds double, double* %176, i64 2
%178 = load double, double* %177
%179 = load double*, double** %6
%180 = getelementptr inbounds double, double* %179, i64 2
%181 = load double, double* %180
%182 = call double @llvm.fmuladd.f64(double %178, double %181, double %175)
%183 = call double @sqrt(double %182)
store double %183, double* %12
%184 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%185 = load double, double* %184
%186 = load double*, double** %6
%187 = getelementptr inbounds double, double* %186, i64 0
%188 = load double, double* %187
%189 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%190 = load double, double* %189
%191 = load double*, double** %6
%192 = getelementptr inbounds double, double* %191, i64 1
%193 = load double, double* %192
%194 = fmul double %190, %193
%195 = call double @llvm.fmuladd.f64(double %185, double %188, double %194)
%196 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%197 = load double, double* %196
%198 = load double*, double** %6
%199 = getelementptr inbounds double, double* %198, i64 2
%200 = load double, double* %199
%201 = call double @llvm.fmuladd.f64(double %197, double %200, double %195)
%202 = load double, double* %12
%203 = fdiv double %201, %202
store double %203, double* %14
%204 = load double, double* %13
%205 = call double @llvm.fabs.f64(double %204)
%206 = fcmp oeq double %205, 0.000000e+00
br i1 %206, label %207, label %214
207: ; preds = %4
%208 = load double, double* %14
%209 = call double @llvm.fabs.f64(double %208)
%210 = fcmp oeq double %209, 0.000000e+00
br i1 %210, label %211, label %214
211: ; preds = %207
%212 = load double, double* @NAN
%213 = load double*, double** %8
store double %212, double* %213
br label %219
214: ; preds = %207, %4
%215 = load double, double* %14
%216 = load double, double* %13
%217 = call double @atan2(double %215, double %216)
%218 = load double*, double** %8
store double %217, double* %218
br label %219
219: ; preds = %214, %211
ret void
}

LLVM IR (-O2):
@NAN = global double 0.000000e+00
define void @_calc_dihedral_angle(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture writeonly %3) {
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = fneg double %6
%8 = getelementptr inbounds double, double* %1, i64 2
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %1, i64 1
%13 = load double, double* %12
%14 = fmul double %11, %13
%15 = tail call double @llvm.fmuladd.f64(double %7, double %9, double %14)
%16 = load double, double* %0
%17 = load double, double* %1
%18 = insertelement <2 x double> poison, double %16, i64 0
%19 = insertelement <2 x double> %18, double %13, i64 1
%20 = fneg <2 x double> %19
%21 = getelementptr inbounds double, double* %2, i64 2
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %2, i64 1
%24 = load double, double* %23
%25 = insertelement <2 x double> poison, double %6, i64 0
%26 = insertelement <2 x double> %25, double %9, i64 1
%27 = insertelement <2 x double> poison, double %17, i64 0
%28 = insertelement <2 x double> %27, double %24, i64 1
%29 = fmul <2 x double> %26, %28
%30 = insertelement <2 x double> poison, double %13, i64 0
%31 = insertelement <2 x double> %30, double %22, i64 1
%32 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %31, <2 x double> %29)
%33 = load double, double* %2
%34 = insertelement <2 x double> poison, double %11, i64 0
%35 = insertelement <2 x double> %34, double %9, i64 1
%36 = fneg <2 x double> %35
%37 = insertelement <2 x double> %27, double %33, i64 1
%38 = fmul <2 x double> %37, %36
%39 = insertelement <2 x double> %18, double %17, i64 1
%40 = insertelement <2 x double> poison, double %9, i64 0
%41 = insertelement <2 x double> %40, double %22, i64 1
%42 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %41, <2 x double> %38)
%43 = fneg double %17
%44 = fmul double %13, %33
%45 = tail call double @llvm.fmuladd.f64(double %43, double %24, double %44)
%46 = extractelement <2 x double> %42, i64 0
%47 = extractelement <2 x double> %42, i64 1
%48 = fmul double %46, %47
%49 = extractelement <2 x double> %32, i64 1
%50 = tail call double @llvm.fmuladd.f64(double %15, double %49, double %48)
%51 = extractelement <2 x double> %32, i64 0
%52 = tail call double @llvm.fmuladd.f64(double %51, double %45, double %50)
%53 = fneg double %51
%54 = fmul double %47, %53
%55 = tail call double @llvm.fmuladd.f64(double %46, double %45, double %54)
%56 = fneg double %15
%57 = fmul double %51, %49
%58 = tail call double @llvm.fmuladd.f64(double %56, double %45, double %57)
%59 = fneg double %46
%60 = fmul double %49, %59
%61 = tail call double @llvm.fmuladd.f64(double %15, double %47, double %60)
%62 = fmul double %13, %13
%63 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %62)
%64 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %63)
%65 = tail call double @sqrt(double %64)
%66 = load double, double* %1
%67 = load double, double* %12
%68 = fmul double %58, %67
%69 = tail call double @llvm.fmuladd.f64(double %55, double %66, double %68)
%70 = load double, double* %8
%71 = tail call double @llvm.fmuladd.f64(double %61, double %70, double %69)
%72 = fdiv double %71, %65
%73 = fcmp oeq double %52, 0.000000e+00
%74 = fcmp oeq double %72, 0.000000e+00
%75 = select i1 %73, i1 %74, i1 false
br i1 %75, label %76, label %78
76: ; preds = %4
%77 = load double, double* @NAN
br label %80
78: ; preds = %4
%79 = tail call double @atan2(double %72, double %52)
br label %80
80: ; preds = %78, %76
%81 = phi double [ %79, %78 ], [ %77, %76 ]
store double %81, double* %3
ret void
}