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

  double Omega_m_over_Omega_r=0.;
  int index_tau_minus = 0;
  int index_tau_plus = pba->bt_size-1;
  int index_tau_mid = 0;
  double tau_minus,tau_plus,tau_mid=0.;
  double * pvecback;

  /* first bracket the right tau value between two consecutive indices in the table */

  while ((index_tau_plus - index_tau_minus) > 1) {

    index_tau_mid = (int)(0.5*(index_tau_plus+index_tau_minus));

    Omega_m_over_Omega_r = pba->background_table[index_tau_mid*pba->bg_size+pba->index_bg_Omega_m]
      /pba->background_table[index_tau_mid*pba->bg_size+pba->index_bg_Omega_r];

    if (Omega_m_over_Omega_r > 1)
      index_tau_plus = index_tau_mid;
    else
      index_tau_minus = index_tau_mid;

  }

  /* then get a better estimate within this range */

  tau_minus = pba->tau_table[index_tau_minus];
  tau_plus =  pba->tau_table[index_tau_plus];

  class_alloc(pvecback,pba->bg_size*sizeof(double),pba->error_message);

  while ((tau_plus - tau_minus) > ppr->tol_tau_eq) {

    tau_mid = 0.5*(tau_plus+tau_minus);

    class_call(background_at_tau(pba,tau_mid,long_info,inter_closeby,&index_tau_minus,pvecback),
               pba->error_message,
               pba->error_message);

    Omega_m_over_Omega_r = pvecback[pba->index_bg_Omega_m]/pvecback[pba->index_bg_Omega_r];

    if (Omega_m_over_Omega_r > 1)
      tau_plus = tau_mid;
    else
      tau_minus = tau_mid;

  }

  pba->a_eq = pvecback[pba->index_bg_a];
  pba->H_eq = pvecback[pba->index_bg_H];
  pba->z_eq = 1./pba->a_eq -1.;
  pba->tau_eq = tau_mid;

  if (pba->background_verbose > 0) {
    printf(" -> radiation/matter equality at z = %f\n",pba->z_eq);
    printf("    corresponding to conformal time = %f Mpc\n",pba->tau_eq);
  }

  free(pvecback);

  return _SUCCESS_;

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movq %rsi, %rbx
movq %rdi, %r14
movl $0x0, 0x4(%rsp)
movl 0x440(%rsi), %edx
leal -0x1(%rdx), %eax
xorl %ecx, %ecx
cmpl $0x3, %edx
jl 0x63e4d
movq 0x460(%rbx), %rdx
movslq 0x43c(%rbx), %rsi
movslq 0x40c(%rbx), %rdi
movslq 0x404(%rbx), %r8
xorl %ecx, %ecx
movsd 0x8ded7(%rip), %xmm0    # 0xf1cd0
movsd 0x8d45f(%rip), %xmm1    # 0xf1260
leal (%rcx,%rax), %r9d
xorps %xmm2, %xmm2
cvtsi2sd %r9d, %xmm2
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %r9d
movslq %r9d, %r10
imulq %rsi, %r10
leaq (%r10,%rdi), %r11
movsd (%rdx,%r11,8), %xmm2
movslq %r10d, %r10
addq %r8, %r10
divsd (%rdx,%r10,8), %xmm2
ucomisd %xmm1, %xmm2
ja 0x63e3e
movl %r9d, %ecx
jmp 0x63e41
movl %r9d, %eax
movl %eax, %r9d
subl %ecx, %r9d
cmpl $0x1, %r9d
jg 0x63e01
movl %ecx, 0x4(%rsp)
movq 0x450(%rbx), %rdx
movslq %ecx, %rcx
movsd (%rdx,%rcx,8), %xmm0
movaps %xmm0, 0x10(%rsp)
cltq
movsd (%rdx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0x43c(%rbx), %r12
leaq (,%r12,8), %rdi
callq 0x8460
testq %rax, %rax
je 0x63fef
movq %rax, %r15
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm0
movapd 0x10(%rsp), %xmm3
subsd %xmm3, %xmm0
xorpd %xmm4, %xmm4
ucomisd 0x58(%r14), %xmm0
jbe 0x63f64
movapd %xmm1, %xmm0
leaq 0x4(%rsp), %r12
movapd %xmm3, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
addsd %xmm0, %xmm3
mulsd 0x8ddf9(%rip), %xmm3    # 0xf1cd0
movq %rbx, %rdi
movapd %xmm3, 0x20(%rsp)
movapd %xmm3, %xmm0
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rcx
movq %r15, %r8
callq 0x5ed53
testl %eax, %eax
jne 0x64032
movslq 0x40c(%rbx), %rax
movsd (%r15,%rax,8), %xmm1
movslq 0x404(%rbx), %rax
divsd (%r15,%rax,8), %xmm1
movsd 0x8d33d(%rip), %xmm2    # 0xf1260
ucomisd %xmm2, %xmm1
movapd 0x20(%rsp), %xmm4
movapd %xmm4, %xmm0
ja 0x63f39
movsd 0x8(%rsp), %xmm0
cmpltsd %xmm1, %xmm2
movapd 0x10(%rsp), %xmm3
andpd %xmm2, %xmm3
andnpd %xmm4, %xmm2
orpd %xmm2, %xmm3
movapd %xmm0, %xmm1
subsd %xmm3, %xmm1
ucomisd 0x58(%r14), %xmm1
ja 0x63ebf
movslq 0x380(%rbx), %rax
movsd (%r15,%rax,8), %xmm1
movsd %xmm1, 0x360(%rbx)
movslq 0x384(%rbx), %rax
movsd (%r15,%rax,8), %xmm0
movsd %xmm0, 0x368(%rbx)
movsd 0x8d2ca(%rip), %xmm0    # 0xf1260
divsd %xmm1, %xmm0
addsd 0x8d846(%rip), %xmm0    # 0xf17e8
movsd %xmm0, 0x370(%rbx)
movsd %xmm4, 0x378(%rbx)
cmpw $0x0, 0xd1a(%rbx)
jle 0x63fe0
leaq 0xabe71(%rip), %rdi     # 0x10fe34
movb $0x1, %al
callq 0x8030
movsd 0x378(%rbx), %xmm0
leaq 0xabe84(%rip), %rdi     # 0x10fe5d
movb $0x1, %al
callq 0x8030
movq %r15, %rdi
callq 0x8410
xorl %eax, %eax
jmp 0x6407e
shll $0x3, %r12d
leaq 0x8d00a(%rip), %rsi     # 0xf1004
leaq 0xb4251(%rip), %rdx     # 0x118252
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0xd1c, %rbx            # imm = 0xD1C
leaq 0x8d013(%rip), %rsi     # 0xf1034
leaq 0xabda2(%rip), %rdx     # 0x10fdca
movq %rbx, %rdi
movl $0xb74, %ecx            # imm = 0xB74
jmp 0x6406f
addq $0xd1c, %rbx            # imm = 0xD1C
leaq 0x8d3b0(%rip), %rsi     # 0xf13f0
leaq 0xabd9c(%rip), %rdx     # 0x10fde3
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x8cfd4(%rip), %rsi     # 0xf1034
leaq 0xabd63(%rip), %rdx     # 0x10fdca
movq %rbx, %rdi
movl $0xb7c, %ecx            # imm = 0xB7C
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r14
popq %r15
retq