// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../source/thermodynamics.c
// Function: thermodynamics_calculate_drag_quantities
int thermodynamics_calculate_drag_quantities(
                                             struct precision* ppr,
                                             struct background * pba,
                                             struct thermodynamics* pth,
                                             double* pvecback
                                             ) {

  /** Summary: */

  /** Define local variables */
  int index_tau;
  int last_index_back;

  /** - find baryon drag time (when tau_d crosses one, using linear interpolation) and sound horizon at that time */
  index_tau=0;
  while ((pth->thermodynamics_table[(index_tau)*pth->th_size+pth->index_th_tau_d] < 1.) && (index_tau < pth->tt_size)) {
    index_tau++;
  }

  pth->z_d = pth->z_table[index_tau-1]+
    (1.-pth->thermodynamics_table[(index_tau-1)*pth->th_size+pth->index_th_tau_d])
    /(pth->thermodynamics_table[(index_tau)*pth->th_size+pth->index_th_tau_d]-pth->thermodynamics_table[(index_tau-1)*pth->th_size+pth->index_th_tau_d])
    *(pth->z_table[index_tau]-pth->z_table[index_tau-1]);

  class_call(background_tau_of_z(pba,pth->z_d,&(pth->tau_d)),
             pba->error_message,
             pth->error_message);

  class_call(background_at_z(pba,pth->z_d, long_info, inter_normal, &last_index_back, pvecback),
             pba->error_message,
             pth->error_message);

  pth->rs_d=pvecback[pba->index_bg_rs];
  pth->ds_d=pth->rs_d/(1.+pth->z_d);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r14
movq 0xf20(%rdx), %rax
movslq 0xf04(%rdx), %rdx
movslq 0xe84(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
xorl %esi, %esi
movsd 0x7ee66(%rip), %xmm1    # 0xf1260
ucomisd %xmm0, %xmm1
jbe 0x7243c
movl 0xf08(%rbx), %edi
xorl %esi, %esi
testl %edi, %edi
cmovgl %edi, %esi
jle 0x7243c
leaq (,%rdx,8), %r8
leaq (%r8,%rcx,8), %r9
addq %rax, %r9
xorl %edi, %edi
movsd (%r9), %xmm0
ucomisd %xmm0, %xmm1
jbe 0x72438
incq %rdi
addq %r8, %r9
cmpq %rdi, %rsi
jne 0x72420
jmp 0x7243c
incl %edi
movl %edi, %esi
movq 0xf10(%rbx), %rdi
movslq %esi, %r8
decl %esi
movsd -0x8(%rdi,%r8,8), %xmm2
imull %edx, %esi
addl %ecx, %esi
movslq %esi, %rcx
movsd (%rax,%rcx,8), %xmm3
subsd %xmm3, %xmm1
subsd %xmm3, %xmm0
divsd %xmm0, %xmm1
movl %r8d, %eax
movsd (%rdi,%rax,8), %xmm0
subsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0xfa0(%rbx)
leaq 0xfa8(%rbx), %rsi
movq %r14, %rdi
callq 0x5efb7
cmpl $0x1, %eax
jne 0x724de
addq $0xd1c, %r14            # imm = 0xD1C
leaq 0x7ef4a(%rip), %rsi     # 0xf13f0
leaq 0xa2716(%rip), %rdx     # 0x114bc3
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1064, %rbx           # imm = 0x1064
leaq 0x7eb67(%rip), %rsi     # 0xf1034
leaq 0xa271f(%rip), %rdx     # 0x114bf3
movq %rbx, %rdi
movl $0xf4b, %ecx            # imm = 0xF4B
jmp 0x72548
movsd 0xfa0(%rbx), %xmm0
xorl %ebp, %ebp
leaq 0xc(%rsp), %rcx
movq %r14, %rdi
movl $0x2, %esi
xorl %edx, %edx
movq %r15, %r8
callq 0x5ea8c
cmpl $0x1, %eax
jne 0x72559
addq $0xd1c, %r14            # imm = 0xD1C
leaq 0x7eede(%rip), %rsi     # 0xf13f0
leaq 0xa2703(%rip), %rdx     # 0x114c1c
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1064, %rbx           # imm = 0x1064
leaq 0x7eafb(%rip), %rsi     # 0xf1034
leaq 0xa26b3(%rip), %rdx     # 0x114bf3
movq %rbx, %rdi
movl $0xf4f, %ecx            # imm = 0xF4F
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
jmp 0x7258a
movslq 0x420(%r14), %rax
movsd (%r15,%rax,8), %xmm0
movsd %xmm0, 0xfb8(%rbx)
movsd 0xfa0(%rbx), %xmm1
addsd 0x7ece2(%rip), %xmm1    # 0xf1260
divsd %xmm1, %xmm0
movsd %xmm0, 0xfb0(%rbx)
movl %ebp, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r14
popq %r15
popq %rbp
retq