#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double const exp(double const);
void sheng_phi1_value(const double r, const double *p, double *f) {
  double y = r - p[4];
  double z = -p[3] * y * y;
  *f = p[0] * exp(-p[1] * r * r) + p[2] * exp(z);
}


x86 assembly (clang, -O0):
<sheng_phi1_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sheng_phi1_value>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm0,%xmm1
subsd  0x20(%rdi),%xmm1
movsd  0x18(%rdi),%xmm3
movapd 0xecd(%rip),%xmm2
xorpd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm3
movapd %xmm3,0x20(%rsp)
movsd  (%rdi),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x8(%rdi),%xmm1
xorpd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @sheng_phi1_value(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%9 = load double, double* %4
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 4
%12 = load double, double* %11
%13 = fsub double %9, %12
store double %13, double* %7
%14 = load double*, double** %5
%15 = getelementptr inbounds double, double* %14, i64 3
%16 = load double, double* %15
%17 = fneg double %16
%18 = load double, double* %7
%19 = fmul double %17, %18
%20 = load double, double* %7
%21 = fmul double %19, %20
store double %21, double* %8
%22 = load double*, double** %5
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = load double*, double** %5
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = fneg double %27
%29 = load double, double* %4
%30 = fmul double %28, %29
%31 = load double, double* %4
%32 = fmul double %30, %31
%33 = call double @exp(double %32)
%34 = load double*, double** %5
%35 = getelementptr inbounds double, double* %34, i64 2
%36 = load double, double* %35
%37 = load double, double* %8
%38 = call double @exp(double %37)
%39 = fmul double %36, %38
%40 = call double @llvm.fmuladd.f64(double %24, double %33, double %39)
%41 = load double*, double** %6
store double %40, double* %41
ret void
}

LLVM IR (-O2):
define void @sheng_phi1_value(double %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds double, double* %1, i64 4
%5 = load double, double* %4
%6 = fsub double %0, %5
%7 = getelementptr inbounds double, double* %1, i64 3
%8 = load double, double* %7
%9 = fneg double %8
%10 = fmul double %6, %9
%11 = fmul double %6, %10
%12 = load double, double* %1
%13 = getelementptr inbounds double, double* %1, i64 1
%14 = load double, double* %13
%15 = fneg double %14
%16 = fmul double %15, %0
%17 = fmul double %16, %0
%18 = tail call double @exp(double %17)
%19 = getelementptr inbounds double, double* %1, i64 2
%20 = load double, double* %19
%21 = tail call double @exp(double %11)
%22 = fmul double %20, %21
%23 = tail call double @llvm.fmuladd.f64(double %12, double %18, double %22)
store double %23, double* %2
ret void
}