#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 chem_fast(double v_post, double v_pre, double *g, double *aux) {
  double e_syn;
  double v_f;
  double s_f;
  if (aux[1] > 0) {
    e_syn = aux[1] - aux[1] * 0.153846;
    v_f = aux[1] + aux[1] * 0.240;
  } else {
    e_syn = aux[1] + aux[1] * 0.153846;
    v_f = aux[1] - aux[1] * 0.240;
  }
  s_f = aux[3] * 0.2;
  return ((*g) * (v_post - e_syn)) / (1.0 + exp(s_f * (v_f - v_pre)));
}


x86 assembly (clang, -O0):
<chem_fast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11aa <chem_fast+0x9a>
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe97(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  0xe68(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    120f <chem_fast+0xff>
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  0xe44(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdfe(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movsd  0xdfd(%rip),%xmm0
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  0xda8(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chem_fast>:
push   %rax
movapd %xmm0,%xmm4
movsd  0x8(%rsi),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    113a <chem_fast+0x2a>
movsd  0xedc(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm2,%xmm0
jmp    1156 <chem_fast+0x46>
movsd  0xebe(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm2,%xmm3
movapd 0xede(%rip),%xmm0
xorpd  %xmm2,%xmm0
mulsd  0xeb2(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  0x18(%rsi),%xmm2
mulsd  0xea9(%rip),%xmm2
subsd  %xmm3,%xmm4
mulsd  (%rdi),%xmm4
movsd  %xmm4,(%rsp)
subsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
addsd  0xe8f(%rip),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @chem_fast(double %0, double %1, double* nocapture %2, double* nocapture %3) {
%5 = getelementptr inbounds double, double* %3, i64 1
%6 = load double, double* %5
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = fneg double %6
%10 = tail call double @llvm.fmuladd.f64(double %9, double 1.538460e-01, double %6)
br label %14
11: ; preds = %4
%12 = tail call double @llvm.fmuladd.f64(double %6, double 1.538460e-01, double %6)
%13 = fneg double %6
br label %14
14: ; preds = %11, %8
%15 = phi double [ %13, %11 ], [ %6, %8 ]
%16 = phi double [ %12, %11 ], [ %10, %8 ]
%17 = tail call double @llvm.fmuladd.f64(double %15, double 2.400000e-01, double %6)
%18 = getelementptr inbounds double, double* %3, i64 3
%19 = load double, double* %18
%20 = fmul double %19, 2.000000e-01
%21 = load double, double* %2
%22 = fsub double %0, %16
%23 = fmul double %22, %21
%24 = fsub double %17, %1
%25 = fmul double %24, %20
%26 = tail call double @exp(double %25)
%27 = fadd double %26, 1.000000e+00
%28 = fdiv double %23, %27
ret double %28
}