#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 exp(double);
double sqrt(double);
double Morlet_Cpsi(double w0) {
  double w, Cpsi = 0, aux;
  for (w = 0.01; w < 100; w += 0.01) {
    aux = (w - w0);
    aux *= aux;
    Cpsi += exp(-aux) / w;
  }
  Cpsi *= 0.01 * sqrt(3.14159265358979328) / 2;
  return (Cpsi);
}


x86 assembly (clang, -O0):
<Morlet_Cpsi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebe(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11ba <Morlet_Cpsi+0x9a>
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
divsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe55(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1142 <Morlet_Cpsi+0x22>
movsd  0xe56(%rip),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe2e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe32(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Morlet_Cpsi>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  0xeda(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm1
subsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
xorpd  0xece(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
divsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
addsd  0xe7d(%rip),%xmm1
movsd  %xmm1,(%rsp)
movsd  0xe78(%rip),%xmm1
ucomisd (%rsp),%xmm1
movsd  (%rsp),%xmm1
ja     1130 <Morlet_Cpsi+0x20>
mulsd  0xe6c(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @Morlet_Cpsi(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %4
store double 1.000000e-02, double* %3
br label %6
6: ; preds = %23, %1
%7 = load double, double* %3
%8 = fcmp olt double %7, 1.000000e+02
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load double, double* %3
%11 = load double, double* %2
%12 = fsub double %10, %11
store double %12, double* %5
%13 = load double, double* %5
%14 = load double, double* %5
%15 = fmul double %14, %13
store double %15, double* %5
%16 = load double, double* %5
%17 = fneg double %16
%18 = call double @exp(double %17)
%19 = load double, double* %3
%20 = fdiv double %18, %19
%21 = load double, double* %4
%22 = fadd double %21, %20
store double %22, double* %4
br label %23
23: ; preds = %9
%24 = load double, double* %3
%25 = fadd double %24, 1.000000e-02
store double %25, double* %3
br label %6
26: ; preds = %6
%27 = call double @sqrt(double 0x400921FB54442D18)
%28 = fmul double 1.000000e-02, %27
%29 = fdiv double %28, 2.000000e+00
%30 = load double, double* %4
%31 = fmul double %30, %29
store double %31, double* %4
%32 = load double, double* %4
ret double %32
}

LLVM IR (-O2):
define double @Morlet_Cpsi(double %0) {
br label %2
2: ; preds = %1, %2
%3 = phi double [ 1.000000e-02, %1 ], [ %11, %2 ]
%4 = phi double [ 0.000000e+00, %1 ], [ %10, %2 ]
%5 = fsub double %3, %0
%6 = fneg double %5
%7 = fmul double %5, %6
%8 = tail call double @exp(double %7)
%9 = fdiv double %8, %3
%10 = fadd double %4, %9
%11 = fadd double %3, 1.000000e-02
%12 = fcmp olt double %11, 1.000000e+02
br i1 %12, label %2, label %13
13: ; preds = %2
%14 = fmul double %10, 0x3F822661A4EEADB5
ret double %14
}