#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 */
int /*<<< orphan*/ calc_dih_ang(double *, double *, double *, double *);
void c_dih_ang(double r1[3], double r2[3], double r3[3], double r4[3],
               double *angle) {
  double r12[3], r23[3], r34[3];
  int i;
  for (i = 0; i < 3; i++) {
    r12[i] = r2[i] - r1[i];
    r23[i] = r3[i] - r2[i];
    r34[i] = r4[i] - r3[i];
  }
  calc_dih_ang(r12, r23, r34, angle);
  return;
}


x86 assembly (clang, -O0):
<c_dih_ang>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x84(%rbp)
cmpl   $0x3,-0x84(%rbp)
jge    11e1 <c_dih_ang+0xd1>
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x84(%rbp),%rax
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x18(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x84(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0x20(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x84(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x84(%rbp),%rax
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1139 <c_dih_ang+0x29>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x80(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <calc_dih_ang@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_dih_ang>:
sub    $0x58,%rsp
movupd (%rsi),%xmm0
movupd (%rdx),%xmm1
movupd (%rdi),%xmm2
movapd %xmm1,%xmm3
subpd  %xmm0,%xmm3
subpd  %xmm2,%xmm0
movapd %xmm0,0x40(%rsp)
movapd %xmm3,0x20(%rsp)
movupd (%rcx),%xmm0
subpd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
movsd  0x10(%rsi),%xmm0
movapd %xmm0,%xmm1
subsd  0x10(%rdi),%xmm1
movsd  %xmm1,0x50(%rsp)
movsd  0x10(%rdx),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x30(%rsp)
movsd  0x10(%rcx),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x40(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
mov    %r8,%rcx
call   1030 <calc_dih_ang@plt>
add    $0x58,%rsp
ret

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

LLVM IR (-O2):
define void @c_dih_ang(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* %4) {
%6 = alloca [3 x double]
%7 = alloca [3 x double]
%8 = alloca [3 x double]
%9 = bitcast [3 x double]* %6 to i8*
%10 = bitcast [3 x double]* %7 to i8*
%11 = bitcast [3 x double]* %8 to i8*
%12 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%13 = bitcast double* %1 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%16 = bitcast double* %2 to <2 x double>*
%17 = load <2 x double>, <2 x double>* %16
%18 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%19 = bitcast double* %0 to <2 x double>*
%20 = load <2 x double>, <2 x double>* %19
%21 = fsub <2 x double> %14, %20
%22 = bitcast [3 x double]* %6 to <2 x double>*
store <2 x double> %21, <2 x double>* %22
%23 = fsub <2 x double> %17, %14
%24 = bitcast [3 x double]* %7 to <2 x double>*
store <2 x double> %23, <2 x double>* %24
%25 = bitcast double* %3 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = fsub <2 x double> %26, %17
%28 = bitcast [3 x double]* %8 to <2 x double>*
store <2 x double> %27, <2 x double>* %28
%29 = getelementptr inbounds double, double* %1, i64 2
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %0, i64 2
%32 = load double, double* %31
%33 = fsub double %30, %32
%34 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %33, double* %34
%35 = getelementptr inbounds double, double* %2, i64 2
%36 = load double, double* %35
%37 = fsub double %36, %30
%38 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
store double %37, double* %38
%39 = getelementptr inbounds double, double* %3, i64 2
%40 = load double, double* %39
%41 = fsub double %40, %36
%42 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 2
store double %41, double* %42
%43 = call i32 @calc_dih_ang(double* %12, double* %15, double* %18, double* %4)
ret void
}