// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../source/primordial.c
// Function: primordial_inflation_potential
int primordial_inflation_potential(
                                   struct primordial * ppm,
                                   double phi,
                                   double * V,
                                   double * dV,
                                   double * ddV
                                   ) {

  double e,de,dde,mu,dmu,ddmu,l,dl,ddl,p,dp,ddp;

  switch (ppm->potential) {

    /* V(phi)=polynomial in phi */
  case polynomial:

    *V   = ppm->V0+phi*ppm->V1+pow(phi,2)/2.*ppm->V2+pow(phi,3)/6.*ppm->V3+pow(phi,4)/24.*ppm->V4;
    *dV  = ppm->V1+phi*ppm->V2+pow(phi,2)/2.*ppm->V3+pow(phi,3)/6.*ppm->V4;
    *ddV = ppm->V2+phi*ppm->V3+pow(phi,2)/2.*ppm->V4;
    break;

    /* V(phi) = Lambda^4(1+cos(phi/f)) = V0 (1+cos(phi/V1)) */
  case natural:

    *V   = ppm->V0*(1.+cos(phi/ppm->V1));
    *dV  = -ppm->V0/ppm->V1*sin(phi/ppm->V1);
    *ddV = -ppm->V0/ppm->V1/ppm->V1*cos(phi/ppm->V1);
    break;

    /* Higgs inflation from arXiv:1403.6078 */
  case higgs_inflation:

    // correspondence with 1403.6078:
    // V0 = b
    // V1 = ksi
    // V2 = kappa
    // V3 = delta_lambda
    // mu = bar(mu)/M_P
    // phi = -chi/M_P

    e = exp(2./sqrt(6.)*sqrt(8.*_PI_)*phi);
    de = 2./sqrt(6.)*sqrt(8.*_PI_)*e;
    dde = 2./3. * 8.*_PI_ * e;

    mu = pow(1.-e,0.5);
    dmu = -0.5*de*pow(1.-e,-0.5);
    ddmu = -0.5*dde*pow(1.-e,-0.5)-0.25*de*de*pow(1.-e,-1.5);

    l = log(mu/ppm->V2);
    dl = dmu/mu;
    ddl = ddmu/mu - dl*dl;

    p = 1./16. + ppm->V3/ppm->V0 + l*l;
    dp = 2.*dl*l;
    ddp = 2.*ddl*l+2.*dl*dl;

    *V = ppm->V0/4./pow(8.*_PI_,2)/ppm->V1/ppm->V1*p*pow(mu,4);
    *dV = ppm->V0/4./pow(8.*_PI_,2)/ppm->V1/ppm->V1*(dp*pow(mu,4)+4.*p*dmu*pow(mu,3));
    *ddV = ppm->V0/4./pow(8.*_PI_,2)/ppm->V1/ppm->V1*(ddp*pow(mu,4)+8.*dp*dmu*pow(mu,3)+4.*p*ddmu*pow(mu,3)+12.*p*pow(dmu*mu,2));

    //fprintf(stderr,"%e  %e  %e\n",*V,p,mu);

    break;

    /* code here other shapes */

  default:
    class_stop(ppm->error_message,"ppm->potential=%d different from all known cases",ppm->potential);
    break;
  }

  return _SUCCESS_;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1068, %rsp           # imm = 0x1068
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movapd %xmm0, %xmm3
movq %rdi, %r14
movl 0x1a8(%rdi), %edx
cmpl $0x2, %edx
je 0x98650
cmpl $0x1, %edx
je 0x98591
testl %edx, %edx
jne 0x989c3
movsd 0x1b8(%r14), %xmm0
mulsd %xmm3, %xmm0
addsd 0x1b0(%r14), %xmm0
movapd %xmm3, %xmm2
mulsd %xmm3, %xmm2
mulsd 0x56852(%rip), %xmm2    # 0xeecd0
movsd %xmm2, 0x30(%rsp)
movsd 0x1c0(%r14), %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x571dd(%rip), %xmm1    # 0xef680
movapd %xmm3, %xmm0
movsd %xmm3, 0x8(%rsp)
callq 0x8620
divsd 0x571b6(%rip), %xmm0    # 0xef670
mulsd 0x1c8(%r14), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x58f61(%rip), %xmm1    # 0xf1438
movsd 0x8(%rsp), %xmm0
callq 0x8620
divsd 0x57206(%rip), %xmm0    # 0xef6f0
mulsd 0x1d0(%r14), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, (%r12)
movsd 0x1c0(%r14), %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm0, %xmm1
addsd 0x1b8(%r14), %xmm1
movsd 0x1c8(%r14), %xmm2
mulsd 0x30(%rsp), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x10(%rsp)
movsd 0x57144(%rip), %xmm1    # 0xef680
callq 0x8620
divsd 0x57127(%rip), %xmm0    # 0xef670
mulsd 0x1d0(%r14), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, (%r15)
movsd 0x8(%rsp), %xmm0
mulsd 0x1c8(%r14), %xmm0
addsd 0x1c0(%r14), %xmm0
movapd %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
mulsd 0x1d0(%r14), %xmm0
addsd %xmm1, %xmm0
jmp 0x98647
movsd 0x1b0(%r14), %xmm0
movsd %xmm0, 0x30(%rsp)
movapd %xmm3, %xmm0
divsd 0x1b8(%r14), %xmm0
movsd %xmm3, 0x8(%rsp)
callq 0x86a0
addsd 0x55ca0(%rip), %xmm0    # 0xee260
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, (%r12)
movsd 0x1b0(%r14), %xmm0
xorpd 0x55c53(%rip), %xmm0    # 0xee230
movsd 0x1b8(%r14), %xmm1
divsd %xmm1, %xmm0
movapd %xmm0, 0x30(%rsp)
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
callq 0x80a0
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, (%r15)
movsd 0x1b0(%r14), %xmm0
xorpd 0x55c15(%rip), %xmm0    # 0xee230
movsd 0x1b8(%r14), %xmm1
divsd %xmm1, %xmm0
divsd %xmm1, %xmm0
movapd %xmm0, 0x30(%rsp)
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
callq 0x86a0
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rbx)
jmp 0x989bf
movsd 0x7fe10(%rip), %xmm0    # 0x118468
movsd %xmm0, 0x28(%rsp)
mulsd %xmm0, %xmm3
movapd %xmm3, %xmm0
callq 0x8670
movsd 0x28(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x7fded(%rip), %xmm1    # 0x118470
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movsd 0x55bcb(%rip), %xmm2    # 0xee260
subsd %xmm0, %xmm2
movsd %xmm2, 0x18(%rsp)
movsd 0x56629(%rip), %xmm1    # 0xeecd0
movapd %xmm2, %xmm0
callq 0x8620
movsd %xmm0, 0x8(%rsp)
movsd 0x58dba(%rip), %xmm1    # 0xf1478
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x8620
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
movsd 0x58d85(%rip), %xmm1    # 0xf1478
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x8620
movsd %xmm0, 0x10(%rsp)
movsd 0x5913a(%rip), %xmm1    # 0xf1850
movsd 0x18(%rsp), %xmm0
callq 0x8620
movsd 0x55b5f(%rip), %xmm1    # 0xee288
movsd 0x28(%rsp), %xmm2
mulsd %xmm2, %xmm1
mulsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
divsd 0x1c0(%r14), %xmm0
callq 0x82c0
movsd 0x30(%rsp), %xmm2
movsd 0x8(%rsp), %xmm4
divsd %xmm4, %xmm2
movsd 0x10(%rsp), %xmm3
divsd %xmm4, %xmm3
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm3
movapd %xmm3, %xmm5
movsd 0x1c8(%r14), %xmm3
movsd 0x1b0(%r14), %xmm7
movsd 0x1b8(%r14), %xmm1
divsd %xmm7, %xmm3
addsd 0x7fcc2(%rip), %xmm3    # 0x118478
movapd %xmm2, %xmm6
addsd %xmm2, %xmm6
addsd %xmm5, %xmm5
mulsd %xmm6, %xmm2
mulsd %xmm0, %xmm6
movsd %xmm6, 0x28(%rsp)
mulsd %xmm0, %xmm5
mulsd %xmm0, %xmm0
addsd %xmm3, %xmm0
movsd %xmm0, 0x48(%rsp)
addsd %xmm2, %xmm5
movsd %xmm5, 0x58(%rsp)
mulsd 0x58d8c(%rip), %xmm7    # 0xf1580
divsd 0x5a4b4(%rip), %xmm7    # 0xf2cb0
divsd %xmm1, %xmm7
divsd %xmm1, %xmm7
mulsd %xmm0, %xmm7
movsd %xmm7, 0x20(%rsp)
movsd 0x58c22(%rip), %xmm1    # 0xf1438
movapd %xmm4, %xmm0
callq 0x8620
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, (%r12)
movsd 0x1b0(%r14), %xmm1
mulsd 0x58d44(%rip), %xmm1    # 0xf1580
divsd 0x5a46c(%rip), %xmm1    # 0xf2cb0
movsd 0x1b8(%r14), %xmm0
divsd %xmm0, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x58bcf(%rip), %xmm1    # 0xf1438
callq 0x8620
movsd %xmm0, 0x40(%rsp)
movsd 0x48(%rsp), %xmm0
mulsd 0x58bb6(%rip), %xmm0    # 0xf1438
movsd %xmm0, 0x20(%rsp)
movsd 0x30(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rsp)
movsd 0x56de0(%rip), %xmm1    # 0xef680
movsd 0x8(%rsp), %xmm0
callq 0x8620
mulsd 0x50(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
mulsd 0x28(%rsp), %xmm1
addsd %xmm0, %xmm1
mulsd 0x18(%rsp), %xmm1
movsd %xmm1, (%r15)
movsd 0x58cac(%rip), %xmm1    # 0xf1580
mulsd 0x1b0(%r14), %xmm1
divsd 0x5a3cb(%rip), %xmm1    # 0xf2cb0
movsd 0x1b8(%r14), %xmm0
divsd %xmm0, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x58b2e(%rip), %xmm1    # 0xf1438
callq 0x8620
movsd %xmm0, 0x18(%rsp)
movsd 0x28(%rsp), %xmm0
mulsd 0x58b4d(%rip), %xmm0    # 0xf1470
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x56d43(%rip), %xmm1    # 0xef680
callq 0x8620
mulsd 0x28(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
mulsd 0x58(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x20(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x56d02(%rip), %xmm1    # 0xef680
callq 0x8620
mulsd 0x20(%rsp), %xmm0
movsd 0x48(%rsp), %xmm2
mulsd 0x72161(%rip), %xmm2    # 0x10aaf8
addsd 0x18(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
mulsd 0x40(%rsp), %xmm1
movsd %xmm1, (%rbx)
xorl %eax, %eax
jmp 0x98a21
leaq 0x80a04(%rip), %rsi     # 0x1193ce
leaq 0x860(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0x55ba2(%rip), %rsi     # 0xee585
leaq 0x60(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x30af0
addq $0x32a, %r14            # imm = 0x32A
leaq 0x55631(%rip), %rsi     # 0xee034
leaq 0x809f5(%rip), %rdx     # 0x1193ff
movq %r14, %rdi
movl $0x43c, %ecx            # imm = 0x43C
movq %r15, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r14
popq %r15
retq