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


x86 assembly (clang, -O0):
<double_morse_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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  0xec2(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xe3b(%rip),%xmm0
mulsd  0x20(%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x28(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x28(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x38(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movaps %xmm0,%xmm4
movsd  -0x20(%rbp),%xmm0
addsd  %xmm4,%xmm4
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  0x30(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_morse_value>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x18(%rsp)
movsd  (%rdi),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rdi),%xmm1
mulsd  0xec6(%rip),%xmm1
subsd  0x10(%rdi),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rbx),%xmm1
xorpd  0xeb5(%rip),%xmm1
movsd  0x18(%rsp),%xmm0
subsd  0x10(%rbx),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
addsd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xe6f(%rip),%xmm1
mulsd  0x20(%rbx),%xmm1
movsd  0x18(%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
subsd  0x28(%rbx),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x20(%rbx),%xmm0
xorpd  0xe48(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
subsd  0x28(%rbx),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
addsd  %xmm0,%xmm0
movsd  0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
addsd  0x30(%rbx),%xmm1
movsd  %xmm1,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @double_morse_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 = fmul double -2.000000e+00, %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 = fmul double %13, %18
%20 = call double @exp(double %19)
%21 = load double*, double** %5
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = fneg double %23
%25 = load double, double* %4
%26 = load double*, double** %5
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = fsub double %25, %28
%30 = fmul double %24, %29
%31 = call double @exp(double %30)
%32 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %31, double %20)
%33 = load double*, double** %5
%34 = getelementptr inbounds double, double* %33, i64 3
%35 = load double, double* %34
%36 = load double*, double** %5
%37 = getelementptr inbounds double, double* %36, i64 4
%38 = load double, double* %37
%39 = fmul double -2.000000e+00, %38
%40 = load double, double* %4
%41 = load double*, double** %5
%42 = getelementptr inbounds double, double* %41, i64 5
%43 = load double, double* %42
%44 = fsub double %40, %43
%45 = fmul double %39, %44
%46 = call double @exp(double %45)
%47 = load double*, double** %5
%48 = getelementptr inbounds double, double* %47, i64 4
%49 = load double, double* %48
%50 = fneg double %49
%51 = load double, double* %4
%52 = load double*, double** %5
%53 = getelementptr inbounds double, double* %52, i64 5
%54 = load double, double* %53
%55 = fsub double %51, %54
%56 = fmul double %50, %55
%57 = call double @exp(double %56)
%58 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %57, double %46)
%59 = fmul double %35, %58
%60 = call double @llvm.fmuladd.f64(double %9, double %32, double %59)
%61 = load double*, double** %5
%62 = getelementptr inbounds double, double* %61, i64 6
%63 = load double, double* %62
%64 = fadd double %60, %63
%65 = load double*, double** %6
store double %64, double* %65
ret void
}

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