#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(int);
int pow(int, int);
double sumWeigtedInputs(int const, double const *, double const *);
double _gaussian(const int numInputs, const double *inputs,
                 const double *connectionWeights) {
  double weightedInputSum;
  double out;
  int centre = 0;
  int width = 1;
  weightedInputSum = sumWeigtedInputs(numInputs, inputs, connectionWeights);
  out = exp(-(pow(weightedInputSum - centre, 2)) / (2 * pow(width, 2)));
  return out;
}


x86 assembly (clang, -O0):
<_gaussian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <sumWeigtedInputs@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <exp@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gaussian>:
push   %rbx
call   1030 <sumWeigtedInputs@plt>
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
add    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
neg    %eax
mov    %eax,%edi
pop    %rbx
jmp    1040 <exp@plt>

LLVM IR (-O0):
define double @_gaussian(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %9
store i32 1, i32* %10
%11 = load i32, i32* %4
%12 = load double*, double** %5
%13 = load double*, double** %6
%14 = call double @sumWeigtedInputs(i32 %11, double* %12, double* %13)
store double %14, double* %7
%15 = load double, double* %7
%16 = load i32, i32* %9
%17 = sitofp i32 %16 to double
%18 = fsub double %15, %17
%19 = fptosi double %18 to i32
%20 = call i32 @pow(i32 %19, i32 2)
%21 = sub nsw i32 0, %20
%22 = load i32, i32* %10
%23 = call i32 @pow(i32 %22, i32 2)
%24 = mul nsw i32 2, %23
%25 = sdiv i32 %21, %24
%26 = call double @exp(i32 %25)
store double %26, double* %8
%27 = load double, double* %8
ret double %27
}

LLVM IR (-O2):
define double @_gaussian(i32 %0, double* %1, double* %2) {
%4 = tail call double @sumWeigtedInputs(i32 %0, double* %1, double* %2)
%5 = fptosi double %4 to i32
%6 = tail call i32 @pow(i32 %5, i32 2)
%7 = tail call i32 @pow(i32 1, i32 2)
%8 = shl nsw i32 %7, 1
%9 = sdiv i32 %6, %8
%10 = sub nsw i32 0, %9
%11 = tail call double @exp(i32 %10)
ret double %11
}