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


x86 assembly (clang, -O0):
<myfun_vec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    118a <myfun_vec+0x7a>
movsd  0xec6(%rip),%xmm0
mov    0x2e9f(%rip),%rax
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9a(%rip),%xmm1
addsd  %xmm1,%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    112e <myfun_vec+0x1e>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfun_vec>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     11e1 <myfun_vec+0xd1>
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%r12d
cmp    $0x1,%esi
jne    1135 <myfun_vec+0x25>
xor    %ebx,%ebx
jmp    11af <myfun_vec+0x9f>
mov    %r12d,%r13d
and    $0xfffffffe,%r13d
xor    %ebx,%ebx
mov    0x2ea3(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%rbp),%xmm0
movsd  0xea3(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  (%r15,%rbx,8),%xmm0
movsd  0xe99(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%r14,%rbx,8)
movsd  0x0(%rbp),%xmm0
mulsd  0xe75(%rip),%xmm0
mulsd  0x8(%r15,%rbx,8),%xmm0
addsd  0xe6e(%rip),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%r14,%rbx,8)
add    $0x2,%rbx
cmp    %rbx,%r13
jne    1150 <myfun_vec+0x40>
test   $0x1,%r12b
je     11e1 <myfun_vec+0xd1>
mov    0x2e2c(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xe38(%rip),%xmm0
mulsd  (%r15,%rbx,8),%xmm0
addsd  0xe32(%rip),%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(double* %0, i32 %1, double* %2, i8* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
%8 = alloca i8*
%9 = alloca i32
store double* %0, double** %5
store i32 %1, i32* %6
store double* %2, double** %7
store i8* %3, i8** %8
store i32 0, i32* %9
br label %10
10: ; preds = %28, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %31
14: ; preds = %10
%15 = load double, double* @M_PI
%16 = fmul double 4.000000e+00, %15
%17 = load double*, double** %5
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = call double @llvm.fmuladd.f64(double %16, double %21, double 1.000000e+00)
%23 = call double @sin(double %22)
%24 = load double*, double** %7
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
store double %23, double* %27
br label %28
28: ; preds = %14
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %10
31: ; preds = %10
ret i32 0
}

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