#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 M_PI;
double acos(float);
float norm(float *, int);
int /*<<< orphan*/ printf(char *, float, float, float, float);
float PsiER(float ve[], float va[]) {
  float nva;
  float nve;
  float v, r;
  float VE[3], VA[3];
  VE[0] = ve[0];
  VE[1] = ve[1];
  VE[2] = 1.0;
  VA[0] = va[0];
  VA[1] = va[1];
  VA[2] = 1.0;
  nva = norm(VA, 3);
  nve = norm(VE, 3);
  v = (VE[0] * VA[0] + VE[1] * VA[1] + 1.0f) / (nva * nve);
  if (v > 1.0 && v < 1.0001)
    v = 1.0;
  r = (float)(acos(v) * 180.0 / M_PI);
  if (!(r >= 0.0 && r < 180.0)) {
    printf("ERROR in PSIER()...\n r=%8.4f  v=%8.4f  nva=%8.4f nve= %8.4f\n", r,
           v, nva, nve);
    printf("va=(%f,%f) ve=(%f,%f)\n", va[0], va[1], ve[0], ve[1]);
  }
  return r;
}


x86 assembly (clang, -O0):
<PsiER>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  0xeb5(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  0xe8d(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
lea    -0x38(%rbp),%rdi
mov    $0x3,%esi
call   1050 <norm@plt>
movss  %xmm0,-0x14(%rbp)
lea    -0x2c(%rbp),%rdi
mov    $0x3,%esi
call   1050 <norm@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  -0x38(%rbp),%xmm2
movss  -0x28(%rbp),%xmm1
mulss  -0x34(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xe3e(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdfe(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1234 <PsiER+0x104>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdeb(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1234 <PsiER+0x104>
movss  0xde9(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <acos@plt>
movsd  0xdca(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2d97(%rip),%rax
divsd  (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     128f <PsiER+0x15f>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd8b(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     12dd <PsiER+0x1ad>
movss  -0x20(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
lea    0xd72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm3
lea    0xd81(%rip),%rdi
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PsiER>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movss  (%rdi),%xmm0
movss  %xmm0,0x24(%rsp)
movss  0x4(%rdi),%xmm0
movss  %xmm0,0x28(%rsp)
movl   $0x3f800000,0x2c(%rsp)
3f
movss  (%rsi),%xmm0
movss  %xmm0,0x18(%rsp)
movss  0x4(%rsi),%xmm0
movss  %xmm0,0x1c(%rsp)
movl   $0x3f800000,0x20(%rsp)
3f
lea    0x18(%rsp),%rdi
mov    $0x3,%esi
call   1050 <norm@plt>
movss  %xmm0,0xc(%rsp)
lea    0x24(%rsp),%rdi
mov    $0x3,%esi
call   1050 <norm@plt>
movss  0x24(%rsp),%xmm1
movss  0x28(%rsp),%xmm2
mulss  0x1c(%rsp),%xmm2
mulss  0x18(%rsp),%xmm1
addss  %xmm2,%xmm1
movss  0xe41(%rip),%xmm4
addss  %xmm4,%xmm1
movss  0xc(%rsp),%xmm2
movss  %xmm0,0x14(%rsp)
mulss  %xmm0,%xmm2
divss  %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
movsd  0xe22(%rip),%xmm3
ucomisd %xmm2,%xmm3
movaps %xmm4,%xmm2
cmpltss %xmm1,%xmm2
movaps %xmm2,%xmm0
andnps %xmm1,%xmm0
ja     11fd <PsiER+0xcd>
movaps %xmm1,%xmm4
andps  %xmm4,%xmm2
orps   %xmm2,%xmm0
movaps %xmm0,0x30(%rsp)
call   1040 <acos@plt>
mulsd  0xdfb(%rip),%xmm0
mov    0x2dcc(%rip),%rax
divsd  (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1239 <PsiER+0x109>
movss  0xdd0(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     1282 <PsiER+0x152>
lea    0xdd8(%rip),%rdi
movss  %xmm0,0x10(%rsp)
movaps 0x30(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
movss  0x14(%rsp),%xmm3
call   1030 <printf@plt>
movss  (%rbx),%xmm0
movss  0x4(%rbx),%xmm1
movss  (%r14),%xmm2
movss  0x4(%r14),%xmm3
lea    0xdde(%rip),%rdi
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
@.str = [61 x i8] c"ERROR in PSIER()...\0A r=%8.4f v=%8.4f nva=%8.4f nve= %8.4f\0A\00"
@.str.1 = [23 x i8] c"va=(%f,%f) ve=(%f,%f)\0A\00"
define float @PsiER(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca [3 x float]
%10 = alloca [3 x float]
store float* %0, float** %3
store float* %1, float** %4
%11 = load float*, float** %3
%12 = getelementptr inbounds float, float* %11, i64 0
%13 = load float, float* %12
%14 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
store float %13, float* %14
%15 = load float*, float** %3
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
store float %17, float* %18
%19 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 2
store float 1.000000e+00, float* %19
%20 = load float*, float** %4
%21 = getelementptr inbounds float, float* %20, i64 0
%22 = load float, float* %21
%23 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
store float %22, float* %23
%24 = load float*, float** %4
%25 = getelementptr inbounds float, float* %24, i64 1
%26 = load float, float* %25
%27 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 1
store float %26, float* %27
%28 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 2
store float 1.000000e+00, float* %28
%29 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%30 = call float @norm(float* %29, i32 3)
store float %30, float* %5
%31 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%32 = call float @norm(float* %31, i32 3)
store float %32, float* %6
%33 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%34 = load float, float* %33
%35 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%36 = load float, float* %35
%37 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
%38 = load float, float* %37
%39 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 1
%40 = load float, float* %39
%41 = fmul float %38, %40
%42 = call float @llvm.fmuladd.f32(float %34, float %36, float %41)
%43 = fadd float %42, 1.000000e+00
%44 = load float, float* %5
%45 = load float, float* %6
%46 = fmul float %44, %45
%47 = fdiv float %43, %46
store float %47, float* %7
%48 = load float, float* %7
%49 = fpext float %48 to double
%50 = fcmp ogt double %49, 1.000000e+00
br i1 %50, label %51, label %56
51: ; preds = %2
%52 = load float, float* %7
%53 = fpext float %52 to double
%54 = fcmp olt double %53, 1.000100e+00
br i1 %54, label %55, label %56
55: ; preds = %51
store float 1.000000e+00, float* %7
br label %56
56: ; preds = %55, %51, %2
%57 = load float, float* %7
%58 = call double @acos(float %57)
%59 = fmul double %58, 1.800000e+02
%60 = load double, double* @M_PI
%61 = fdiv double %59, %60
%62 = fptrunc double %61 to float
store float %62, float* %8
%63 = load float, float* %8
%64 = fpext float %63 to double
%65 = fcmp oge double %64, 0.000000e+00
br i1 %65, label %66, label %70
66: ; preds = %56
%67 = load float, float* %8
%68 = fpext float %67 to double
%69 = fcmp olt double %68, 1.800000e+02
br i1 %69, label %89, label %70
70: ; preds = %66, %56
%71 = load float, float* %8
%72 = load float, float* %7
%73 = load float, float* %5
%74 = load float, float* %6
%75 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), float %71, float %72, float %73, float %74)
%76 = load float*, float** %4
%77 = getelementptr inbounds float, float* %76, i64 0
%78 = load float, float* %77
%79 = load float*, float** %4
%80 = getelementptr inbounds float, float* %79, i64 1
%81 = load float, float* %80
%82 = load float*, float** %3
%83 = getelementptr inbounds float, float* %82, i64 0
%84 = load float, float* %83
%85 = load float*, float** %3
%86 = getelementptr inbounds float, float* %85, i64 1
%87 = load float, float* %86
%88 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), float %78, float %81, float %84, float %87)
br label %89
89: ; preds = %70, %66
%90 = load float, float* %8
ret float %90
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
@.str = [61 x i8] c"ERROR in PSIER()...\0A r=%8.4f v=%8.4f nva=%8.4f nve= %8.4f\0A\00"
@.str.1 = [23 x i8] c"va=(%f,%f) ve=(%f,%f)\0A\00"
define float @PsiER(float* nocapture %0, float* nocapture %1) {
%3 = alloca [3 x float]
%4 = alloca [3 x float]
%5 = bitcast [3 x float]* %3 to i8*
%6 = bitcast [3 x float]* %4 to i8*
%7 = load float, float* %0
%8 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
store float %7, float* %8
%9 = getelementptr inbounds float, float* %0, i64 1
%10 = load float, float* %9
%11 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 1
store float %10, float* %11
%12 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 2
store float 1.000000e+00, float* %12
%13 = load float, float* %1
%14 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 0
store float %13, float* %14
%15 = getelementptr inbounds float, float* %1, i64 1
%16 = load float, float* %15
%17 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 1
store float %16, float* %17
%18 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 2
store float 1.000000e+00, float* %18
%19 = call float @norm(float* %14, i32 3)
%20 = call float @norm(float* %8, i32 3)
%21 = load float, float* %8
%22 = load float, float* %14
%23 = load float, float* %11
%24 = load float, float* %17
%25 = fmul float %23, %24
%26 = call float @llvm.fmuladd.f32(float %21, float %22, float %25)
%27 = fadd float %26, 1.000000e+00
%28 = fmul float %19, %20
%29 = fdiv float %27, %28
%30 = fcmp ogt float %29, 1.000000e+00
%31 = fpext float %29 to double
%32 = fcmp olt double %31, 1.000100e+00
%33 = and i1 %30, %32
%34 = select i1 %33, float 1.000000e+00, float %29
%35 = call double @acos(float %34)
%36 = fmul double %35, 1.800000e+02
%37 = load double, double* @M_PI
%38 = fdiv double %36, %37
%39 = fptrunc double %38 to float
%40 = fcmp oge float %39, 0.000000e+00
%41 = fcmp olt float %39, 1.800000e+02
%42 = and i1 %40, %41
br i1 %42, label %50, label %43
43: ; preds = %2
%44 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), float %39, float %34, float %19, float %20)
%45 = load float, float* %1
%46 = load float, float* %15
%47 = load float, float* %0
%48 = load float, float* %9
%49 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), float %45, float %46, float %47, float %48)
br label %50
50: ; preds = %2, %43
ret float %39
}