#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 */
float exp(double);
double pow(float, int);
float sqrt(double);
float calculate_gaussian_probability(float mean, float sigma, float x) {
  float value = exp(-(pow((mean - x), 2) / (pow(sigma, 2)) / 2.0)) /
                sqrt(2.0 * 3.141592654 * (pow(sigma, 2)));
  return value;
}


x86 assembly (clang, -O0):
<calculate_gaussian_probability>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe85(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe3e(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_gaussian_probability>:
sub    $0x18,%rsp
movss  %xmm1,0xc(%rsp)
subss  %xmm2,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  0xe90(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0xe71(%rip),%xmm0
call   1050 <sqrt@plt>
movss  0x10(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @calculate_gaussian_probability(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%8 = load float, float* %4
%9 = load float, float* %6
%10 = fsub float %8, %9
%11 = call double @pow(float %10, i32 2)
%12 = load float, float* %5
%13 = call double @pow(float %12, i32 2)
%14 = fdiv double %11, %13
%15 = fdiv double %14, 2.000000e+00
%16 = fneg double %15
%17 = call float @exp(double %16)
%18 = load float, float* %5
%19 = call double @pow(float %18, i32 2)
%20 = fmul double 0x401921FB54524550, %19
%21 = call float @sqrt(double %20)
%22 = fdiv float %17, %21
store float %22, float* %7
%23 = load float, float* %7
ret float %23
}

LLVM IR (-O2):
define float @calculate_gaussian_probability(float %0, float %1, float %2) {
%4 = fsub float %0, %2
%5 = tail call double @pow(float %4, i32 2)
%6 = tail call double @pow(float %1, i32 2)
%7 = fdiv double %5, %6
%8 = fmul double %7, -5.000000e-01
%9 = tail call float @exp(double %8)
%10 = tail call double @pow(float %1, i32 2)
%11 = fmul double %10, 0x401921FB54524550
%12 = tail call float @sqrt(double %11)
%13 = fdiv float %9, %12
ret float %13
}