#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 mla(double, double, double);
__attribute__((always_)) const double atan2k(double y, double x) {
  double s, t, u;
  int q = 0;
  if (x < 0) {
    x = -x;
    q = -2;
  }
  if (y > x) {
    t = x;
    x = y;
    y = -t;
    q += 1;
  }
  s = y / x;
  t = s * s;
  double t2 = t * t, t4 = t2 * t2, t8 = t4 * t4, t16 = t8 * t8;
  u = mla(t16,
          mla(t2, (-1.88796008463073496563746e-05),
              mla(t, (0.000209850076645816976906797),
                  (-0.00110611831486672482563471))),
          mla(t8,
              mla(t4,
                  mla(t2,
                      mla(t, (0.00370026744188713119232403),
                          (-0.00889896195887655491740809)),
                      mla(t, (0.016599329773529201970117),
                          (-0.0254517624932312641616861))),
                  mla(t2,
                      mla(t, (0.0337852580001353069993897),
                          (-0.0407629191276836500001934)),
                      mla(t, (0.0466667150077840625632675),
                          (-0.0523674852303482457616113)))),
              mla(t4,
                  mla(t2,
                      mla(t, (0.0587666392926673580854313),
                          (-0.0666573579361080525984562)),
                      mla(t, (0.0769219538311769618355029),
                          (-0.090908995008245008229153))),
                  mla(t2,
                      mla(t, (0.111111105648261418443745),
                          (-0.14285714266771329383765)),
                      mla(t, (0.199999999996591265594148),
                          (-0.333333333333311110369124))))));
  t = u * t * s + s;
  t = q * (3.141592653589793238462643383279502884 / 2) + t;
  return t;
}


x86 assembly (clang, -O0):
<atan2k>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movl   $0x0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1162 <atan2k+0x52>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0xfffffffe,-0x2c(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11b0 <atan2k+0xa0>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xe62(%rip),%xmm1
movsd  0xe62(%rip),%xmm2
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  -0xd8(%rbp),%xmm0
ff
movsd  0xe3a(%rip),%xmm1
call   1030 <mla@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xdef(%rip),%xmm1
movsd  0xdef(%rip),%xmm2
call   1030 <mla@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xdbd(%rip),%xmm1
movsd  0xdbd(%rip),%xmm2
call   1030 <mla@plt>
movsd  -0xd0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xc8(%rbp),%xmm0
ff
call   1030 <mla@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xd66(%rip),%xmm1
movsd  0xd66(%rip),%xmm2
call   1030 <mla@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xd34(%rip),%xmm1
movsd  0xd34(%rip),%xmm2
call   1030 <mla@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xb8(%rbp),%xmm0
ff
call   1030 <mla@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
call   1030 <mla@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xcbe(%rip),%xmm1
movsd  0xcbe(%rip),%xmm2
call   1030 <mla@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xc8c(%rip),%xmm1
movsd  0xc8c(%rip),%xmm2
call   1030 <mla@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
call   1030 <mla@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xc38(%rip),%xmm1
movsd  0xc38(%rip),%xmm2
call   1030 <mla@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xc06(%rip),%xmm1
movsd  0xc06(%rip),%xmm2
call   1030 <mla@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
call   1030 <mla@plt>
movsd  -0x80(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x78(%rbp),%xmm0
call   1030 <mla@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
call   1030 <mla@plt>
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
call   1030 <mla@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xb6b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan2k>:
push   %rbx
sub    $0x50,%rsp
xorpd  %xmm3,%xmm3
xor    %eax,%eax
ucomisd %xmm1,%xmm3
setbe  %al
movapd 0xed6(%rip),%xmm5
movapd %xmm1,%xmm4
xorpd  %xmm5,%xmm4
movapd %xmm1,%xmm2
cmpltsd %xmm3,%xmm2
andpd  %xmm2,%xmm4
andnpd %xmm1,%xmm2
orpd   %xmm4,%xmm2
xor    %ecx,%ecx
ucomisd %xmm2,%xmm0
seta   %cl
lea    -0x2(%rcx,%rax,2),%ebx
movapd %xmm0,%xmm1
maxsd  %xmm2,%xmm1
jbe    1166 <atan2k+0x56>
xorpd  %xmm5,%xmm2
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x48(%rsp)
mulsd  %xmm0,%xmm0
movapd %xmm0,%xmm1
movsd  %xmm0,(%rsp)
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x38(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x40(%rsp)
movsd  0xe63(%rip),%xmm1
movsd  0xe63(%rip),%xmm2
call   1030 <mla@plt>
movapd %xmm0,%xmm2
movsd  0xe5a(%rip),%xmm1
movsd  0x18(%rsp),%xmm0
call   1030 <mla@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0xe49(%rip),%xmm1
movsd  0xe49(%rip),%xmm2
movsd  (%rsp),%xmm0
call   1030 <mla@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe39(%rip),%xmm1
movsd  0xe39(%rip),%xmm2
movsd  (%rsp),%xmm0
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <mla@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe15(%rip),%xmm1
movsd  0xe15(%rip),%xmm2
movsd  (%rsp),%xmm0
call   1030 <mla@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe05(%rip),%xmm1
movsd  0xe05(%rip),%xmm2
movsd  (%rsp),%xmm0
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <mla@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xdcd(%rip),%xmm1
movsd  0xdcd(%rip),%xmm2
movsd  (%rsp),%xmm0
call   1030 <mla@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xdbd(%rip),%xmm1
movsd  0xdbd(%rip),%xmm2
movsd  (%rsp),%xmm0
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <mla@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xd99(%rip),%xmm1
movsd  0xd99(%rip),%xmm2
movsd  (%rsp),%xmm0
call   1030 <mla@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0xd89(%rip),%xmm1
movsd  0xd89(%rip),%xmm2
movsd  (%rsp),%xmm0
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x20(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x38(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x40(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
call   1030 <mla@plt>
mulsd  (%rsp),%xmm0
movsd  0x48(%rsp),%xmm2
mulsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
addsd  %xmm2,%xmm0
mulsd  0xd15(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @atan2k(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %3
store double %1, double* %4
store i32 0, i32* %8
%13 = load double, double* %4
%14 = fcmp olt double %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load double, double* %4
%17 = fneg double %16
store double %17, double* %4
store i32 -2, i32* %8
br label %18
18: ; preds = %15, %2
%19 = load double, double* %3
%20 = load double, double* %4
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = load double, double* %4
store double %23, double* %6
%24 = load double, double* %3
store double %24, double* %4
%25 = load double, double* %6
%26 = fneg double %25
store double %26, double* %3
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %29
29: ; preds = %22, %18
%30 = load double, double* %3
%31 = load double, double* %4
%32 = fdiv double %30, %31
store double %32, double* %5
%33 = load double, double* %5
%34 = load double, double* %5
%35 = fmul double %33, %34
store double %35, double* %6
%36 = load double, double* %6
%37 = load double, double* %6
%38 = fmul double %36, %37
store double %38, double* %9
%39 = load double, double* %9
%40 = load double, double* %9
%41 = fmul double %39, %40
store double %41, double* %10
%42 = load double, double* %10
%43 = load double, double* %10
%44 = fmul double %42, %43
store double %44, double* %11
%45 = load double, double* %11
%46 = load double, double* %11
%47 = fmul double %45, %46
store double %47, double* %12
%48 = load double, double* %12
%49 = load double, double* %9
%50 = load double, double* %6
%51 = call double @mla(double %50, double 0x3F2B81666EB938AF, double 0xBF521F657F3915DA)
%52 = call double @mla(double %49, double 0xBEF3CBF44A88555F, double %51)
%53 = load double, double* %11
%54 = load double, double* %10
%55 = load double, double* %9
%56 = load double, double* %6
%57 = call double @mla(double %56, double 0x3F6E5005F4C78C20, double 0xBF82399E74A75E56)
%58 = load double, double* %6
%59 = call double @mla(double %58, double 0x3F90FF6A2A0D2286, double 0xBF9A1006DE22CDAC)
%60 = call double @mla(double %55, double %57, double %59)
%61 = load double, double* %9
%62 = load double, double* %6
%63 = call double @mla(double %62, double 0x3FA14C4D24651F2E, double 0xBFA4DEE09915F638)
%64 = load double, double* %6
%65 = call double @mla(double %64, double 0x3FA7E4B31D8A55AE, double 0xBFAACFE938E04FCA)
%66 = call double @mla(double %61, double %63, double %65)
%67 = call double @mla(double %54, double %60, double %66)
%68 = load double, double* %10
%69 = load double, double* %9
%70 = load double, double* %6
%71 = call double @mla(double %70, double 0x3FAE16A933B73622, double 0xBFB11074E45F93E0)
%72 = load double, double* %6
%73 = call double @mla(double %72, double 0x3FB3B1283C0CA0B1, double 0xBFB745CFD878FEE8)
%74 = call double @mla(double %69, double %71, double %73)
%75 = load double, double* %9
%76 = load double, double* %6
%77 = call double @mla(double %76, double 0x3FBC71C704FB4F9F, double 0xBFC2492491E100BB)
%78 = load double, double* %6
%79 = call double @mla(double %78, double 0x3FC999999997B9DD, double 0xBFD55555555553C5)
%80 = call double @mla(double %75, double %77, double %79)
%81 = call double @mla(double %68, double %74, double %80)
%82 = call double @mla(double %53, double %67, double %81)
%83 = call double @mla(double %48, double %52, double %82)
store double %83, double* %7
%84 = load double, double* %7
%85 = load double, double* %6
%86 = fmul double %84, %85
%87 = load double, double* %5
%88 = load double, double* %5
%89 = call double @llvm.fmuladd.f64(double %86, double %87, double %88)
store double %89, double* %6
%90 = load i32, i32* %8
%91 = sitofp i32 %90 to double
%92 = load double, double* %6
%93 = call double @llvm.fmuladd.f64(double %91, double 0x3FF921FB54442D18, double %92)
store double %93, double* %6
%94 = load double, double* %6
ret double %94
}

LLVM IR (-O2):
define double @atan2k(double %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
%4 = fneg double %1
%5 = select i1 %3, i32 -2, i32 0
%6 = select i1 %3, double %4, double %1
%7 = fcmp olt double %6, %0
%8 = fneg double %6
%9 = zext i1 %7 to i32
%10 = or i32 %5, %9
%11 = select i1 %7, double %0, double %6
%12 = select i1 %7, double %8, double %0
%13 = fdiv double %12, %11
%14 = fmul double %13, %13
%15 = fmul double %14, %14
%16 = fmul double %15, %15
%17 = fmul double %16, %16
%18 = fmul double %17, %17
%19 = tail call double @mla(double %14, double 0x3F2B81666EB938AF, double 0xBF521F657F3915DA)
%20 = tail call double @mla(double %15, double 0xBEF3CBF44A88555F, double %19)
%21 = tail call double @mla(double %14, double 0x3F6E5005F4C78C20, double 0xBF82399E74A75E56)
%22 = tail call double @mla(double %14, double 0x3F90FF6A2A0D2286, double 0xBF9A1006DE22CDAC)
%23 = tail call double @mla(double %15, double %21, double %22)
%24 = tail call double @mla(double %14, double 0x3FA14C4D24651F2E, double 0xBFA4DEE09915F638)
%25 = tail call double @mla(double %14, double 0x3FA7E4B31D8A55AE, double 0xBFAACFE938E04FCA)
%26 = tail call double @mla(double %15, double %24, double %25)
%27 = tail call double @mla(double %16, double %23, double %26)
%28 = tail call double @mla(double %14, double 0x3FAE16A933B73622, double 0xBFB11074E45F93E0)
%29 = tail call double @mla(double %14, double 0x3FB3B1283C0CA0B1, double 0xBFB745CFD878FEE8)
%30 = tail call double @mla(double %15, double %28, double %29)
%31 = tail call double @mla(double %14, double 0x3FBC71C704FB4F9F, double 0xBFC2492491E100BB)
%32 = tail call double @mla(double %14, double 0x3FC999999997B9DD, double 0xBFD55555555553C5)
%33 = tail call double @mla(double %15, double %31, double %32)
%34 = tail call double @mla(double %16, double %30, double %33)
%35 = tail call double @mla(double %17, double %27, double %34)
%36 = tail call double @mla(double %18, double %20, double %35)
%37 = fmul double %14, %36
%38 = tail call double @llvm.fmuladd.f64(double %37, double %13, double %13)
%39 = sitofp i32 %10 to double
%40 = tail call double @llvm.fmuladd.f64(double %39, double 0x3FF921FB54442D18, double %38)
ret double %40
}