// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_update_HIS
int transfer_update_HIS(
                        struct precision * ppr,
                        struct transfer * ptr,
                        struct transfer_workspace * ptw,
                        int index_q,
                        double tau0
                        ) {

  double nu,new_nu;
  int int_nu;
  double xmin, xmax, sampling, phiminabs, xtol;
  double sqrt_absK;
  int l_size_max;
  int index_l_left,index_l_right;

  if (ptw->HIS_allocated == _TRUE_) {
    class_call(hyperspherical_HIS_free(&(ptw->HIS),ptr->error_message),
               ptr->error_message,
               ptr->error_message);
    ptw->HIS_allocated = _FALSE_;
  }

  if ((ptw->sgnK!=0) && (index_q < ptr->index_q_flat_approximation)) {

    xmin = ppr->hyper_x_min;

    sqrt_absK = sqrt(ptw->sgnK*ptw->K);

    xmax = sqrt_absK*tau0;
    nu = ptr->q[index_q]/sqrt_absK;

    if (ptw->sgnK == 1) {
      xmax = MIN(xmax,_PI_/2.0-ppr->hyper_x_min); //We only need solution on [0;pi/2]

      int_nu = (int)(nu+0.2);
      new_nu = (double)int_nu;
      class_test(nu-new_nu > 1.e-6,
                 ptr->error_message,
                 "problem in q list definition in closed case for index_q=%d, nu=%e, nu-int(nu)=%e",index_q,nu,nu-new_nu);
      nu = new_nu;

    }

    if (nu > ppr->hyper_nu_sampling_step)
      sampling = ppr->hyper_sampling_curved_high_nu;
    else
      sampling = ppr->hyper_sampling_curved_low_nu;

    /* find the highest value of l such that x_nonzero < xmax = sqrt(|K|) tau0. That will be l_max. */
    l_size_max = ptr->l_size_max;
    if (ptw->sgnK == 1)
      while ((double)ptr->l[l_size_max-1] >= nu)
        l_size_max--;

    if (ptw->sgnK == -1){
      xtol = ppr->hyper_x_tol;
      phiminabs = ppr->hyper_phi_min_abs;

      /* First try to find lmax using fast approximation: */
      index_l_left=0;
      index_l_right=l_size_max-1;
      class_call(transfer_get_lmax(hyperspherical_get_xmin_from_approx,
                                   ptw->sgnK,
                                   nu,
                                   ptr->l,
                                   l_size_max,
                                   phiminabs,
                                   xmax,
                                   xtol,
                                   &index_l_left,
                                   &index_l_right,
                                   ptr->error_message),
                 ptr->error_message,
                 ptr->error_message);

      /* Now use WKB approximation to eventually modify borders: */
      class_call(transfer_get_lmax(hyperspherical_get_xmin_from_Airy,
                                   ptw->sgnK,
                                   nu,
                                   ptr->l,
                                   l_size_max,
                                   phiminabs,
                                   xmax,
                                   xtol,
                                   &index_l_left,
                                   &index_l_right,
                                   ptr->error_message),
                 ptr->error_message,
                 ptr->error_message);
      l_size_max = index_l_right+1;
    }

    class_test(nu <= 0.,
               ptr->error_message,
               "nu=%e when index_q=%d, q=%e, K=%e, sqrt(|K|)=%e; instead nu should always be strictly positive",
               nu,index_q,ptr->q[index_q],ptw->K,sqrt_absK);

    class_call(hyperspherical_HIS_create(ptw->sgnK,
                                         nu,
                                         l_size_max,
                                         ptr->l,
                                         xmin,
                                         xmax,
                                         sampling,
                                         ptr->l[l_size_max-1]+1,
                                         ppr->hyper_phi_min_abs,
                                         &(ptw->HIS),
                                         ptr->error_message),
               ptr->error_message,
               ptr->error_message);

    ptw->HIS_allocated = _TRUE_;

  }

  return _SUCCESS_;
}

// Assembly:
subq $0x4098, %rsp           # imm = 0x4098
movq %rdi, 0x4088(%rsp)
movq %rsi, 0x4080(%rsp)
movq %rdx, 0x4078(%rsp)
movl %ecx, 0x4074(%rsp)
movsd %xmm0, 0x4068(%rsp)
movq 0x4078(%rsp), %rax
cmpl $0x1, 0x60(%rax)
jne 0x147e8e
movq 0x4078(%rsp), %rdi
movq 0x4080(%rsp), %rsi
addq $0x96a, %rsi            # imm = 0x96A
callq 0x402f0
cmpl $0x1, %eax
jne 0x147e7f
leaq 0x3810(%rsp), %rdi
movq 0x4080(%rsp), %rcx
addq $0x96a, %rcx            # imm = 0x96A
leaq 0x8a5a8(%rip), %rsi     # 0x1d23d8
leaq 0xbd0e0(%rip), %rdx     # 0x204f17
movb $0x0, %al
callq 0x5b9c0
movq 0x4080(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x3810(%rsp), %r8
leaq 0x8a1d8(%rip), %rsi     # 0x1d2034
leaq 0xbd104(%rip), %rdx     # 0x204f67
movl $0x11e0, %ecx           # imm = 0x11E0
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4094(%rsp)
jmp 0x1485b2
movq 0x4078(%rsp), %rax
movl $0x0, 0x60(%rax)
movq 0x4078(%rsp), %rax
cmpl $0x0, 0xc0(%rax)
je 0x1485a7
movl 0x4074(%rsp), %eax
movq 0x4080(%rsp), %rcx
cmpl 0x938(%rcx), %eax
jge 0x1485a7
movq 0x4088(%rsp), %rax
movsd 0x718(%rax), %xmm0
movsd %xmm0, 0x4048(%rsp)
movq 0x4078(%rsp), %rax
cvtsi2sdl 0xc0(%rax), %xmm0
movq 0x4078(%rsp), %rax
mulsd 0xb8(%rax), %xmm0
callq 0x82e0
movsd %xmm0, 0x4020(%rsp)
movsd 0x4020(%rsp), %xmm0
mulsd 0x4068(%rsp), %xmm0
movsd %xmm0, 0x4040(%rsp)
movq 0x4080(%rsp), %rax
movq 0x928(%rax), %rax
movslq 0x4074(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd 0x4020(%rsp), %xmm0
movsd %xmm0, 0x4060(%rsp)
movq 0x4078(%rsp), %rax
cmpl $0x1, 0xc0(%rax)
jne 0x1480ca
movsd 0x4040(%rsp), %xmm1
movq 0x4088(%rsp), %rax
movsd 0x8d574(%rip), %xmm0    # 0x1d54f0
subsd 0x718(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x147f9b
movsd 0x4040(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
jmp 0x147fb9
movq 0x4088(%rsp), %rax
movsd 0x8d545(%rip), %xmm0    # 0x1d54f0
subsd 0x718(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x4040(%rsp)
movsd 0x8a2b0(%rip), %xmm0    # 0x1d2280
addsd 0x4060(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x4054(%rsp)
cvtsi2sdl 0x4054(%rsp), %xmm0
movsd %xmm0, 0x4058(%rsp)
movsd 0x4060(%rsp), %xmm0
subsd 0x4058(%rsp), %xmm0
movsd 0x8ac58(%rip), %xmm1    # 0x1d2c68
ucomisd %xmm1, %xmm0
jbe 0x1480b8
leaq 0x3010(%rsp), %rdi
movl 0x4074(%rsp), %edx
movsd 0x4060(%rsp), %xmm0
movsd 0x4060(%rsp), %xmm1
subsd 0x4058(%rsp), %xmm1
leaq 0xbcf30(%rip), %rsi     # 0x204f7b
movb $0x2, %al
callq 0x5b9c0
leaq 0x2810(%rsp), %rdi
leaq 0x3010(%rsp), %rcx
leaq 0x8a019(%rip), %rsi     # 0x1d2082
leaq 0xbcf5c(%rip), %rdx     # 0x204fcc
movb $0x0, %al
callq 0x5b9c0
movq 0x4080(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x2810(%rsp), %r8
leaq 0x89f9f(%rip), %rsi     # 0x1d2034
leaq 0xbcecb(%rip), %rdx     # 0x204f67
movl $0x11f4, %ecx           # imm = 0x11F4
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4094(%rsp)
jmp 0x1485b2
movsd 0x4058(%rsp), %xmm0
movsd %xmm0, 0x4060(%rsp)
movsd 0x4060(%rsp), %xmm0
movq 0x4088(%rsp), %rax
ucomisd 0x738(%rax), %xmm0
jbe 0x148100
movq 0x4088(%rsp), %rax
movsd 0x730(%rax), %xmm0
movsd %xmm0, 0x4038(%rsp)
jmp 0x148119
movq 0x4088(%rsp), %rax
movsd 0x728(%rax), %xmm0
movsd %xmm0, 0x4038(%rsp)
movq 0x4080(%rsp), %rax
movl 0x908(%rax), %eax
movl %eax, 0x401c(%rsp)
movq 0x4078(%rsp), %rax
cmpl $0x1, 0xc0(%rax)
jne 0x148182
jmp 0x148141
movq 0x4080(%rsp), %rax
movq 0x910(%rax), %rax
movl 0x401c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
ucomisd 0x4060(%rsp), %xmm0
jb 0x148180
movl 0x401c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x401c(%rsp)
jmp 0x148141
jmp 0x148182
movq 0x4078(%rsp), %rax
cmpl $-0x1, 0xc0(%rax)
jne 0x1483c6
movq 0x4088(%rsp), %rax
movsd 0x748(%rax), %xmm0
movsd %xmm0, 0x4028(%rsp)
movq 0x4088(%rsp), %rax
movsd 0x740(%rax), %xmm0
movsd %xmm0, 0x4030(%rsp)
movl $0x0, 0x4018(%rsp)
movl 0x401c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x4014(%rsp)
movq 0x4078(%rsp), %rax
movl 0xc0(%rax), %esi
movsd 0x4060(%rsp), %xmm0
movq 0x4080(%rsp), %rax
movq 0x910(%rax), %rdx
movl 0x401c(%rsp), %ecx
movsd 0x4030(%rsp), %xmm1
movsd 0x4040(%rsp), %xmm2
movsd 0x4028(%rsp), %xmm3
movq 0x4080(%rsp), %rax
addq $0x96a, %rax            # imm = 0x96A
leaq -0x108282(%rip), %rdi   # 0x3ffc0
leaq 0x4018(%rsp), %r8
leaq 0x4014(%rsp), %r9
movq %rax, (%rsp)
callq 0x1485d0
cmpl $0x1, %eax
jne 0x1482cd
leaq 0x2010(%rsp), %rdi
movq 0x4080(%rsp), %rcx
addq $0x96a, %rcx            # imm = 0x96A
leaq 0x8a15a(%rip), %rsi     # 0x1d23d8
leaq 0xbcd59(%rip), %rdx     # 0x204fde
movb $0x0, %al
callq 0x5b9c0
movq 0x4080(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x2010(%rsp), %r8
leaq 0x89d8a(%rip), %rsi     # 0x1d2034
leaq 0xbccb6(%rip), %rdx     # 0x204f67
movl $0x1217, %ecx           # imm = 0x1217
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4094(%rsp)
jmp 0x1485b2
movq 0x4078(%rsp), %rax
movl 0xc0(%rax), %esi
movsd 0x4060(%rsp), %xmm0
movq 0x4080(%rsp), %rax
movq 0x910(%rax), %rdx
movl 0x401c(%rsp), %ecx
movsd 0x4030(%rsp), %xmm1
movsd 0x4040(%rsp), %xmm2
movsd 0x4028(%rsp), %xmm3
movq 0x4080(%rsp), %rax
addq $0x96a, %rax            # imm = 0x96A
leaq -0x10386a(%rip), %rdi   # 0x44ac0
leaq 0x4018(%rsp), %r8
leaq 0x4014(%rsp), %r9
movq %rax, (%rsp)
callq 0x1485d0
cmpl $0x1, %eax
jne 0x1483b5
leaq 0x1810(%rsp), %rdi
movq 0x4080(%rsp), %rcx
addq $0x96a, %rcx            # imm = 0x96A
leaq 0x8a072(%rip), %rsi     # 0x1d23d8
leaq 0xbcd15(%rip), %rdx     # 0x205082
movb $0x0, %al
callq 0x5b9c0
movq 0x4080(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x1810(%rsp), %r8
leaq 0x89ca2(%rip), %rsi     # 0x1d2034
leaq 0xbcbce(%rip), %rdx     # 0x204f67
movl $0x1226, %ecx           # imm = 0x1226
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4094(%rsp)
jmp 0x1485b2
movl 0x4014(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x401c(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x4060(%rsp), %xmm0
jb 0x148499
leaq 0x1010(%rsp), %rdi
movsd 0x4060(%rsp), %xmm0
movl 0x4074(%rsp), %edx
movq 0x4080(%rsp), %rax
movq 0x928(%rax), %rax
movslq 0x4074(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x4078(%rsp), %rax
movsd 0xb8(%rax), %xmm2
movsd 0x4020(%rsp), %xmm3
leaq 0xbccf8(%rip), %rsi     # 0x205124
movb $0x4, %al
callq 0x5b9c0
leaq 0x810(%rsp), %rdi
leaq 0x1010(%rsp), %rcx
leaq 0x89c38(%rip), %rsi     # 0x1d2082
leaq 0xbcd32(%rip), %rdx     # 0x205183
movb $0x0, %al
callq 0x5b9c0
movq 0x4080(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x810(%rsp), %r8
leaq 0x89bbe(%rip), %rsi     # 0x1d2034
leaq 0xbcaea(%rip), %rdx     # 0x204f67
movl $0x122d, %ecx           # imm = 0x122D
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4094(%rsp)
jmp 0x1485b2
movq 0x4078(%rsp), %rax
movl 0xc0(%rax), %edi
movsd 0x4060(%rsp), %xmm0
movl 0x401c(%rsp), %esi
movq 0x4080(%rsp), %rax
movq 0x910(%rax), %rdx
movsd 0x4048(%rsp), %xmm1
movsd 0x4040(%rsp), %xmm2
movsd 0x4038(%rsp), %xmm3
movq 0x4080(%rsp), %rax
movq 0x910(%rax), %rax
movl 0x401c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
addl $0x1, %ecx
movq 0x4088(%rsp), %rax
movsd 0x740(%rax), %xmm4
movq 0x4078(%rsp), %r8
movq 0x4080(%rsp), %r9
addq $0x96a, %r9             # imm = 0x96A
callq 0x3e8b0
cmpl $0x1, %eax
jne 0x148598
leaq 0x10(%rsp), %rdi
movq 0x4080(%rsp), %rcx
addq $0x96a, %rcx            # imm = 0x96A
leaq 0x89e89(%rip), %rsi     # 0x1d23d8
leaq 0xbcc36(%rip), %rdx     # 0x20518c
movb $0x0, %al
callq 0x5b9c0
movq 0x4080(%rsp), %rdi
addq $0x96a, %rdi            # imm = 0x96A
leaq 0x10(%rsp), %r8
leaq 0x89abc(%rip), %rsi     # 0x1d2034
leaq 0xbc9e8(%rip), %rdx     # 0x204f67
movl $0x123b, %ecx           # imm = 0x123B
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4094(%rsp)
jmp 0x1485b2
movq 0x4078(%rsp), %rax
movl $0x1, 0x60(%rax)
movl $0x0, 0x4094(%rsp)
movl 0x4094(%rsp), %eax
addq $0x4098, %rsp           # imm = 0x4098
retq
nopw %cs:(%rax,%rax)