// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, %rbx
movl %edx, %r14d
movq %rsi, %r15
movapd %xmm0, %xmm4
cvtsi2sd %edi, %xmm1
movsd 0xc2730(%rip), %xmm0    # 0xe5260
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
xorpd %xmm5, %xmm5
ucomisd %xmm5, %xmm0
movsd %xmm4, (%rsp)
jb 0x22b4d
sqrtsd %xmm0, %xmm0
jmp 0x22b5b
callq 0x82d0
xorpd %xmm5, %xmm5
movsd (%rsp), %xmm4
movsd 0xc26fd(%rip), %xmm1    # 0xe5260
movapd %xmm1, %xmm2
movsd %xmm0, 0x58(%rsp)
divsd %xmm0, %xmm2
mulsd %xmm4, %xmm2
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
movapd %xmm1, %xmm3
divsd %xmm2, %xmm3
movsd %xmm3, 0x18(%rsp)
movapd %xmm0, 0x60(%rsp)
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm6
ucomisd %xmm5, %xmm2
movapd %xmm2, 0x20(%rsp)
jb 0x22bab
sqrtsd %xmm2, %xmm0
jmp 0x22bd3
movapd %xmm2, %xmm0
movsd %xmm6, 0x10(%rsp)
callq 0x82d0
movsd 0x10(%rsp), %xmm6
movsd (%rsp), %xmm4
movapd 0x20(%rsp), %xmm2
movsd 0xc268d(%rip), %xmm1    # 0xe5260
movsd 0x18(%rsp), %xmm3
mulsd %xmm3, %xmm3
movsd %xmm3, 0x48(%rsp)
movapd %xmm1, %xmm3
divsd %xmm6, %xmm3
movsd %xmm3, 0x40(%rsp)
movapd %xmm1, %xmm3
divsd %xmm4, %xmm3
movapd 0xc262f(%rip), %xmm4    # 0xe5230
movapd %xmm2, %xmm5
xorpd %xmm4, %xmm5
movapd %xmm5, 0x70(%rsp)
mulsd 0xc3099(%rip), %xmm0    # 0xe5cb0
xorpd 0x60(%rsp), %xmm4
movapd %xmm4, 0x80(%rsp)
mulsd %xmm3, %xmm0
mulsd 0xc5856(%rip), %xmm0    # 0xe8488
movsd %xmm0, 0x50(%rsp)
xorl %r12d, %r12d
testl %r14d, %r14d
cmovlel %r12d, %r14d
cmpq %r12, %r14
je 0x22e6e
movsd (%r15,%r12,8), %xmm3
movapd %xmm1, %xmm0
divsd %xmm3, %xmm0
mulsd %xmm2, %xmm3
mulsd %xmm3, %xmm3
movsd %xmm0, 0x10(%rsp)
ucomisd %xmm0, %xmm2
jbe 0x22c8f
movapd %xmm3, %xmm0
addsd 0xc2b6f(%rip), %xmm0    # 0xe57e8
ucomisd 0xc25d7(%rip), %xmm0    # 0xe5258
movsd %xmm0, 0x30(%rsp)
jb 0x22ca7
sqrtsd %xmm0, %xmm0
jmp 0x22cb6
movapd %xmm1, %xmm0
subsd %xmm3, %xmm0
ucomisd 0xc25b9(%rip), %xmm0    # 0xe5258
jb 0x22cf9
sqrtsd %xmm0, %xmm0
jmp 0x22d10
movsd %xmm3, (%rsp)
callq 0x82d0
movsd (%rsp), %xmm3
addsd 0x60(%rsp), %xmm3
movsd %xmm3, (%rsp)
sqrtsd %xmm3, %xmm1
addsd %xmm0, %xmm1
mulsd 0x40(%rsp), %xmm1
movapd %xmm1, %xmm0
callq 0x82e0
movsd (%rsp), %xmm1
movsd %xmm0, 0x8(%rsp)
divsd 0x30(%rsp), %xmm1
ucomisd 0xc2567(%rip), %xmm1    # 0xe5258
jb 0x22d30
sqrtsd %xmm1, %xmm0
jmp 0x22d39
movsd %xmm3, (%rsp)
callq 0x82d0
movsd (%rsp), %xmm3
movsd 0xc2550(%rip), %xmm1    # 0xe5260
movsd %xmm0, 0x8(%rsp)
mulsd 0x48(%rsp), %xmm3
addsd %xmm1, %xmm3
ucomisd 0xc2530(%rip), %xmm3    # 0xe5258
jb 0x22d66
sqrtsd %xmm3, %xmm0
jmp 0x22d6f
movapd %xmm1, %xmm0
callq 0x82d0
mulsd 0x18(%rsp), %xmm0
callq 0x8300
movsd 0x8(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
addsd %xmm0, %xmm1
addsd 0xc5734(%rip), %xmm1    # 0xe8490
movsd 0xc2a84(%rip), %xmm0    # 0xe57e8
jmp 0x22db5
movapd %xmm3, %xmm0
callq 0x82d0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movapd %xmm1, %xmm0
callq 0x8670
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
callq 0x8300
movapd %xmm0, %xmm1
mulsd 0x70(%rsp), %xmm1
addsd (%rsp), %xmm1
movsd 0xc24ab(%rip), %xmm0    # 0xe5260
movsd %xmm0, 0x8(%rsp)
mulsd 0xc51c5(%rip), %xmm1    # 0xe7f88
mulsd 0x58(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd 0x80(%rsp), %xmm0
andpd 0xc245c(%rip), %xmm0    # 0xe5240
movapd %xmm0, 0x30(%rsp)
movapd %xmm1, %xmm0
movsd 0xc56a2(%rip), %xmm1    # 0xe8498
callq 0x8650
movsd %xmm0, (%rsp)
movsd 0xc55f0(%rip), %xmm1    # 0xe83f8
callq 0x8650
mulsd 0x8(%rsp), %xmm0
callq 0x22e7f
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
mulsd 0x50(%rsp), %xmm0
movsd %xmm0, (%rsp)
movapd 0x30(%rsp), %xmm0
movsd 0xc244c(%rip), %xmm1    # 0xe5288
callq 0x8650
mulsd (%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rbx,%r12,8)
incq %r12
movsd 0xc23fd(%rip), %xmm1    # 0xe5260
movapd 0x20(%rsp), %xmm2
jmp 0x22c42
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq