// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/HMcode/hmcode.c
// Function: hmcode_growint
int hmcode_growint(
                   struct precision *ppr,
                   struct background *pba,
                   struct fourier *pfo,
                   double a,
                   double w0,
                   double wa,
                   double *growth
                   ){

  double z, ainit, amax, scalefactor, gamma, X_de, Hubble2, Omega_m;
  int i, index_scalefactor, index_a, index_growth, index_ddgrowth, index_gcol, ng; // index_scalefactor is a running index while index_a is a column index
  double *pvecback;
  double *integrand;

  ng = 1024; // number of growth values (stepsize of the integral), should not be hardcoded and replaced by a precision parameter
  ainit = a;
  amax = 1.;

  i=0;
  index_a = i;
  i++;
  index_growth = i;
  i++;
  index_ddgrowth = i;
  i++;
  index_gcol = i;

  class_alloc(integrand,ng*index_gcol*sizeof(double),pfo->error_message);
  class_alloc(pvecback,pba->bg_size*sizeof(double),pfo->error_message);

  if (ainit == amax) {
    *growth = 1.;
  }
  else {

    for (index_scalefactor=0;index_scalefactor<ng;index_scalefactor++){

      scalefactor = ainit+(amax-ainit)*(index_scalefactor)/(ng-1);
      z = 1./scalefactor-1.;

      /* This will compute Omega_m(z) for the input values of w0 and wa, to let the user compare the wCDM and LCDM cases. This is why we cannot extract Omega_m(z) fromn the background module in this place. */
      X_de = pow(scalefactor, -3.*(1.+w0+wa))*exp(-3.*wa*(1.-scalefactor));
      Hubble2 = (pba->Omega0_m*pow((1.+z), 3.) + pba->Omega0_k*pow((1.+z), 2.) + pba->Omega0_de*X_de);
      Omega_m = (pba->Omega0_m*pow((1.+z), 3.))/Hubble2;
      /* Samuel brieden: TBC: check that the matching between the
         background quantity and this fitting formula improves by
         using Omega_cb (as it is done in background). Carefull:
         Hubble remains with Omega0_m */

      if (w0 == -1.){
        gamma = 0.55;
      }
      else if (w0 < -1.){
        gamma = 0.55+0.02*(1+w0);
      }
      else {
        gamma = 0.55+0.05*(1+w0);
      }
      integrand[index_scalefactor*index_gcol+index_a] = scalefactor;
      integrand[index_scalefactor*index_gcol+index_growth]= -pow(Omega_m, gamma)/scalefactor;
    }

    class_call(array_spline(integrand,
                            index_gcol,
                            ng,
                            index_a,
                            index_growth,
                            index_ddgrowth,
                            _SPLINE_EST_DERIV_,
                            pfo->error_message),
               pfo->error_message,
               pfo->error_message);

    class_call(array_integrate_all_trapzd_or_spline(integrand,
                                                    index_gcol,
                                                    ng,
                                                    0, //ng-1,
                                                    index_a,
                                                    index_growth,
                                                    index_ddgrowth,
                                                    growth,
                                                    pfo->error_message),
               pfo->error_message,
               pfo->error_message);

    *growth = exp(*growth);

  }
  //fprintf(stdout, "%e %e \n", a, *growth);
  free(pvecback);
  free(integrand);

  return _SUCCESS_;
}

// Assembly:
subq $0x2108, %rsp           # imm = 0x2108
movq %rdi, 0x20f8(%rsp)
movq %rsi, 0x20f0(%rsp)
movq %rdx, 0x20e8(%rsp)
movsd %xmm0, 0x20e0(%rsp)
movsd %xmm1, 0x20d8(%rsp)
movsd %xmm2, 0x20d0(%rsp)
movq %rcx, 0x20c8(%rsp)
movl $0x400, 0x206c(%rsp) # imm = 0x400
movsd 0x20e0(%rsp), %xmm0
movsd %xmm0, 0x20b8(%rsp)
movsd 0x16681(%rip), %xmm0    # 0x1d2248
movsd %xmm0, 0x20b0(%rsp)
movl $0x0, 0x2084(%rsp)
movl 0x2084(%rsp), %eax
movl %eax, 0x207c(%rsp)
movl 0x2084(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2084(%rsp)
movl 0x2084(%rsp), %eax
movl %eax, 0x2078(%rsp)
movl 0x2084(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2084(%rsp)
movl 0x2084(%rsp), %eax
movl %eax, 0x2074(%rsp)
movl 0x2084(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2084(%rsp)
movl 0x2084(%rsp), %eax
movl %eax, 0x2070(%rsp)
movl 0x206c(%rsp), %eax
imull 0x2070(%rsp), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x2058(%rsp)
cmpq $0x0, 0x2058(%rsp)
jne 0x1bbcf9
movl 0x206c(%rsp), %eax
imull 0x2070(%rsp), %eax
cltq
shlq $0x3, %rax
movl %eax, 0x2054(%rsp)
leaq 0x1850(%rsp), %rdi
movl 0x2054(%rsp), %ecx
leaq 0x1635a(%rip), %rsi     # 0x1d2004
leaq 0x56d5e(%rip), %rdx     # 0x212a0f
movb $0x0, %al
callq 0x5b9c0
movq 0x20e8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x1850(%rsp), %r8
leaq 0x1635e(%rip), %rsi     # 0x1d2034
leaq 0x55bf4(%rip), %rdx     # 0x2118d1
movl $0x595, %ecx            # imm = 0x595
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2104(%rsp)
jmp 0x1bc2f0
movq 0x20f0(%rsp), %rax
movslq 0x43c(%rax), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x2060(%rsp)
cmpq $0x0, 0x2060(%rsp)
jne 0x1bbda3
movq 0x20f0(%rsp), %rax
movslq 0x43c(%rax), %rax
shlq $0x3, %rax
movl %eax, 0x184c(%rsp)
leaq 0x1040(%rsp), %rdi
movl 0x184c(%rsp), %ecx
leaq 0x162b0(%rip), %rsi     # 0x1d2004
leaq 0x3d51c(%rip), %rdx     # 0x1f9277
movb $0x0, %al
callq 0x5b9c0
movq 0x20e8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x1040(%rsp), %r8
leaq 0x162b4(%rip), %rsi     # 0x1d2034
leaq 0x55b4a(%rip), %rdx     # 0x2118d1
movl $0x596, %ecx            # imm = 0x596
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2104(%rsp)
jmp 0x1bc2f0
movsd 0x20b8(%rsp), %xmm0
ucomisd 0x20b0(%rsp), %xmm0
jne 0x1bbdd2
jp 0x1bbdd2
movq 0x20c8(%rsp), %rax
movsd 0x1647f(%rip), %xmm0    # 0x1d2248
movsd %xmm0, (%rax)
jmp 0x1bc2cb
movl $0x0, 0x2080(%rsp)
movl 0x2080(%rsp), %eax
cmpl 0x206c(%rsp), %eax
jge 0x1bc12e
movsd 0x20b8(%rsp), %xmm0
movsd 0x20b0(%rsp), %xmm1
subsd 0x20b8(%rsp), %xmm1
cvtsi2sdl 0x2080(%rsp), %xmm2
mulsd %xmm2, %xmm1
movl 0x206c(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x20a8(%rsp)
movsd 0x16408(%rip), %xmm0    # 0x1d2248
divsd 0x20a8(%rsp), %xmm0
movsd 0x163f7(%rip), %xmm1    # 0x1d2248
subsd %xmm1, %xmm0
movsd %xmm0, 0x20c0(%rsp)
movsd 0x20a8(%rsp), %xmm0
movsd 0x163d9(%rip), %xmm2    # 0x1d2248
addsd 0x20d8(%rsp), %xmm2
addsd 0x20d0(%rsp), %xmm2
movsd 0x19b1f(%rip), %xmm1    # 0x1d59a8
mulsd %xmm2, %xmm1
callq 0x8610
movsd %xmm0, 0x18(%rsp)
movsd 0x19b08(%rip), %xmm0    # 0x1d59a8
mulsd 0x20d0(%rsp), %xmm0
movsd 0x16397(%rip), %xmm1    # 0x1d2248
subsd 0x20a8(%rsp), %xmm1
mulsd %xmm1, %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x2098(%rsp)
movq 0x20f0(%rsp), %rax
movsd 0x340(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x16351(%rip), %xmm0    # 0x1d2248
addsd 0x20c0(%rsp), %xmm0
movsd 0x17790(%rip), %xmm1    # 0x1d3698
callq 0x8610
movsd %xmm0, 0x28(%rsp)
movq 0x20f0(%rsp), %rax
movsd 0x2d0(%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x16317(%rip), %xmm0    # 0x1d2248
addsd 0x20c0(%rsp), %xmm0
movsd 0x16d3e(%rip), %xmm1    # 0x1d2c80
callq 0x8610
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0x30(%rsp), %xmm0
mulsd %xmm3, %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movq 0x20f0(%rsp), %rax
movsd 0x350(%rax), %xmm0
movsd 0x2098(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x2090(%rsp)
movq 0x20f0(%rsp), %rax
movsd 0x340(%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x16298(%rip), %xmm0    # 0x1d2248
addsd 0x20c0(%rsp), %xmm0
movsd 0x176d7(%rip), %xmm1    # 0x1d3698
callq 0x8610
movaps %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
mulsd %xmm1, %xmm0
divsd 0x2090(%rsp), %xmm0
movsd %xmm0, 0x2088(%rsp)
movsd 0x20d8(%rsp), %xmm0
movsd 0x167da(%rip), %xmm1    # 0x1d27d0
ucomisd %xmm1, %xmm0
jne 0x1bc011
jp 0x1bc011
movsd 0x50bea(%rip), %xmm0    # 0x20cbf0
movsd %xmm0, 0x20a0(%rsp)
jmp 0x1bc08c
movsd 0x167b7(%rip), %xmm0    # 0x1d27d0
ucomisd 0x20d8(%rsp), %xmm0
jbe 0x1bc058
movsd 0x1621c(%rip), %xmm0    # 0x1d2248
addsd 0x20d8(%rsp), %xmm0
movsd 0x1a50b(%rip), %xmm1    # 0x1d6548
mulsd %xmm1, %xmm0
movsd 0x50ba7(%rip), %xmm1    # 0x20cbf0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20a0(%rsp)
jmp 0x1bc08a
movsd 0x161e8(%rip), %xmm0    # 0x1d2248
addsd 0x20d8(%rsp), %xmm0
movsd 0x16c2f(%rip), %xmm1    # 0x1d2ca0
mulsd %xmm1, %xmm0
movsd 0x50b73(%rip), %xmm1    # 0x20cbf0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20a0(%rsp)
jmp 0x1bc08c
movsd 0x20a8(%rsp), %xmm0
movq 0x2058(%rsp), %rax
movl 0x2080(%rsp), %ecx
imull 0x2070(%rsp), %ecx
addl 0x207c(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x2088(%rsp), %xmm0
movsd 0x20a0(%rsp), %xmm1
callq 0x8610
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
divsd 0x20a8(%rsp), %xmm0
movq 0x2058(%rsp), %rax
movl 0x2080(%rsp), %ecx
imull 0x2070(%rsp), %ecx
addl 0x2078(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x2080(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2080(%rsp)
jmp 0x1bbddd
movq 0x2058(%rsp), %rdi
movl 0x2070(%rsp), %esi
movl 0x206c(%rsp), %edx
movl 0x207c(%rsp), %ecx
movl 0x2078(%rsp), %r8d
movl 0x2074(%rsp), %r9d
movq 0x20e8(%rsp), %rax
addq $0x192, %rax            # imm = 0x192
movl $0x1, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1b340
cmpl $0x1, %eax
jne 0x1bc1ec
leaq 0x840(%rsp), %rdi
movq 0x20e8(%rsp), %rcx
addq $0x192, %rcx            # imm = 0x192
leaq 0x1623b(%rip), %rsi     # 0x1d23d8
leaq 0x5573c(%rip), %rdx     # 0x2118e0
movb $0x0, %al
callq 0x5b9c0
movq 0x20e8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x840(%rsp), %r8
leaq 0x15e6b(%rip), %rsi     # 0x1d2034
leaq 0x55701(%rip), %rdx     # 0x2118d1
movl $0x5c1, %ecx            # imm = 0x5C1
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2104(%rsp)
jmp 0x1bc2f0
movq 0x2058(%rsp), %rdi
movl 0x2070(%rsp), %esi
movl 0x206c(%rsp), %edx
movl 0x207c(%rsp), %r8d
movl 0x2078(%rsp), %r9d
movl 0x2074(%rsp), %r11d
movq 0x20c8(%rsp), %r10
movq 0x20e8(%rsp), %rax
addq $0x192, %rax            # imm = 0x192
xorl %ecx, %ecx
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x22eb0
cmpl $0x1, %eax
jne 0x1bc2ae
leaq 0x40(%rsp), %rdi
movq 0x20e8(%rsp), %rcx
addq $0x192, %rcx            # imm = 0x192
leaq 0x16173(%rip), %rsi     # 0x1d23d8
leaq 0x556da(%rip), %rdx     # 0x211946
movb $0x0, %al
callq 0x5b9c0
movq 0x20e8(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x40(%rsp), %r8
leaq 0x15da6(%rip), %rsi     # 0x1d2034
leaq 0x5563c(%rip), %rdx     # 0x2118d1
movl $0x5cd, %ecx            # imm = 0x5CD
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x2104(%rsp)
jmp 0x1bc2f0
movq 0x20c8(%rsp), %rax
movsd (%rax), %xmm0
callq 0x8670
movq 0x20c8(%rsp), %rax
movsd %xmm0, (%rax)
movq 0x2060(%rsp), %rdi
callq 0x8420
movq 0x2058(%rsp), %rdi
callq 0x8420
movl $0x0, 0x2104(%rsp)
movl 0x2104(%rsp), %eax
addq $0x2108, %rsp           # imm = 0x2108
retq
nop