#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 ENDSWAP_32(int);
void bei2f_array(int *src, int count, float *dest, float normfact) {
  int value;
  while (--count >= 0) {
    value = src[count];
    value = ENDSWAP_32(value);
    dest[count] = ((float)value) * normfact;
  };
}


x86 assembly (clang, -O0):
<bei2f_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     116f <bei2f_array+0x5f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <ENDSWAP_32@plt>
mov    %eax,-0x20(%rbp)
cvtsi2ssl -0x20(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    1128 <bei2f_array+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bei2f_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    115e <bei2f_array+0x4e>
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%ebx
add    $0x1,%rbx
movss  %xmm0,0x4(%rsp)
xchg   %ax,%ax
lea    -0x2(%rbx),%r12d
mov    (%r15,%r12,4),%edi
call   1030 <ENDSWAP_32@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%r14,%r12,4)
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1130 <bei2f_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @bei2f_array(i32* %0, i32 %1, float* %2, float %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca float*
%8 = alloca float
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store float* %2, float** %7
store float %3, float* %8
br label %10
10: ; preds = %14, %4
%11 = load i32, i32* %6
%12 = add nsw i32 %11, -1
store i32 %12, i32* %6
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %30
14: ; preds = %10
%15 = load i32*, i32** %5
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = call i32 @ENDSWAP_32(i32 %20)
store i32 %21, i32* %9
%22 = load i32, i32* %9
%23 = sitofp i32 %22 to float
%24 = load float, float* %8
%25 = fmul float %23, %24
%26 = load float*, float** %7
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %26, i64 %28
store float %25, float* %29
br label %10
30: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @bei2f_array(i32* nocapture %0, i32 %1, float* nocapture writeonly %2, float %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %19
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ %7, %6 ], [ %10, %8 ]
%10 = add nsw i64 %9, -1
%11 = and i64 %10, 4294967295
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = tail call i32 @ENDSWAP_32(i32 %13)
%15 = sitofp i32 %14 to float
%16 = fmul float %15, %3
%17 = getelementptr inbounds float, float* %2, i64 %11
store float %16, float* %17
%18 = icmp ugt i64 %9, 1
br i1 %18, label %8, label %19
19: ; preds = %8, %4
ret void
}