#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(int);
double exp(int);
double fun_3D_gabor(double x, double y, double unused) {
  return (3.1416 / 2.0) * exp(-2.0 * (x * x + y * y)) *
             cos(2 * 3.1416 * (x + y)) +
         exp(1);
}


x86 assembly (clang, -O0):
<fun_3D_gabor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xeb5(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe95(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xe72(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
mov    $0x1,%edi
call   1030 <exp@plt>
movsd  -0x28(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_3D_gabor>:
sub    $0x18,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
mulsd  0xeb5(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <exp@plt>
mulsd  0xeac(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xe9b(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1030 <exp@plt>
movsd  (%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @fun_3D_gabor(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %4
%9 = load double, double* %5
%10 = load double, double* %5
%11 = fmul double %9, %10
%12 = call double @llvm.fmuladd.f64(double %7, double %8, double %11)
%13 = fmul double -2.000000e+00, %12
%14 = fptosi double %13 to i32
%15 = call double @exp(i32 %14)
%16 = fmul double 1.570800e+00, %15
%17 = load double, double* %4
%18 = load double, double* %5
%19 = fadd double %17, %18
%20 = fmul double 6.283200e+00, %19
%21 = fptosi double %20 to i32
%22 = call double @cos(i32 %21)
%23 = call double @exp(i32 1)
%24 = call double @llvm.fmuladd.f64(double %16, double %22, double %23)
ret double %24
}

LLVM IR (-O2):
define double @fun_3D_gabor(double %0, double %1, double %2) {
%4 = fmul double %1, %1
%5 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %4)
%6 = fmul double %5, -2.000000e+00
%7 = fptosi double %6 to i32
%8 = tail call double @exp(i32 %7)
%9 = fmul double %8, 1.570800e+00
%10 = fadd double %0, %1
%11 = fmul double %10, 6.283200e+00
%12 = fptosi double %11 to i32
%13 = tail call double @cos(i32 %12)
%14 = tail call double @exp(i32 1)
%15 = tail call double @llvm.fmuladd.f64(double %9, double %13, double %14)
ret double %15
}