// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x1058, %rsp           # imm = 0x1058
movq %rdi, 0x1048(%rsp)
movq %rsi, 0x1040(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x1038(%rsp)
movl $0x0, 0x1034(%rsp)
movq 0x1040(%rsp), %rax
movl 0x440(%rax), %eax
subl $0x1, %eax
movl %eax, 0x1030(%rsp)
movl $0x0, 0x102c(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x1010(%rsp)
movl 0x1030(%rsp), %eax
subl 0x1034(%rsp), %eax
cmpl $0x1, %eax
jle 0xa81a6
movl 0x1030(%rsp), %eax
addl 0x1034(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x12abaa(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x102c(%rsp)
movq 0x1040(%rsp), %rax
movq 0x460(%rax), %rax
movl 0x102c(%rsp), %ecx
movq 0x1040(%rsp), %rdx
imull 0x43c(%rdx), %ecx
movq 0x1040(%rsp), %rdx
addl 0x40c(%rdx), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1040(%rsp), %rax
movq 0x460(%rax), %rax
movl 0x102c(%rsp), %ecx
movq 0x1040(%rsp), %rdx
imull 0x43c(%rdx), %ecx
movq 0x1040(%rsp), %rdx
addl 0x404(%rdx), %ecx
movslq %ecx, %rcx
divsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1038(%rsp)
movsd 0x1038(%rsp), %xmm0
movsd 0x12a0cb(%rip), %xmm1   # 0x1d2248
ucomisd %xmm1, %xmm0
jbe 0xa8193
movl 0x102c(%rsp), %eax
movl %eax, 0x1030(%rsp)
jmp 0xa81a1
movl 0x102c(%rsp), %eax
movl %eax, 0x1034(%rsp)
jmp 0xa80ad
movq 0x1040(%rsp), %rax
movq 0x450(%rax), %rax
movslq 0x1034(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1020(%rsp)
movq 0x1040(%rsp), %rax
movq 0x450(%rax), %rax
movslq 0x1030(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1018(%rsp)
movq 0x1040(%rsp), %rax
movslq 0x43c(%rax), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x1008(%rsp)
cmpq $0x0, 0x1008(%rsp)
jne 0xa829a
movq 0x1040(%rsp), %rax
movslq 0x43c(%rax), %rax
shlq $0x3, %rax
movl %eax, 0x1004(%rsp)
leaq 0x800(%rsp), %rdi
movl 0x1004(%rsp), %ecx
leaq 0x129db9(%rip), %rsi    # 0x1d2004
leaq 0x151025(%rip), %rdx    # 0x1f9277
movb $0x0, %al
callq 0x5b9c0
movq 0x1040(%rsp), %rdi
addq $0xd1c, %rdi            # imm = 0xD1C
leaq 0x800(%rsp), %r8
leaq 0x129dbd(%rip), %rsi    # 0x1d2034
leaq 0x1489ff(%rip), %rdx    # 0x1f0c7d
movl $0xb74, %ecx            # imm = 0xB74
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1054(%rsp)
jmp 0xa8510
jmp 0xa829c
movsd 0x1018(%rsp), %xmm0
subsd 0x1020(%rsp), %xmm0
movq 0x1048(%rsp), %rax
ucomisd 0x58(%rax), %xmm0
jbe 0xa8403
movsd 0x1018(%rsp), %xmm1
addsd 0x1020(%rsp), %xmm1
movsd 0x12a9ad(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
movsd %xmm0, 0x1010(%rsp)
movq 0x1040(%rsp), %rdi
movsd 0x1010(%rsp), %xmm0
movq 0x1008(%rsp), %r8
movl $0x2, %esi
movl $0x1, %edx
leaq 0x1034(%rsp), %rcx
callq 0x9e9b0
cmpl $0x1, %eax
jne 0xa8380
movq %rsp, %rdi
movq 0x1040(%rsp), %rcx
addq $0xd1c, %rcx            # imm = 0xD1C
leaq 0x12a0a2(%rip), %rsi    # 0x1d23d8
leaq 0x148959(%rip), %rdx    # 0x1f0c96
movb $0x0, %al
callq 0x5b9c0
movq 0x1040(%rsp), %rdi
addq $0xd1c, %rdi            # imm = 0xD1C
movq %rsp, %r8
leaq 0x129cd7(%rip), %rsi    # 0x1d2034
leaq 0x148919(%rip), %rdx    # 0x1f0c7d
movl $0xb7c, %ecx            # imm = 0xB7C
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1054(%rsp)
jmp 0xa8510
movq 0x1008(%rsp), %rax
movq 0x1040(%rsp), %rcx
movslq 0x40c(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1008(%rsp), %rax
movq 0x1040(%rsp), %rcx
movslq 0x404(%rcx), %rcx
divsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1038(%rsp)
movsd 0x1038(%rsp), %xmm0
movsd 0x129e76(%rip), %xmm1   # 0x1d2248
ucomisd %xmm1, %xmm0
jbe 0xa83ec
movsd 0x1010(%rsp), %xmm0
movsd %xmm0, 0x1018(%rsp)
jmp 0xa83fe
movsd 0x1010(%rsp), %xmm0
movsd %xmm0, 0x1020(%rsp)
jmp 0xa829c
movq 0x1008(%rsp), %rax
movq 0x1040(%rsp), %rcx
movslq 0x380(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1040(%rsp), %rax
movsd %xmm0, 0x360(%rax)
movq 0x1008(%rsp), %rax
movq 0x1040(%rsp), %rcx
movslq 0x384(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1040(%rsp), %rax
movsd %xmm0, 0x368(%rax)
movq 0x1040(%rsp), %rax
movsd 0x129ddd(%rip), %xmm0   # 0x1d2248
divsd 0x360(%rax), %xmm0
movsd 0x129dcd(%rip), %xmm1   # 0x1d2248
subsd %xmm1, %xmm0
movq 0x1040(%rsp), %rax
movsd %xmm0, 0x370(%rax)
movsd 0x1010(%rsp), %xmm0
movq 0x1040(%rsp), %rax
movsd %xmm0, 0x378(%rax)
movq 0x1040(%rsp), %rax
movswl 0xd1a(%rax), %eax
cmpl $0x0, %eax
jle 0xa84f8
movq 0x1040(%rsp), %rax
movsd 0x370(%rax), %xmm0
leaq 0x148814(%rip), %rdi    # 0x1f0ce7
movb $0x1, %al
callq 0x8030
movq 0x1040(%rsp), %rax
movsd 0x378(%rax), %xmm0
leaq 0x14881f(%rip), %rdi    # 0x1f0d10
movb $0x1, %al
callq 0x8030
movq 0x1008(%rsp), %rdi
callq 0x8420
movl $0x0, 0x1054(%rsp)
movl 0x1054(%rsp), %eax
addq $0x1058, %rsp           # imm = 0x1058
retq
nop