// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/hyperspherical.c
// Function: get_CF1
int get_CF1(int K,int l,double beta, double cotK, double *CF, int *isign){
  int maxiter = 1000000;
  double tiny = 1e-100;
  double reltol = DBL_EPSILON;
  double aj,bj,fj,Cj,Dj,Delj;
  double beta2 = beta*beta;
  double sqrttmp;
  int j;

  if (K==1) maxiter = (int)(beta-l-10);
  bj = l*cotK; //This is b_0
  fj = bj;
  Cj = bj;
  Dj = 0.0;
  *isign = 1;
  for(j=1; j<=maxiter; j++){
    sqrttmp = sqrt(beta2-K*(l+j+1)*(l+j+1));
    aj = -sqrt(beta2-K*(l+j)*(l+j))/sqrttmp;
    if (j==1)
      aj = sqrt(beta2-K*(l+1)*(l+1))*aj;
    bj = (2*(l+j)+1)/sqrttmp*cotK;
    Dj = bj+aj*Dj;
    if (Dj==0.0)
      Dj = tiny;
    Cj = bj+aj/Cj;
    if (Cj==0.0)
      Cj = tiny;
    Dj = 1.0/Dj;
    Delj = Cj*Dj;
    fj = fj*Delj;
    if (Dj<0)
      *isign *= -1;
    if (fabs(Delj-1.0)<reltol){
      *CF = fj;
      //printf("iter:%d, %g, %g\n",j,sqrttmp,fj);
      return _SUCCESS_;
    }
  }
  return _FAILURE_;
}

// Assembly:
subq $0x98, %rsp
movl %edi, 0x90(%rsp)
movl %esi, 0x8c(%rsp)
movsd %xmm0, 0x80(%rsp)
movsd %xmm1, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
movl $0xf4240, 0x64(%rsp)    # imm = 0xF4240
movsd 0x192c3a(%rip), %xmm0   # 0x1d4fc8
movsd %xmm0, 0x58(%rsp)
movsd 0x19316c(%rip), %xmm0   # 0x1d5508
movsd %xmm0, 0x50(%rsp)
movsd 0x80(%rsp), %xmm0
mulsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
cmpl $0x1, 0x90(%rsp)
jne 0x423ee
movsd 0x80(%rsp), %xmm0
cvtsi2sdl 0x8c(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd 0x1903fe(%rip), %xmm1   # 0x1d27e0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x64(%rsp)
cvtsi2sdl 0x8c(%rsp), %xmm0
mulsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x68(%rsp), %rax
movl $0x1, (%rax)
movl $0x1, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x64(%rsp), %eax
jg 0x42667
movsd 0x18(%rsp), %xmm0
movl 0x90(%rsp), %eax
movl 0x8c(%rsp), %ecx
addl 0xc(%rsp), %ecx
addl $0x1, %ecx
imull %ecx, %eax
movl 0x8c(%rsp), %ecx
addl 0xc(%rsp), %ecx
addl $0x1, %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
callq 0x82e0
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
movl 0x90(%rsp), %eax
movl 0x8c(%rsp), %ecx
addl 0xc(%rsp), %ecx
imull %ecx, %eax
movl 0x8c(%rsp), %ecx
addl 0xc(%rsp), %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
callq 0x82e0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
divsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
cmpl $0x1, 0xc(%rsp)
jne 0x42527
movsd 0x18(%rsp), %xmm0
movl 0x90(%rsp), %eax
movl 0x8c(%rsp), %ecx
addl $0x1, %ecx
imull %ecx, %eax
movl 0x8c(%rsp), %ecx
addl $0x1, %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
callq 0x82e0
mulsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movl 0x8c(%rsp), %eax
addl 0xc(%rsp), %eax
shll %eax
addl $0x1, %eax
cvtsi2sd %eax, %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm1
movsd 0x48(%rsp), %xmm0
movsd 0x28(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x28(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4258a
jp 0x4258a
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
divsd 0x30(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x425c3
jp 0x425c3
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x18fc7d(%rip), %xmm0   # 0x1d2248
divsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x30(%rsp), %xmm0
mulsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x38(%rsp), %xmm0
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x28(%rsp), %xmm0
jbe 0x42610
movq 0x68(%rsp), %rax
imull $-0x1, (%rax), %ecx
movl %ecx, (%rax)
movsd 0x20(%rsp), %xmm1
movsd 0x18fc2a(%rip), %xmm0   # 0x1d2248
subsd %xmm0, %xmm1
movaps 0x18fc07(%rip), %xmm0   # 0x1d2230
pand %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x42655
movsd 0x38(%rsp), %xmm0
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0x94(%rsp)
jmp 0x42672
jmp 0x42657
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x42437
movl $0x1, 0x94(%rsp)
movl 0x94(%rsp), %eax
addq $0x98, %rsp
retq
nopw %cs:(%rax,%rax)