#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 gauss(float, double);
float meanGauss(float x, double sigma) {
  float z =
      (gauss(x, sigma) + gauss(x + 0.5, sigma) + gauss(x - 0.5, sigma)) / 3.0;
  z = z / (3.141593 * 2.0 * sigma * sigma);
  return z;
}


x86 assembly (clang, -O0):
<meanGauss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <gauss@plt>
movsd  %xmm0,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec9(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <gauss@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe95(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <gauss@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe67(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe41(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meanGauss>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movss  %xmm0,0x4(%rsp)
call   1030 <gauss@plt>
movsd  %xmm0,0x8(%rsp)
movss  0xecd(%rip),%xmm0
addss  0x4(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <gauss@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
addss  0xea6(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <gauss@plt>
addsd  0x8(%rsp),%xmm0
divsd  0xe91(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe89(%rip),%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @meanGauss(float %0, double %1) {
%3 = alloca float
%4 = alloca double
%5 = alloca float
store float %0, float* %3
store double %1, double* %4
%6 = load float, float* %3
%7 = load double, double* %4
%8 = call double @gauss(float %6, double %7)
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fadd double %10, 5.000000e-01
%12 = fptrunc double %11 to float
%13 = load double, double* %4
%14 = call double @gauss(float %12, double %13)
%15 = fadd double %8, %14
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = fsub double %17, 5.000000e-01
%19 = fptrunc double %18 to float
%20 = load double, double* %4
%21 = call double @gauss(float %19, double %20)
%22 = fadd double %15, %21
%23 = fdiv double %22, 3.000000e+00
%24 = fptrunc double %23 to float
store float %24, float* %5
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = load double, double* %4
%28 = fmul double 0x401921FB82C2BD7F, %27
%29 = load double, double* %4
%30 = fmul double %28, %29
%31 = fdiv double %26, %30
%32 = fptrunc double %31 to float
store float %32, float* %5
%33 = load float, float* %5
ret float %33
}

LLVM IR (-O2):
define float @meanGauss(float %0, double %1) {
%3 = tail call double @gauss(float %0, double %1)
%4 = fadd float %0, 5.000000e-01
%5 = tail call double @gauss(float %4, double %1)
%6 = fadd double %3, %5
%7 = fadd float %0, -5.000000e-01
%8 = tail call double @gauss(float %7, double %1)
%9 = fadd double %6, %8
%10 = fdiv double %9, 3.000000e+00
%11 = fptrunc double %10 to float
%12 = fpext float %11 to double
%13 = fmul double %1, 0x401921FB82C2BD7F
%14 = fmul double %13, %1
%15 = fdiv double %12, %14
%16 = fptrunc double %15 to float
ret float %16
}