#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 int24p_to_int32(char const *);
void int24ple_to_float32_array(const char *__restrict in, float *__restrict out,
                               size_t len) {
  size_t i;
  len *= 3;
  for (i = 0; i < len; i += 3) {
    out[i / 3] = (float)(int24p_to_int32(&in[i]) / (8.0 * 0x10000000));
  }
}


x86 assembly (clang, -O0):
<int24ple_to_float32_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
imul   $0x3,-0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1193 <int24ple_to_float32_array+0x83>
mov    -0x8(%rbp),%rdi
add    -0x20(%rbp),%rdi
call   1030 <int24p_to_int32@plt>
movsd  0xea8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x20(%rbp)
jmp    1135 <int24ple_to_float32_array+0x25>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int24ple_to_float32_array>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    (%rdx,%rdx,2),%r12
test   %r12,%r12
je     116e <int24ple_to_float32_array+0x5e>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
movabs $0xaaaaaaaaaaaaaaab,%r13
aa aa aa
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r15,%rbx,1),%rdi
call   1030 <int24p_to_int32@plt>
mulsd  0xeaf(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    %rbx,%rax
mul    %r13
and    $0xfffffffffffffffe,%rdx
movss  %xmm0,(%r14,%rdx,2)
add    $0x3,%rbx
cmp    %r12,%rbx
jb     1140 <int24ple_to_float32_array+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @int24ple_to_float32_array(i8* noalias %0, float* noalias %1, i64 %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store float* %1, float** %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = mul i64 %8, 3
store i64 %9, i64* %6
store i64 0, i64* %7
br label %10
10: ; preds = %25, %3
%11 = load i64, i64* %7
%12 = load i64, i64* %6
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i64, i64* %7
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = call double @int24p_to_int32(i8* %17)
%19 = fdiv double %18, 0x41E0000000000000
%20 = fptrunc double %19 to float
%21 = load float*, float** %5
%22 = load i64, i64* %7
%23 = udiv i64 %22, 3
%24 = getelementptr inbounds float, float* %21, i64 %23
store float %20, float* %24
br label %25
25: ; preds = %14
%26 = load i64, i64* %7
%27 = add i64 %26, 3
store i64 %27, i64* %7
br label %10
28: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @int24ple_to_float32_array(i8* noalias %0, float* noalias nocapture writeonly %1, i64 %2) {
%4 = mul i64 %2, 3
%5 = icmp eq i64 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %14, %6 ], [ 0, %3 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call double @int24p_to_int32(i8* %8)
%10 = fmul double %9, 0x3E00000000000000
%11 = fptrunc double %10 to float
%12 = udiv i64 %7, 3
%13 = getelementptr inbounds float, float* %1, i64 %12
store float %11, float* %13
%14 = add i64 %7, 3
%15 = icmp ult i64 %14, %4
br i1 %15, label %6, label %16
16: ; preds = %6, %3
ret void
}