#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 *malloc(int);
double pow(double, int);
double *parrot(double t, double X[]) {
  double x = X[0], y = X[1];
  double x_dot, y_dot;
  double *X_dot = malloc(2 * sizeof(double));
  x_dot = y + pow(y, 2);
  y_dot = -x + 0.2 * y - x * y + 1.2 * pow(y, 2);
  X_dot[0] = x_dot;
  X_dot[1] = y_dot;
  return X_dot;
}


x86 assembly (clang, -O0):
<parrot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    %rax,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe5b(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  -0x40(%rbp),%xmm1
movsd  0xe01(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x38(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parrot>:
push   %rbx
sub    $0x20,%rsp
movsd  (%rdi),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xe91(%rip),%xmm3
mulsd  %xmm2,%xmm3
movsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm1
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm3
movsd  %xmm3,0x8(%rsp)
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0xe67(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  %xmm1,(%rbx)
movsd  %xmm0,0x8(%rbx)
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias double* @parrot(double %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = tail call double* @malloc(i32 16)
%7 = tail call double @pow(double %5, i32 2)
%8 = fadd double %5, %7
%9 = fneg double %3
%10 = tail call double @llvm.fmuladd.f64(double %5, double 2.000000e-01, double %9)
%11 = tail call double @llvm.fmuladd.f64(double %9, double %5, double %10)
%12 = tail call double @pow(double %5, i32 2)
%13 = tail call double @llvm.fmuladd.f64(double %12, double 1.200000e+00, double %11)
store double %8, double* %6
%14 = getelementptr inbounds double, double* %6, i64 1
store double %13, double* %14
ret double* %6
}