#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 */
int exp(double);
void DOGauss(double *x, int sigInLength, double *psi, int sigOutLength,
             double ys) {
  int count;
  double x2;
  for (count = 0; count < sigInLength; count++) {
    x2 = x[count] * x[count];
    psi[count] = exp(-x2 / 2) / ys - exp(-x2 / 8) / (2 * ys);
  }
  return;
}


x86 assembly (clang, -O0):
<DOGauss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fe <DOGauss+0xee>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe7f(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe4c(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
movsd  0xe2a(%rip),%xmm2
mulsd  -0x28(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1132 <DOGauss+0x22>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DOGauss>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
movsd  %xmm0,0x8(%rsp)
test   %esi,%esi
jle    11c9 <DOGauss+0xb9>
mov    %rdx,%r14
mov    %rdi,%r15
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %esi,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%r15,%rbx,8),%xmm0
movapd %xmm0,%xmm1
xorpd  0xe9e(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movapd %xmm1,%xmm0
mulsd  0xe98(%rip),%xmm0
call   1030 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movapd 0x20(%rsp),%xmm0
mulsd  0xe7a(%rip),%xmm0
call   1030 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <DOGauss+0x40>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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