// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/HyRec2020/hydrogen.c
// Function: populate_Diffusion
void populate_Diffusion(double *Aup, double *Adn, double *A2p_up, double *A2p_dn,
                        double TM, double Eb_tab[NVIRT], double A1s_tab[NVIRT]) {

  unsigned b;
  double DE2;

  DE2 = E21*E21*2.*TM/mH;

 /****** RED WING ******/
  b = NSUBLYA - NDIFF/2;
  Aup[b] = DE2 / square(Eb_tab[b+1] - Eb_tab[b]) * A1s_tab[b];    /* A{0,1}. Assume A{0,-1} = 0 */

  for (b = NSUBLYA - NDIFF/2 + 1; b < NSUBLYA-1; b++) {
    Adn[b] = exp((Eb_tab[b] - Eb_tab[b-1])/TM) * Aup[b-1];                      /* Detailed balance */
    Aup[b] = (DE2 * A1s_tab[b] - square(Eb_tab[b] - Eb_tab[b-1]) * Adn[b])
                    /square(Eb_tab[b+1] - Eb_tab[b]);        /* Aup[b] , Adn[b] must add up to correct diffusion rate */
  }
  /* Last bin below Lyman alpha */
  b = NSUBLYA - 1;
  Adn[b] = exp((Eb_tab[b] - Eb_tab[b-1])/TM) * Aup[b-1];

  Aup[b] = (DE2 * A1s_tab[b] - square(Eb_tab[b] - Eb_tab[b-1]) * Adn[b])
                  /square(E21 - Eb_tab[b]);
  *A2p_dn = exp((E21 - Eb_tab[b])/TM)/3.* Aup[b];   /* 2p -> NSUBLYA-1 rate obtained by detailed balance */


  /****** BLUE WING ******/
  b = NSUBLYA + NDIFF/2 - 1;
  Adn[b] = DE2 / square(Eb_tab[b] - Eb_tab[b-1]) * A1s_tab[b];

  for (b = NSUBLYA + NDIFF/2 - 2; b > NSUBLYA; b--) {
    Aup[b] = exp((Eb_tab[b] - Eb_tab[b+1])/TM) * Adn[b+1];
    Adn[b] = (DE2 * A1s_tab[b] - square(Eb_tab[b+1] - Eb_tab[b]) * Aup[b])
                /square(Eb_tab[b] - Eb_tab[b-1]);
  }
  /* First bin above Lyman alpha */
  b = NSUBLYA;
  Aup[b] = exp((Eb_tab[b] - Eb_tab[b+1])/TM) * Adn[b+1];

  Adn[b] = (DE2 * A1s_tab[b] - square(Eb_tab[b+1] - Eb_tab[b]) * Aup[b])
               /square(Eb_tab[b] - E21);
  *A2p_up = exp((E21 - Eb_tab[b])/TM)/3. * Adn[b];   /* 2p -> NSUBLYA rate obtained by detailed balance */

}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movsd %xmm0, 0x90(%rsp)
movq %r8, 0x88(%rsp)
movq %r9, 0x80(%rsp)
movsd 0x64768(%rip), %xmm0    # 0x20e930
mulsd 0x90(%rsp), %xmm0
movsd 0x6474f(%rip), %xmm1    # 0x20e928
divsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
movl $0x64, 0x7c(%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movaps %xmm0, %xmm1
movsd 0x68(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0x80(%rsp), %rax
movl 0x7c(%rsp), %ecx
mulsd (%rax,%rcx,8), %xmm0
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl $0x65, 0x7c(%rsp)
cmpl $0x8b, 0x7c(%rsp)
jae 0x1aa3b2
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
subsd (%rax,%rcx,8), %xmm0
divsd 0x90(%rsp), %xmm0
callq 0x8670
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
mulsd (%rax,%rcx,8), %xmm0
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x80(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movsd 0x50(%rsp), %xmm2
movaps %xmm0, %xmm1
movsd 0x58(%rsp), %xmm0
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
mulsd (%rax,%rcx,8), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movaps %xmm0, %xmm1
movsd 0x60(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x1aa25a
movl $0x8b, 0x7c(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
subsd (%rax,%rcx,8), %xmm0
divsd 0x90(%rsp), %xmm0
callq 0x8670
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
mulsd (%rax,%rcx,8), %xmm0
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x80(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movsd 0x30(%rsp), %xmm2
movaps %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
mulsd (%rax,%rcx,8), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd 0x6447a(%rip), %xmm0    # 0x20e938
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movaps %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd 0x6443e(%rip), %xmm0    # 0x20e938
subsd (%rax,%rcx,8), %xmm0
divsd 0x90(%rsp), %xmm0
callq 0x8670
movsd 0x29183(%rip), %xmm1    # 0x1d3698
divsd %xmm1, %xmm0
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
mulsd (%rax,%rcx,8), %xmm0
movq 0x98(%rsp), %rax
movsd %xmm0, (%rax)
movl $0xb3, 0x7c(%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movaps %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0x80(%rsp), %rax
movl 0x7c(%rsp), %ecx
mulsd (%rax,%rcx,8), %xmm0
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl $0xb2, 0x7c(%rsp)
cmpl $0x8c, 0x7c(%rsp)
jbe 0x1aa705
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
subsd (%rax,%rcx,8), %xmm0
divsd 0x90(%rsp), %xmm0
callq 0x8670
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
mulsd (%rax,%rcx,8), %xmm0
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x80(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movsd 0x18(%rsp), %xmm2
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
mulsd (%rax,%rcx,8), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl 0x7c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x1aa5ad
movl $0x8c, 0x7c(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
subsd (%rax,%rcx,8), %xmm0
divsd 0x90(%rsp), %xmm0
callq 0x8670
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
mulsd (%rax,%rcx,8), %xmm0
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x80(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
subsd (%rax,%rcx,8), %xmm0
callq 0x1a5650
movsd (%rsp), %xmm2
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movq 0xb0(%rsp), %rax
movl 0x7c(%rsp), %ecx
mulsd (%rax,%rcx,8), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movsd 0x64124(%rip), %xmm1    # 0x20e938
subsd %xmm1, %xmm0
callq 0x1a5650
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movq 0x88(%rsp), %rax
movl 0x7c(%rsp), %ecx
movsd 0x640e9(%rip), %xmm0    # 0x20e938
subsd (%rax,%rcx,8), %xmm0
divsd 0x90(%rsp), %xmm0
callq 0x8670
movsd 0x28e2e(%rip), %xmm1    # 0x1d3698
divsd %xmm1, %xmm0
movq 0xa8(%rsp), %rax
movl 0x7c(%rsp), %ecx
mulsd (%rax,%rcx,8), %xmm0
movq 0xa0(%rsp), %rax
movsd %xmm0, (%rax)
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)