// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_smooth_Gaussian
int array_smooth_Gaussian(double * x,
                          double * y,
                          double * ysmooth,
                          int length,
                          double sigma,
                          ErrorMsg errmsg){
  int i,j;
  double weight, total;
  double nsig = 3.;

  class_test(sigma<=0.,errmsg,"Cannot smooth with sigma<0 (sigma=%e)",sigma);

  for ( i=0;i<length;++i){
    total = 0.;
    if(abs(x[i]-x[0]) < nsig*sigma || abs(x[i]-x[length-1]) < nsig*sigma){
      ysmooth[i] = y[i];
    }
    else{
      ysmooth[i] = 0.;
      for( j=0;j<length;++j){
        weight = exp(-(x[i]-x[j])*(x[i]-x[j])/(2.*sigma*sigma));
        ysmooth[i] += y[j]*weight;
        total +=weight;
      }
      ysmooth[i]/=total;
    }
  }
  return _SUCCESS_;
}

// Assembly:
subq $0x1058, %rsp           # imm = 0x1058
movq %rdi, 0x1048(%rsp)
movq %rsi, 0x1040(%rsp)
movq %rdx, 0x1038(%rsp)
movl %ecx, 0x1034(%rsp)
movsd %xmm0, 0x1028(%rsp)
movq %r8, 0x1020(%rsp)
movsd 0x1a7d29(%rip), %xmm0   # 0x1d3698
movsd %xmm0, 0x1000(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x1028(%rsp), %xmm0
jb 0x2b9fa
leaq 0x800(%rsp), %rdi
movsd 0x1028(%rsp), %xmm0
leaq 0x1a8d8f(%rip), %rsi    # 0x1d472d
movb $0x1, %al
callq 0x5b9c0
movq %rsp, %rdi
leaq 0x800(%rsp), %rcx
leaq 0x1a66cb(%rip), %rsi    # 0x1d2082
leaq 0x1a8d95(%rip), %rdx    # 0x1d4753
movb $0x0, %al
callq 0x5b9c0
movq 0x1020(%rsp), %rdi
movq %rsp, %r8
leaq 0x1a665d(%rip), %rsi    # 0x1d2034
leaq 0x1a8d7f(%rip), %rdx    # 0x1d475d
movl $0xe0b, %ecx            # imm = 0xE0B
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1054(%rsp)
jmp 0x2bc71
movl $0x0, 0x101c(%rsp)
movl 0x101c(%rsp), %eax
cmpl 0x1034(%rsp), %eax
jge 0x2bc66
xorps %xmm0, %xmm0
movsd %xmm0, 0x1008(%rsp)
movq 0x1048(%rsp), %rax
movslq 0x101c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1048(%rsp), %rax
subsd (%rax), %xmm0
callq 0x2f3a0
movaps %xmm0, %xmm1
movsd 0x1000(%rsp), %xmm0
mulsd 0x1028(%rsp), %xmm0
ucomisd %xmm1, %xmm0
ja 0x2bab5
movq 0x1048(%rsp), %rax
movslq 0x101c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1048(%rsp), %rax
movl 0x1034(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
callq 0x2f3a0
movaps %xmm0, %xmm1
movsd 0x1000(%rsp), %xmm0
mulsd 0x1028(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2bae4
movq 0x1040(%rsp), %rax
movslq 0x101c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1038(%rsp), %rax
movslq 0x101c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x2bc4e
movq 0x1038(%rsp), %rax
movslq 0x101c(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, 0x1018(%rsp)
movl 0x1018(%rsp), %eax
cmpl 0x1034(%rsp), %eax
jge 0x2bc27
movq 0x1048(%rsp), %rax
movslq 0x101c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1048(%rsp), %rax
movslq 0x1018(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq 0x1048(%rsp), %rax
movslq 0x101c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x1048(%rsp), %rax
movslq 0x1018(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm1
mulsd %xmm1, %xmm0
movsd 0x1a70ee(%rip), %xmm1   # 0x1d2c80
mulsd 0x1028(%rsp), %xmm1
mulsd 0x1028(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x8670
movsd %xmm0, 0x1010(%rsp)
movq 0x1040(%rsp), %rax
movslq 0x1018(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x1010(%rsp), %xmm2
movq 0x1038(%rsp), %rax
movslq 0x101c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd 0x1010(%rsp), %xmm0
addsd 0x1008(%rsp), %xmm0
movsd %xmm0, 0x1008(%rsp)
movl 0x1018(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1018(%rsp)
jmp 0x2bb07
movsd 0x1008(%rsp), %xmm1
movq 0x1038(%rsp), %rax
movslq 0x101c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x2bc50
movl 0x101c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x101c(%rsp)
jmp 0x2ba05
movl $0x0, 0x1054(%rsp)
movl 0x1054(%rsp), %eax
addq $0x1058, %rsp           # imm = 0x1058
retq