// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../source/primordial.c
// Function: primordial_inflation_find_attractor
int primordial_inflation_find_attractor(
                                        struct primordial * ppm,
                                        struct precision * ppr,
                                        double phi_0,
                                        double precision,
                                        double * y,
                                        double * dy,
                                        double * H_0,
                                        double * dphidt_0
                                        ) {

  double V_0,dV_0,ddV_0;
  double V=0.,dV=0.,ddV=0.;
  double a;
  double dphidt,dphidt_0new,dphidt_0old,phi;
  int counter;

  /* we want a series of value of phi' in phi_0, obtained by
     integrating the system from earlier and earlier time. The first
     value iof the series is the slow-roll prediction phi' =
     -V'/3H. The following lines compute this value and initialize relevant quantities. */

  class_call(primordial_inflation_check_potential(ppm,phi_0,&V_0,&dV_0,&ddV_0),
             ppm->error_message,
             ppm->error_message);

  dphidt_0new = -dV_0/3./sqrt((8.*_PI_/3.)*V_0);
  phi = phi_0;
  counter = 0;

  dphidt_0old = dphidt_0new/(precision+2.); // this silly value just
                                            // ensures that the loop
                                            // below will be executed
                                            // at least once.

  /* loop over different values of phi, from which the background
     equations are integrated until phi_0 */

  while (fabs(dphidt_0new/dphidt_0old-1.) >= precision) {

    counter ++;
    class_test(counter >= ppr->primordial_inflation_attractor_maxit,
               ppm->error_message,
               "could not converge after %d iterations: there exists no attractor solution near phi=%g. Potential probably too steep in this region, or precision parameter primordial_inflation_attractor_precision=%g too small",
               counter,
               phi_0,
               precision);

    dphidt_0old = dphidt_0new;

    /* take one step in phi, corresponding roughly to adding one more
       e-fold of inflation */

    phi=phi+dV_0/V_0/16./_PI_;

    /* fix the initial phi' to the slow-roll prediction in that point,
       and initialize other relevant quantities */

    class_call(primordial_inflation_check_potential(ppm,phi,&V,&dV,&ddV),
               ppm->error_message,
               ppm->error_message);

    a = 1.;
    dphidt = -dV/3./sqrt((8.*_PI_/3.)*V);
    y[ppm->index_in_a]=a;
    y[ppm->index_in_phi]=phi;
    y[ppm->index_in_dphi]=a*dphidt;

    /* evolve the background equations until phi_0 is reached */

    class_call(primordial_inflation_evolve_background(ppm,
                                                      ppr,
                                                      y,
                                                      dy,
                                                      _phi_,
                                                      phi_0,
                                                      _TRUE_,
                                                      forward,
                                                      conformal),
               ppm->error_message,
               ppm->error_message);

    /* compute phi' in phi_0, this is the new point in the series
       which convergence we want to check */

    dphidt_0new = y[ppm->index_in_dphi]/y[ppm->index_in_a];

  }

  /* if we have converged and found the attractor, we take the last
     value of phi' in phi_0 to be the correct one for the attractor
     solution */

  *dphidt_0 = dphidt_0new;
  *H_0 = sqrt((8.*_PI_/3.)*(0.5*dphidt_0new*dphidt_0new+V_0));

  if (ppm->primordial_verbose > 1) {
    printf(" (attractor found in phi=%g with phi'=%g, H=%g)\n",phi_0,*dphidt_0,*H_0);
  }

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1088, %rsp           # imm = 0x1088
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r13
movsd %xmm1, 0x18(%rsp)
movq %rsi, %rbp
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, 0x48(%rsp)
movq %rax, 0x40(%rsp)
movq %rax, 0x60(%rsp)
leaq 0x70(%rsp), %rsi
leaq 0x68(%rsp), %rdx
leaq 0x78(%rsp), %rcx
movsd %xmm0, 0x8(%rsp)
callq 0x9e23a
testl %eax, %eax
je 0x9ca82
addq $0x32a, %rbx            # imm = 0x32A
leaq 0x549c3(%rip), %rsi     # 0xf13f0
leaq 0x80406(%rip), %rdx     # 0x11ce3a
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x545e4(%rip), %rsi     # 0xf1034
leaq 0x80425(%rip), %rdx     # 0x11ce7c
movq %rbx, %rdi
movl $0x7ab, %ecx            # imm = 0x7AB
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
movl %ebp, %eax
addq $0x1088, %rsp           # imm = 0x1088
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movapd %xmm0, %xmm3
divsd 0x579d6(%rip), %xmm3    # 0xf4470
movsd 0x70(%rsp), %xmm1
movsd 0x7e9a0(%rip), %xmm0    # 0x11b448
movsd %xmm1, 0x38(%rsp)
mulsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x9cac2
sqrtsd %xmm0, %xmm0
jmp 0x9cad3
movsd %xmm3, 0x20(%rsp)
callq 0x82b0
movsd 0x20(%rsp), %xmm3
movsd 0x18(%rsp), %xmm1
movq %r15, 0x30(%rsp)
movq %r14, 0x50(%rsp)
divsd %xmm0, %xmm3
movsd 0x55211(%rip), %xmm0    # 0xf1d00
addsd %xmm1, %xmm0
movapd %xmm3, %xmm2
divsd %xmm0, %xmm2
movapd %xmm3, %xmm0
divsd %xmm2, %xmm0
addsd 0x54cdd(%rip), %xmm0    # 0xf17e8
andpd 0x5472d(%rip), %xmm0    # 0xf1240
ucomisd %xmm1, %xmm0
jae 0x9cb5f
movapd %xmm3, %xmm2
movsd 0x551ab(%rip), %xmm0    # 0xf1cd0
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm0
addsd 0x38(%rsp), %xmm0
mulsd 0x7e90d(%rip), %xmm0    # 0x11b448
movq 0x50(%rsp), %r14
movsd %xmm2, (%r14)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x9ccdc
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0x9cce5
movsd 0x10(%rsp), %xmm0
divsd 0x38(%rsp), %xmm0
mulsd 0x7e8c5(%rip), %xmm0    # 0x11b438
divsd 0x5744d(%rip), %xmm0    # 0xf3fc8
movsd %xmm0, 0x10(%rsp)
movl $0x1, %r15d
leaq 0x60(%rsp), %r14
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
cmpl 0x6c8(%rbp), %r15d
jge 0x9cd1c
movsd %xmm3, 0x20(%rsp)
movsd 0x28(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
movsd %xmm0, 0x28(%rsp)
leaq 0x48(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %r14, %rcx
callq 0x9e23a
testl %eax, %eax
jne 0x9cd86
movsd 0x40(%rsp), %xmm2
divsd 0x57888(%rip), %xmm2    # 0xf4470
movsd 0x48(%rsp), %xmm0
mulsd 0x7e852(%rip), %xmm0    # 0x11b448
ucomisd 0x5465a(%rip), %xmm0    # 0xf1258
jb 0x9cc06
sqrtsd %xmm0, %xmm0
jmp 0x9cc17
movsd %xmm2, 0x58(%rsp)
callq 0x82b0
movsd 0x58(%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm2
movslq 0x2d0(%rbx), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, (%r13,%rax,8)
movslq 0x2d4(%rbx), %rax
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%r13,%rax,8)
movslq 0x2d8(%rbx), %rax
movsd %xmm2, (%r13,%rax,8)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
movl $0x1, %r8d
movapd %xmm1, %xmm0
movl $0x1, %r9d
pushq $0x0
pushq $0x1
callq 0x9cf0c
addq $0x10, %rsp
testl %eax, %eax
jne 0x9cdcb
movslq 0x2d8(%rbx), %rax
movsd (%r13,%rax,8), %xmm2
movslq 0x2d0(%rbx), %rax
divsd (%r13,%rax,8), %xmm2
movapd %xmm2, %xmm0
divsd 0x20(%rsp), %xmm0
addsd 0x54b30(%rip), %xmm0    # 0xf17e8
andpd 0x54580(%rip), %xmm0    # 0xf1240
incl %r15d
movsd 0x18(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movapd %xmm2, %xmm3
jae 0x9cb98
jmp 0x9cb1d
callq 0x82b0
movapd %xmm0, %xmm2
movq 0x30(%rsp), %rax
movsd %xmm2, (%rax)
xorl %ebp, %ebp
cmpw $0x2, 0x328(%rbx)
jl 0x9ca6e
movsd (%r14), %xmm1
leaq 0x80334(%rip), %rdi     # 0x11d03e
movsd 0x8(%rsp), %xmm0
movb $0x3, %al
callq 0x8030
jmp 0x9ca6e
leaq 0x8017d(%rip), %rsi     # 0x11cea0
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movsd 0x8(%rsp), %xmm0
movb $0x2, %al
callq 0x30c2c
leaq 0x5433d(%rip), %rsi     # 0xf1082
leaq 0x80226(%rip), %rdx     # 0x11cf72
leaq 0x880(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x32a, %rbx            # imm = 0x32A
leaq 0x542c5(%rip), %rsi     # 0xf1034
leaq 0x80106(%rip), %rdx     # 0x11ce7c
movq %rbx, %rdi
movl $0x7c1, %ecx            # imm = 0x7C1
movq %r15, %r8
jmp 0x9ca62
addq $0x32a, %rbx            # imm = 0x32A
leaq 0x5465c(%rip), %rsi     # 0xf13f0
leaq 0x8020c(%rip), %rdx     # 0x11cfa7
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x5427d(%rip), %rsi     # 0xf1034
leaq 0x800be(%rip), %rdx     # 0x11ce7c
movq %rbx, %rdi
movl $0x7cf, %ecx            # imm = 0x7CF
jmp 0x9ca5f
addq $0x32a, %rbx            # imm = 0x32A
leaq 0x54617(%rip), %rsi     # 0xf13f0
leaq 0x80201(%rip), %rdx     # 0x11cfe1
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x54238(%rip), %rsi     # 0xf1034
leaq 0x80079(%rip), %rdx     # 0x11ce7c
movq %rbx, %rdi
movl $0x7e3, %ecx            # imm = 0x7E3
jmp 0x9ca5f