#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 fabs(double);
double atan(double x) {
  int n;
  double f;
  const static double a[4] = {0.0, 0.52359877559829887038,
                              1.57079632679489661923, 1.04719755119659774615};
  f = fabs(x);
  if (f > 1.0) {
    f = 1.0 / f;
    n = 2;
  } else
    n = 0;
  if (f > 0.26794919243112270647) {
    f = (+(+(0.73205080756887729353 * f - 0.5) - 0.5) + f) /
        (1.73205080756887729353 + f);
    n++;
  }
  if (fabs(f) > 1.e-10) {
    double g = f * f;
    double r;
    r = ((((-0.83758299368150059274 * g + -0.84946240351320683534e1) * g +
           -0.20505855195861651981e2) *
              g +
          -0.13688768894191926929e2) *
         g) /
        ((((g + 0.15024001160028576121e2) * g + 0.59578436142597344465e2) * g +
          0.86157349597130242515e2) *
             g +
         0.41066306682575781263e2);
    f = f + f * r;
  }
  if (n > 1)
    f = -f;
  f = f + a[n];
  if (x < 0)
    return -f;
  else
    return f;
}


x86 assembly (clang, -O0):
<atan>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xf6b(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xed5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1153 <atan+0x53>
movsd  0xec3(%rip),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x2,-0x14(%rbp)
jmp    115a <atan+0x5a>
movl   $0x0,-0x14(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xea1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11be <atan+0xbe>
movsd  -0x20(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe82(%rip),%xmm1
subsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xe69(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x20(%rbp),%xmm0
movaps 0xeb6(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe5a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12ac <atan+0x1ac>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe6c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe68(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe43(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe26(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xe0d(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdef(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdd2(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdb5(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x1,-0x14(%rbp)
jle    12d7 <atan+0x1d7>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movslq -0x14(%rbp),%rcx
lea    0xda9(%rip),%rax
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1325 <atan+0x225>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    132f <atan+0x22f>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan>:
movapd 0xef8(%rip),%xmm2
andpd  %xmm0,%xmm2
movsd  0xf0c(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm2
seta   %cl
ja     1125 <atan+0x25>
movapd %xmm2,%xmm1
jmp    1129 <atan+0x29>
divsd  %xmm2,%xmm1
mov    %cl,%al
add    %eax,%eax
ucomisd 0xef3(%rip),%xmm1
jbe    116a <atan+0x6a>
movsd  0xef1(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  0xeed(%rip),%xmm3
addsd  %xmm3,%xmm2
addsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
addsd  0xee1(%rip),%xmm1
divsd  %xmm1,%xmm2
or     $0x1,%eax
movapd %xmm2,%xmm1
movapd 0xe8e(%rip),%xmm2
andpd  %xmm1,%xmm2
ucomisd 0xeca(%rip),%xmm2
jbe    11f4 <atan+0xf4>
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
movsd  0xec0(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xebc(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xeb8(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xeb4(%rip),%xmm2
movsd  0xeb4(%rip),%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm3,%xmm4
addsd  0xeac(%rip),%xmm4
mulsd  %xmm3,%xmm4
addsd  0xea8(%rip),%xmm4
mulsd  %xmm3,%xmm4
addsd  0xea4(%rip),%xmm4
mulsd  %xmm3,%xmm2
divsd  %xmm4,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm2,%xmm1
movapd 0xe14(%rip),%xmm2
cmp    $0x2,%eax
jl     1205 <atan+0x105>
xorpd  %xmm2,%xmm1
mov    %eax,%eax
lea    0xe82(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm1
xorpd  %xmm1,%xmm2
xorpd  %xmm3,%xmm3
cmpltsd %xmm3,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm1,%xmm3
andpd  %xmm2,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
@atan.a = internal constant [4 x double] [double 0.000000e+00, double 0x3FE0C152382D7365, double 0x3FF921FB54442D18, double 0x3FF0C152382D7366]
define double @atan(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
%8 = load double, double* %3
%9 = call double @llvm.fabs.f64(double %8)
store double %9, double* %5
%10 = load double, double* %5
%11 = fcmp ogt double %10, 1.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load double, double* %5
%14 = fdiv double 1.000000e+00, %13
store double %14, double* %5
store i32 2, i32* %4
br label %16
15: ; preds = %1
store i32 0, i32* %4
br label %16
16: ; preds = %15, %12
%17 = load double, double* %5
%18 = fcmp ogt double %17, 0x3FD126145E9ECD56
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = load double, double* %5
%21 = call double @llvm.fmuladd.f64(double 0x3FE76CF5D0B09955, double %20, double -5.000000e-01)
%22 = fsub double %21, 5.000000e-01
%23 = load double, double* %5
%24 = fadd double %22, %23
%25 = load double, double* %5
%26 = fadd double 0x3FFBB67AE8584CAA, %25
%27 = fdiv double %24, %26
store double %27, double* %5
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %30
30: ; preds = %19, %16
%31 = load double, double* %5
%32 = call double @llvm.fabs.f64(double %31)
%33 = fcmp ogt double %32, 1.000000e-10
br i1 %33, label %34, label %59
34: ; preds = %30
%35 = load double, double* %5
%36 = load double, double* %5
%37 = fmul double %35, %36
store double %37, double* %6
%38 = load double, double* %6
%39 = call double @llvm.fmuladd.f64(double 0xBFEACD7AD9B187BD, double %38, double 0xC020FD3F5C8D6A63)
%40 = load double, double* %6
%41 = call double @llvm.fmuladd.f64(double %39, double %40, double 0xC034817FB9E2BCCB)
%42 = load double, double* %6
%43 = call double @llvm.fmuladd.f64(double %41, double %42, double 0xC02B60A651061CE2)
%44 = load double, double* %6
%45 = fmul double %43, %44
%46 = load double, double* %6
%47 = fadd double %46, 0x402E0C49E14AC710
%48 = load double, double* %6
%49 = call double @llvm.fmuladd.f64(double %47, double %48, double 0x404DCA0A320DA3D7)
%50 = load double, double* %6
%51 = call double @llvm.fmuladd.f64(double %49, double %50, double 0x40558A12040B6DA5)
%52 = load double, double* %6
%53 = call double @llvm.fmuladd.f64(double %51, double %52, double 0x4044887CBCC495A9)
%54 = fdiv double %45, %53
store double %54, double* %7
%55 = load double, double* %5
%56 = load double, double* %5
%57 = load double, double* %7
%58 = call double @llvm.fmuladd.f64(double %56, double %57, double %55)
store double %58, double* %5
br label %59
59: ; preds = %34, %30
%60 = load i32, i32* %4
%61 = icmp sgt i32 %60, 1
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = load double, double* %5
%64 = fneg double %63
store double %64, double* %5
br label %65
65: ; preds = %62, %59
%66 = load double, double* %5
%67 = load i32, i32* %4
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [4 x double], [4 x double]* @atan.a, i64 0, i64 %68
%70 = load double, double* %69
%71 = fadd double %66, %70
store double %71, double* %5
%72 = load double, double* %3
%73 = fcmp olt double %72, 0.000000e+00
br i1 %73, label %74, label %77
74: ; preds = %65
%75 = load double, double* %5
%76 = fneg double %75
store double %76, double* %2
br label %79
77: ; preds = %65
%78 = load double, double* %5
store double %78, double* %2
br label %79
79: ; preds = %77, %74
%80 = load double, double* %2
ret double %80
}

LLVM IR (-O2):
@atan.a = internal unnamed_addr constant [4 x double] [double 0.000000e+00, double 0x3FE0C152382D7365, double 0x3FF921FB54442D18, double 0x3FF0C152382D7366]
define double @atan(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp ogt double %2, 1.000000e+00
%4 = fdiv double 1.000000e+00, %2
%5 = select i1 %3, double %4, double %2
%6 = select i1 %3, i32 2, i32 0
%7 = fcmp ogt double %5, 0x3FD126145E9ECD56
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = tail call double @llvm.fmuladd.f64(double %5, double 0x3FE76CF5D0B09955, double -5.000000e-01)
%10 = fadd double %9, -5.000000e-01
%11 = fadd double %5, %10
%12 = fadd double %5, 0x3FFBB67AE8584CAA
%13 = fdiv double %11, %12
%14 = or i32 %6, 1
br label %15
15: ; preds = %8, %1
%16 = phi double [ %13, %8 ], [ %5, %1 ]
%17 = phi i32 [ %14, %8 ], [ %6, %1 ]
%18 = tail call double @llvm.fabs.f64(double %16)
%19 = fcmp ogt double %18, 1.000000e-10
br i1 %19, label %20, label %32
20: ; preds = %15
%21 = fmul double %16, %16
%22 = tail call double @llvm.fmuladd.f64(double %21, double 0xBFEACD7AD9B187BD, double 0xC020FD3F5C8D6A63)
%23 = tail call double @llvm.fmuladd.f64(double %22, double %21, double 0xC034817FB9E2BCCB)
%24 = tail call double @llvm.fmuladd.f64(double %23, double %21, double 0xC02B60A651061CE2)
%25 = fmul double %21, %24
%26 = fadd double %21, 0x402E0C49E14AC710
%27 = tail call double @llvm.fmuladd.f64(double %26, double %21, double 0x404DCA0A320DA3D7)
%28 = tail call double @llvm.fmuladd.f64(double %27, double %21, double 0x40558A12040B6DA5)
%29 = tail call double @llvm.fmuladd.f64(double %28, double %21, double 0x4044887CBCC495A9)
%30 = fdiv double %25, %29
%31 = tail call double @llvm.fmuladd.f64(double %16, double %30, double %16)
br label %32
32: ; preds = %20, %15
%33 = phi double [ %31, %20 ], [ %16, %15 ]
%34 = icmp sgt i32 %17, 1
%35 = fneg double %33
%36 = select i1 %34, double %35, double %33
%37 = sext i32 %17 to i64
%38 = getelementptr inbounds [4 x double], [4 x double]* @atan.a, i64 0, i64 %37
%39 = load double, double* %38
%40 = fadd double %36, %39
%41 = fcmp olt double %0, 0.000000e+00
%42 = fneg double %40
%43 = select i1 %41, double %42, double %40
ret double %43
}