#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 */
int /*<<< orphan*/ cos(int /*<<< orphan*/);
void vectorFPCosine(double *a, double *b, double *c, int nsize) {
  int j;
  for (j = nsize; j > 0; j--)
    *(c++) = cos(*(a++));
}


x86 assembly (clang, -O0):
<vectorFPCosine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    1174 <vectorFPCosine+0x64>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
cvttsd2si (%rax),%edi
call   1030 <cos@plt>
cvtsi2sd %eax,%xmm0
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    112d <vectorFPCosine+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vectorFPCosine>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %ecx,%ecx
jle    11f0 <vectorFPCosine+0xe0>
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rdi,%rbx
lea    -0x1(%r14),%r12d
mov    %ecx,%r13d
and    $0x3,%r13d
je     1168 <vectorFPCosine+0x58>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
cvttsd2si (%rbx),%edi
add    $0x8,%rbx
call   1030 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r15)
add    $0x8,%r15
add    $0x1,%ebp
cmp    %ebp,%r13d
jne    1140 <vectorFPCosine+0x30>
sub    %ebp,%r14d
cmp    $0x3,%r12d
jb     11f0 <vectorFPCosine+0xe0>
add    $0xffffffff,%r14d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
cvttsd2si (%rbx,%rbp,1),%edi
call   1030 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r15,%rbp,1)
cvttsd2si 0x8(%rbx,%rbp,1),%edi
call   1030 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%r15,%rbp,1)
cvttsd2si 0x10(%rbx,%rbp,1),%edi
call   1030 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%r15,%rbp,1)
cvttsd2si 0x18(%rbx,%rbp,1),%edi
call   1030 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x18(%r15,%rbp,1)
add    $0xfffffffc,%r14d
add    $0x20,%rbp
cmp    $0xfffffffe,%r14d
jb     1180 <vectorFPCosine+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vectorFPCosine(double* %0, double* %1, double* %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
store i32 %10, i32* %9
br label %11
11: ; preds = %23, %4
%12 = load i32, i32* %9
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i32 1
store double* %16, double** %5
%17 = load double, double* %15
%18 = fptosi double %17 to i32
%19 = call i32 @cos(i32 %18)
%20 = sitofp i32 %19 to double
%21 = load double*, double** %7
%22 = getelementptr inbounds double, double* %21, i32 1
store double* %22, double** %7
store double %20, double* %21
br label %23
23: ; preds = %14
%24 = load i32, i32* %9
%25 = add nsw i32 %24, -1
store i32 %25, i32* %9
br label %11
26: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @vectorFPCosine(double* nocapture %0, double* nocapture readnone %1, double* nocapture writeonly %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %60
6: ; preds = %4
%7 = add i32 %3, -1
%8 = and i32 %3, 3
%9 = icmp eq i32 %8, 0
br i1 %9, label %24, label %10
10: ; preds = %6, %10
%11 = phi i32 [ %21, %10 ], [ %3, %6 ]
%12 = phi double* [ %15, %10 ], [ %0, %6 ]
%13 = phi double* [ %20, %10 ], [ %2, %6 ]
%14 = phi i32 [ %22, %10 ], [ 0, %6 ]
%15 = getelementptr inbounds double, double* %12, i64 1
%16 = load double, double* %12
%17 = fptosi double %16 to i32
%18 = tail call i32 @cos(i32 %17)
%19 = sitofp i32 %18 to double
%20 = getelementptr inbounds double, double* %13, i64 1
store double %19, double* %13
%21 = add nsw i32 %11, -1
%22 = add i32 %14, 1
%23 = icmp eq i32 %22, %8
br i1 %23, label %24, label %10
24: ; preds = %10, %6
%25 = phi i32 [ %3, %6 ], [ %21, %10 ]
%26 = phi double* [ %0, %6 ], [ %15, %10 ]
%27 = phi double* [ %2, %6 ], [ %20, %10 ]
%28 = icmp ult i32 %7, 3
br i1 %28, label %60, label %29
29: ; preds = %24, %29
%30 = phi i32 [ %57, %29 ], [ %25, %24 ]
%31 = phi double* [ %51, %29 ], [ %26, %24 ]
%32 = phi double* [ %56, %29 ], [ %27, %24 ]
%33 = getelementptr inbounds double, double* %31, i64 1
%34 = load double, double* %31
%35 = fptosi double %34 to i32
%36 = tail call i32 @cos(i32 %35)
%37 = sitofp i32 %36 to double
%38 = getelementptr inbounds double, double* %32, i64 1
store double %37, double* %32
%39 = getelementptr inbounds double, double* %31, i64 2
%40 = load double, double* %33
%41 = fptosi double %40 to i32
%42 = tail call i32 @cos(i32 %41)
%43 = sitofp i32 %42 to double
%44 = getelementptr inbounds double, double* %32, i64 2
store double %43, double* %38
%45 = getelementptr inbounds double, double* %31, i64 3
%46 = load double, double* %39
%47 = fptosi double %46 to i32
%48 = tail call i32 @cos(i32 %47)
%49 = sitofp i32 %48 to double
%50 = getelementptr inbounds double, double* %32, i64 3
store double %49, double* %44
%51 = getelementptr inbounds double, double* %31, i64 4
%52 = load double, double* %45
%53 = fptosi double %52 to i32
%54 = tail call i32 @cos(i32 %53)
%55 = sitofp i32 %54 to double
%56 = getelementptr inbounds double, double* %32, i64 4
store double %55, double* %50
%57 = add nsw i32 %30, -4
%58 = add i32 %30, -5
%59 = icmp ult i32 %58, -2
br i1 %59, label %29, label %60
60: ; preds = %24, %29, %4
ret void
}