#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 cgau2(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] = (4 * x2 * cosx + 4 * x[count] * sinx - 3 * cosx) * exp(-x2) /
                  sqrt(10 * sqrt(3.1415926535897931159980 / 2));
    psii[count] = (-4 * x2 * sinx + 4 * x[count] * cosx + 3 * sinx) * exp(-x2) /
                  sqrt(10 * sqrt(3.1415926535897931159980 / 2));
  }
  return;
}


x86 assembly (clang, -O0):
<cgau2>:
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    1328 <cgau2+0x1e8>
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)
movsd  0xe40(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xe26(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xe17(%rip),%xmm2
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>
imul   $0xa,%eax,%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)
movsd  0xd9b(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xd79(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0xd52(%rip),%xmm2
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>
imul   $0xa,%eax,%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 <cgau2+0x27>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgau2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
test   %esi,%esi
jle    12d4 <cgau2+0x194>
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
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
call   1050 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x0(%r13,%rbx,8),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm3
movapd %xmm3,%xmm4
movsd  0xe4c(%rip),%xmm2
mulsd  %xmm2,%xmm4
movsd  0x0(%r13,%rbx,8),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm0
mulsd  %xmm0,%xmm4
addsd  %xmm1,%xmm4
mulsd  0xe2b(%rip),%xmm0
addsd  %xmm4,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm3,%xmm0
xorpd  0xe2d(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x1,%edi
call   1060 <sqrt@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%edi
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rbx,8)
movapd 0x20(%rsp),%xmm1
mulsd  0xdc6(%rip),%xmm1
movsd  0x0(%r13,%rbx,8),%xmm0
mulsd  0xda7(%rip),%xmm0
mulsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xda3(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
movaps 0x30(%rsp),%xmm0
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>
add    %eax,%eax
lea    (%rax,%rax,4),%edi
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1170 <cgau2+0x30>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @cgau2(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 = %101, %6
%18 = load i32, i32* %13
%19 = load i32, i32* %8
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %104
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* %14
%46 = fmul double 4.000000e+00, %45
%47 = load double, double* %15
%48 = load double*, double** %7
%49 = load i32, i32* %13
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = fmul double 4.000000e+00, %52
%54 = load double, double* %16
%55 = fmul double %53, %54
%56 = call double @llvm.fmuladd.f64(double %46, double %47, double %55)
%57 = load double, double* %15
%58 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %57, double %56)
%59 = load double, double* %14
%60 = fneg double %59
%61 = call i32 @exp(double %60)
%62 = sitofp i32 %61 to double
%63 = fmul double %58, %62
%64 = call i32 @sqrt(i32 1)
%65 = mul nsw i32 10, %64
%66 = call i32 @sqrt(i32 %65)
%67 = sitofp i32 %66 to double
%68 = fdiv double %63, %67
%69 = load double*, double** %9
%70 = load i32, i32* %13
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
store double %68, double* %72
%73 = load double, double* %14
%74 = fmul double -4.000000e+00, %73
%75 = load double, double* %16
%76 = load double*, double** %7
%77 = load i32, i32* %13
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
%80 = load double, double* %79
%81 = fmul double 4.000000e+00, %80
%82 = load double, double* %15
%83 = fmul double %81, %82
%84 = call double @llvm.fmuladd.f64(double %74, double %75, double %83)
%85 = load double, double* %16
%86 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %85, double %84)
%87 = load double, double* %14
%88 = fneg double %87
%89 = call i32 @exp(double %88)
%90 = sitofp i32 %89 to double
%91 = fmul double %86, %90
%92 = call i32 @sqrt(i32 1)
%93 = mul nsw i32 10, %92
%94 = call i32 @sqrt(i32 %93)
%95 = sitofp i32 %94 to double
%96 = fdiv double %91, %95
%97 = load double*, double** %10
%98 = load i32, i32* %13
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %97, i64 %99
store double %96, double* %100
br label %101
101: ; preds = %21
%102 = load i32, i32* %13
%103 = add nsw i32 %102, 1
store i32 %103, i32* %13
br label %17
104: ; preds = %17
ret void
}

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