#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*/ neon_convert_si16_ps_4n(float *, short const *, int);
void neon_convert_si16_ps(float *out, const short *in, int len) {
  int start = len / 4 * 4;
  neon_convert_si16_ps_4n(out, in, len >> 2);
  for (int i = 0; i < len % 4; i++)
    out[start + i] = (float)in[start + i];
}


x86 assembly (clang, -O0):
<neon_convert_si16_ps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
shl    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
sar    $0x2,%edx
call   1030 <neon_convert_si16_ps_4n@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
cmp    %edx,%eax
jge    11a1 <neon_convert_si16_ps+0x91>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movswl (%rax,%rcx,2),%eax
cvtsi2ss %eax,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114e <neon_convert_si16_ps+0x3e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neon_convert_si16_ps>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%r14
sar    $0x2,%edx
call   1030 <neon_convert_si16_ps_4n@plt>
lea    0x3(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
mov    %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%ebx
test   %ebx,%ebx
jle    1188 <neon_convert_si16_ps+0x78>
sar    $0x2,%eax
shl    $0x2,%eax
cltq
movswl (%r15,%rax,2),%ecx
cvtsi2ss %ecx,%xmm0
movss  %xmm0,(%r14,%rax,4)
cmp    $0x1,%ebx
je     1188 <neon_convert_si16_ps+0x78>
mov    %rax,%rcx
or     $0x1,%rcx
movswl (%r15,%rcx,2),%edx
xorps  %xmm0,%xmm0
cvtsi2ss %edx,%xmm0
movss  %xmm0,(%r14,%rcx,4)
cmp    $0x2,%ebx
je     1188 <neon_convert_si16_ps+0x78>
or     $0x2,%rax
movswl (%r15,%rax,2),%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
movss  %xmm0,(%r14,%rax,4)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @neon_convert_si16_ps(float* %0, i16* %1, i32 %2) {
%4 = alloca float*
%5 = alloca i16*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store float* %0, float** %4
store i16* %1, i16** %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = sdiv i32 %9, 4
%11 = mul nsw i32 %10, 4
store i32 %11, i32* %7
%12 = load float*, float** %4
%13 = load i16*, i16** %5
%14 = load i32, i32* %6
%15 = ashr i32 %14, 2
%16 = call i32 @neon_convert_si16_ps_4n(float* %12, i16* %13, i32 %15)
store i32 0, i32* %8
br label %17
17: ; preds = %37, %3
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = srem i32 %19, 4
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %40
22: ; preds = %17
%23 = load i16*, i16** %5
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = add nsw i32 %24, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i16, i16* %23, i64 %27
%29 = load i16, i16* %28
%30 = sitofp i16 %29 to float
%31 = load float*, float** %4
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = add nsw i32 %32, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %31, i64 %35
store float %30, float* %36
br label %37
37: ; preds = %22
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %17
40: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @neon_convert_si16_ps(float* %0, i16* %1, i32 %2) {
%4 = ashr i32 %2, 2
%5 = tail call i32 @neon_convert_si16_ps_4n(float* %0, i16* %1, i32 %4)
%6 = srem i32 %2, 4
%7 = sdiv i32 %2, 4
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %17
9: ; preds = %3
%10 = shl nsw i32 %7, 2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i16, i16* %1, i64 %11
%13 = load i16, i16* %12
%14 = sitofp i16 %13 to float
%15 = getelementptr inbounds float, float* %0, i64 %11
store float %14, float* %15
%16 = icmp eq i32 %6, 1
br i1 %16, label %17, label %18
17: ; preds = %9, %18, %25, %3
ret void
18: ; preds = %9
%19 = or i64 %11, 1
%20 = getelementptr inbounds i16, i16* %1, i64 %19
%21 = load i16, i16* %20
%22 = sitofp i16 %21 to float
%23 = getelementptr inbounds float, float* %0, i64 %19
store float %22, float* %23
%24 = icmp eq i32 %6, 2
br i1 %24, label %17, label %25
25: ; preds = %18
%26 = or i64 %11, 2
%27 = getelementptr inbounds i16, i16* %1, i64 %26
%28 = load i16, i16* %27
%29 = sitofp i16 %28 to float
%30 = getelementptr inbounds float, float* %0, i64 %26
store float %29, float* %30
br label %17
}