// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/Halofit/halofit.c
// Function: halofit_integrate
int halofit_integrate(
                      struct fourier *pfo,
                      double *integrand_array,
                      int integrand_size,
                      int ia_size,
                      int index_ia_k,
                      int index_ia_pk,
                      int index_ia_sum,
                      int index_ia_ddsum,
                      double R,
                      enum halofit_integral_type type,
                      double *sum
                      ) {

  double k,pk,x2,integrand;
  int index_k;
  double anorm = 1./(2*pow(_PI_,2));

  for (index_k=0; index_k < integrand_size; index_k++) {
    k = integrand_array[index_k*ia_size + index_ia_k];
    pk = integrand_array[index_k*ia_size + index_ia_pk];
    x2 = k*k*R*R;

    integrand = pk*k*k*anorm*exp(-x2);
    if (type == halofit_integral_two) integrand *= 2.*x2;
    if (type == halofit_integral_three) integrand *= 4.*x2*(1.-x2);

    integrand_array[index_k*ia_size + index_ia_sum] = integrand;
  }

  /* fill in second derivatives */
  class_call(array_spline(integrand_array,
                          ia_size,
                          integrand_size,
                          index_ia_k,
                          index_ia_sum,
                          index_ia_ddsum,
                          _SPLINE_NATURAL_,
                          pfo->error_message),
             pfo->error_message,
             pfo->error_message);

  /* integrate */
  class_call(array_integrate_all_spline(integrand_array,
                                        ia_size,
                                        integrand_size,
                                        index_ia_k,
                                        index_ia_sum,
                                        index_ia_ddsum,
                                        sum,
                                        pfo->error_message),
             pfo->error_message,
             pfo->error_message);

  return _SUCCESS_;
}

// Assembly:
subq $0x1088, %rsp           # imm = 0x1088
movq 0x10a8(%rsp), %rax
movl 0x10a0(%rsp), %eax
movl 0x1098(%rsp), %eax
movl 0x1090(%rsp), %eax
movq %rdi, 0x1078(%rsp)
movq %rsi, 0x1070(%rsp)
movl %edx, 0x106c(%rsp)
movl %ecx, 0x1068(%rsp)
movl %r8d, 0x1064(%rsp)
movl %r9d, 0x1060(%rsp)
movsd %xmm0, 0x1058(%rsp)
movsd 0x1dc0d(%rip), %xmm0    # 0x1d4fe0
movsd 0x1b8a5(%rip), %xmm1    # 0x1d2c80
callq 0x8610
movsd 0x1b898(%rip), %xmm1    # 0x1d2c80
mulsd %xmm0, %xmm1
movsd 0x1ae54(%rip), %xmm0    # 0x1d2248
divsd %xmm1, %xmm0
movsd %xmm0, 0x1028(%rsp)
movl $0x0, 0x1034(%rsp)
movl 0x1034(%rsp), %eax
cmpl 0x106c(%rsp), %eax
jge 0x1b75c4
movq 0x1070(%rsp), %rax
movl 0x1034(%rsp), %ecx
imull 0x1068(%rsp), %ecx
addl 0x1064(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1050(%rsp)
movq 0x1070(%rsp), %rax
movl 0x1034(%rsp), %ecx
imull 0x1068(%rsp), %ecx
addl 0x1060(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1048(%rsp)
movsd 0x1050(%rsp), %xmm0
mulsd 0x1050(%rsp), %xmm0
mulsd 0x1058(%rsp), %xmm0
mulsd 0x1058(%rsp), %xmm0
movsd %xmm0, 0x1040(%rsp)
movsd 0x1048(%rsp), %xmm0
mulsd 0x1050(%rsp), %xmm0
mulsd 0x1050(%rsp), %xmm0
mulsd 0x1028(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x1040(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x1038(%rsp)
cmpl $0x1, 0x10a0(%rsp)
jne 0x1b753d
movsd 0x1b75e(%rip), %xmm0    # 0x1d2c80
mulsd 0x1040(%rsp), %xmm0
mulsd 0x1038(%rsp), %xmm0
movsd %xmm0, 0x1038(%rsp)
cmpl $0x2, 0x10a0(%rsp)
jne 0x1b757f
movsd 0x1df79(%rip), %xmm0    # 0x1d54c8
mulsd 0x1040(%rsp), %xmm0
movsd 0x1ace8(%rip), %xmm1    # 0x1d2248
subsd 0x1040(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd 0x1038(%rsp), %xmm0
movsd %xmm0, 0x1038(%rsp)
movsd 0x1038(%rsp), %xmm0
movq 0x1070(%rsp), %rax
movl 0x1034(%rsp), %ecx
imull 0x1068(%rsp), %ecx
addl 0x1090(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x1034(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1034(%rsp)
jmp 0x1b740c
movq 0x1070(%rsp), %rdi
movl 0x1068(%rsp), %esi
movl 0x106c(%rsp), %edx
movl 0x1064(%rsp), %ecx
movl 0x1090(%rsp), %r8d
movl 0x1098(%rsp), %r9d
movq 0x1078(%rsp), %rax
addq $0x192, %rax            # imm = 0x192
xorl %r10d, %r10d
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1b340
cmpl $0x1, %eax
jne 0x1b7685
leaq 0x820(%rsp), %rdi
movq 0x1078(%rsp), %rcx
addq $0x192, %rcx            # imm = 0x192
leaq 0x1ada2(%rip), %rsi     # 0x1d23d8
leaq 0x58a9f(%rip), %rdx     # 0x2100dc
movb $0x0, %al
callq 0x5b9c0
movq 0x1078(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x820(%rsp), %r8
leaq 0x1a9d2(%rip), %rsi     # 0x1d2034
leaq 0x58aeb(%rip), %rdx     # 0x210154
movl $0x217, %ecx            # imm = 0x217
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1084(%rsp)
jmp 0x1b774a
movq 0x1070(%rsp), %rdi
movl 0x1068(%rsp), %esi
movl 0x106c(%rsp), %edx
movl 0x1064(%rsp), %ecx
movl 0x1090(%rsp), %r8d
movl 0x1098(%rsp), %r9d
movq 0x10a8(%rsp), %r10
movq 0x1078(%rsp), %rax
addq $0x192, %rax            # imm = 0x192
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x22c20
cmpl $0x1, %eax
jne 0x1b773f
leaq 0x20(%rsp), %rdi
movq 0x1078(%rsp), %rcx
addq $0x192, %rcx            # imm = 0x192
leaq 0x1ace2(%rip), %rsi     # 0x1d23d8
leaq 0x58a69(%rip), %rdx     # 0x210166
movb $0x0, %al
callq 0x5b9c0
movq 0x1078(%rsp), %rdi
addq $0x192, %rdi            # imm = 0x192
leaq 0x20(%rsp), %r8
leaq 0x1a915(%rip), %rsi     # 0x1d2034
leaq 0x58a2e(%rip), %rdx     # 0x210154
movl $0x223, %ecx            # imm = 0x223
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1084(%rsp)
jmp 0x1b774a
movl $0x0, 0x1084(%rsp)
movl 0x1084(%rsp), %eax
addq $0x1088, %rsp           # imm = 0x1088
retq
nopl (%rax)