// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x1048, %rsp           # imm = 0x1048
movq %rdi, 0x1038(%rsp)
movq %rsi, 0x1030(%rsp)
movq %rdx, 0x1028(%rsp)
movq %rcx, 0x1020(%rsp)
movl $0x0, 0x101c(%rsp)
movq 0x1028(%rsp), %rax
movq 0xf20(%rax), %rcx
movl 0x101c(%rsp), %eax
movq 0x1028(%rsp), %rdx
imull 0xf04(%rdx), %eax
movq 0x1028(%rsp), %rdx
addl 0xe84(%rdx), %eax
movslq %eax, %rdx
xorl %eax, %eax
movsd 0x10e986(%rip), %xmm0   # 0x1d2248
ucomisd (%rcx,%rdx,8), %xmm0
movb %al, 0xf(%rsp)
jbe 0xc38e9
movl 0x101c(%rsp), %eax
movq 0x1028(%rsp), %rcx
cmpl 0xf08(%rcx), %eax
setl %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0xc38f3
jmp 0xc3909
movl 0x101c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x101c(%rsp)
jmp 0xc3882
movq 0x1028(%rsp), %rax
movq 0xf10(%rax), %rax
movl 0x101c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x1028(%rsp), %rax
movq 0xf20(%rax), %rax
movl 0x101c(%rsp), %ecx
subl $0x1, %ecx
movq 0x1028(%rsp), %rdx
imull 0xf04(%rdx), %ecx
movq 0x1028(%rsp), %rdx
addl 0xe84(%rdx), %ecx
movslq %ecx, %rcx
movsd 0x10e8dd(%rip), %xmm0   # 0x1d2248
subsd (%rax,%rcx,8), %xmm0
movq 0x1028(%rsp), %rax
movq 0xf20(%rax), %rax
movl 0x101c(%rsp), %ecx
movq 0x1028(%rsp), %rdx
imull 0xf04(%rdx), %ecx
movq 0x1028(%rsp), %rdx
addl 0xe84(%rdx), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm2
movq 0x1028(%rsp), %rax
movq 0xf20(%rax), %rax
movl 0x101c(%rsp), %ecx
subl $0x1, %ecx
movq 0x1028(%rsp), %rdx
imull 0xf04(%rdx), %ecx
movq 0x1028(%rsp), %rdx
addl 0xe84(%rdx), %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm2
divsd %xmm2, %xmm0
movq 0x1028(%rsp), %rax
movq 0xf10(%rax), %rax
movslq 0x101c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq 0x1028(%rsp), %rax
movq 0xf10(%rax), %rax
movl 0x101c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x1028(%rsp), %rax
movsd %xmm0, 0xfa0(%rax)
movq 0x1030(%rsp), %rdi
movq 0x1028(%rsp), %rax
movsd 0xfa0(%rax), %xmm0
movq 0x1028(%rsp), %rsi
addq $0xfa8, %rsi            # imm = 0xFA8
callq 0x9ee00
cmpl $0x1, %eax
jne 0xc3ae0
leaq 0x810(%rsp), %rdi
movq 0x1030(%rsp), %rcx
addq $0xd1c, %rcx            # imm = 0xD1C
leaq 0x10e947(%rip), %rsi    # 0x1d23d8
leaq 0x132074(%rip), %rdx    # 0x1f5b0c
movb $0x0, %al
callq 0x5b9c0
movq 0x1028(%rsp), %rdi
addq $0x1064, %rdi           # imm = 0x1064
leaq 0x810(%rsp), %r8
leaq 0x10e577(%rip), %rsi    # 0x1d2034
leaq 0x132078(%rip), %rdx    # 0x1f5b3c
movl $0xf4b, %ecx            # imm = 0xF4B
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1044(%rsp)
jmp 0xc3bf0
movq 0x1030(%rsp), %rdi
movq 0x1028(%rsp), %rax
movsd 0xfa0(%rax), %xmm0
movq 0x1020(%rsp), %r8
movl $0x2, %esi
xorl %edx, %edx
leaq 0x1018(%rsp), %rcx
callq 0x9e4b0
cmpl $0x1, %eax
jne 0xc3b7d
leaq 0x10(%rsp), %rdi
movq 0x1030(%rsp), %rcx
addq $0xd1c, %rcx            # imm = 0xD1C
leaq 0x10e8a4(%rip), %rsi    # 0x1d23d8
leaq 0x13202a(%rip), %rdx    # 0x1f5b65
movb $0x0, %al
callq 0x5b9c0
movq 0x1028(%rsp), %rdi
addq $0x1064, %rdi           # imm = 0x1064
leaq 0x10(%rsp), %r8
leaq 0x10e4d7(%rip), %rsi    # 0x1d2034
leaq 0x131fd8(%rip), %rdx    # 0x1f5b3c
movl $0xf4f, %ecx            # imm = 0xF4F
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1044(%rsp)
jmp 0xc3bf0
movq 0x1020(%rsp), %rax
movq 0x1030(%rsp), %rcx
movslq 0x420(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1028(%rsp), %rax
movsd %xmm0, 0xfb8(%rax)
movq 0x1028(%rsp), %rax
movsd 0xfb8(%rax), %xmm0
movq 0x1028(%rsp), %rax
movsd 0x10e67f(%rip), %xmm1   # 0x1d2248
addsd 0xfa0(%rax), %xmm1
divsd %xmm1, %xmm0
movq 0x1028(%rsp), %rax
movsd %xmm0, 0xfb0(%rax)
movl $0x0, 0x1044(%rsp)
movl 0x1044(%rsp), %eax
addq $0x1048, %rsp           # imm = 0x1048
retq
nop