#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 cos(double);
int exp(double);
double sin(double);
int sqrt(int);
void cgau1(double *x, int sigInLength, double *psir, double *psii,
           int sigOutLength, double ys) {
  int count;
  double x2, cosx, sinx;
  for (count = 0; count < sigInLength; count++) {
    x2 = x[count] * x[count];
    cosx = cos(x[count]);
    sinx = sin(x[count]);
    psir[count] = (-2 * x[count] * cosx - sinx) * exp(-x2) /
                  sqrt(2 * sqrt(3.1415926535897931159980 / 2));
    psii[count] = (2 * x[count] * sinx - cosx) * exp(-x2) /
                  sqrt(2 * sqrt(3.1415926535897931159980 / 2));
  }
  return;
}


x86 assembly (clang, -O0):
<cgau1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1316 <cgau1+0x1d6>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xe38(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
movsd  -0x70(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    $0x1,%edi
call   1060 <sqrt@plt>
mov    %eax,%edi
shl    $0x1,%edi
call   1060 <sqrt@plt>
movsd  -0x68(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xd8c(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
movsd  -0x60(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    $0x1,%edi
call   1060 <sqrt@plt>
mov    %eax,%edi
shl    $0x1,%edi
call   1060 <sqrt@plt>
movsd  -0x58(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1167 <cgau1+0x27>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgau1>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
test   %esi,%esi
jle    127e <cgau1+0x13e>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%r13
mov    %esi,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x0(%r13,%rbx,8),%xmm0
movaps %xmm0,0x10(%rsp)
call   1050 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x0(%r13,%rbx,8),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x0(%r13,%rbx,8),%xmm1
mulsd  0xe59(%rip),%xmm1
mulsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd 0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
xorpd  0xe48(%rip),%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%edi
call   1060 <sqrt@plt>
lea    (%rax,%rax,1),%edi
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rbx,8)
movsd  0x0(%r13,%rbx,8),%xmm0
addsd  %xmm0,%xmm0
mulsd  0x28(%rsp),%xmm0
subsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1060 <sqrt@plt>
lea    (%rax,%rax,1),%edi
call   1060 <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    1170 <cgau1+0x30>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @cgau1(double* %0, i32 %1, double* %2, double* %3, i32 %4, double %5) {
%7 = alloca double*
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
store double* %0, double** %7
store i32 %1, i32* %8
store double* %2, double** %9
store double* %3, double** %10
store i32 %4, i32* %11
store double %5, double* %12
store i32 0, i32* %13
br label %17
17: ; preds = %93, %6
%18 = load i32, i32* %13
%19 = load i32, i32* %8
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %96
21: ; preds = %17
%22 = load double*, double** %7
%23 = load i32, i32* %13
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = load double*, double** %7
%28 = load i32, i32* %13
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = fmul double %26, %31
store double %32, double* %14
%33 = load double*, double** %7
%34 = load i32, i32* %13
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = call double @cos(double %37)
store double %38, double* %15
%39 = load double*, double** %7
%40 = load i32, i32* %13
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = call double @sin(double %43)
store double %44, double* %16
%45 = load double*, double** %7
%46 = load i32, i32* %13
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
%49 = load double, double* %48
%50 = fmul double -2.000000e+00, %49
%51 = load double, double* %15
%52 = load double, double* %16
%53 = fneg double %52
%54 = call double @llvm.fmuladd.f64(double %50, double %51, double %53)
%55 = load double, double* %14
%56 = fneg double %55
%57 = call i32 @exp(double %56)
%58 = sitofp i32 %57 to double
%59 = fmul double %54, %58
%60 = call i32 @sqrt(i32 1)
%61 = mul nsw i32 2, %60
%62 = call i32 @sqrt(i32 %61)
%63 = sitofp i32 %62 to double
%64 = fdiv double %59, %63
%65 = load double*, double** %9
%66 = load i32, i32* %13
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
store double %64, double* %68
%69 = load double*, double** %7
%70 = load i32, i32* %13
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
%73 = load double, double* %72
%74 = fmul double 2.000000e+00, %73
%75 = load double, double* %16
%76 = load double, double* %15
%77 = fneg double %76
%78 = call double @llvm.fmuladd.f64(double %74, double %75, double %77)
%79 = load double, double* %14
%80 = fneg double %79
%81 = call i32 @exp(double %80)
%82 = sitofp i32 %81 to double
%83 = fmul double %78, %82
%84 = call i32 @sqrt(i32 1)
%85 = mul nsw i32 2, %84
%86 = call i32 @sqrt(i32 %85)
%87 = sitofp i32 %86 to double
%88 = fdiv double %83, %87
%89 = load double*, double** %10
%90 = load i32, i32* %13
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
store double %88, double* %92
br label %93
93: ; preds = %21
%94 = load i32, i32* %13
%95 = add nsw i32 %94, 1
store i32 %95, i32* %13
br label %17
96: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @cgau1(double* nocapture %0, i32 %1, double* nocapture writeonly %2, double* nocapture writeonly %3, i32 %4, double %5) {
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %47
8: ; preds = %6
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %45, %10 ]
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = load double, double* %12
%14 = tail call double @cos(double %13)
%15 = load double, double* %12
%16 = tail call double @sin(double %15)
%17 = load double, double* %12
%18 = fmul double %17, -2.000000e+00
%19 = fneg double %16
%20 = tail call double @llvm.fmuladd.f64(double %18, double %14, double %19)
%21 = fneg double %13
%22 = fmul double %13, %21
%23 = tail call i32 @exp(double %22)
%24 = sitofp i32 %23 to double
%25 = fmul double %20, %24
%26 = tail call i32 @sqrt(i32 1)
%27 = shl nsw i32 %26, 1
%28 = tail call i32 @sqrt(i32 %27)
%29 = sitofp i32 %28 to double
%30 = fdiv double %25, %29
%31 = getelementptr inbounds double, double* %2, i64 %11
store double %30, double* %31
%32 = load double, double* %12
%33 = fmul double %32, 2.000000e+00
%34 = fneg double %14
%35 = tail call double @llvm.fmuladd.f64(double %33, double %16, double %34)
%36 = tail call i32 @exp(double %22)
%37 = sitofp i32 %36 to double
%38 = fmul double %35, %37
%39 = tail call i32 @sqrt(i32 1)
%40 = shl nsw i32 %39, 1
%41 = tail call i32 @sqrt(i32 %40)
%42 = sitofp i32 %41 to double
%43 = fdiv double %38, %42
%44 = getelementptr inbounds double, double* %3, i64 %11
store double %43, double* %44
%45 = add nuw nsw i64 %11, 1
%46 = icmp eq i64 %45, %9
br i1 %46, label %47, label %10
47: ; preds = %10, %6
ret void
}