// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/hyperspherical.c
// Function: hyperspherical_get_xmin_from_approx
int hyperspherical_get_xmin_from_approx(int K,
                                        int l,
                                        double nu,
                                        double ignore1,
                                        double phiminabs,
                                        double *xmin,
                                        int *ignore2){

  double l_plus_half;
  double lhs;
  double alpha;
  double ldbl = l;
  double x;

  l_plus_half = l+0.5;
  lhs = 1.0/l_plus_half*log(2*phiminabs*l_plus_half);
  //Using Chebyshev cubic root, much cleaner:
  alpha = -2.0*lhs/5.0*(1.0+2.0*cosh(1.0/3.0*acosh(1.0+375.0/(16.0*lhs*lhs))));
  x = l_plus_half/cosh(alpha)/nu;
  if (K==-1){
    //%Correct for open case:
    x *= asinh(ldbl/nu)/(ldbl/nu);
    //...and fudge for small nu:
    x *=((nu+0.4567)/(nu+1.24)-2.209e-3);
  }
  else if(K==1){
    //Correct for closed case if possible
    x *= asin(ldbl/nu)/(ldbl/nu);
  }
  *xmin = x;
  return _SUCCESS_;
}

// Assembly:
subq $0x78, %rsp
movl %edi, 0x74(%rsp)
movl %esi, 0x70(%rsp)
movsd %xmm0, 0x68(%rsp)
movsd %xmm1, 0x60(%rsp)
movsd %xmm2, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
cvtsi2sdl 0x70(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
cvtsi2sdl 0x70(%rsp), %xmm0
movsd 0x192c86(%rip), %xmm1   # 0x1d2c88
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x192234(%rip), %xmm0   # 0x1d2248
divsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x192c58(%rip), %xmm0   # 0x1d2c80
mulsd 0x58(%rsp), %xmm0
mulsd 0x40(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x19372c(%rip), %xmm0   # 0x1d3780
mulsd 0x38(%rsp), %xmm0
movsd 0x19220e(%rip), %xmm1   # 0x1d2270
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x192764(%rip), %xmm0   # 0x1d27d8
mulsd 0x38(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
movsd 0x195418(%rip), %xmm1   # 0x1d54a0
divsd %xmm0, %xmm1
movsd 0x1921b4(%rip), %xmm0   # 0x1d2248
addsd %xmm1, %xmm0
callq 0x8620
movaps %xmm0, %xmm1
movsd 0x1953f0(%rip), %xmm0   # 0x1d5498
mulsd %xmm1, %xmm0
callq 0x84a0
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm1
movsd 0x192182(%rip), %xmm2   # 0x1d2248
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x30(%rsp), %xmm0
callq 0x84a0
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
divsd %xmm1, %xmm0
divsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
cmpl $-0x1, 0x74(%rsp)
jne 0x40172
movsd 0x28(%rsp), %xmm0
divsd 0x68(%rsp), %xmm0
callq 0x8480
movsd 0x28(%rsp), %xmm1
divsd 0x68(%rsp), %xmm1
divsd %xmm1, %xmm0
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x195378(%rip), %xmm0   # 0x1d54b8
addsd 0x68(%rsp), %xmm0
movsd 0x195362(%rip), %xmm1   # 0x1d54b0
addsd 0x68(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd 0x195348(%rip), %xmm1   # 0x1d54a8
subsd %xmm1, %xmm0
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
jmp 0x401a8
cmpl $0x1, 0x74(%rsp)
jne 0x401a6
movsd 0x28(%rsp), %xmm0
divsd 0x68(%rsp), %xmm0
callq 0x8590
movsd 0x28(%rsp), %xmm1
divsd 0x68(%rsp), %xmm1
divsd %xmm1, %xmm0
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
jmp 0x401a8
movsd 0x20(%rsp), %xmm0
movq 0x50(%rsp), %rax
movsd %xmm0, (%rax)
xorl %eax, %eax
addq $0x78, %rsp
retq
nop