#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 sin(double);
duff(double *in, double *out, int nin, int nout, double *var, double *con) {
  double x = in[0], y = in[1];
  double a = in[2], b = in[3], c = in[4], d = in[5];
  double t = in[6];
  out[0] = y;
  out[1] = x * (1 - x * x) + a * sin(b * t) - c * y;
}


x86 assembly (clang, -O0):
<duff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe2a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x80(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<duff>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
movsd  (%rdi),%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0x8(%rdi),%xmm1
movsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x18(%rdi),%xmm0
mulsd  0x30(%rdi),%xmm0
movsd  0x20(%rdi),%xmm3
mulsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
movsd  %xmm1,(%rsi)
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xea1(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
call   1030 <sin@plt>
mulsd  0x18(%rsp),%xmm0
movsd  (%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
subsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x8(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @duff(double* nocapture %0, double* nocapture writeonly %1, i32 %2, i32 %3, double* nocapture readnone %4, double* nocapture readnone %5) {
%7 = load double, double* %0
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %0, i64 3
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %0, i64 4
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %0, i64 6
%17 = load double, double* %16
store double %9, double* %1
%18 = fneg double %7
%19 = tail call double @llvm.fmuladd.f64(double %18, double %7, double 1.000000e+00)
%20 = fmul double %13, %17
%21 = tail call double @sin(double %20)
%22 = fmul double %11, %21
%23 = tail call double @llvm.fmuladd.f64(double %7, double %19, double %22)
%24 = fneg double %15
%25 = tail call double @llvm.fmuladd.f64(double %24, double %9, double %23)
%26 = getelementptr inbounds double, double* %1, i64 1
store double %25, double* %26
ret i32 undef
}