#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 M_PI;
double cos(double);
double exp(double);
double easom(double *xs) {
  double x = xs[0];
  double y = xs[1];
  return (-cos(x) * cos(y) *
          exp(-(((x - M_PI) * (x - M_PI)) + ((y - M_PI) * (y - M_PI)))));
}


x86 assembly (clang, -O0):
<easom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    0x2e54(%rip),%rax
subsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm2
mov    0x2e44(%rip),%rax
subsd  (%rax),%xmm2
movsd  -0x18(%rbp),%xmm1
mov    0x2e34(%rip),%rax
subsd  (%rax),%xmm1
movsd  -0x18(%rbp),%xmm3
mov    0x2e24(%rip),%rax
subsd  (%rax),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<easom>:
sub    $0x38,%rsp
movsd  (%rdi),%xmm1
movaps %xmm1,0x20(%rsp)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x8(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos@plt>
xorps  0xeb9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x2e7e(%rip),%rax
movsd  (%rax),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
xorpd  0xe6a(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @easom(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
store double* %0, double** %2
%5 = load double*, double** %2
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
store double %7, double* %3
%8 = load double*, double** %2
%9 = getelementptr inbounds double, double* %8, i64 1
%10 = load double, double* %9
store double %10, double* %4
%11 = load double, double* %3
%12 = call double @cos(double %11)
%13 = fneg double %12
%14 = load double, double* %4
%15 = call double @cos(double %14)
%16 = fmul double %13, %15
%17 = load double, double* %3
%18 = load double, double* @M_PI
%19 = fsub double %17, %18
%20 = load double, double* %3
%21 = load double, double* @M_PI
%22 = fsub double %20, %21
%23 = load double, double* %4
%24 = load double, double* @M_PI
%25 = fsub double %23, %24
%26 = load double, double* %4
%27 = load double, double* @M_PI
%28 = fsub double %26, %27
%29 = fmul double %25, %28
%30 = call double @llvm.fmuladd.f64(double %19, double %22, double %29)
%31 = fneg double %30
%32 = call double @exp(double %31)
%33 = fmul double %16, %32
ret double %33
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @easom(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = tail call double @cos(double %2)
%6 = fneg double %5
%7 = tail call double @cos(double %4)
%8 = fmul double %7, %6
%9 = load double, double* @M_PI
%10 = fsub double %2, %9
%11 = fsub double %4, %9
%12 = fmul double %11, %11
%13 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %12)
%14 = fneg double %13
%15 = tail call double @exp(double %14)
%16 = fmul double %8, %15
ret double %16
}