#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 dsquare(double const);
double const exp(double const);
void double_exp_value(const double r, const double *p, double *f) {
  *f = (p[0] * exp(-p[1] * dsquare(r - p[2])) + exp(-p[3] * (r - p[4])));
}


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

x86 assembly (clang, -O2):
<double_exp_value>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm0,%xmm1
movsd  %xmm0,0x18(%rsp)
movsd  (%rdi),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rdi),%xmm0
xorps  0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
subsd  0x10(%rdi),%xmm1
movapd %xmm1,%xmm0
call   1030 <dsquare@plt>
mulsd  (%rsp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,(%rsp)
movsd  0x18(%rbx),%xmm0
xorpd  0xe85(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
subsd  0x20(%rbx),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <exp@plt>
movsd  (%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

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