#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 M_PI;
double cos(int);
double const exp(double);
double sin(int);
double fun(double x, double y) {
  const double envelope = exp(-4.0 * (x * x + y * y));
  return envelope * exp(cos(5 * M_PI * x) * sin(2 * M_PI * y));
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe9a(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e63(%rip),%rax
imul   $0x5,(%rax),%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
mov    0x2e42(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xea7(%rip),%xmm0
call   1040 <exp@plt>
mov    0x2e83(%rip),%rbx
mov    (%rbx),%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm0,0x10(%rsp)
mulsd  0x8(%rsp),%xmm1
cvttsd2si %xmm1,%edi
call   1050 <cos@plt>
mov    (%rbx),%eax
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm0,0x8(%rsp)
mulsd  0x18(%rsp),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
call   1040 <exp@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global i32 0
define double @fun(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %3
%8 = load double, double* %4
%9 = load double, double* %4
%10 = fmul double %8, %9
%11 = call double @llvm.fmuladd.f64(double %6, double %7, double %10)
%12 = fmul double -4.000000e+00, %11
%13 = call double @exp(double %12)
store double %13, double* %5
%14 = load double, double* %5
%15 = load i32, i32* @M_PI
%16 = mul nsw i32 5, %15
%17 = sitofp i32 %16 to double
%18 = load double, double* %3
%19 = fmul double %17, %18
%20 = fptosi double %19 to i32
%21 = call double @cos(i32 %20)
%22 = load i32, i32* @M_PI
%23 = mul nsw i32 2, %22
%24 = sitofp i32 %23 to double
%25 = load double, double* %4
%26 = fmul double %24, %25
%27 = fptosi double %26 to i32
%28 = call double @sin(i32 %27)
%29 = fmul double %21, %28
%30 = call double @exp(double %29)
%31 = fmul double %14, %30
ret double %31
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @fun(double %0, double %1) {
%3 = fmul double %1, %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %3)
%5 = fmul double %4, -4.000000e+00
%6 = tail call double @exp(double %5)
%7 = load i32, i32* @M_PI
%8 = mul nsw i32 %7, 5
%9 = sitofp i32 %8 to double
%10 = fmul double %9, %0
%11 = fptosi double %10 to i32
%12 = tail call double @cos(i32 %11)
%13 = load i32, i32* @M_PI
%14 = shl nsw i32 %13, 1
%15 = sitofp i32 %14 to double
%16 = fmul double %15, %1
%17 = fptosi double %16 to i32
%18 = tail call double @sin(i32 %17)
%19 = fmul double %12, %18
%20 = tail call double @exp(double %19)
%21 = fmul double %6, %20
ret double %21
}