#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);
int sqrt(int);
void Gaus2(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] = 2 * (2 * x2 - 1) * exp(-x2) /
                 sqrt(3 * sqrt(3.1415926535897931159980 / 2));
  }
  return;
}


x86 assembly (clang, -O0):
<Gaus2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    1200 <Gaus2+0xe0>
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),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe8a(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe76(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  -0x48(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    $0x1,%edi
call   1040 <sqrt@plt>
imul   $0x3,%eax,%edi
call   1040 <sqrt@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %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    1142 <Gaus2+0x22>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Gaus2>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %esi,%esi
jle    11b2 <Gaus2+0x92>
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
xchg   %ax,%ax
movsd  (%r15,%rbx,8),%xmm0
mulsd  %xmm0,%xmm0
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
addsd  0xea6(%rip),%xmm1
addsd  %xmm1,%xmm1
movapd %xmm1,(%rsp)
xorpd  0xea5(%rip),%xmm0
call   1030 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1040 <sqrt@plt>
lea    (%rax,%rax,2),%edi
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <Gaus2+0x20>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Gaus2(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 = %46, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %49
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 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %29, double -1.000000e+00)
%31 = fmul double 2.000000e+00, %30
%32 = load double, double* %12
%33 = fneg double %32
%34 = call i32 @exp(double %33)
%35 = sitofp i32 %34 to double
%36 = fmul double %31, %35
%37 = call i32 @sqrt(i32 1)
%38 = mul nsw i32 3, %37
%39 = call i32 @sqrt(i32 %38)
%40 = sitofp i32 %39 to double
%41 = fdiv double %36, %40
%42 = load double*, double** %8
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
store double %41, double* %45
br label %46
46: ; preds = %17
%47 = load i32, i32* %11
%48 = add nsw i32 %47, 1
store i32 %48, i32* %11
br label %13
49: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @Gaus2(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 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %26, %9 ]
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = fmul double %12, %12
%14 = tail call double @llvm.fmuladd.f64(double %13, double 2.000000e+00, double -1.000000e+00)
%15 = fmul double %14, 2.000000e+00
%16 = fneg double %13
%17 = tail call i32 @exp(double %16)
%18 = sitofp i32 %17 to double
%19 = fmul double %15, %18
%20 = tail call i32 @sqrt(i32 1)
%21 = mul nsw i32 %20, 3
%22 = tail call i32 @sqrt(i32 %21)
%23 = sitofp i32 %22 to double
%24 = fdiv double %19, %23
%25 = getelementptr inbounds double, double* %2, i64 %10
store double %24, double* %25
%26 = add nuw nsw i64 %10, 1
%27 = icmp eq i64 %26, %8
br i1 %27, label %28, label %9
28: ; preds = %9, %5
ret void
}