// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/thermodynamics.c
// Function: thermodynamics_output_data
int thermodynamics_output_data(
                               struct background * pba,
                               struct thermodynamics *pth,
                               int number_of_titles,
                               double *data
                               ) {

  int index_z, storeidx;
  double *dataptr, *pvecthermo;
  double z,tau;

  // pth->number_of_thermodynamics_titles = get_number_of_titles(pth->thermodynamics_titles);
  // pth->size_thermodynamics_data = pth->number_of_thermodynamics_titles*pth->tt_size;

  /* Store quantities: */
  for (index_z=0; index_z<pth->tt_size; index_z++) {
    dataptr = data + index_z*number_of_titles;
    pvecthermo = pth->thermodynamics_table+index_z*pth->th_size;
    z = pth->z_table[index_z];
    storeidx=0;

    class_call(background_tau_of_z(pba, z, &tau),
               pba->error_message,
               pth->error_message);

    class_store_double(dataptr,1./(1.+z),_TRUE_,storeidx);
    class_store_double(dataptr,z,_TRUE_,storeidx);
    class_store_double(dataptr,tau,_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_xe],_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_dkappa],_TRUE_,storeidx);
    //class_store_double(dataptr,pvecthermo[pth->index_th_ddkappa],_TRUE_,storeidx);
    //class_store_double(dataptr,pvecthermo[pth->index_th_dddkappa],_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_exp_m_kappa],_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_g],_TRUE_,storeidx);
    //class_store_double(dataptr,pvecthermo[pth->index_th_dg],_TRUE_,storeidx);
    //class_store_double(dataptr,pvecthermo[pth->index_th_ddg],_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_Tb],_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_dTb],_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_wb],_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_cb2],_TRUE_,storeidx);
    if (pba->has_idm == _TRUE_) {
      class_store_double(dataptr,pvecthermo[pth->index_th_T_idm],_TRUE_,storeidx);
      class_store_double(dataptr,pvecthermo[pth->index_th_c2_idm],_TRUE_,storeidx);
      if (pth->has_idm_g == _TRUE_) {
        class_store_double(dataptr,pvecthermo[pth->index_th_dmu_idm_g],_TRUE_,storeidx);
        class_store_double(dataptr,pvecthermo[pth->index_th_ddmu_idm_g],_TRUE_,storeidx);
      }
      if (pth->has_idm_b == _TRUE_){
        class_store_double(dataptr,pvecthermo[pth->index_th_R_idm_b],_TRUE_,storeidx);
      }
      if (pth->has_idm_dr == _TRUE_){
        class_store_double(dataptr,pvecthermo[pth->index_th_dmu_idm_dr],_TRUE_,storeidx);
        class_store_double(dataptr,pvecthermo[pth->index_th_tau_idm_dr],_TRUE_,storeidx);
        class_store_double(dataptr,pvecthermo[pth->index_th_tau_idr],_TRUE_,storeidx);
        class_store_double(dataptr,pvecthermo[pth->index_th_g_idm_dr],_TRUE_,storeidx);
      }
    }
    if (pba->has_idr == _TRUE_) {
      class_store_double(dataptr, pvecthermo[pth->index_th_T_idr],_TRUE_,storeidx);
      class_store_double(dataptr,pvecthermo[pth->index_th_dmu_idr],_TRUE_,storeidx);
    }
    class_store_double(dataptr,pvecthermo[pth->index_th_tau_d],_TRUE_,storeidx);
    //class_store_double(dataptr,pvecthermo[pth->index_th_rate],_TRUE_,storeidx);
    class_store_double(dataptr,pvecthermo[pth->index_th_r_d],pth->compute_damping_scale,storeidx);

  }

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rcx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movslq %edx, %rbp
shlq $0x3, %rbp
xorl %r15d, %r15d
movslq 0xf08(%rbx), %rax
cmpq %rax, %r15
jge 0x6d12d
movslq 0xf04(%rbx), %r13
imulq %r15, %r13
shlq $0x3, %r13
addq 0xf20(%rbx), %r13
movq 0xf10(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movq %r14, %rdi
movsd %xmm0, (%rsp)
leaq 0x8(%rsp), %rsi
callq 0x58adb
cmpl $0x1, %eax
je 0x6d131
movsd (%rsp), %xmm2
movapd %xmm2, %xmm0
movsd 0x78364(%rip), %xmm1    # 0xe5260
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, (%r12)
movsd %xmm2, 0x8(%r12)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x10(%r12)
movslq 0xe7c(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x18(%r12)
movslq 0xe80(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x20(%r12)
movslq 0xe90(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x28(%r12)
movslq 0xe94(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x30(%r12)
movslq 0xee4(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x38(%r12)
movslq 0xee8(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x40(%r12)
movslq 0xeec(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x48(%r12)
movslq 0xef0(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x50(%r12)
cmpw $0x1, 0x4b6(%r14)
pushq $0xb
popq %rax
jne 0x6d0b7
movslq 0xea0(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x58(%r12)
movslq 0xea4(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x60(%r12)
cmpw $0x1, 0x36(%rbx)
pushq $0xd
popq %rax
jne 0x6d039
movslq 0xec8(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x68(%r12)
movslq 0xecc(%rbx), %rax
movsd (%r13,%rax,8), %xmm0
movsd %xmm0, 0x70(%r12)
pushq $0xf
popq %rax
cmpw $0x1, 0x34(%rbx)
jne 0x6d058
movslq 0xed8(%rbx), %rcx
movsd (%r13,%rcx,8), %xmm0
movl %eax, %ecx
incl %eax
movsd %xmm0, (%r12,%rcx,8)
cmpw $0x1, 0x38(%rbx)
jne 0x6d0b7
movslq 0xeac(%rbx), %rcx
movsd (%r13,%rcx,8), %xmm0
movl %eax, %ecx
movsd %xmm0, (%r12,%rcx,8)
movslq 0xebc(%rbx), %rdx
movsd (%r13,%rdx,8), %xmm0
movsd %xmm0, 0x8(%r12,%rcx,8)
movslq 0xec0(%rbx), %rdx
movsd (%r13,%rdx,8), %xmm0
movsd %xmm0, 0x10(%r12,%rcx,8)
movslq 0xec4(%rbx), %rdx
movsd (%r13,%rdx,8), %xmm0
addl $0x4, %eax
movsd %xmm0, 0x18(%r12,%rcx,8)
cmpw $0x1, 0x4c6(%r14)
jne 0x6d0f0
movslq 0xea8(%rbx), %rcx
movsd (%r13,%rcx,8), %xmm0
movl %eax, %ecx
movsd %xmm0, (%r12,%rcx,8)
movslq 0xeb8(%rbx), %rdx
movsd (%r13,%rdx,8), %xmm0
addl $0x2, %eax
movsd %xmm0, 0x8(%r12,%rcx,8)
movslq 0xe84(%rbx), %rcx
movsd (%r13,%rcx,8), %xmm0
movl %eax, %eax
movsd %xmm0, (%r12,%rax,8)
cmpw $0x1, 0x32(%rbx)
jne 0x6d122
movslq 0xf00(%rbx), %rcx
movsd (%r13,%rcx,8), %xmm0
movsd %xmm0, 0x8(%r12,%rax,8)
incq %r15
addq %rbp, %r12
jmp 0x6ce9d
xorl %eax, %eax
jmp 0x6d182
addq $0xd1c, %r14            # imm = 0xD1C
leaq 0x782b1(%rip), %rsi     # 0xe53f0
leaq 0x9bb99(%rip), %rdx     # 0x108cdf
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1064, %rbx           # imm = 0x1064
leaq 0x77ece(%rip), %rsi     # 0xe5034
leaq 0x9bb94(%rip), %rdx     # 0x108d01
movq %rbx, %rdi
movl $0x115c, %ecx           # imm = 0x115C
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq