// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/primordial.c
// Function: primordial_inflation_analytic_spectra
int primordial_inflation_analytic_spectra(
                                          struct perturbations * ppt,
                                          struct primordial * ppm,
                                          struct precision * ppr,
                                          double * y_ini
                                          ) {
  double * y;
  double * dy;
  int index_k;
  double k,phi_k;
  double curvature,tensors;
  double V,dV,ddV;

  /** Summary */
  /** - allocate vectors for background/perturbed quantities */
  class_alloc(y,ppm->in_size*sizeof(double),ppm->error_message);
  class_alloc(dy,ppm->in_size*sizeof(double),ppm->error_message);

  /** - initialize the background part of the running vector */
  y[ppm->index_in_a] = y_ini[ppm->index_in_a];
  y[ppm->index_in_phi] = y_ini[ppm->index_in_phi];
  if ((ppm->primordial_spec_type == inflation_V) || (ppm->primordial_spec_type == inflation_V_end))
    y[ppm->index_in_dphi] = y_ini[ppm->index_in_dphi];

  /** - loop over Fourier wavenumbers */
  for (index_k=0; index_k < ppm->lnk_size; index_k++) {

    k = exp(ppm->lnk[index_k]);

    /* evolve background until k=aH is reached */
    class_call(primordial_inflation_evolve_background(ppm,
                                                      ppr,
                                                      y,
                                                      dy,
                                                      _aH_,
                                                      k,
                                                      _FALSE_,
                                                      forward,
                                                      conformal),
               ppm->error_message,
               ppm->error_message);

    /** - read value of phi at time when k=aH */
    phi_k = y[ppm->index_in_phi];

    /** - get potential (and its derivatives) at this value */
    class_call(primordial_inflation_check_potential(ppm,phi_k,&V,&dV,&ddV),
               ppm->error_message,
               ppm->error_message);

    /** - calculate the analytic slow-roll formula for the spectra */
    curvature = 128.*_PI_/3.*pow(V,3)/pow(dV,2);
    tensors = pow(dV/V,2)/_PI_*128.*_PI_/3.*pow(V,3)/pow(dV,2);

    /** - store the obtained result for curvature and tensor perturbations */
    ppm->lnpk[ppt->index_md_scalars][index_k] = log(curvature);
    ppm->lnpk[ppt->index_md_tensors][index_k] = log(tensors);
  }

  ppm->is_non_zero[ppt->index_md_scalars][ppt->index_ic_ad] = _TRUE_;
  ppm->is_non_zero[ppt->index_md_tensors][ppt->index_ic_ten] = _TRUE_;

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x848, %rsp            # imm = 0x848
movq %rcx, %rbp
movq %rdx, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x300(%rsi), %r15
movq %r15, %r13
shlq $0x3, %r13
movq %r13, %rdi
callq 0x8490
testq %rax, %rax
je 0x964d2
movq %rax, %r12
movq %r13, %rdi
callq 0x8490
testq %rax, %rax
je 0x96519
movq %rax, %r13
movslq 0x2d0(%rbx), %rax
movsd (%rbp,%rax,8), %xmm0
movsd %xmm0, (%r12,%rax,8)
movslq 0x2d4(%rbx), %rax
movsd (%rbp,%rax,8), %xmm0
movsd %xmm0, (%r12,%rax,8)
movl 0x18(%rbx), %eax
cmpl $0x4, %eax
je 0x9636c
cmpl $0x2, %eax
jne 0x9637f
movslq 0x2d8(%rbx), %rax
movsd (%rbp,%rax,8), %xmm0
movsd %xmm0, (%r12,%rax,8)
xorl %ebp, %ebp
movq 0x8(%rsp), %r15
movslq 0x290(%rbx), %rax
cmpq %rax, %rbp
jge 0x96560
movq 0x298(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
callq 0x86a0
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq $0x1
callq 0x953b4
popq %rcx
popq %rdx
testl %eax, %eax
jne 0x9659e
movslq 0x2d4(%rbx), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0x38(%rsp), %rcx
callq 0x96639
testl %eax, %eax
jne 0x965dd
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x5033c(%rip), %xmm1    # 0xe6748
callq 0x8650
mulsd 0x78f3f(%rip), %xmm0    # 0x10f358
movsd 0x28(%rsp), %xmm2
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
movsd %xmm1, (%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm3
divsd %xmm3, %xmm2
mulsd %xmm2, %xmm2
movsd 0x51b4c(%rip), %xmm0    # 0xe7f98
divsd %xmm0, %xmm2
mulsd 0x78f08(%rip), %xmm2    # 0x10f360
mulsd %xmm0, %xmm2
movsd 0x502e4(%rip), %xmm1    # 0xe6748
divsd %xmm1, %xmm2
movsd %xmm2, 0x10(%rsp)
movapd %xmm3, %xmm0
callq 0x8650
mulsd 0x10(%rsp), %xmm0
divsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x82e0
movq 0x2a0(%rbx), %rax
movslq 0x848(%r14), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax,%rbp,8)
movsd (%rsp), %xmm0
callq 0x82e0
movq 0x2a0(%rbx), %rax
movslq 0x84c(%r14), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
jmp 0x96386
leal (,%r15,8), %ecx
leaq 0x4eb23(%rip), %rsi     # 0xe5004
leaq 0x51ef6(%rip), %rdx     # 0xe83de
leaq 0x40(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x32a, %rbx            # imm = 0x32A
leaq 0x4eb2f(%rip), %rsi     # 0xe5034
leaq 0x7a44c(%rip), %rdx     # 0x110958
movq %rbx, %rdi
movl $0x62e, %ecx            # imm = 0x62E
jmp 0x9661a
leal (,%r15,8), %ecx
leaq 0x4eadc(%rip), %rsi     # 0xe5004
leaq 0x773ee(%rip), %rdx     # 0x10d91d
leaq 0x40(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x32a, %rbx            # imm = 0x32A
leaq 0x4eae8(%rip), %rsi     # 0xe5034
leaq 0x7a405(%rip), %rdx     # 0x110958
movq %rbx, %rdi
movl $0x62f, %ecx            # imm = 0x62F
jmp 0x9661a
movq 0x2b0(%rbx), %rax
movslq 0x848(%r14), %rcx
movq (%rax,%rcx,8), %rcx
movslq 0x858(%r14), %rdx
movw $0x1, %si
movw %si, (%rcx,%rdx,2)
movslq 0x84c(%r14), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x86c(%r14), %rcx
movw %si, (%rax,%rcx,2)
xorl %eax, %eax
jmp 0x96627
addq $0x32a, %rbx            # imm = 0x32A
leaq 0x4ee44(%rip), %rsi     # 0xe53f0
leaq 0x7a3cb(%rip), %rdx     # 0x11097e
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x4ea68(%rip), %rsi     # 0xe5034
leaq 0x7a385(%rip), %rdx     # 0x110958
movq %rbx, %rdi
movl $0x647, %ecx            # imm = 0x647
jmp 0x9661a
addq $0x32a, %rbx            # imm = 0x32A
leaq 0x4ee05(%rip), %rsi     # 0xe53f0
leaq 0x7a3e4(%rip), %rdx     # 0x1109d6
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x4ea29(%rip), %rsi     # 0xe5034
leaq 0x7a346(%rip), %rdx     # 0x110958
movq %rbx, %rdi
movl $0x64f, %ecx            # imm = 0x64F
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x848, %rsp            # imm = 0x848
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq