#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 atan(double);
int fabs(double);
int CalculateAngle(double x1, double y1, double x2, double y2) {
  double vertexX = x2 - x1;
  double vertexY = y2 - y1;
  if (fabs(vertexX) < 1e-6 && fabs(vertexY) < 1e-6)
    return -1;
  else if (fabs(vertexX) < 1e-6 && vertexY > 1e-6)
    return 0;
  else if (vertexX > 1e-6 && fabs(vertexY) < 1e-6)
    return 90;
  else if (fabs(vertexX) < 1e-6 && -1 * vertexY > 1e-6)
    return 180;
  else if (-1 * vertexX > 1e-6 && fabs(vertexY) < 1e-6)
    return 270;
  else {
    if (vertexX > 1e-6)
      return 90 - (int)(atan(vertexY / vertexX) * 180 / 3.14159265358979323846);
    else
      return 270 -
             (int)(atan(vertexY / vertexX) * 180 / 3.14159265358979323846);
  }
}


x86 assembly (clang, -O0):
<CalculateAngle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe90(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a6 <CalculateAngle+0x86>
movsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe70(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a6 <CalculateAngle+0x86>
movl   $0xffffffff,-0x4(%rbp)
jmp    1344 <CalculateAngle+0x224>
movsd  -0x30(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe44(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e9 <CalculateAngle+0xc9>
movsd  -0x38(%rbp),%xmm0
movsd  0xe2d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e9 <CalculateAngle+0xc9>
movl   $0x0,-0x4(%rbp)
jmp    1344 <CalculateAngle+0x224>
movsd  -0x30(%rbp),%xmm0
movsd  0xe0a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    122c <CalculateAngle+0x10c>
movsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdea(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    122c <CalculateAngle+0x10c>
movl   $0x5a,-0x4(%rbp)
jmp    1344 <CalculateAngle+0x224>
movsd  -0x30(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdbe(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1277 <CalculateAngle+0x157>
movsd  0xdb4(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xd9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1277 <CalculateAngle+0x157>
movl   $0xb4,-0x4(%rbp)
jmp    1344 <CalculateAngle+0x224>
movsd  0xd89(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xd74(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12c2 <CalculateAngle+0x1a2>
movsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xd54(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12c2 <CalculateAngle+0x1a2>
movl   $0x10e,-0x4(%rbp)
jmp    1344 <CalculateAngle+0x224>
movsd  -0x30(%rbp),%xmm0
movsd  0xd31(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1311 <CalculateAngle+0x1f1>
movsd  -0x38(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
call   1040 <atan@plt>
imul   $0xb4,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd16(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    $0x5a,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1344 <CalculateAngle+0x224>
movsd  -0x38(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
call   1040 <atan@plt>
imul   $0xb4,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  0xcde(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    $0x10e,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateAngle>:
sub    $0x18,%rsp
subsd  %xmm0,%xmm2
subsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jg     1158 <CalculateAngle+0x38>
movsd  0x10(%rsp),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jle    1225 <CalculateAngle+0x105>
movsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xe8f(%rip),%xmm0
jbe    1180 <CalculateAngle+0x60>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jg     1180 <CalculateAngle+0x60>
add    $0x18,%rsp
ret
movsd  0x8(%rsp),%xmm1
ucomisd 0xe72(%rip),%xmm1
jbe    11a3 <CalculateAngle+0x83>
call   1030 <fabs@plt>
movsd  0x8(%rsp),%xmm1
test   %eax,%eax
jle    122f <CalculateAngle+0x10f>
movapd %xmm1,%xmm0
call   1030 <fabs@plt>
movsd  0x10(%rsp),%xmm0
movsd  0xe4e(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    11cb <CalculateAngle+0xab>
mov    %eax,%ecx
mov    $0xb4,%eax
test   %ecx,%ecx
jle    117b <CalculateAngle+0x5b>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm2
jbe    11ec <CalculateAngle+0xcc>
call   1030 <fabs@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
test   %eax,%eax
jle    1245 <CalculateAngle+0x125>
divsd  %xmm1,%xmm0
call   1040 <atan@plt>
imul   $0xb4,%eax,%eax
movsd  0x8(%rsp),%xmm0
ucomisd 0xdf7(%rip),%xmm0
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xdf8(%rip),%xmm0
cvttsd2si %xmm0,%ecx
jbe    1239 <CalculateAngle+0x119>
mov    $0x5a,%eax
jmp    123e <CalculateAngle+0x11e>
mov    $0xffffffff,%eax
add    $0x18,%rsp
ret
mov    $0x5a,%eax
add    $0x18,%rsp
ret
mov    $0x10e,%eax
sub    %ecx,%eax
add    $0x18,%rsp
ret
mov    $0x10e,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @CalculateAngle(double %0, double %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
%12 = load double, double* %8
%13 = load double, double* %6
%14 = fsub double %12, %13
store double %14, double* %10
%15 = load double, double* %9
%16 = load double, double* %7
%17 = fsub double %15, %16
store double %17, double* %11
%18 = load double, double* %10
%19 = call i32 @fabs(double %18)
%20 = sitofp i32 %19 to double
%21 = fcmp olt double %20, 0x3EB0C6F7A0B5ED8D
br i1 %21, label %22, label %28
22: ; preds = %4
%23 = load double, double* %11
%24 = call i32 @fabs(double %23)
%25 = sitofp i32 %24 to double
%26 = fcmp olt double %25, 0x3EB0C6F7A0B5ED8D
br i1 %26, label %27, label %28
27: ; preds = %22
store i32 -1, i32* %5
br label %89
28: ; preds = %22, %4
%29 = load double, double* %10
%30 = call i32 @fabs(double %29)
%31 = sitofp i32 %30 to double
%32 = fcmp olt double %31, 0x3EB0C6F7A0B5ED8D
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load double, double* %11
%35 = fcmp ogt double %34, 0x3EB0C6F7A0B5ED8D
br i1 %35, label %36, label %37
36: ; preds = %33
store i32 0, i32* %5
br label %89
37: ; preds = %33, %28
%38 = load double, double* %10
%39 = fcmp ogt double %38, 0x3EB0C6F7A0B5ED8D
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = load double, double* %11
%42 = call i32 @fabs(double %41)
%43 = sitofp i32 %42 to double
%44 = fcmp olt double %43, 0x3EB0C6F7A0B5ED8D
br i1 %44, label %45, label %46
45: ; preds = %40
store i32 90, i32* %5
br label %89
46: ; preds = %40, %37
%47 = load double, double* %10
%48 = call i32 @fabs(double %47)
%49 = sitofp i32 %48 to double
%50 = fcmp olt double %49, 0x3EB0C6F7A0B5ED8D
br i1 %50, label %51, label %56
51: ; preds = %46
%52 = load double, double* %11
%53 = fmul double -1.000000e+00, %52
%54 = fcmp ogt double %53, 0x3EB0C6F7A0B5ED8D
br i1 %54, label %55, label %56
55: ; preds = %51
store i32 180, i32* %5
br label %89
56: ; preds = %51, %46
%57 = load double, double* %10
%58 = fmul double -1.000000e+00, %57
%59 = fcmp ogt double %58, 0x3EB0C6F7A0B5ED8D
br i1 %59, label %60, label %66
60: ; preds = %56
%61 = load double, double* %11
%62 = call i32 @fabs(double %61)
%63 = sitofp i32 %62 to double
%64 = fcmp olt double %63, 0x3EB0C6F7A0B5ED8D
br i1 %64, label %65, label %66
65: ; preds = %60
store i32 270, i32* %5
br label %89
66: ; preds = %60, %56
%67 = load double, double* %10
%68 = fcmp ogt double %67, 0x3EB0C6F7A0B5ED8D
br i1 %68, label %69, label %79
69: ; preds = %66
%70 = load double, double* %11
%71 = load double, double* %10
%72 = fdiv double %70, %71
%73 = call i32 @atan(double %72)
%74 = mul nsw i32 %73, 180
%75 = sitofp i32 %74 to double
%76 = fdiv double %75, 0x400921FB54442D18
%77 = fptosi double %76 to i32
%78 = sub nsw i32 90, %77
store i32 %78, i32* %5
br label %89
79: ; preds = %66
%80 = load double, double* %11
%81 = load double, double* %10
%82 = fdiv double %80, %81
%83 = call i32 @atan(double %82)
%84 = mul nsw i32 %83, 180
%85 = sitofp i32 %84 to double
%86 = fdiv double %85, 0x400921FB54442D18
%87 = fptosi double %86 to i32
%88 = sub nsw i32 270, %87
store i32 %88, i32* %5
br label %89
89: ; preds = %79, %69, %65, %55, %45, %36, %27
%90 = load i32, i32* %5
ret i32 %90
}

LLVM IR (-O2):
define i32 @CalculateAngle(double %0, double %1, double %2, double %3) {
%5 = fsub double %2, %0
%6 = fsub double %3, %1
%7 = tail call i32 @fabs(double %5)
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = tail call i32 @fabs(double %6)
%11 = icmp slt i32 %10, 1
br i1 %11, label %43, label %12
12: ; preds = %9, %4
%13 = tail call i32 @fabs(double %5)
%14 = icmp slt i32 %13, 1
%15 = fcmp ogt double %6, 0x3EB0C6F7A0B5ED8D
%16 = and i1 %15, %14
br i1 %16, label %43, label %17
17: ; preds = %12
%18 = fcmp ogt double %5, 0x3EB0C6F7A0B5ED8D
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = tail call i32 @fabs(double %6)
%21 = icmp slt i32 %20, 1
br i1 %21, label %43, label %22
22: ; preds = %19, %17
%23 = tail call i32 @fabs(double %5)
%24 = icmp slt i32 %23, 1
%25 = fcmp olt double %6, 0xBEB0C6F7A0B5ED8D
%26 = and i1 %25, %24
br i1 %26, label %43, label %27
27: ; preds = %22
%28 = fcmp olt double %5, 0xBEB0C6F7A0B5ED8D
br i1 %28, label %29, label %32
29: ; preds = %27
%30 = tail call i32 @fabs(double %6)
%31 = icmp slt i32 %30, 1
br i1 %31, label %43, label %32
32: ; preds = %29, %27
%33 = fdiv double %6, %5
%34 = tail call i32 @atan(double %33)
%35 = mul nsw i32 %34, 180
%36 = sitofp i32 %35 to double
%37 = fdiv double %36, 0x400921FB54442D18
%38 = fptosi double %37 to i32
br i1 %18, label %39, label %41
39: ; preds = %32
%40 = sub nsw i32 90, %38
br label %43
41: ; preds = %32
%42 = sub nsw i32 270, %38
br label %43
43: ; preds = %29, %22, %19, %12, %9, %41, %39
%44 = phi i32 [ %40, %39 ], [ %42, %41 ], [ -1, %9 ], [ 0, %12 ], [ 90, %19 ], [ 180, %22 ], [ 270, %29 ]
ret i32 %44
}