// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../source/distortions.c
// Function: distortions_compute_heating_rate
int distortions_compute_heating_rate(struct precision* ppr,
                                     struct background* pba,
                                     struct thermodynamics * pth,
                                     struct perturbations * ppt,
                                     struct primordial * ppm,
                                     struct distortions * psd){

  /** Define local variables */
  struct noninjection* pni = &(psd->ni);
  struct injection* pin = &(pth->in);

  int index_z;
  double tau;
  int last_index_back;
  double *pvecback;
  double heat;
  double H, a, rho_g;

  if (psd->include_only_exotic == _FALSE_) {
    /** Update heating table with second order contributions */
    class_call(noninjection_init(ppr,pba,pth,ppt,ppm,pni),
               pni->error_message,
               psd->error_message);
  }

  /** Allocate space for background vector */
  last_index_back = 0;
  class_alloc(pvecback,
              pba->bg_size*sizeof(double),
              psd->error_message);

  /** Allocate space for total heating function */
  class_alloc(psd->dQrho_dz_tot,
              psd->z_size*sizeof(double*),
              psd->error_message);

  /* Loop over z and calculate the heating at each point */
  for (index_z=0; index_z<psd->z_size; ++index_z){

    /** Import quantities from background structure */
    class_call(background_tau_of_z(pba,
                                   psd->z[index_z],
                                   &tau),
               pba->error_message,
               psd->error_message);
    class_call(background_at_tau(pba,
                                 tau,
                                 long_info,
                                 inter_closeby,
                                 &last_index_back,
                                 pvecback),
               pba->error_message,
               psd->error_message);
    H = pvecback[pba->index_bg_H]*_c_/_Mpc_over_m_;               // [1/s]
    a = pvecback[pba->index_bg_a];                                // [-]
    rho_g = pvecback[pba->index_bg_rho_g]*_Jm3_over_Mpc2_;        // [J/m^3]

    heat = 0;

    /** Import heat from non-injection structure */
    if (psd->include_only_exotic == _FALSE_) {
      class_call(noninjection_photon_heating_at_z(pni,
                                                  psd->z[index_z],
                                                  &heat),           // [J/(m^3 s)]
                 pni->error_message,
                 psd->error_message);
    }

    /** Add heat from injection structure */
    if (pth->has_exotic_injection == _TRUE_) {
      class_call(injection_deposition_at_z(pth,
                                           psd->z[index_z]),
                 pin->error_message,
                 psd->error_message);
      heat += pin->pvecdeposition[pin->index_dep_heat];
    }

    /** Calculate total heating rate */
    psd->dQrho_dz_tot[index_z] = heat*a/(H*rho_g);                // [-]
  }

  free(pvecback);

  if (psd->include_only_exotic == _FALSE_) {
    /** Update heating table with second order contributions */
    class_call(noninjection_free(pni),
               pni->error_message,
               psd->error_message);
  }

  return _SUCCESS_;
}

// Assembly:
subq $0x40a8, %rsp           # imm = 0x40A8
movq %rdi, 0x4098(%rsp)
movq %rsi, 0x4090(%rsp)
movq %rdx, 0x4088(%rsp)
movq %rcx, 0x4080(%rsp)
movq %r8, 0x4078(%rsp)
movq %r9, 0x4070(%rsp)
movq 0x4070(%rsp), %rax
addq $0xcf0, %rax            # imm = 0xCF0
movq %rax, 0x4068(%rsp)
movq 0x4088(%rsp), %rax
addq $0xc0, %rax
movq %rax, 0x4060(%rsp)
movq 0x4070(%rsp), %rax
cmpl $0x0, 0xce4(%rax)
jne 0x191581
movq 0x4098(%rsp), %rdi
movq 0x4090(%rsp), %rsi
movq 0x4088(%rsp), %rdx
movq 0x4080(%rsp), %rcx
movq 0x4078(%rsp), %r8
movq 0x4068(%rsp), %r9
callq 0x1a37c0
cmpl $0x1, %eax
jne 0x19157f
leaq 0x3820(%rsp), %rdi
movq 0x4068(%rsp), %rcx
addq $0x110, %rcx            # imm = 0x110
leaq 0x40ea8(%rip), %rsi     # 0x1d23d8
leaq 0x79f5b(%rip), %rdx     # 0x20b492
movb $0x0, %al
callq 0x5b9c0
movq 0x4070(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
leaq 0x3820(%rsp), %r8
leaq 0x40ad8(%rip), %rsi     # 0x1d2034
leaq 0x79f5a(%rip), %rdx     # 0x20b4bd
movl $0x326, %ecx            # imm = 0x326
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x40a4(%rsp)
jmp 0x191b8c
jmp 0x191581
movl $0x0, 0x404c(%rsp)
movq 0x4090(%rsp), %rax
movslq 0x43c(%rax), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x4040(%rsp)
cmpq $0x0, 0x4040(%rsp)
jne 0x191636
movq 0x4090(%rsp), %rax
movslq 0x43c(%rax), %rax
shlq $0x3, %rax
movl %eax, 0x381c(%rsp)
leaq 0x3010(%rsp), %rdi
movl 0x381c(%rsp), %ecx
leaq 0x40a1d(%rip), %rsi     # 0x1d2004
leaq 0x67c89(%rip), %rdx     # 0x1f9277
movb $0x0, %al
callq 0x5b9c0
movq 0x4070(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
leaq 0x3010(%rsp), %r8
leaq 0x40a21(%rip), %rsi     # 0x1d2034
leaq 0x79ea3(%rip), %rdx     # 0x20b4bd
movl $0x32d, %ecx            # imm = 0x32D
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x40a4(%rsp)
jmp 0x191b8c
movq 0x4070(%rsp), %rax
movslq 0x330(%rax), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, %rcx
movq 0x4070(%rsp), %rax
movq %rcx, 0xc00(%rax)
movq 0x4070(%rsp), %rax
cmpq $0x0, 0xc00(%rax)
jne 0x1916f1
movq 0x4070(%rsp), %rax
movslq 0x330(%rax), %rax
shlq $0x3, %rax
movl %eax, 0x300c(%rsp)
leaq 0x2800(%rsp), %rdi
movl 0x300c(%rsp), %ecx
leaq 0x40962(%rip), %rsi     # 0x1d2004
leaq 0x79e35(%rip), %rdx     # 0x20b4de
movb $0x0, %al
callq 0x5b9c0
movq 0x4070(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
leaq 0x2800(%rsp), %r8
leaq 0x40966(%rip), %rsi     # 0x1d2034
leaq 0x79de8(%rip), %rdx     # 0x20b4bd
movl $0x332, %ecx            # imm = 0x332
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x40a4(%rsp)
jmp 0x191b8c
movl $0x0, 0x405c(%rsp)
movl 0x405c(%rsp), %eax
movq 0x4070(%rsp), %rcx
cmpl 0x330(%rcx), %eax
jge 0x191aef
movq 0x4090(%rsp), %rdi
movq 0x4070(%rsp), %rax
movq 0x340(%rax), %rax
movslq 0x405c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x4050(%rsp), %rsi
callq 0x9ee00
cmpl $0x1, %eax
jne 0x1917ba
leaq 0x2000(%rsp), %rdi
movq 0x4090(%rsp), %rcx
addq $0xd1c, %rcx            # imm = 0xD1C
leaq 0x40c6d(%rip), %rsi     # 0x1d23d8
leaq 0x79d7e(%rip), %rdx     # 0x20b4f0
movb $0x0, %al
callq 0x5b9c0
movq 0x4070(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
leaq 0x2000(%rsp), %r8
leaq 0x4089d(%rip), %rsi     # 0x1d2034
leaq 0x79d1f(%rip), %rdx     # 0x20b4bd
movl $0x33c, %ecx            # imm = 0x33C
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x40a4(%rsp)
jmp 0x191b8c
movq 0x4090(%rsp), %rdi
movsd 0x4050(%rsp), %xmm0
movq 0x4040(%rsp), %r8
movl $0x2, %esi
movl $0x1, %edx
leaq 0x404c(%rsp), %rcx
callq 0x9e9b0
cmpl $0x1, %eax
jne 0x19185c
leaq 0x1800(%rsp), %rdi
movq 0x4090(%rsp), %rcx
addq $0xd1c, %rcx            # imm = 0xD1C
leaq 0x40bcb(%rip), %rsi     # 0x1d23d8
leaq 0x79d0c(%rip), %rdx     # 0x20b520
movb $0x0, %al
callq 0x5b9c0
movq 0x4070(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
leaq 0x1800(%rsp), %r8
leaq 0x407fb(%rip), %rsi     # 0x1d2034
leaq 0x79c7d(%rip), %rdx     # 0x20b4bd
movl $0x344, %ecx            # imm = 0x344
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x40a4(%rsp)
jmp 0x191b8c
movq 0x4040(%rsp), %rax
movq 0x4090(%rsp), %rcx
movslq 0x384(%rcx), %rcx
movsd 0x44db5(%rip), %xmm0    # 0x1d6630
mulsd (%rax,%rcx,8), %xmm0
movsd 0x44dd8(%rip), %xmm1    # 0x1d6660
divsd %xmm1, %xmm0
movsd %xmm0, 0x4030(%rsp)
movq 0x4040(%rsp), %rax
movq 0x4090(%rsp), %rcx
movslq 0x380(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x4028(%rsp)
movq 0x4040(%rsp), %rax
movq 0x4090(%rsp), %rcx
movslq 0x38c(%rcx), %rcx
movsd 0x5fc87(%rip), %xmm0    # 0x1f1560
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x4020(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x4038(%rsp)
movq 0x4070(%rsp), %rax
cmpl $0x0, 0xce4(%rax)
jne 0x1919ad
movq 0x4068(%rsp), %rdi
movq 0x4070(%rsp), %rax
movq 0x340(%rax), %rax
movslq 0x405c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x4038(%rsp), %rsi
callq 0x1a53c0
cmpl $0x1, %eax
jne 0x1919ab
leaq 0x1000(%rsp), %rdi
movq 0x4068(%rsp), %rcx
addq $0x110, %rcx            # imm = 0x110
leaq 0x40a7c(%rip), %rsi     # 0x1d23d8
leaq 0x79c0f(%rip), %rdx     # 0x20b572
movb $0x0, %al
callq 0x5b9c0
movq 0x4070(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
leaq 0x1000(%rsp), %r8
leaq 0x406ac(%rip), %rsi     # 0x1d2034
leaq 0x79b2e(%rip), %rdx     # 0x20b4bd
movl $0x351, %ecx            # imm = 0x351
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x40a4(%rsp)
jmp 0x191b8c
jmp 0x1919ad
movq 0x4088(%rsp), %rax
movswl 0xb8(%rax), %eax
cmpl $0x1, %eax
jne 0x191a95
movq 0x4088(%rsp), %rdi
movq 0x4070(%rsp), %rax
movq 0x340(%rax), %rax
movslq 0x405c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x1a32b0
cmpl $0x1, %eax
jne 0x191a60
leaq 0x800(%rsp), %rdi
movq 0x4060(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x409c7(%rip), %rsi     # 0x1d23d8
leaq 0x79b98(%rip), %rdx     # 0x20b5b0
movb $0x0, %al
callq 0x5b9c0
movq 0x4070(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
leaq 0x800(%rsp), %r8
leaq 0x405f7(%rip), %rsi     # 0x1d2034
leaq 0x79a79(%rip), %rdx     # 0x20b4bd
movl $0x359, %ecx            # imm = 0x359
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x40a4(%rsp)
jmp 0x191b8c
movq 0x4060(%rsp), %rax
movq 0x550(%rax), %rax
movq 0x4060(%rsp), %rcx
movslq 0x538(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd 0x4038(%rsp), %xmm0
movsd %xmm0, 0x4038(%rsp)
movsd 0x4038(%rsp), %xmm0
mulsd 0x4028(%rsp), %xmm0
movsd 0x4030(%rsp), %xmm1
mulsd 0x4020(%rsp), %xmm1
divsd %xmm1, %xmm0
movq 0x4070(%rsp), %rax
movq 0xc00(%rax), %rax
movslq 0x405c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x405c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x405c(%rsp)
jmp 0x1916fc
movq 0x4040(%rsp), %rdi
callq 0x8420
movq 0x4070(%rsp), %rax
cmpl $0x0, 0xce4(%rax)
jne 0x191b81
movq 0x4068(%rsp), %rdi
callq 0x1a5330
cmpl $0x1, %eax
jne 0x191b7f
movq %rsp, %rdi
movq 0x4068(%rsp), %rcx
addq $0x110, %rcx            # imm = 0x110
leaq 0x408a0(%rip), %rsi     # 0x1d23d8
leaq 0x79aa1(%rip), %rdx     # 0x20b5e0
movb $0x0, %al
callq 0x5b9c0
movq 0x4070(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
movq %rsp, %r8
leaq 0x404d5(%rip), %rsi     # 0x1d2034
leaq 0x79957(%rip), %rdx     # 0x20b4bd
movl $0x367, %ecx            # imm = 0x367
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x40a4(%rsp)
jmp 0x191b8c
jmp 0x191b81
movl $0x0, 0x40a4(%rsp)
movl 0x40a4(%rsp), %eax
addq $0x40a8, %rsp           # imm = 0x40A8
retq
nopl (%rax,%rax)