// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../source/perturbations.c
// Function: perturbations_rsa_idr_delta_and_theta
int perturbations_rsa_idr_delta_and_theta(
                                          struct precision * ppr,
                                          struct background * pba,
                                          struct thermodynamics * pth,
                                          struct perturbations * ppt,
                                          double k,
                                          double * y,
                                          double a_prime_over_a,
                                          double * pvecthermo,
                                          struct perturbations_workspace * ppw,
                                          ErrorMsg error_message
                                          ) {
  /* - define local variables */

  double k2;

  k2 = k*k;

  // formulas below TBC for curvaturema

  /* newtonian gauge */
  if (ppt->gauge == newtonian) {

    if (ppw->approx[ppw->index_ap_rsa_idr] == (int)rsa_idr_on) {

      ppw->rsa_delta_idr = -4.*y[ppw->pv->index_pt_phi];
      ppw->rsa_theta_idr = 6.*ppw->pvecmetric[ppw->index_mt_phi_prime];

    }
  }

  if (ppt->gauge == synchronous) {

    if (ppw->approx[ppw->index_ap_rsa_idr] == (int)rsa_idr_on) {

      ppw->rsa_delta_idr = 4./k2*(a_prime_over_a*ppw->pvecmetric[ppw->index_mt_h_prime]
                                  -k2*y[ppw->pv->index_pt_eta]);
      ppw->rsa_theta_idr = -0.5*ppw->pvecmetric[ppw->index_mt_h_prime];

    }
  }

  return _SUCCESS_;

}

// Assembly:
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rax
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movq %rcx, -0x20(%rsp)
movsd %xmm0, -0x28(%rsp)
movq %r8, -0x30(%rsp)
movsd %xmm1, -0x38(%rsp)
movq %r9, -0x40(%rsp)
movsd -0x28(%rsp), %xmm0
mulsd -0x28(%rsp), %xmm0
movsd %xmm0, -0x48(%rsp)
movq -0x20(%rsp), %rax
cmpl $0x0, 0x83c(%rax)
jne 0x107e0f
movq 0x8(%rsp), %rax
movq 0x180(%rax), %rax
movq 0x8(%rsp), %rcx
movslq 0x16c(%rcx), %rcx
cmpl $0x1, (%rax,%rcx,4)
jne 0x107e0d
movq -0x30(%rsp), %rax
movq 0x8(%rsp), %rcx
movq 0x48(%rcx), %rcx
movslq 0xd4(%rcx), %rcx
movsd 0xcd6f1(%rip), %xmm0    # 0x1d54c0
mulsd (%rax,%rcx,8), %xmm0
movq 0x8(%rsp), %rax
movsd %xmm0, 0xc8(%rax)
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rsp), %rcx
movslq 0x4(%rcx), %rcx
movsd 0xcb88d(%rip), %xmm0    # 0x1d3688
mulsd (%rax,%rcx,8), %xmm0
movq 0x8(%rsp), %rax
movsd %xmm0, 0xd0(%rax)
jmp 0x107e0f
movq -0x20(%rsp), %rax
cmpl $0x1, 0x83c(%rax)
jne 0x107eec
movq 0x8(%rsp), %rax
movq 0x180(%rax), %rax
movq 0x8(%rsp), %rcx
movslq 0x16c(%rcx), %rcx
cmpl $0x1, (%rax,%rcx,4)
jne 0x107eea
movsd 0xcd67d(%rip), %xmm0    # 0x1d54c8
divsd -0x48(%rsp), %xmm0
movsd -0x38(%rsp), %xmm1
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rsp), %rcx
movslq 0x8(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm3
movsd -0x48(%rsp), %xmm2
movq -0x30(%rsp), %rax
movq 0x8(%rsp), %rcx
movq 0x48(%rcx), %rcx
movslq 0xd0(%rcx), %rcx
mulsd (%rax,%rcx,8), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movq 0x8(%rsp), %rax
movsd %xmm0, 0xc8(%rax)
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rsp), %rcx
movslq 0x8(%rcx), %rcx
movsd 0xcb7c8(%rip), %xmm0    # 0x1d36a0
mulsd (%rax,%rcx,8), %xmm0
movq 0x8(%rsp), %rax
movsd %xmm0, 0xd0(%rax)
jmp 0x107eec
xorl %eax, %eax
retq
nop