#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 */
int dpow(double, int);
double arctanh(double n) {
  if (n < -1 || n > 1) {
    return 0. / 0.;
  }
  double sum = 0;
  int i;
  for (i = 1; i < 100; i++) {
    sum += dpow(n, 2 * i - 1) / (2 * i - 1);
  }
  return sum;
}


x86 assembly (clang, -O0):
<arctanh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     1147 <arctanh+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  0xecb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1159 <arctanh+0x49>
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b7 <arctanh+0xa7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    11ad <arctanh+0x9d>
movsd  -0x10(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
shl    $0x1,%edi
sub    $0x1,%edi
call   1030 <dpow@plt>
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1168 <arctanh+0x58>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arctanh>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,%xmm1
movsd  0xedf(%rip),%xmm0
ucomisd %xmm1,%xmm0
movsd  0xedb(%rip),%xmm0
ja     118e <arctanh+0x7e>
ucomisd 0xed9(%rip),%xmm1
ja     118e <arctanh+0x7e>
xorps  %xmm0,%xmm0
mov    $0x1,%ebx
movsd  %xmm1,0x8(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
mov    %ebx,%edi
call   1030 <dpow@plt>
cltd
idiv   %ebx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm0
add    $0x2,%ebx
cmp    $0xc7,%ebx
jne    1150 <arctanh+0x40>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @arctanh(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %3
%6 = load double, double* %3
%7 = fcmp olt double %6, -1.000000e+00
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load double, double* %3
%10 = fcmp ogt double %9, 1.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8, %1
store double 0x7FF8000000000000, double* %2
br label %34
12: ; preds = %8
store double 0.000000e+00, double* %4
store i32 1, i32* %5
br label %13
13: ; preds = %29, %12
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 100
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = load double, double* %3
%18 = load i32, i32* %5
%19 = mul nsw i32 2, %18
%20 = sub nsw i32 %19, 1
%21 = call i32 @dpow(double %17, i32 %20)
%22 = load i32, i32* %5
%23 = mul nsw i32 2, %22
%24 = sub nsw i32 %23, 1
%25 = sdiv i32 %21, %24
%26 = sitofp i32 %25 to double
%27 = load double, double* %4
%28 = fadd double %27, %26
store double %28, double* %4
br label %29
29: ; preds = %16
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %13
32: ; preds = %13
%33 = load double, double* %4
store double %33, double* %2
br label %34
34: ; preds = %32, %11
%35 = load double, double* %2
ret double %35
}

LLVM IR (-O2):
define double @arctanh(double %0) {
%2 = fcmp olt double %0, -1.000000e+00
%3 = fcmp ogt double %0, 1.000000e+00
%4 = or i1 %2, %3
br i1 %4, label %16, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %14, %5 ], [ 1, %1 ]
%7 = phi double [ %13, %5 ], [ 0.000000e+00, %1 ]
%8 = shl nuw nsw i32 %6, 1
%9 = add nsw i32 %8, -1
%10 = tail call i32 @dpow(double %0, i32 %9)
%11 = sdiv i32 %10, %9
%12 = sitofp i32 %11 to double
%13 = fadd double %7, %12
%14 = add nuw nsw i32 %6, 1
%15 = icmp eq i32 %14, 100
br i1 %15, label %16, label %5
16: ; preds = %5, %1
%17 = phi double [ 0x7FF8000000000000, %1 ], [ %13, %5 ]
ret double %17
}