#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 cos(int);
void derivs_one(double *y, double *dxdt, const double *p) {
  dxdt[0] = p[0] - p[1] * cos(y[0]) - cos(2. * y[0]);
}


x86 assembly (clang, -O0):
<derivs_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
cvttsd2si (%rax),%edi
call   1030 <cos@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xe77(%rip),%xmm0
mulsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<derivs_one>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdx),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x10(%rsp)
cvttsd2si (%rdi),%edi
call   1030 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%rbx),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @derivs_one(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %6
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = fptosi double %15 to i32
%17 = call double @cos(i32 %16)
%18 = fneg double %12
%19 = call double @llvm.fmuladd.f64(double %18, double %17, double %9)
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = fmul double 2.000000e+00, %22
%24 = fptosi double %23 to i32
%25 = call double @cos(i32 %24)
%26 = fsub double %19, %25
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 0
store double %26, double* %28
ret void
}

LLVM IR (-O2):
define void @derivs_one(double* nocapture %0, double* nocapture writeonly %1, double* nocapture %2) {
%4 = load double, double* %2
%5 = getelementptr inbounds double, double* %2, i64 1
%6 = load double, double* %5
%7 = load double, double* %0
%8 = fptosi double %7 to i32
%9 = tail call double @cos(i32 %8)
%10 = fneg double %6
%11 = tail call double @llvm.fmuladd.f64(double %10, double %9, double %4)
%12 = load double, double* %0
%13 = fmul double %12, 2.000000e+00
%14 = fptosi double %13 to i32
%15 = tail call double @cos(i32 %14)
%16 = fsub double %11, %15
store double %16, double* %1
ret void
}