#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 M_PI;
double sin(double);
int myfun_vec_param(const double *x, unsigned int N, double *out, void *data) {
  int k;
  double omega = *((double *)data);
  for (k = 0; k < N; k++)
    out[k] = sin(omega * M_PI * x[k]);
  return 0;
}


x86 assembly (clang, -O0):
<myfun_vec_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1184 <myfun_vec_param+0x74>
movsd  -0x30(%rbp),%xmm0
mov    0x2e95(%rip),%rax
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1030 <sin@plt>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113b <myfun_vec_param+0x2b>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfun_vec_param>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     11bb <myfun_vec_param+0xab>
mov    %rdx,%r14
mov    %rdi,%r15
movsd  (%rcx),%xmm1
mov    %esi,%r12d
cmp    $0x1,%esi
jne    1139 <myfun_vec_param+0x29>
xor    %ebx,%ebx
jmp    1195 <myfun_vec_param+0x85>
mov    %r12d,%r13d
and    $0xfffffffe,%r13d
xor    %ebx,%ebx
mov    0x2e9f(%rip),%rbp
movsd  %xmm1,(%rsp)
xchg   %ax,%ax
movsd  0x0(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  (%r15,%rbx,8),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%r14,%rbx,8)
movsd  0x0(%rbp),%xmm0
mulsd  (%rsp),%xmm0
mulsd  0x8(%r15,%rbx,8),%xmm0
call   1030 <sin@plt>
movsd  (%rsp),%xmm1
movsd  %xmm0,0x8(%r14,%rbx,8)
add    $0x2,%rbx
cmp    %rbx,%r13
jne    1150 <myfun_vec_param+0x40>
test   $0x1,%r12b
je     11bb <myfun_vec_param+0xab>
mov    0x2e46(%rip),%rax
mulsd  (%rax),%xmm1
mulsd  (%r15,%rbx,8),%xmm1
movapd %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%r14,%rbx,8)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define i32 @myfun_vec_param(double* %0, i32 %1, double* %2, i8* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca double
store double* %0, double** %5
store i32 %1, i32* %6
store double* %2, double** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %8
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
store double %13, double* %10
store i32 0, i32* %9
br label %14
14: ; preds = %33, %4
%15 = load i32, i32* %9
%16 = load i32, i32* %6
%17 = icmp ult i32 %15, %16
br i1 %17, label %18, label %36
18: ; preds = %14
%19 = load double, double* %10
%20 = load double, double* @M_PI
%21 = fmul double %19, %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 = fmul double %21, %26
%28 = call double @sin(double %27)
%29 = load double*, double** %7
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
store double %28, double* %32
br label %33
33: ; preds = %18
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %14
36: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define i32 @myfun_vec_param(double* nocapture %0, i32 %1, double* nocapture writeonly %2, i8* nocapture %3) {
%5 = bitcast i8* %3 to double*
%6 = load double, double* %5
%7 = icmp eq i32 %1, 0
br i1 %7, label %46, label %8
8: ; preds = %4
%9 = zext i32 %1 to i64
%10 = and i64 %9, 1
%11 = icmp eq i32 %1, 1
br i1 %11, label %35, label %12
12: ; preds = %8
%13 = and i64 %9, 4294967294
br label %14
14: ; preds = %14, %12
%15 = phi i64 [ 0, %12 ], [ %32, %14 ]
%16 = phi i64 [ 0, %12 ], [ %33, %14 ]
%17 = load double, double* @M_PI
%18 = fmul double %6, %17
%19 = getelementptr inbounds double, double* %0, i64 %15
%20 = load double, double* %19
%21 = fmul double %18, %20
%22 = tail call double @sin(double %21)
%23 = getelementptr inbounds double, double* %2, i64 %15
store double %22, double* %23
%24 = or i64 %15, 1
%25 = load double, double* @M_PI
%26 = fmul double %6, %25
%27 = getelementptr inbounds double, double* %0, i64 %24
%28 = load double, double* %27
%29 = fmul double %26, %28
%30 = tail call double @sin(double %29)
%31 = getelementptr inbounds double, double* %2, i64 %24
store double %30, double* %31
%32 = add nuw nsw i64 %15, 2
%33 = add i64 %16, 2
%34 = icmp eq i64 %33, %13
br i1 %34, label %35, label %14
35: ; preds = %14, %8
%36 = phi i64 [ 0, %8 ], [ %32, %14 ]
%37 = icmp eq i64 %10, 0
br i1 %37, label %46, label %38
38: ; preds = %35
%39 = load double, double* @M_PI
%40 = fmul double %6, %39
%41 = getelementptr inbounds double, double* %0, i64 %36
%42 = load double, double* %41
%43 = fmul double %40, %42
%44 = tail call double @sin(double %43)
%45 = getelementptr inbounds double, double* %2, i64 %36
store double %44, double* %45
br label %46
46: ; preds = %38, %35, %4
ret i32 0
}