double satan(double arg) {
  double xatan(double);
  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
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1144 <satan+0x34>
movsd  -0x10(%rbp),%xmm0
call   1030 <xatan@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11c1 <satan+0xb1>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1186 <satan+0x76>
movsd  0xeb5(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <xatan@plt>
movaps %xmm0,%xmm1
movsd  0xea8(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c1 <satan+0xb1>
movsd  -0x10(%rbp),%xmm0
movsd  0xe85(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe79(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <xatan@plt>
movaps %xmm0,%xmm1
movsd  0xe58(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<satan>:
push   %rax
movsd  0xee7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1125 <satan+0x15>
pop    %rax
jmp    1030 <xatan@plt>
ucomisd 0xedb(%rip),%xmm0
jbe    1156 <satan+0x46>
movsd  0xee1(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <xatan@plt>
movapd %xmm0,%xmm1
movsd  0xed8(%rip),%xmm0
subsd  %xmm1,%xmm0
pop    %rax
ret
movsd  0xeb2(%rip),%xmm1
addsd  %xmm0,%xmm1
addsd  0xeae(%rip),%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <xatan@plt>
addsd  0xea1(%rip),%xmm0
pop    %rax
ret

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

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