#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*/ atan(double const);
double f_seal_RadiansToDegrees(int /*<<< orphan*/);
double fabs(double const);
double f_seal_DirectionOfVector(const double p_xComponent,
                                const double p_yComponent) {
  if ((p_xComponent == 0) || (p_yComponent == 0)) {
    if (p_xComponent > 0)
      return 90;
    if (p_xComponent < 0)
      return 270;
    if (p_yComponent > 0)
      return 0;
    if (p_yComponent < 0)
      return 180;
    return 0;
  }
  {
    const double d = f_seal_RadiansToDegrees(atan(p_yComponent / p_xComponent));
    if ((p_xComponent > 0) && (p_yComponent > 0))
      return 90 - d;
    if ((p_xComponent > 0) && (p_yComponent < 0))
      return fabs(d) + 90;
    if ((p_xComponent < 0) && (p_yComponent < 0))
      return 270 - d;
    return fabs(d) + 270;
  }
}


x86 assembly (clang, -O0):
<f_seal_DirectionOfVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114f <f_seal_DirectionOfVector+0x2f>
jp     114f <f_seal_DirectionOfVector+0x2f>
jmp    1167 <f_seal_DirectionOfVector+0x47>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11f7 <f_seal_DirectionOfVector+0xd7>
jp     11f7 <f_seal_DirectionOfVector+0xd7>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    118b <f_seal_DirectionOfVector+0x6b>
movsd  0xe87(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <f_seal_DirectionOfVector+0x1c7>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11ab <f_seal_DirectionOfVector+0x8b>
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <f_seal_DirectionOfVector+0x1c7>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ca <f_seal_DirectionOfVector+0xaa>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <f_seal_DirectionOfVector+0x1c7>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11ea <f_seal_DirectionOfVector+0xca>
movsd  0xe30(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <f_seal_DirectionOfVector+0x1c7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <f_seal_DirectionOfVector+0x1c7>
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <atan@plt>
mov    %eax,%edi
call   1040 <f_seal_RadiansToDegrees@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    124d <f_seal_DirectionOfVector+0x12d>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    124d <f_seal_DirectionOfVector+0x12d>
movsd  0xdca(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <f_seal_DirectionOfVector+0x1c7>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1293 <f_seal_DirectionOfVector+0x173>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1293 <f_seal_DirectionOfVector+0x173>
movsd  -0x20(%rbp),%xmm0
movaps 0xda7(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd83(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <f_seal_DirectionOfVector+0x1c7>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12c6 <f_seal_DirectionOfVector+0x1a6>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    12c6 <f_seal_DirectionOfVector+0x1a6>
movsd  0xd49(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <f_seal_DirectionOfVector+0x1c7>
movsd  -0x20(%rbp),%xmm0
movaps 0xd4e(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd22(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_seal_DirectionOfVector>:
sub    $0x28,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1134 <f_seal_DirectionOfVector+0x14>
jnp    1189 <f_seal_DirectionOfVector+0x69>
ucomisd %xmm0,%xmm1
jne    113c <f_seal_DirectionOfVector+0x1c>
jnp    1189 <f_seal_DirectionOfVector+0x69>
movapd %xmm1,%xmm0
divsd  %xmm2,%xmm0
movapd %xmm1,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1030 <atan@plt>
mov    %eax,%edi
call   1040 <f_seal_RadiansToDegrees@plt>
movsd  0x8(%rsp),%xmm3
movapd 0x10(%rsp),%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jbe    11b3 <f_seal_DirectionOfVector+0x93>
ucomisd %xmm0,%xmm2
jbe    11b3 <f_seal_DirectionOfVector+0x93>
movsd  0xe94(%rip),%xmm0
jmp    1214 <f_seal_DirectionOfVector+0xf4>
ucomisd %xmm0,%xmm2
jbe    119c <f_seal_DirectionOfVector+0x7c>
movsd  0xe81(%rip),%xmm0
add    $0x28,%rsp
ret
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jbe    11dc <f_seal_DirectionOfVector+0xbc>
movsd  0xe62(%rip),%xmm0
add    $0x28,%rsp
ret
ucomisd %xmm0,%xmm3
jbe    11fc <f_seal_DirectionOfVector+0xdc>
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jbe    11fc <f_seal_DirectionOfVector+0xdc>
movapd 0xe35(%rip),%xmm0
andpd  %xmm1,%xmm0
addsd  0xe41(%rip),%xmm0
add    $0x28,%rsp
ret
ucomisd %xmm0,%xmm1
ja     1231 <f_seal_DirectionOfVector+0x111>
xorpd  %xmm0,%xmm0
cmpltsd %xmm0,%xmm1
movsd  0xe2d(%rip),%xmm0
andpd  %xmm1,%xmm0
add    $0x28,%rsp
ret
xorpd  %xmm0,%xmm0
ucomisd %xmm3,%xmm0
jbe    121d <f_seal_DirectionOfVector+0xfd>
ucomisd %xmm2,%xmm0
jbe    121d <f_seal_DirectionOfVector+0xfd>
movsd  0xdfc(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x28,%rsp
ret
movapd 0xddb(%rip),%xmm0
andpd  %xmm1,%xmm0
addsd  0xddf(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @f_seal_DirectionOfVector(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %4
%8 = fcmp oeq double %7, 0.000000e+00
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load double, double* %5
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %29
12: ; preds = %9, %2
%13 = load double, double* %4
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %12
store double 9.000000e+01, double* %3
br label %66
16: ; preds = %12
%17 = load double, double* %4
%18 = fcmp olt double %17, 0.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %16
store double 2.700000e+02, double* %3
br label %66
20: ; preds = %16
%21 = load double, double* %5
%22 = fcmp ogt double %21, 0.000000e+00
br i1 %22, label %23, label %24
23: ; preds = %20
store double 0.000000e+00, double* %3
br label %66
24: ; preds = %20
%25 = load double, double* %5
%26 = fcmp olt double %25, 0.000000e+00
br i1 %26, label %27, label %28
27: ; preds = %24
store double 1.800000e+02, double* %3
br label %66
28: ; preds = %24
store double 0.000000e+00, double* %3
br label %66
29: ; preds = %9
%30 = load double, double* %5
%31 = load double, double* %4
%32 = fdiv double %30, %31
%33 = call i32 @atan(double %32)
%34 = call double @f_seal_RadiansToDegrees(i32 %33)
store double %34, double* %6
%35 = load double, double* %4
%36 = fcmp ogt double %35, 0.000000e+00
br i1 %36, label %37, label %43
37: ; preds = %29
%38 = load double, double* %5
%39 = fcmp ogt double %38, 0.000000e+00
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load double, double* %6
%42 = fsub double 9.000000e+01, %41
store double %42, double* %3
br label %66
43: ; preds = %37, %29
%44 = load double, double* %4
%45 = fcmp ogt double %44, 0.000000e+00
br i1 %45, label %46, label %53
46: ; preds = %43
%47 = load double, double* %5
%48 = fcmp olt double %47, 0.000000e+00
br i1 %48, label %49, label %53
49: ; preds = %46
%50 = load double, double* %6
%51 = call double @llvm.fabs.f64(double %50)
%52 = fadd double %51, 9.000000e+01
store double %52, double* %3
br label %66
53: ; preds = %46, %43
%54 = load double, double* %4
%55 = fcmp olt double %54, 0.000000e+00
br i1 %55, label %56, label %62
56: ; preds = %53
%57 = load double, double* %5
%58 = fcmp olt double %57, 0.000000e+00
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load double, double* %6
%61 = fsub double 2.700000e+02, %60
store double %61, double* %3
br label %66
62: ; preds = %56, %53
%63 = load double, double* %6
%64 = call double @llvm.fabs.f64(double %63)
%65 = fadd double %64, 2.700000e+02
store double %65, double* %3
br label %66
66: ; preds = %62, %59, %49, %40, %28, %27, %23, %19, %15
%67 = load double, double* %3
ret double %67
}

LLVM IR (-O2):
define double @f_seal_DirectionOfVector(double %0, double %1) {
%3 = fcmp oeq double %0, 0.000000e+00
%4 = fcmp oeq double %1, 0.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = fcmp ogt double %0, 0.000000e+00
br i1 %7, label %38, label %8
8: ; preds = %6
%9 = fcmp olt double %0, 0.000000e+00
br i1 %9, label %38, label %10
10: ; preds = %8
%11 = fcmp ogt double %1, 0.000000e+00
br i1 %11, label %38, label %12
12: ; preds = %10
%13 = fcmp olt double %1, 0.000000e+00
%14 = select i1 %13, double 1.800000e+02, double 0.000000e+00
br label %38
15: ; preds = %2
%16 = fdiv double %1, %0
%17 = tail call i32 @atan(double %16)
%18 = tail call double @f_seal_RadiansToDegrees(i32 %17)
%19 = fcmp ogt double %0, 0.000000e+00
%20 = fcmp ogt double %1, 0.000000e+00
%21 = and i1 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = fsub double 9.000000e+01, %18
br label %38
24: ; preds = %15
%25 = fcmp olt double %1, 0.000000e+00
%26 = and i1 %19, %25
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = tail call double @llvm.fabs.f64(double %18)
%29 = fadd double %28, 9.000000e+01
br label %38
30: ; preds = %24
%31 = fcmp olt double %0, 0.000000e+00
%32 = and i1 %31, %25
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = fsub double 2.700000e+02, %18
br label %38
35: ; preds = %30
%36 = tail call double @llvm.fabs.f64(double %18)
%37 = fadd double %36, 2.700000e+02
br label %38
38: ; preds = %22, %27, %33, %35, %12, %10, %8, %6
%39 = phi double [ 9.000000e+01, %6 ], [ 2.700000e+02, %8 ], [ 0.000000e+00, %10 ], [ %14, %12 ], [ %23, %22 ], [ %29, %27 ], [ %34, %33 ], [ %37, %35 ]
ret double %39
}