#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 ms_value(const double r, const double *p, double *f) {
  double x = 1.0 - r / p[2];
  *f = p[0] * (exp(p[1] * x) - 2.0 * exp((p[1] * x) / 2.0));
}


x86 assembly (clang, -O0):
<ms_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
mov    -0x10(%rbp),%rax
divsd  0x10(%rax),%xmm1
movsd  0xecd(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ms_value>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
divsd  0x10(%rdi),%xmm0
movsd  0xed6(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rdi),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rdi),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mulsd  0x8(%rbx),%xmm0
mulsd  0xea5(%rip),%xmm0
call   1030 <exp@plt>
addsd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @ms_value(double %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds double, double* %1, i64 2
%5 = load double, double* %4
%6 = fdiv double %0, %5
%7 = fsub double 1.000000e+00, %6
%8 = load double, double* %1
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = fmul double %10, %7
%12 = tail call double @exp(double %11)
%13 = load double, double* %9
%14 = fmul double %7, %13
%15 = fmul double %14, 5.000000e-01
%16 = tail call double @exp(double %15)
%17 = tail call double @llvm.fmuladd.f64(double %16, double -2.000000e+00, double %12)
%18 = fmul double %8, %17
store double %18, double* %2
ret void
}