#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 pow(double, double);
double fun_3D_OGR(double x, double y, double unused) {
  unused = unused;
  double z1 =
      0.5 * exp(-(pow(9.0 * x - 2.0, 2.0) + pow(9.0 * y - 2.0, 2.0)) / 4.0);
  double z2 = 0.75 * exp(-pow(9.0 * x + 1.0, 2.0) / 49.0 -
                         pow(9.0 * y + 1.0, 2.0) / 10.0);
  double z3 =
      0.5 * exp(-(pow(9.0 * x - 7.0, 2.0) + pow(9.0 * y - 3.0, 2.0)) / 4.0);
  double z4 = 0.2 * exp(-pow(9.0 * x - 4.0, 2.0) - pow(9.0 * y - 7.0, 2.0));
  return z1 + z2 + z3 - z4;
}


x86 assembly (clang, -O0):
<fun_3D_OGR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xec2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf06(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe93(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe73(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe6b(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe4f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe21(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe55(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe01(%rip),%xmm1
call   1040 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe2d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdcf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe03(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xdaf(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0xdda(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xdba(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd74(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd70(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd54(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xd45(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd61(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd25(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd1d(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xd01(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xcd3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcd7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xcb3(%rip),%xmm1
call   1040 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xc8d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc89(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xc6d(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xc44(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_3D_OGR>:
sub    $0x28,%rsp
unpcklpd %xmm1,%xmm0
mulpd  0xee0(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movapd 0xee2(%rip),%xmm1
addpd  %xmm0,%xmm1
mulpd  %xmm1,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xf26(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xf21(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0xebb(%rip),%xmm1
addpd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
xorpd  0xeb9(%rip),%xmm0
shufpd $0x2,%xmm1,%xmm0
mulpd  %xmm1,%xmm0
divpd  0xeb8(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0xedf(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0xe9b(%rip),%xmm1
addpd  0x10(%rsp),%xmm1
mulpd  %xmm1,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe9d(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xe98(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
addpd  0xe66(%rip),%xmm0
movapd 0xe2e(%rip),%xmm1
xorpd  %xmm0,%xmm1
shufpd $0x2,%xmm0,%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0xe5c(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @fun_3D_OGR(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%11 = load double, double* %6
store double %11, double* %6
%12 = load double, double* %4
%13 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %12, double -2.000000e+00)
%14 = call double @pow(double %13, double 2.000000e+00)
%15 = load double, double* %5
%16 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %15, double -2.000000e+00)
%17 = call double @pow(double %16, double 2.000000e+00)
%18 = fadd double %14, %17
%19 = fneg double %18
%20 = fdiv double %19, 4.000000e+00
%21 = call double @exp(double %20)
%22 = fmul double 5.000000e-01, %21
store double %22, double* %7
%23 = load double, double* %4
%24 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %23, double 1.000000e+00)
%25 = call double @pow(double %24, double 2.000000e+00)
%26 = fneg double %25
%27 = fdiv double %26, 4.900000e+01
%28 = load double, double* %5
%29 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %28, double 1.000000e+00)
%30 = call double @pow(double %29, double 2.000000e+00)
%31 = fdiv double %30, 1.000000e+01
%32 = fsub double %27, %31
%33 = call double @exp(double %32)
%34 = fmul double 7.500000e-01, %33
store double %34, double* %8
%35 = load double, double* %4
%36 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %35, double -7.000000e+00)
%37 = call double @pow(double %36, double 2.000000e+00)
%38 = load double, double* %5
%39 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %38, double -3.000000e+00)
%40 = call double @pow(double %39, double 2.000000e+00)
%41 = fadd double %37, %40
%42 = fneg double %41
%43 = fdiv double %42, 4.000000e+00
%44 = call double @exp(double %43)
%45 = fmul double 5.000000e-01, %44
store double %45, double* %9
%46 = load double, double* %4
%47 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %46, double -4.000000e+00)
%48 = call double @pow(double %47, double 2.000000e+00)
%49 = fneg double %48
%50 = load double, double* %5
%51 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %50, double -7.000000e+00)
%52 = call double @pow(double %51, double 2.000000e+00)
%53 = fsub double %49, %52
%54 = call double @exp(double %53)
%55 = fmul double 2.000000e-01, %54
store double %55, double* %10
%56 = load double, double* %7
%57 = load double, double* %8
%58 = fadd double %56, %57
%59 = load double, double* %9
%60 = fadd double %58, %59
%61 = load double, double* %10
%62 = fsub double %60, %61
ret double %62
}

LLVM IR (-O2):
define double @fun_3D_OGR(double %0, double %1, double %2) {
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %1, i64 1
%6 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %5, <2 x double> <double 9.000000e+00, double 9.000000e+00>, <2 x double> <double -2.000000e+00, double -2.000000e+00>)
%7 = fmul <2 x double> %6, %6
%8 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%9 = fadd <2 x double> %7, %8
%10 = extractelement <2 x double> %9, i64 0
%11 = fmul double %10, -2.500000e-01
%12 = tail call double @exp(double %11)
%13 = fmul double %12, 5.000000e-01
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %5, <2 x double> <double 9.000000e+00, double 9.000000e+00>, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%15 = extractelement <2 x double> %14, i64 0
%16 = fneg double %15
%17 = insertelement <2 x double> %14, double %16, i64 0
%18 = fmul <2 x double> %14, %17
%19 = fdiv <2 x double> %18, <double 4.900000e+01, double 1.000000e+01>
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%21 = fsub <2 x double> %19, %20
%22 = extractelement <2 x double> %21, i64 0
%23 = tail call double @exp(double %22)
%24 = fmul double %23, 7.500000e-01
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %5, <2 x double> <double 9.000000e+00, double 9.000000e+00>, <2 x double> <double -7.000000e+00, double -3.000000e+00>)
%26 = fmul <2 x double> %25, %25
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%28 = fadd <2 x double> %26, %27
%29 = extractelement <2 x double> %28, i64 0
%30 = fmul double %29, -2.500000e-01
%31 = tail call double @exp(double %30)
%32 = fmul double %31, 5.000000e-01
%33 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %5, <2 x double> <double 9.000000e+00, double 9.000000e+00>, <2 x double> <double -4.000000e+00, double -7.000000e+00>)
%34 = extractelement <2 x double> %33, i64 0
%35 = fneg double %34
%36 = insertelement <2 x double> %33, double %35, i64 0
%37 = fmul <2 x double> %33, %36
%38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%39 = fsub <2 x double> %37, %38
%40 = extractelement <2 x double> %39, i64 0
%41 = tail call double @exp(double %40)
%42 = fmul double %41, 2.000000e-01
%43 = fadd double %13, %24
%44 = fadd double %43, %32
%45 = fsub double %44, %42
ret double %45
}