#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 const exp(double const);
void df(const double *x, double **res) {
  res[0][0] = -*x * exp(*x) - exp(*x);
  res[1][1] = -2 * x[1];
  res[0][1] = res[1][0] = 0.0;
}


x86 assembly (clang, -O0):
<df>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <exp@plt>
movsd  -0x20(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xe5a(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<df>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movaps 0xed8(%rip),%xmm1
xorps  %xmm0,%xmm1
movaps %xmm1,0x10(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx),%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mov    (%r14),%rax
movsd  %xmm1,(%rax)
movsd  0x8(%rbx),%xmm0
mulsd  0xea8(%rip),%xmm0
mov    0x8(%r14),%rcx
movsd  %xmm0,0x8(%rcx)
movq   $0x0,(%rcx)
movq   $0x0,0x8(%rax)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

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