#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 */
float HUGE_VAL;
float atanf(float);
float trig_delta_to_angle_f(float dx, float dy) {
  float angle;
  if (dx == 0)
    angle = (dy < 0) ? -HUGE_VAL : HUGE_VAL;
  else
    angle = dy / dx;
  angle = atanf(angle);
  if (dx < 0)
    angle = angle + 3.141592653589793;
  else if (angle < 0)
    angle = 2. * 3.141592653589793 + angle;
  return angle;
}


x86 assembly (clang, -O0):
<trig_delta_to_angle_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1187 <trig_delta_to_angle_f+0x77>
jp     1187 <trig_delta_to_angle_f+0x77>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1168 <trig_delta_to_angle_f+0x58>
mov    0x2e9b(%rip),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1178 <trig_delta_to_angle_f+0x68>
mov    0x2e79(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1196 <trig_delta_to_angle_f+0x86>
movss  -0x8(%rbp),%xmm0
divss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <atanf@plt>
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    11d5 <trig_delta_to_angle_f+0xc5>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe45(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1205 <trig_delta_to_angle_f+0xf5>
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1200 <trig_delta_to_angle_f+0xf0>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe0d(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1205 <trig_delta_to_angle_f+0xf5>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trig_delta_to_angle_f>:
push   %rax
xorps  %xmm4,%xmm4
ucomiss %xmm4,%xmm0
movss  %xmm0,0x4(%rsp)
jne    1146 <trig_delta_to_angle_f+0x36>
jp     1146 <trig_delta_to_angle_f+0x36>
mov    0x2ec0(%rip),%rax
movss  (%rax),%xmm2
movaps 0xecd(%rip),%xmm3
xorps  %xmm2,%xmm3
cmpltss %xmm4,%xmm1
andps  %xmm1,%xmm3
andnps %xmm2,%xmm1
orps   %xmm3,%xmm1
jmp    114a <trig_delta_to_angle_f+0x3a>
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
call   1030 <atanf@plt>
xorps  %xmm1,%xmm1
ucomiss 0x4(%rsp),%xmm1
jbe    116a <trig_delta_to_angle_f+0x5a>
cvtss2sd %xmm0,%xmm0
addsd  0xeb0(%rip),%xmm0
jmp    117b <trig_delta_to_angle_f+0x6b>
ucomiss %xmm0,%xmm1
jbe    117f <trig_delta_to_angle_f+0x6f>
cvtss2sd %xmm0,%xmm0
addsd  0xe95(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@HUGE_VAL = global float 0.000000e+00
define float @trig_delta_to_angle_f(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = fcmp oeq float %6, 0.000000e+00
br i1 %7, label %8, label %18
8: ; preds = %2
%9 = load float, float* %4
%10 = fcmp olt float %9, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load float, float* @HUGE_VAL
%13 = fneg float %12
br label %16
14: ; preds = %8
%15 = load float, float* @HUGE_VAL
br label %16
16: ; preds = %14, %11
%17 = phi float [ %13, %11 ], [ %15, %14 ]
store float %17, float* %5
br label %22
18: ; preds = %2
%19 = load float, float* %4
%20 = load float, float* %3
%21 = fdiv float %19, %20
store float %21, float* %5
br label %22
22: ; preds = %18, %16
%23 = load float, float* %5
%24 = call float @atanf(float %23)
store float %24, float* %5
%25 = load float, float* %3
%26 = fcmp olt float %25, 0.000000e+00
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = load float, float* %5
%29 = fpext float %28 to double
%30 = fadd double %29, 0x400921FB54442D18
%31 = fptrunc double %30 to float
store float %31, float* %5
br label %41
32: ; preds = %22
%33 = load float, float* %5
%34 = fcmp olt float %33, 0.000000e+00
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load float, float* %5
%37 = fpext float %36 to double
%38 = fadd double 0x401921FB54442D18, %37
%39 = fptrunc double %38 to float
store float %39, float* %5
br label %40
40: ; preds = %35, %32
br label %41
41: ; preds = %40, %27
%42 = load float, float* %5
ret float %42
}

LLVM IR (-O2):
@HUGE_VAL = global float 0.000000e+00
define float @trig_delta_to_angle_f(float %0, float %1) {
%3 = fcmp oeq float %0, 0.000000e+00
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = fcmp olt float %1, 0.000000e+00
%6 = load float, float* @HUGE_VAL
%7 = fneg float %6
%8 = select i1 %5, float %7, float %6
br label %11
9: ; preds = %2
%10 = fdiv float %1, %0
br label %11
11: ; preds = %9, %4
%12 = phi float [ %8, %4 ], [ %10, %9 ]
%13 = tail call float @atanf(float %12)
%14 = fcmp olt float %0, 0.000000e+00
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = fpext float %13 to double
%17 = fadd double %16, 0x400921FB54442D18
%18 = fptrunc double %17 to float
br label %25
19: ; preds = %11
%20 = fcmp olt float %13, 0.000000e+00
br i1 %20, label %21, label %25
21: ; preds = %19
%22 = fpext float %13 to double
%23 = fadd double %22, 0x401921FB54442D18
%24 = fptrunc double %23 to float
br label %25
25: ; preds = %19, %21, %15
%26 = phi float [ %18, %15 ], [ %24, %21 ], [ %13, %19 ]
ret float %26
}