#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 cos(double);
int LinearADR_Sine_du(int *iwork, double *rwork, int nPoints, double t,
                      double *x, double *f) {
  int i, j;
  double omega[3] = {rwork[0], rwork[1], rwork[2]};
  double omega0 = rwork[3];
  double Y;
  for (i = 0; i < nPoints; i++) {
    Y = cos(omega[0] * x[i * 3 + 0] + omega[1] * x[i * 3 + 1] +
            omega[2] * x[i * 3 + 2] + omega0);
    for (j = 0; j < 3; j++) {
      f[i * 3 + j] = omega[j] * Y;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<LinearADR_Sine_du>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1235 <LinearADR_Sine_du+0x125>
movsd  -0x50(%rbp),%xmm1
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x58(%rbp),%xmm0
call   1030 <cos@plt>
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x3,-0x38(%rbp)
jge    1222 <LinearADR_Sine_du+0x112>
movslq -0x38(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
mulsd  -0x60(%rbp),%xmm0
mov    -0x30(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11e8 <LinearADR_Sine_du+0xd8>
jmp    1227 <LinearADR_Sine_du+0x117>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    116e <LinearADR_Sine_du+0x5e>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LinearADR_Sine_du>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %edx,%edx
jle    11c1 <LinearADR_Sine_du+0xb1>
mov    %r8,%r14
mov    %rcx,%r12
movupd (%rsi),%xmm0
movsd  0x10(%rsi),%xmm1
movsd  %xmm1,(%rsp)
movsd  0x18(%rsi),%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %edx,%eax
movapd %xmm0,0x10(%rsp)
unpckhpd %xmm0,%xmm0
movapd %xmm0,0x20(%rsp)
shl    $0x3,%rax
lea    (%rax,%rax,2),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
movsd  0x8(%r12,%rbx,1),%xmm0
mulsd  0x20(%rsp),%xmm0
movsd  (%r12,%rbx,1),%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%r12,%rbx,1),%xmm0
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
call   1030 <cos@plt>
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
mulpd  0x10(%rsp),%xmm1
movupd %xmm1,(%r14,%rbx,1)
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x10(%r14,%rbx,1)
add    $0x18,%rbx
cmp    %rbx,%r15
jne    1160 <LinearADR_Sine_du+0x50>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @LinearADR_Sine_du(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5) {
%7 = alloca i32*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca [3 x double]
%16 = alloca double
%17 = alloca double
store i32* %0, i32** %7
store double* %1, double** %8
store i32 %2, i32* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%18 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 0
%19 = load double*, double** %8
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
store double %21, double* %18
%22 = getelementptr inbounds double, double* %18, i64 1
%23 = load double*, double** %8
%24 = getelementptr inbounds double, double* %23, i64 1
%25 = load double, double* %24
store double %25, double* %22
%26 = getelementptr inbounds double, double* %22, i64 1
%27 = load double*, double** %8
%28 = getelementptr inbounds double, double* %27, i64 2
%29 = load double, double* %28
store double %29, double* %26
%30 = load double*, double** %8
%31 = getelementptr inbounds double, double* %30, i64 3
%32 = load double, double* %31
store double %32, double* %16
store i32 0, i32* %13
br label %33
33: ; preds = %92, %6
%34 = load i32, i32* %13
%35 = load i32, i32* %9
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %95
37: ; preds = %33
%38 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 0
%39 = load double, double* %38
%40 = load double*, double** %11
%41 = load i32, i32* %13
%42 = mul nsw i32 %41, 3
%43 = add nsw i32 %42, 0
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %40, i64 %44
%46 = load double, double* %45
%47 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 1
%48 = load double, double* %47
%49 = load double*, double** %11
%50 = load i32, i32* %13
%51 = mul nsw i32 %50, 3
%52 = add nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %49, i64 %53
%55 = load double, double* %54
%56 = fmul double %48, %55
%57 = call double @llvm.fmuladd.f64(double %39, double %46, double %56)
%58 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 2
%59 = load double, double* %58
%60 = load double*, double** %11
%61 = load i32, i32* %13
%62 = mul nsw i32 %61, 3
%63 = add nsw i32 %62, 2
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %60, i64 %64
%66 = load double, double* %65
%67 = call double @llvm.fmuladd.f64(double %59, double %66, double %57)
%68 = load double, double* %16
%69 = fadd double %67, %68
%70 = call double @cos(double %69)
store double %70, double* %17
store i32 0, i32* %14
br label %71
71: ; preds = %88, %37
%72 = load i32, i32* %14
%73 = icmp slt i32 %72, 3
br i1 %73, label %74, label %91
74: ; preds = %71
%75 = load i32, i32* %14
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 %76
%78 = load double, double* %77
%79 = load double, double* %17
%80 = fmul double %78, %79
%81 = load double*, double** %12
%82 = load i32, i32* %13
%83 = mul nsw i32 %82, 3
%84 = load i32, i32* %14
%85 = add nsw i32 %83, %84
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %81, i64 %86
store double %80, double* %87
br label %88
88: ; preds = %74
%89 = load i32, i32* %14
%90 = add nsw i32 %89, 1
store i32 %90, i32* %14
br label %71
91: ; preds = %71
br label %92
92: ; preds = %91
%93 = load i32, i32* %13
%94 = add nsw i32 %93, 1
store i32 %94, i32* %13
br label %33
95: ; preds = %33
ret i32 0
}

LLVM IR (-O2):
define i32 @LinearADR_Sine_du(i32* nocapture readnone %0, double* nocapture %1, i32 %2, double %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = bitcast double* %1 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
%9 = getelementptr inbounds double, double* %1, i64 2
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %1, i64 3
%12 = load double, double* %11
%13 = icmp sgt i32 %2, 0
br i1 %13, label %14, label %43
14: ; preds = %6
%15 = zext i32 %2 to i64
%16 = extractelement <2 x double> %8, i64 1
%17 = extractelement <2 x double> %8, i64 0
br label %18
18: ; preds = %14, %18
%19 = phi i64 [ 0, %14 ], [ %41, %18 ]
%20 = mul nuw nsw i64 %19, 3
%21 = getelementptr inbounds double, double* %4, i64 %20
%22 = load double, double* %21
%23 = add nuw nsw i64 %20, 1
%24 = getelementptr inbounds double, double* %4, i64 %23
%25 = load double, double* %24
%26 = fmul double %16, %25
%27 = tail call double @llvm.fmuladd.f64(double %17, double %22, double %26)
%28 = add nuw nsw i64 %20, 2
%29 = getelementptr inbounds double, double* %4, i64 %28
%30 = load double, double* %29
%31 = tail call double @llvm.fmuladd.f64(double %10, double %30, double %27)
%32 = fadd double %12, %31
%33 = tail call double @cos(double %32)
%34 = getelementptr inbounds double, double* %5, i64 %20
%35 = insertelement <2 x double> poison, double %33, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = fmul <2 x double> %36, %8
%38 = bitcast double* %34 to <2 x double>*
store <2 x double> %37, <2 x double>* %38
%39 = fmul double %33, %10
%40 = getelementptr inbounds double, double* %5, i64 %28
store double %39, double* %40
%41 = add nuw nsw i64 %19, 1
%42 = icmp eq i64 %41, %15
br i1 %42, label %43, label %18
43: ; preds = %18, %6
ret i32 0
}