#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);
double g6_eq45_grad(double r, double a, double c) {
  double r1 = 1.0 / r;
  double r2 = r1 * r1;
  double r4 = r2 * r2;
  double r6 = r4 * r2;
  double ar = a * r;
  double t = 1.0;
  double s = t;
  for (int m = 1; m <= 9; m++) {
    t *= (ar / m);
    s += t;
  }
  return c * r6 * ((6.0 * r1 * s + a * t) * exp(-ar) - 6.0 * r1);
}


x86 assembly (clang, -O0):
<g6_eq45_grad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xed1(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe83(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x54(%rbp)
cmpl   $0x9,-0x54(%rbp)
jg     11d2 <g6_eq45_grad+0xc2>
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x54(%rbp),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1193 <g6_eq45_grad+0x83>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe1f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x60(%rbp),%xmm0
movsd  0xdc8(%rip),%xmm2
mulsd  -0x20(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g6_eq45_grad>:
sub    $0x18,%rsp
movsd  0xee4(%rip),%xmm7
movapd %xmm7,%xmm6
divsd  %xmm0,%xmm6
mulsd  %xmm1,%xmm0
addsd  %xmm0,%xmm7
movsd  0xed4(%rip),%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm3,%xmm7
movapd %xmm0,%xmm4
divsd  0xec4(%rip),%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm4,%xmm7
movsd  0xebc(%rip),%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm3,%xmm7
movapd %xmm0,%xmm4
divsd  0xeac(%rip),%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm4,%xmm7
movsd  0xea3(%rip),%xmm8
movapd %xmm0,%xmm5
divsd  %xmm8,%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm5,%xmm7
movapd %xmm0,%xmm4
divsd  0xe8e(%rip),%xmm4
mulsd  %xmm5,%xmm4
addsd  %xmm4,%xmm7
movsd  0xe86(%rip),%xmm5
mulsd  %xmm0,%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm5,%xmm7
movapd %xmm0,%xmm4
divsd  0xe76(%rip),%xmm4
mulsd  %xmm5,%xmm4
addsd  %xmm4,%xmm7
movapd %xmm6,%xmm3
mulsd  %xmm6,%xmm3
movapd %xmm3,%xmm5
mulsd  %xmm3,%xmm5
mulsd  %xmm3,%xmm5
mulsd  %xmm2,%xmm5
movsd  %xmm5,0x10(%rsp)
mulsd  %xmm8,%xmm6
movsd  %xmm6,0x8(%rsp)
mulsd  %xmm1,%xmm4
mulsd  %xmm6,%xmm7
addsd  %xmm4,%xmm7
movsd  %xmm7,(%rsp)
xorpd  0xe3c(%rip),%xmm0
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @g6_eq45_grad(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%15 = load double, double* %4
%16 = fdiv double 1.000000e+00, %15
store double %16, double* %7
%17 = load double, double* %7
%18 = load double, double* %7
%19 = fmul double %17, %18
store double %19, double* %8
%20 = load double, double* %8
%21 = load double, double* %8
%22 = fmul double %20, %21
store double %22, double* %9
%23 = load double, double* %9
%24 = load double, double* %8
%25 = fmul double %23, %24
store double %25, double* %10
%26 = load double, double* %5
%27 = load double, double* %4
%28 = fmul double %26, %27
store double %28, double* %11
store double 1.000000e+00, double* %12
%29 = load double, double* %12
store double %29, double* %13
store i32 1, i32* %14
br label %30
30: ; preds = %43, %3
%31 = load i32, i32* %14
%32 = icmp sle i32 %31, 9
br i1 %32, label %33, label %46
33: ; preds = %30
%34 = load double, double* %11
%35 = load i32, i32* %14
%36 = sitofp i32 %35 to double
%37 = fdiv double %34, %36
%38 = load double, double* %12
%39 = fmul double %38, %37
store double %39, double* %12
%40 = load double, double* %12
%41 = load double, double* %13
%42 = fadd double %41, %40
store double %42, double* %13
br label %43
43: ; preds = %33
%44 = load i32, i32* %14
%45 = add nsw i32 %44, 1
store i32 %45, i32* %14
br label %30
46: ; preds = %30
%47 = load double, double* %6
%48 = load double, double* %10
%49 = fmul double %47, %48
%50 = load double, double* %7
%51 = fmul double 6.000000e+00, %50
%52 = load double, double* %13
%53 = load double, double* %5
%54 = load double, double* %12
%55 = fmul double %53, %54
%56 = call double @llvm.fmuladd.f64(double %51, double %52, double %55)
%57 = load double, double* %11
%58 = fneg double %57
%59 = call double @exp(double %58)
%60 = load double, double* %7
%61 = fmul double 6.000000e+00, %60
%62 = fneg double %61
%63 = call double @llvm.fmuladd.f64(double %56, double %59, double %62)
%64 = fmul double %49, %63
ret double %64
}

LLVM IR (-O2):
define double @g6_eq45_grad(double %0, double %1, double %2) {
%4 = fdiv double 1.000000e+00, %0
%5 = fmul double %0, %1
%6 = fadd double %5, 1.000000e+00
%7 = fmul double %5, 5.000000e-01
%8 = fmul double %5, %7
%9 = fadd double %6, %8
%10 = fdiv double %5, 3.000000e+00
%11 = fmul double %8, %10
%12 = fadd double %9, %11
%13 = fmul double %5, 2.500000e-01
%14 = fmul double %11, %13
%15 = fadd double %12, %14
%16 = fdiv double %5, 5.000000e+00
%17 = fmul double %14, %16
%18 = fadd double %15, %17
%19 = fdiv double %5, 6.000000e+00
%20 = fmul double %17, %19
%21 = fadd double %18, %20
%22 = fdiv double %5, 7.000000e+00
%23 = fmul double %20, %22
%24 = fadd double %21, %23
%25 = fmul double %5, 1.250000e-01
%26 = fmul double %23, %25
%27 = fadd double %24, %26
%28 = fdiv double %5, 9.000000e+00
%29 = fmul double %26, %28
%30 = fadd double %27, %29
%31 = fmul double %4, %4
%32 = fmul double %31, %31
%33 = fmul double %31, %32
%34 = fmul double %33, %2
%35 = fmul double %4, 6.000000e+00
%36 = fmul double %29, %1
%37 = tail call double @llvm.fmuladd.f64(double %35, double %30, double %36)
%38 = fneg double %5
%39 = tail call double @exp(double %38)
%40 = fneg double %35
%41 = tail call double @llvm.fmuladd.f64(double %37, double %39, double %40)
%42 = fmul double %34, %41
ret double %42
}