// File: /workspace/github_c_makefile_star2_O2/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 0x9394f
cmpl $0x1, %edx
je 0x93890
testl %edx, %edx
jne 0x93cc2
movsd 0x1b8(%r14), %xmm0
mulsd %xmm3, %xmm0
addsd 0x1b0(%r14), %xmm0
movapd %xmm3, %xmm2
mulsd %xmm3, %xmm2
mulsd 0x52533(%rip), %xmm2    # 0xe5cb0
movsd %xmm2, 0x30(%rsp)
movsd 0x1c0(%r14), %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x52fa6(%rip), %xmm1    # 0xe6748
movapd %xmm3, %xmm0
movsd %xmm3, 0x8(%rsp)
callq 0x8650
divsd 0x52e97(%rip), %xmm0    # 0xe6650
mulsd 0x1c8(%r14), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x54c22(%rip), %xmm1    # 0xe83f8
movsd 0x8(%rsp), %xmm0
callq 0x8650
divsd 0x52edf(%rip), %xmm0    # 0xe66c8
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 0x52f0d(%rip), %xmm1    # 0xe6748
callq 0x8650
divsd 0x52e08(%rip), %xmm0    # 0xe6650
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 0x93946
movsd 0x1b0(%r14), %xmm0
movsd %xmm0, 0x30(%rsp)
movapd %xmm3, %xmm0
divsd 0x1b8(%r14), %xmm0
movsd %xmm3, 0x8(%rsp)
callq 0x86d0
addsd 0x519a1(%rip), %xmm0    # 0xe5260
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, (%r12)
movsd 0x1b0(%r14), %xmm0
xorpd 0x51954(%rip), %xmm0    # 0xe5230
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 0x51916(%rip), %xmm0    # 0xe5230
movsd 0x1b8(%r14), %xmm1
divsd %xmm1, %xmm0
divsd %xmm1, %xmm0
movapd %xmm0, 0x30(%rsp)
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
callq 0x86d0
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rbx)
jmp 0x93cbe
movsd 0x7b9b1(%rip), %xmm0    # 0x10f308
movsd %xmm0, 0x28(%rsp)
mulsd %xmm0, %xmm3
movapd %xmm3, %xmm0
callq 0x86a0
movsd 0x28(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x7b98e(%rip), %xmm1    # 0x10f310
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movsd 0x518cc(%rip), %xmm2    # 0xe5260
subsd %xmm0, %xmm2
movsd %xmm2, 0x18(%rsp)
movsd 0x5230a(%rip), %xmm1    # 0xe5cb0
movapd %xmm2, %xmm0
callq 0x8650
movsd %xmm0, 0x8(%rsp)
movsd 0x54a7b(%rip), %xmm1    # 0xe8438
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x8650
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
movsd 0x54a46(%rip), %xmm1    # 0xe8438
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x8650
movsd %xmm0, 0x10(%rsp)
movsd 0x54dbb(%rip), %xmm1    # 0xe87d0
movsd 0x18(%rsp), %xmm0
callq 0x8650
movsd 0x51860(%rip), %xmm1    # 0xe5288
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 0x82e0
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 0x7b863(%rip), %xmm3    # 0x10f318
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 0x54a0d(%rip), %xmm7    # 0xe8500
divsd 0x5607d(%rip), %xmm7    # 0xe9b78
divsd %xmm1, %xmm7
divsd %xmm1, %xmm7
mulsd %xmm0, %xmm7
movsd %xmm7, 0x20(%rsp)
movsd 0x548e3(%rip), %xmm1    # 0xe83f8
movapd %xmm4, %xmm0
callq 0x8650
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, (%r12)
movsd 0x1b0(%r14), %xmm1
mulsd 0x549c5(%rip), %xmm1    # 0xe8500
divsd 0x56035(%rip), %xmm1    # 0xe9b78
movsd 0x1b8(%r14), %xmm0
divsd %xmm0, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x54890(%rip), %xmm1    # 0xe83f8
callq 0x8650
movsd %xmm0, 0x40(%rsp)
movsd 0x48(%rsp), %xmm0
mulsd 0x54877(%rip), %xmm0    # 0xe83f8
movsd %xmm0, 0x20(%rsp)
movsd 0x30(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rsp)
movsd 0x52ba9(%rip), %xmm1    # 0xe6748
movsd 0x8(%rsp), %xmm0
callq 0x8650
mulsd 0x50(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
mulsd 0x28(%rsp), %xmm1
addsd %xmm0, %xmm1
mulsd 0x18(%rsp), %xmm1
movsd %xmm1, (%r15)
movsd 0x5492d(%rip), %xmm1    # 0xe8500
mulsd 0x1b0(%r14), %xmm1
divsd 0x55f94(%rip), %xmm1    # 0xe9b78
movsd 0x1b8(%r14), %xmm0
divsd %xmm0, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x547ef(%rip), %xmm1    # 0xe83f8
callq 0x8650
movsd %xmm0, 0x18(%rsp)
movsd 0x28(%rsp), %xmm0
mulsd 0x5480e(%rip), %xmm0    # 0xe8430
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x52b0c(%rip), %xmm1    # 0xe6748
callq 0x8650
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 0x52acb(%rip), %xmm1    # 0xe6748
callq 0x8650
mulsd 0x20(%rsp), %xmm0
movsd 0x48(%rsp), %xmm2
mulsd 0x6dd3a(%rip), %xmm2    # 0x1019d0
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 0x93d1e
leaq 0x7c5a5(%rip), %rsi     # 0x11026e
leaq 0x860(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x518a3(%rip), %rsi     # 0xe5585
leaq 0x60(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2e014
addq $0x32a, %r14            # imm = 0x32A
leaq 0x51332(%rip), %rsi     # 0xe5034
leaq 0x7c596(%rip), %rdx     # 0x11029f
movq %r14, %rdi
movl $0x43c, %ecx            # imm = 0x43C
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r14
popq %r15
retq