#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);
void my_model(double *x, double *y, double *c, double n) {
  for (int i = 0; i < n; i++)
    y[i] = c[0] * sin(c[1] * x[i] + c[2]);
}


x86 assembly (clang, -O0):
<my_model>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a4 <my_model+0x94>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1130 <my_model+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_model>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    1188 <my_model+0x78>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
movsd  %xmm1,0x8(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  (%r12),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%r12),%xmm0
mulsd  (%r15,%rbx,8),%xmm0
addsd  0x10(%r12),%xmm0
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
ucomisd %xmm0,%xmm1
ja     1140 <my_model+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @my_model(double* %0, double* %1, double* %2, double %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double
%9 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double %3, double* %8
store i32 0, i32* %9
br label %10
10: ; preds = %37, %4
%11 = load i32, i32* %9
%12 = sitofp i32 %11 to double
%13 = load double, double* %8
%14 = fcmp olt double %12, %13
br i1 %14, label %15, label %40
15: ; preds = %10
%16 = load double*, double** %7
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = load double*, double** %7
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double*, double** %5
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = load double*, double** %7
%28 = getelementptr inbounds double, double* %27, i64 2
%29 = load double, double* %28
%30 = call double @llvm.fmuladd.f64(double %21, double %26, double %29)
%31 = call double @sin(double %30)
%32 = fmul double %18, %31
%33 = load double*, double** %6
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
store double %32, double* %36
br label %37
37: ; preds = %15
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
br label %10
40: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @my_model(double* nocapture %0, double* nocapture writeonly %1, double* nocapture %2, double %3) {
%5 = fcmp ogt double %3, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = getelementptr inbounds double, double* %2, i64 1
%8 = getelementptr inbounds double, double* %2, i64 2
br label %10
9: ; preds = %10, %4
ret void
10: ; preds = %6, %10
%11 = phi i64 [ 0, %6 ], [ %21, %10 ]
%12 = load double, double* %2
%13 = load double, double* %7
%14 = getelementptr inbounds double, double* %0, i64 %11
%15 = load double, double* %14
%16 = load double, double* %8
%17 = tail call double @llvm.fmuladd.f64(double %13, double %15, double %16)
%18 = tail call double @sin(double %17)
%19 = fmul double %12, %18
%20 = getelementptr inbounds double, double* %1, i64 %11
store double %19, double* %20
%21 = add nuw i64 %11, 1
%22 = trunc i64 %21 to i32
%23 = sitofp i32 %22 to double
%24 = fcmp olt double %23, %3
br i1 %24, label %10, label %9
}