// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../tools/hyperspherical.c
// Function: hyperspherical_WKB_vec
int hyperspherical_WKB_vec(int l,
                            double beta,
                            double * __restrict__ sinK_vec,
                            int size_sinK_vec,
                            double * __restrict__ Phi){
  double e, w, w2, alpha, alpha2, t;
  double S, Q, C, argu, Ai;
  int airy_sign = 1, phisign = 1;
  int index_sinK;
  double one_over_alpha;
  double one_over_alpha2;
  double one_over_sqrt_one_plus_alpha2;
  double sqrt_alpha;
  double one_over_e;
  double one_over_beta;
  double cscK;
  double pow_argu_onesixth;

  one_over_e = sqrt(l*(l+1.0));
  e = 1.0/one_over_e;
  alpha = beta*e;
  alpha2 = alpha*alpha;
  one_over_alpha = 1.0/alpha;
  one_over_alpha2 = one_over_alpha*one_over_alpha;
  one_over_sqrt_one_plus_alpha2 = 1.0/sqrt(1.0+alpha2);
  sqrt_alpha=sqrt(alpha);
  one_over_beta = 1.0/beta;

  for (index_sinK=0; index_sinK<size_sinK_vec; index_sinK++){
    cscK=1.0/sinK_vec[index_sinK];
    w = alpha*sinK_vec[index_sinK];
    w2 = w*w;
    if (alpha > cscK){
      S = alpha*log((sqrt(w2-1.0)+sqrt(w2+alpha2))*one_over_sqrt_one_plus_alpha2)+
        atan(one_over_alpha*sqrt((w2+alpha2)/(w2-1.0)))-M_PI_2;
      airy_sign = -1;
    }
    else{
      t = sqrt(1.0-w2)/sqrt(1.0+w2*one_over_alpha2);
      S = atanh(t)-alpha*atan(t*one_over_alpha);
      airy_sign = 1;
    }
    argu = 1.5*S*one_over_e;
    Q = cscK*cscK-alpha2;
    C = 0.5*sqrt_alpha*one_over_beta;
    pow_argu_onesixth = pow(argu,1.0/6.0);
    Ai = airy_cheb_approx(airy_sign*pow(pow_argu_onesixth,4));
    Phi[index_sinK] = phisign*2.0*_SQRT_PI_*C*pow_argu_onesixth*pow(fabs(Q),-0.25)*Ai*cscK;
  }
  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movsd %xmm0, (%rsp)
cvtsi2sd %edi, %xmm1
movsd 0xcc0cd(%rip), %xmm0    # 0xf1260
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jb 0x251ae
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x251bb
callq 0x82b0
xorpd %xmm4, %xmm4
movapd %xmm0, %xmm1
movsd 0xcc09d(%rip), %xmm2    # 0xf1260
movapd %xmm2, %xmm3
divsd %xmm1, %xmm3
mulsd (%rsp), %xmm3
movapd %xmm3, %xmm0
mulsd %xmm3, %xmm0
movapd %xmm0, 0x60(%rsp)
addsd %xmm2, %xmm0
ucomisd %xmm4, %xmm0
movapd %xmm3, 0x20(%rsp)
movsd %xmm1, 0x58(%rsp)
jb 0x251fd
xorps %xmm4, %xmm4
sqrtsd %xmm0, %xmm4
jmp 0x2520c
callq 0x82b0
movapd 0x20(%rsp), %xmm3
movapd %xmm0, %xmm4
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
jb 0x2521f
xorps %xmm0, %xmm0
sqrtsd %xmm3, %xmm0
jmp 0x2523a
movapd %xmm3, %xmm0
movsd %xmm4, 0x10(%rsp)
callq 0x82b0
movsd 0x10(%rsp), %xmm4
movapd 0x20(%rsp), %xmm3
movsd 0xcc01e(%rip), %xmm1    # 0xf1260
testl %ebp, %ebp
jle 0x2551e
movapd %xmm1, %xmm2
divsd %xmm3, %xmm2
movsd %xmm2, 0x18(%rsp)
mulsd %xmm2, %xmm2
movsd %xmm2, 0x48(%rsp)
movapd %xmm1, %xmm2
divsd %xmm4, %xmm2
movsd %xmm2, 0x40(%rsp)
movapd %xmm1, %xmm2
divsd (%rsp), %xmm2
movapd 0xcbfaf(%rip), %xmm4    # 0xf1230
movapd %xmm3, %xmm5
xorpd %xmm4, %xmm5
movapd %xmm5, 0x70(%rsp)
xorpd 0x60(%rsp), %xmm4
movapd %xmm4, 0x80(%rsp)
mulsd 0xcca2a(%rip), %xmm0    # 0xf1cd0
mulsd %xmm2, %xmm0
mulsd 0xcf206(%rip), %xmm0    # 0xf44b8
movsd %xmm0, 0x50(%rsp)
movl %ebp, %r15d
xorl %r12d, %r12d
movsd (%r14,%r12,8), %xmm2
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
mulsd %xmm3, %xmm2
mulsd %xmm2, %xmm2
movsd %xmm0, 0x10(%rsp)
ucomisd %xmm0, %xmm3
jbe 0x25305
movapd %xmm2, %xmm0
addsd 0xcc4fc(%rip), %xmm0    # 0xf17e8
ucomisd 0xcbf64(%rip), %xmm0    # 0xf1258
movsd %xmm0, 0x30(%rsp)
jb 0x25327
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x2533a
movapd %xmm1, %xmm0
subsd %xmm2, %xmm0
ucomisd 0xcbf43(%rip), %xmm0    # 0xf1258
jb 0x253d6
xorps %xmm3, %xmm3
sqrtsd %xmm0, %xmm3
jmp 0x253f1
movsd %xmm2, (%rsp)
callq 0x82b0
movsd (%rsp), %xmm2
movapd %xmm0, %xmm1
addsd 0x60(%rsp), %xmm2
ucomisd 0xcbf10(%rip), %xmm2    # 0xf1258
movsd %xmm2, (%rsp)
jb 0x25358
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0x2536d
movapd %xmm2, %xmm0
movsd %xmm1, 0x8(%rsp)
callq 0x82b0
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
mulsd 0x40(%rsp), %xmm1
movapd %xmm1, %xmm0
callq 0x82c0
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
divsd 0x30(%rsp), %xmm0
ucomisd 0xcbebf(%rip), %xmm0    # 0xf1258
jb 0x253a1
sqrtsd %xmm0, %xmm0
jmp 0x253a6
callq 0x82b0
mulsd 0x18(%rsp), %xmm0
callq 0x82e0
movsd 0x8(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
addsd %xmm0, %xmm1
addsd 0xcf0f7(%rip), %xmm1    # 0xf44c0
movsd 0xcc417(%rip), %xmm0    # 0xf17e8
jmp 0x25461
movsd %xmm2, (%rsp)
callq 0x82b0
movsd (%rsp), %xmm2
movsd 0xcbe73(%rip), %xmm1    # 0xf1260
movapd %xmm0, %xmm3
mulsd 0x48(%rsp), %xmm2
addsd %xmm1, %xmm2
ucomisd 0xcbe55(%rip), %xmm2    # 0xf1258
jb 0x2540e
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0x25421
movapd %xmm2, %xmm0
movsd %xmm3, (%rsp)
callq 0x82b0
movsd (%rsp), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, (%rsp)
movapd %xmm3, %xmm0
callq 0x8640
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
callq 0x82e0
movapd %xmm0, %xmm1
mulsd 0x70(%rsp), %xmm1
addsd 0x8(%rsp), %xmm1
movsd 0xcbdff(%rip), %xmm0    # 0xf1260
movsd %xmm0, 0x8(%rsp)
mulsd 0xceb49(%rip), %xmm1    # 0xf3fb8
mulsd 0x58(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd 0x80(%rsp), %xmm0
andpd 0xcbdb0(%rip), %xmm0    # 0xf1240
movapd %xmm0, 0x30(%rsp)
movapd %xmm1, %xmm0
movsd 0xcf026(%rip), %xmm1    # 0xf44c8
callq 0x8620
movsd %xmm0, (%rsp)
movsd 0xcef74(%rip), %xmm1    # 0xf4428
callq 0x8620
mulsd 0x8(%rsp), %xmm0
callq 0x25530
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
mulsd 0x50(%rsp), %xmm0
movsd %xmm0, (%rsp)
movapd 0x30(%rsp), %xmm0
movsd 0xcbda0(%rip), %xmm1    # 0xf1288
callq 0x8620
mulsd (%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rbx,%r12,8)
incq %r12
cmpq %r12, %r15
movsd 0xcbd4e(%rip), %xmm1    # 0xf1260
movapd 0x20(%rsp), %xmm3
jne 0x252be
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq