#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 sin(double);
double dg_dy(double x, double y) {
  return 2.0 * y * (2.0 + cos(M_PI * x) + cos(M_PI * y)) -
         M_PI * sin(M_PI * y) * (x * x + y * y);
}


x86 assembly (clang, -O0):
<dg_dy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xec6(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e9d(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe9c(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    0x2e74(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e4e(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e3e(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movsd  -0x8(%rbp),%xmm3
movsd  -0x8(%rbp),%xmm5
movsd  -0x10(%rbp),%xmm4
mulsd  -0x10(%rbp),%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dg_dy>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x10(%rsp)
movapd %xmm0,%xmm2
movsd  %xmm0,0x18(%rsp)
addsd  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    0x2ea2(%rip),%rbx
movsd  (%rbx),%xmm0
mulsd  %xmm2,%xmm0
call   1040 <cos@plt>
addsd  0xea5(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rbx),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
addsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx),%xmm0
movsd  %xmm0,(%rsp)
mulsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
mulsd  (%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @dg_dy(double %0, double %1) {
%3 = fmul double %1, 2.000000e+00
%4 = load double, double* @M_PI
%5 = fmul double %4, %0
%6 = tail call double @cos(double %5)
%7 = fadd double %6, 2.000000e+00
%8 = load double, double* @M_PI
%9 = fmul double %8, %1
%10 = tail call double @cos(double %9)
%11 = fadd double %7, %10
%12 = load double, double* @M_PI
%13 = fmul double %12, %1
%14 = tail call double @sin(double %13)
%15 = fmul double %1, %1
%16 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %15)
%17 = fneg double %12
%18 = fmul double %14, %17
%19 = fmul double %16, %18
%20 = tail call double @llvm.fmuladd.f64(double %3, double %11, double %19)
ret double %20
}