#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 xatan(float);
float satan(float arg) {
  if (arg < 0.414213562373095e0) {
    return (xatan(arg));
  } else if (arg > 2.41421356237309e0) {
    return (1.57079632679489e0 - xatan(1.0 / arg));
  } else {
    return (0.785398163397448e0 + xatan((arg - 1.0) / (arg + 1.0)));
  }
}


x86 assembly (clang, -O0):
<satan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed2(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    114c <satan+0x3c>
movss  -0x8(%rbp),%xmm0
call   1030 <xatan@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11f3 <satan+0xe3>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeab(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a3 <satan+0x93>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea0(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <xatan@plt>
cvtss2sd %xmm0,%xmm1
movsd  0xe8f(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f3 <satan+0xe3>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe64(%rip),%xmm1
subsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe4f(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <xatan@plt>
cvtss2sd %xmm0,%xmm1
movsd  0xe2a(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<satan>:
push   %rax
cvtss2sd %xmm0,%xmm1
movsd  0xee3(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    1129 <satan+0x19>
pop    %rax
jmp    1030 <xatan@plt>
ucomisd 0xed7(%rip),%xmm1
jbe    1160 <satan+0x50>
movss  0xef5(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
call   1030 <xatan@plt>
cvtss2sd %xmm0,%xmm0
movsd  0xed5(%rip),%xmm1
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
pop    %rax
ret
movsd  0xea8(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <xatan@plt>
cvtss2sd %xmm0,%xmm0
addsd  0xe93(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @satan(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp olt double %5, 0x3FDA827999FCEF31
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load float, float* %3
%9 = call float @xatan(float %8)
store float %9, float* %2
br label %36
10: ; preds = %1
%11 = load float, float* %3
%12 = fpext float %11 to double
%13 = fcmp ogt double %12, 0x4003504F333F9DDB
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load float, float* %3
%16 = fpext float %15 to double
%17 = fdiv double 1.000000e+00, %16
%18 = fptrunc double %17 to float
%19 = call float @xatan(float %18)
%20 = fpext float %19 to double
%21 = fsub double 0x3FF921FB54442CFA, %20
%22 = fptrunc double %21 to float
store float %22, float* %2
br label %36
23: ; preds = %10
%24 = load float, float* %3
%25 = fpext float %24 to double
%26 = fsub double %25, 1.000000e+00
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = fadd double %28, 1.000000e+00
%30 = fdiv double %26, %29
%31 = fptrunc double %30 to float
%32 = call float @xatan(float %31)
%33 = fpext float %32 to double
%34 = fadd double 0x3FE921FB54442D15, %33
%35 = fptrunc double %34 to float
store float %35, float* %2
br label %36
36: ; preds = %23, %14, %7
%37 = load float, float* %2
ret float %37
}

LLVM IR (-O2):
define float @satan(float %0) {
%2 = fpext float %0 to double
%3 = fcmp olt double %2, 0x3FDA827999FCEF31
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call float @xatan(float %0)
br label %23
6: ; preds = %1
%7 = fcmp ogt double %2, 0x4003504F333F9DDB
br i1 %7, label %8, label %14
8: ; preds = %6
%9 = fdiv float 1.000000e+00, %0
%10 = tail call float @xatan(float %9)
%11 = fpext float %10 to double
%12 = fsub double 0x3FF921FB54442CFA, %11
%13 = fptrunc double %12 to float
br label %23
14: ; preds = %6
%15 = fadd double %2, -1.000000e+00
%16 = fadd double %2, 1.000000e+00
%17 = fdiv double %15, %16
%18 = fptrunc double %17 to float
%19 = tail call float @xatan(float %18)
%20 = fpext float %19 to double
%21 = fadd double %20, 0x3FE921FB54442D15
%22 = fptrunc double %21 to float
br label %23
23: ; preds = %14, %8, %4
%24 = phi float [ %5, %4 ], [ %13, %8 ], [ %22, %14 ]
ret float %24
}