#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 asin(float);
scalar_t__ fabs(float);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
float norm(float *, int);
int /*<<< orphan*/ printf(char *, float, float, ...);
float sqrt(double);
int /*<<< orphan*/ stdout;
float PsiEN(float ve[], float va[]) {
  float nva, nve;
  float v1, v2;
  float n[2];
  nva = norm(va, 2), nve = norm(ve, 2);
  if (nve > 0.00000001) {
    n[0] = ve[0] / nve;
    n[1] = ve[1] / nve;
    v1 = (va[0] * n[0] + va[1] * n[1] - nve);
    v2 = (float)(v1 / (sqrt((1.0 + nva * nva)) * sqrt((1.0 + nve * nve))));
    v1 = (float)(asin(v2) * 180.0 / M_PI);
    if (!(v1 >= -90.0 && v1 <= 90.0)) {
      printf("ERROR in PSIEN()  v1: %f ve: %f\n", v1, v2);
      printf("nve: %f nva: %f\n", nve, nva);
      printf("n: %f %f\n", n[0], n[1]);
      printf(" ve: %f %f va: %f %f\n", ve[0], ve[1], va[0], va[1]);
      fflush(stdout);
    }
  } else
    v1 = 100.0;
  return (float)fabs(v1);
}


x86 assembly (clang, -O0):
<PsiEN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1050 <norm@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1050 <norm@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe59(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    135d <PsiEN+0x1fd>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x28(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdf5(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1080 <sqrt@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdd1(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1080 <sqrt@plt>
movss  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x2c(%rbp),%xmm0
mulss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
call   1060 <asin@plt>
movsd  0xd94(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2d61(%rip),%rax
divsd  (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd63(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12ca <PsiEN+0x16a>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd60(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    1358 <PsiEN+0x1f8>
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
lea    0xd51(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
lea    0xd5a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x28(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
lea    0xd53(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm2
cvtss2sd %xmm2,%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xd25(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
mov    0x2c87(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
jmp    136a <PsiEN+0x20a>
movss  0xcc3(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2ss %rax,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PsiEN>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    $0x2,%esi
call   1050 <norm@plt>
movss  %xmm0,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <norm@plt>
movaps %xmm0,%xmm3
cvtss2sd %xmm0,%xmm0
ucomisd 0xe74(%rip),%xmm0
jbe    12fb <PsiEN+0x19b>
movss  (%rbx),%xmm1
movss  0x4(%rbx),%xmm2
divss  %xmm3,%xmm1
divss  %xmm3,%xmm2
movss  0x4(%r14),%xmm0
movss  %xmm2,0x10(%rsp)
mulss  %xmm2,%xmm0
movss  (%r14),%xmm2
movss  %xmm1,0x14(%rsp)
mulss  %xmm1,%xmm2
addss  %xmm0,%xmm2
subss  %xmm3,%xmm2
movss  %xmm2,0x4(%rsp)
movss  0xc(%rsp),%xmm0
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xe22(%rip),%xmm0
movss  %xmm3,0x8(%rsp)
call   1080 <sqrt@plt>
movss  %xmm0,(%rsp)
movss  0x8(%rsp),%xmm0
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xdfc(%rip),%xmm0
call   1080 <sqrt@plt>
mulss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movaps %xmm1,%xmm0
call   1060 <asin@plt>
mulsd  0xdda(%rip),%xmm0
mov    0x2d9b(%rip),%rax
divsd  (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
ucomiss 0xda8(%rip),%xmm0
jb     126f <PsiEN+0x10f>
movss  0xda2(%rip),%xmm1
ucomiss %xmm0,%xmm1
jae    1303 <PsiEN+0x1a3>
lea    0xdb2(%rip),%rdi
movss  %xmm0,(%rsp)
movss  0x4(%rsp),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xdba(%rip),%rdi
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xdb1(%rip),%rdi
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
movss  (%rbx),%xmm0
movss  0x4(%rbx),%xmm1
movss  (%r14),%xmm2
movss  0x4(%r14),%xmm3
cvtss2sd %xmm2,%xmm2
cvtss2sd %xmm3,%xmm3
lea    0xd85(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movss  (%rsp),%xmm0
jmp    1303 <PsiEN+0x1a3>
movss  0xcfd(%rip),%xmm0
call   1040 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
@.str = [33 x i8] c"ERROR in PSIEN() v1: %f ve: %f\0A\00"
@.str.1 = [17 x i8] c"nve: %f nva: %f\0A\00"
@.str.2 = [10 x i8] c"n: %f %f\0A\00"
@.str.3 = [22 x i8] c" ve: %f %f va: %f %f\0A\00"
@stdout = global i32 0
define float @PsiEN(float* %0, float* %1) {
%3 = tail call float @norm(float* %1, i32 2)
%4 = tail call float @norm(float* %0, i32 2)
%5 = fpext float %4 to double
%6 = fcmp ogt double %5, 1.000000e-08
br i1 %6, label %7, label %50
7: ; preds = %2
%8 = load float, float* %0
%9 = fdiv float %8, %4
%10 = getelementptr inbounds float, float* %0, i64 1
%11 = load float, float* %10
%12 = fdiv float %11, %4
%13 = load float, float* %1
%14 = getelementptr inbounds float, float* %1, i64 1
%15 = load float, float* %14
%16 = fmul float %12, %15
%17 = tail call float @llvm.fmuladd.f32(float %13, float %9, float %16)
%18 = fsub float %17, %4
%19 = fmul float %3, %3
%20 = fpext float %19 to double
%21 = fadd double %20, 1.000000e+00
%22 = tail call float @sqrt(double %21)
%23 = fmul float %4, %4
%24 = fpext float %23 to double
%25 = fadd double %24, 1.000000e+00
%26 = tail call float @sqrt(double %25)
%27 = fmul float %22, %26
%28 = fdiv float %18, %27
%29 = tail call double @asin(float %28)
%30 = fmul double %29, 1.800000e+02
%31 = load double, double* @M_PI
%32 = fdiv double %30, %31
%33 = fptrunc double %32 to float
%34 = fcmp ult float %33, -9.000000e+01
%35 = fcmp ugt float %33, 9.000000e+01
%36 = or i1 %34, %35
br i1 %36, label %37, label %50
37: ; preds = %7
%38 = tail call i32 (i8*, float, float, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), float %33, float %28)
%39 = tail call i32 (i8*, float, float, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), float %4, float %3)
%40 = tail call i32 (i8*, float, float, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), float %9, float %12)
%41 = load float, float* %0
%42 = load float, float* %10
%43 = load float, float* %1
%44 = fpext float %43 to double
%45 = load float, float* %14
%46 = fpext float %45 to double
%47 = tail call i32 (i8*, float, float, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), float %41, float %42, double %44, double %46)
%48 = load i32, i32* @stdout
%49 = tail call i32 @fflush(i32 %48)
br label %50
50: ; preds = %2, %7, %37
%51 = phi float [ %33, %37 ], [ %33, %7 ], [ 1.000000e+02, %2 ]
%52 = tail call i64 @fabs(float %51)
%53 = sitofp i64 %52 to float
ret float %53
}