void dspl_win_gaussian(double *w, double alpha, int n, int win_type) {
  double x = 0.0;
  double y;
  double sigma;
  int i;
  if ((win_type & 0x00000100) == 0x00000000)
    x = (double)(n - 1) * 0.5;
  if ((win_type & 0x00000100) == 0x00000100)
    x = (double)(n)*0.5;
  sigma = alpha / x;
  for (i = 0; i < n; i++) {
    y = ((double)i - x) * sigma;
    w[i] = exp(-0.5 * y * y);
  }
}


x86 assembly (clang, -O0):
<dspl_win_gaussian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
jne    115b <dspl_win_gaussian+0x4b>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xeae(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
and    $0x100,%eax
cmp    $0x100,%eax
jne    1184 <dspl_win_gaussian+0x74>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe85(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ec <dspl_win_gaussian+0xdc>
cvtsi2sdl -0x34(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe46(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1030 <exp@plt>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119a <dspl_win_gaussian+0x8a>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dspl_win_gaussian>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,(%rsp)
test   %esi,%esi
jle    1196 <dspl_win_gaussian+0x86>
mov    %rdi,%r14
shr    $0x8,%edx
and    $0x1,%edx
lea    (%rsi,%rdx,1),%eax
add    $0xffffffff,%eax
cvtsi2sd %eax,%xmm1
mulsd  0xec3(%rip),%xmm1
movsd  (%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
subsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  0xe8a(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <dspl_win_gaussian+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @dspl_win_gaussian(double* %0, double %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
store double* %0, double** %5
store double %1, double* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store double 0.000000e+00, double* %9
%13 = load i32, i32* %8
%14 = and i32 %13, 256
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %4
%17 = load i32, i32* %7
%18 = sub nsw i32 %17, 1
%19 = sitofp i32 %18 to double
%20 = fmul double %19, 5.000000e-01
store double %20, double* %9
br label %21
21: ; preds = %16, %4
%22 = load i32, i32* %8
%23 = and i32 %22, 256
%24 = icmp eq i32 %23, 256
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i32, i32* %7
%27 = sitofp i32 %26 to double
%28 = fmul double %27, 5.000000e-01
store double %28, double* %9
br label %29
29: ; preds = %25, %21
%30 = load double, double* %6
%31 = load double, double* %9
%32 = fdiv double %30, %31
store double %32, double* %11
store i32 0, i32* %12
br label %33
33: ; preds = %53, %29
%34 = load i32, i32* %12
%35 = load i32, i32* %7
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %56
37: ; preds = %33
%38 = load i32, i32* %12
%39 = sitofp i32 %38 to double
%40 = load double, double* %9
%41 = fsub double %39, %40
%42 = load double, double* %11
%43 = fmul double %41, %42
store double %43, double* %10
%44 = load double, double* %10
%45 = fmul double -5.000000e-01, %44
%46 = load double, double* %10
%47 = fmul double %45, %46
%48 = call double @exp(double %47)
%49 = load double*, double** %5
%50 = load i32, i32* %12
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double %48, double* %52
br label %53
53: ; preds = %37
%54 = load i32, i32* %12
%55 = add nsw i32 %54, 1
store i32 %55, i32* %12
br label %33
56: ; preds = %33
ret void
}

LLVM IR (-O2):
define void @dspl_win_gaussian(double* nocapture writeonly %0, double %1, i32 %2, i32 %3) {
%5 = lshr i32 %3, 8
%6 = and i32 %5, 1
%7 = add i32 %2, -1
%8 = add i32 %7, %6
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 5.000000e-01
%11 = fdiv double %1, %10
%12 = icmp sgt i32 %2, 0
br i1 %12, label %13, label %27
13: ; preds = %4
%14 = zext i32 %2 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %25, %15 ]
%17 = trunc i64 %16 to i32
%18 = sitofp i32 %17 to double
%19 = fsub double %18, %10
%20 = fmul double %11, %19
%21 = fmul double %20, -5.000000e-01
%22 = fmul double %20, %21
%23 = tail call double @exp(double %22)
%24 = getelementptr inbounds double, double* %0, i64 %16
store double %23, double* %24
%25 = add nuw nsw i64 %16, 1
%26 = icmp eq i64 %25, %14
br i1 %26, label %27, label %15
27: ; preds = %15, %4
ret void
}