#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*/ c_bnd_len(double *, double *, double *);
int /*<<< orphan*/ calc_bnd_ang(double *, double *, double *);
void c_bnd_ang(double r1[3], double r2[3], double r3[3], double *angle) {
  double r21[3], r23[3];
  double l21, l23;
  int i;
  c_bnd_len(r2, r1, &l21);
  c_bnd_len(r2, r3, &l23);
  for (i = 0; i < 3; i++) {
    r21[i] = (r1[i] - r2[i]) / l21;
    r23[i] = (r3[i] - r2[i]) / l23;
  }
  calc_bnd_ang(r21, r23, angle);
  return;
}


x86 assembly (clang, -O0):
<c_bnd_ang>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x68(%rbp),%rdx
call   1040 <c_bnd_len@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x70(%rbp),%rdx
call   1040 <c_bnd_len@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    11ce <c_bnd_ang+0xae>
mov    -0x8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x68(%rbp),%xmm0
movslq -0x74(%rbp),%rax
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x18(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x70(%rbp),%xmm0
movslq -0x74(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1164 <c_bnd_ang+0x44>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <calc_bnd_ang@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_bnd_ang>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
lea    0x8(%rsp),%rdx
mov    %rsi,%rdi
mov    %r12,%rsi
call   1040 <c_bnd_len@plt>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <c_bnd_len@plt>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
movupd (%rbx),%xmm2
movupd (%r12),%xmm3
subpd  %xmm2,%xmm3
movapd %xmm0,%xmm4
unpcklpd %xmm0,%xmm4
divpd  %xmm4,%xmm3
movapd %xmm3,0x30(%rsp)
movupd (%r15),%xmm3
subpd  %xmm2,%xmm3
movapd %xmm1,%xmm2
unpcklpd %xmm1,%xmm2
divpd  %xmm2,%xmm3
movapd %xmm3,0x10(%rsp)
movsd  0x10(%r12),%xmm2
movsd  0x10(%rbx),%xmm3
subsd  %xmm3,%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x40(%rsp)
movsd  0x10(%r15),%xmm0
subsd  %xmm3,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r14,%rdx
call   1030 <calc_bnd_ang@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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