// File: /workspace/github_c_makefile_star2_O3/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
movapd %xmm0, %xmm6
cvtsi2sd %edi, %xmm1
movsd 0xc91bf(%rip), %xmm0    # 0xee260
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
movsd %xmm6, (%rsp)
jb 0x250be
sqrtsd %xmm0, %xmm0
jmp 0x250cc
callq 0x82b0
xorpd %xmm3, %xmm3
movsd (%rsp), %xmm6
movsd 0xc918c(%rip), %xmm1    # 0xee260
movapd %xmm1, %xmm2
divsd %xmm0, %xmm2
mulsd %xmm6, %xmm2
ucomisd %xmm3, %xmm2
movapd %xmm2, 0x20(%rsp)
movsd %xmm0, 0x58(%rsp)
jb 0x250fb
xorps %xmm0, %xmm0
sqrtsd %xmm2, %xmm0
jmp 0x25117
movapd %xmm2, %xmm0
callq 0x82b0
movsd (%rsp), %xmm6
movapd 0x20(%rsp), %xmm2
movsd 0xc9149(%rip), %xmm1    # 0xee260
testl %ebp, %ebp
jle 0x253e9
movapd %xmm2, %xmm4
mulsd %xmm2, %xmm4
movapd %xmm4, %xmm3
addsd %xmm1, %xmm3
movapd %xmm1, %xmm5
divsd %xmm2, %xmm5
sqrtsd %xmm3, %xmm3
movsd %xmm5, 0x10(%rsp)
mulsd %xmm5, %xmm5
movsd %xmm5, 0x48(%rsp)
movapd %xmm1, %xmm5
divsd %xmm3, %xmm5
movsd %xmm5, 0x40(%rsp)
movapd %xmm1, %xmm3
divsd %xmm6, %xmm3
movapd 0xc90c7(%rip), %xmm5    # 0xee230
movapd %xmm2, %xmm6
xorpd %xmm5, %xmm6
movapd %xmm6, 0x60(%rsp)
movapd %xmm4, 0x70(%rsp)
xorpd %xmm4, %xmm5
movapd %xmm5, 0x80(%rsp)
mulsd 0xc9b3e(%rip), %xmm0    # 0xeecd0
mulsd %xmm3, %xmm0
mulsd 0xcc32a(%rip), %xmm0    # 0xf14c8
movsd %xmm0, 0x50(%rsp)
movl %ebp, %r15d
xorl %r12d, %r12d
movsd (%r14,%r12,8), %xmm3
movapd %xmm1, %xmm0
divsd %xmm3, %xmm0
mulsd %xmm2, %xmm3
mulsd %xmm3, %xmm3
movsd %xmm0, 0x18(%rsp)
ucomisd %xmm0, %xmm2
jbe 0x251ee
movapd %xmm3, %xmm0
addsd 0xc9610(%rip), %xmm0    # 0xee7e8
ucomisd 0xc9078(%rip), %xmm0    # 0xee258
movsd %xmm0, 0x30(%rsp)
jb 0x25210
sqrtsd %xmm0, %xmm0
jmp 0x2521f
movapd %xmm1, %xmm0
subsd %xmm3, %xmm0
ucomisd 0xc905a(%rip), %xmm0    # 0xee258
jb 0x252a1
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0x252bc
movsd %xmm3, (%rsp)
callq 0x82b0
movsd (%rsp), %xmm3
addsd 0x70(%rsp), %xmm3
movsd %xmm3, (%rsp)
xorps %xmm1, %xmm1
sqrtsd %xmm3, %xmm1
addsd %xmm0, %xmm1
mulsd 0x40(%rsp), %xmm1
movapd %xmm1, %xmm0
callq 0x82c0
movsd (%rsp), %xmm1
movsd %xmm0, 0x8(%rsp)
divsd 0x30(%rsp), %xmm1
ucomisd 0xc8ffb(%rip), %xmm1    # 0xee258
jb 0x25268
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0x25271
movapd %xmm1, %xmm0
callq 0x82b0
mulsd 0x10(%rsp), %xmm0
callq 0x82e0
movsd 0x8(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
addsd %xmm0, %xmm1
addsd 0xcc23c(%rip), %xmm1    # 0xf14d0
movsd 0xc954c(%rip), %xmm0    # 0xee7e8
jmp 0x2532c
movsd %xmm3, (%rsp)
callq 0x82b0
movsd (%rsp), %xmm3
movsd 0xc8fa8(%rip), %xmm1    # 0xee260
movapd %xmm0, %xmm2
mulsd 0x48(%rsp), %xmm3
addsd %xmm1, %xmm3
ucomisd 0xc8f8a(%rip), %xmm3    # 0xee258
jb 0x252d9
xorps %xmm0, %xmm0
sqrtsd %xmm3, %xmm0
jmp 0x252ec
movapd %xmm3, %xmm0
movsd %xmm2, (%rsp)
callq 0x82b0
movsd (%rsp), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, (%rsp)
movapd %xmm2, %xmm0
callq 0x8640
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
callq 0x82e0
movapd %xmm0, %xmm1
mulsd 0x60(%rsp), %xmm1
addsd 0x8(%rsp), %xmm1
movsd 0xc8f34(%rip), %xmm0    # 0xee260
movsd %xmm0, 0x8(%rsp)
mulsd 0xcbc8e(%rip), %xmm1    # 0xf0fc8
mulsd 0x58(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd 0x80(%rsp), %xmm0
andpd 0xc8ee5(%rip), %xmm0    # 0xee240
movapd %xmm0, 0x30(%rsp)
movapd %xmm1, %xmm0
movsd 0xcc16b(%rip), %xmm1    # 0xf14d8
callq 0x8620
movsd %xmm0, (%rsp)
movsd 0xcc0b9(%rip), %xmm1    # 0xf1438
callq 0x8620
mulsd 0x8(%rsp), %xmm0
callq 0x253fb
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
mulsd 0x50(%rsp), %xmm0
movsd %xmm0, (%rsp)
movapd 0x30(%rsp), %xmm0
movsd 0xc8ed5(%rip), %xmm1    # 0xee288
callq 0x8620
mulsd (%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rbx,%r12,8)
incq %r12
cmpq %r12, %r15
movsd 0xc8e83(%rip), %xmm1    # 0xee260
movapd 0x20(%rsp), %xmm2
jne 0x251aa
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq