#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 fabsf(float);
float atan2f(float y, float x) {
  float res, absX, absY;
  absX = fabsf(x);
  absY = fabsf(y);
  res = ((absX) > (absY) ? (absX) : (absY));
  if (res > 0 || res < 0)
    res = ((absX) < (absY) ? (absX) : (absY)) / res;
  else
    res = 0.0f;
  res = -((((0.05030176425872175f * res - 0.3099814292351353f) * res -
            0.14744007058297684f) *
               res -
           0.99997356613987f) *
              res -
          3.14551665884836e-07f) /
        ((0.6444640676891548f * res + 0.1471039133652469f) * res + 1.0f);
  if (absY > absX)
    res = (3.14159265358979323846f / 2.0f) - res;
  if (x < 0)
    res = 3.14159265358979323846f - res;
  if (y < 0)
    res = -res;
  return res;
}


x86 assembly (clang, -O0):
<atan2f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movaps 0xee6(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movaps 0xed1(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    1156 <atan2f+0x56>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1160 <atan2f+0x60>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
ja     1188 <atan2f+0x88>
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11c8 <atan2f+0xc8>
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11aa <atan2f+0xaa>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11b4 <atan2f+0xb4>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11d0 <atan2f+0xd0>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe4b(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe43(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe26(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe0d(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xdf4(%rip),%xmm1
addss  %xmm1,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xdce(%rip),%xmm2
mulss  %xmm2,%xmm1
movss  0xdc6(%rip),%xmm2
addss  %xmm2,%xmm1
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm1
movss  0xda9(%rip),%xmm2
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x14(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1295 <atan2f+0x195>
movss  0xda5(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    12b4 <atan2f+0x1b4>
movss  0xd8a(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    12d8 <atan2f+0x1d8>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan2f>:
movaps 0xef9(%rip),%xmm4
movaps %xmm1,%xmm3
andps  %xmm4,%xmm3
andps  %xmm0,%xmm4
movaps %xmm3,%xmm5
maxss  %xmm4,%xmm5
xorps  %xmm8,%xmm8
ucomiss %xmm8,%xmm5
xorps  %xmm7,%xmm7
jbe    112f <atan2f+0x2f>
movaps %xmm3,%xmm7
minss  %xmm4,%xmm7
divss  %xmm5,%xmm7
movss  0xee9(%rip),%xmm6
mulss  %xmm7,%xmm6
addss  0xee1(%rip),%xmm6
mulss  %xmm7,%xmm6
addss  0xed9(%rip),%xmm6
mulss  %xmm7,%xmm6
addss  0xed1(%rip),%xmm6
mulss  %xmm7,%xmm6
addss  0xec9(%rip),%xmm6
movaps 0xea2(%rip),%xmm5
xorps  %xmm5,%xmm6
movss  0xebb(%rip),%xmm2
mulss  %xmm7,%xmm2
addss  0xeb3(%rip),%xmm2
mulss  %xmm7,%xmm2
addss  0xeab(%rip),%xmm2
divss  %xmm2,%xmm6
movss  0xea3(%rip),%xmm2
subss  %xmm6,%xmm2
cmpltss %xmm4,%xmm3
movaps %xmm3,%xmm4
andnps %xmm6,%xmm4
andps  %xmm2,%xmm3
orps   %xmm4,%xmm3
movss  0xe8a(%rip),%xmm2
subss  %xmm3,%xmm2
cmpltss %xmm8,%xmm1
movaps %xmm1,%xmm4
andnps %xmm3,%xmm4
andps  %xmm2,%xmm1
orps   %xmm4,%xmm1
xorps  %xmm1,%xmm5
cmpltss %xmm8,%xmm0
movaps %xmm0,%xmm2
andnps %xmm1,%xmm2
andps  %xmm5,%xmm0
orps   %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @atan2f(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %3
store float %1, float* %4
%8 = load float, float* %4
%9 = call float @llvm.fabs.f32(float %8)
store float %9, float* %6
%10 = load float, float* %3
%11 = call float @llvm.fabs.f32(float %10)
store float %11, float* %7
%12 = load float, float* %6
%13 = load float, float* %7
%14 = fcmp ogt float %12, %13
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = load float, float* %6
br label %19
17: ; preds = %2
%18 = load float, float* %7
br label %19
19: ; preds = %17, %15
%20 = phi float [ %16, %15 ], [ %18, %17 ]
store float %20, float* %5
%21 = load float, float* %5
%22 = fcmp ogt float %21, 0.000000e+00
br i1 %22, label %26, label %23
23: ; preds = %19
%24 = load float, float* %5
%25 = fcmp olt float %24, 0.000000e+00
br i1 %25, label %26, label %38
26: ; preds = %23, %19
%27 = load float, float* %6
%28 = load float, float* %7
%29 = fcmp olt float %27, %28
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load float, float* %6
br label %34
32: ; preds = %26
%33 = load float, float* %7
br label %34
34: ; preds = %32, %30
%35 = phi float [ %31, %30 ], [ %33, %32 ]
%36 = load float, float* %5
%37 = fdiv float %35, %36
store float %37, float* %5
br label %39
38: ; preds = %23
store float 0.000000e+00, float* %5
br label %39
39: ; preds = %38, %34
%40 = load float, float* %5
%41 = call float @llvm.fmuladd.f32(float 0x3FA9C12720000000, float %40, float 0xBFD3D6BC60000000)
%42 = load float, float* %5
%43 = call float @llvm.fmuladd.f32(float %41, float %42, float 0xBFC2DF5100000000)
%44 = load float, float* %5
%45 = call float @llvm.fmuladd.f32(float %43, float %44, float 0xBFEFFFC8A0000000)
%46 = load float, float* %5
%47 = call float @llvm.fmuladd.f32(float %45, float %46, float 0xBE951BF4E0000000)
%48 = fneg float %47
%49 = load float, float* %5
%50 = call float @llvm.fmuladd.f32(float 0x3FE49F7320000000, float %49, float 0x3FC2D44D20000000)
%51 = load float, float* %5
%52 = call float @llvm.fmuladd.f32(float %50, float %51, float 1.000000e+00)
%53 = fdiv float %48, %52
store float %53, float* %5
%54 = load float, float* %7
%55 = load float, float* %6
%56 = fcmp ogt float %54, %55
br i1 %56, label %57, label %60
57: ; preds = %39
%58 = load float, float* %5
%59 = fsub float 0x3FF921FB60000000, %58
store float %59, float* %5
br label %60
60: ; preds = %57, %39
%61 = load float, float* %4
%62 = fcmp olt float %61, 0.000000e+00
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = load float, float* %5
%65 = fsub float 0x400921FB60000000, %64
store float %65, float* %5
br label %66
66: ; preds = %63, %60
%67 = load float, float* %3
%68 = fcmp olt float %67, 0.000000e+00
br i1 %68, label %69, label %72
69: ; preds = %66
%70 = load float, float* %5
%71 = fneg float %70
store float %71, float* %5
br label %72
72: ; preds = %69, %66
%73 = load float, float* %5
ret float %73
}

LLVM IR (-O2):
define float @atan2f(float %0, float %1) {
%3 = tail call float @llvm.fabs.f32(float %1)
%4 = tail call float @llvm.fabs.f32(float %0)
%5 = fcmp ogt float %3, %4
%6 = select i1 %5, float %3, float %4
%7 = fcmp ogt float %6, 0.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = fcmp olt float %3, %4
%10 = select i1 %9, float %3, float %4
%11 = fdiv float %10, %6
br label %12
12: ; preds = %2, %8
%13 = phi float [ %11, %8 ], [ 0.000000e+00, %2 ]
%14 = tail call float @llvm.fmuladd.f32(float %13, float 0x3FA9C12720000000, float 0xBFD3D6BC60000000)
%15 = tail call float @llvm.fmuladd.f32(float %14, float %13, float 0xBFC2DF5100000000)
%16 = tail call float @llvm.fmuladd.f32(float %15, float %13, float 0xBFEFFFC8A0000000)
%17 = tail call float @llvm.fmuladd.f32(float %16, float %13, float 0xBE951BF4E0000000)
%18 = fneg float %17
%19 = tail call float @llvm.fmuladd.f32(float %13, float 0x3FE49F7320000000, float 0x3FC2D44D20000000)
%20 = tail call float @llvm.fmuladd.f32(float %19, float %13, float 1.000000e+00)
%21 = fdiv float %18, %20
%22 = fcmp ogt float %4, %3
%23 = fsub float 0x3FF921FB60000000, %21
%24 = select i1 %22, float %23, float %21
%25 = fcmp olt float %1, 0.000000e+00
%26 = fsub float 0x400921FB60000000, %24
%27 = select i1 %25, float %26, float %24
%28 = fcmp olt float %0, 0.000000e+00
%29 = fneg float %27
%30 = select i1 %28, float %29, float %27
ret float %30
}