#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
int /*<<< orphan*/ FifoProtocol_memcpy(scalar_t__ *, int /*<<< orphan*/ const *,
                                       int);
uint16_t inv_fifo_protocol_helper_decode_calibrationgains(const void *in,
                                                          uint16_t len,
                                                          float *data) {
  const uint8_t *buf = (const uint8_t *)in;
  int i;
  for (i = 0; i < 9; i++) {
    int32_t elt;
    FifoProtocol_memcpy((&elt), (&buf[sizeof(int32_t) * i]), (sizeof(int32_t)));
    elt = elt;
    data[i] = ((float)(int32_t)(elt) / (float)(1ULL << (30)));
  }
  (void)len;
  return 0;
}


x86 assembly (clang, -O0):
<inv_fifo_protocol_helper_decode_calibrationgains>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x9,-0x24(%rbp)
jge    1192 <inv_fifo_protocol_helper_decode_calibrationgains+0x82>
mov    -0x20(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    -0x30(%rbp),%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
cvtsi2ssq -0x30(%rbp),%xmm0
movss  0xe8d(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <inv_fifo_protocol_helper_decode_calibrationgains+0x22>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_fifo_protocol_helper_decode_calibrationgains>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rdi,%rbx
lea    0x8(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xebd(%rip),%xmm0
movss  %xmm0,(%r14)
lea    0x20(%rbx),%rsi
mov    %r15,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xe95(%rip),%xmm0
movss  %xmm0,0x4(%r14)
lea    0x40(%rbx),%rsi
mov    %r15,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xe6c(%rip),%xmm0
movss  %xmm0,0x8(%r14)
lea    0x60(%rbx),%rsi
mov    %r15,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xe43(%rip),%xmm0
movss  %xmm0,0xc(%r14)
lea    0x80(%rbx),%rsi
mov    %r15,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xe17(%rip),%xmm0
movss  %xmm0,0x10(%r14)
lea    0xa0(%rbx),%rsi
mov    %r15,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xdeb(%rip),%xmm0
movss  %xmm0,0x14(%r14)
lea    0xc0(%rbx),%rsi
mov    %r15,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xdbf(%rip),%xmm0
movss  %xmm0,0x18(%r14)
lea    0xe0(%rbx),%rsi
mov    %r15,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xd93(%rip),%xmm0
movss  %xmm0,0x1c(%r14)
add    $0x100,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xd64(%rip),%xmm0
movss  %xmm0,0x20(%r14)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @inv_fifo_protocol_helper_decode_calibrationgains(i8* %0, i32 %1, float* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca float*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store float* %2, float** %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %7
store i32 0, i32* %8
br label %12
12: ; preds = %30, %3
%13 = load i32, i32* %8
%14 = icmp slt i32 %13, 9
br i1 %14, label %15, label %33
15: ; preds = %12
%16 = load i32*, i32** %7
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = mul i64 8, %18
%20 = getelementptr inbounds i32, i32* %16, i64 %19
%21 = call i32 @FifoProtocol_memcpy(i64* %9, i32* %20, i32 8)
%22 = load i64, i64* %9
store i64 %22, i64* %9
%23 = load i64, i64* %9
%24 = sitofp i64 %23 to float
%25 = fdiv float %24, 0x41D0000000000000
%26 = load float*, float** %6
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %26, i64 %28
store float %25, float* %29
br label %30
30: ; preds = %15
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %12
33: ; preds = %12
%34 = load i32, i32* %5
ret i32 0
}

LLVM IR (-O2):
define i32 @inv_fifo_protocol_helper_decode_calibrationgains(i8* %0, i32 %1, float* nocapture writeonly %2) {
%4 = alloca i64
%5 = bitcast i8* %0 to i32*
%6 = bitcast i64* %4 to i8*
%7 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %5, i32 8)
%8 = load i64, i64* %4
%9 = sitofp i64 %8 to float
%10 = fmul float %9, 0x3E10000000000000
store float %10, float* %2
%11 = getelementptr inbounds i8, i8* %0, i64 32
%12 = bitcast i8* %11 to i32*
%13 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %12, i32 8)
%14 = load i64, i64* %4
%15 = sitofp i64 %14 to float
%16 = fmul float %15, 0x3E10000000000000
%17 = getelementptr inbounds float, float* %2, i64 1
store float %16, float* %17
%18 = getelementptr inbounds i8, i8* %0, i64 64
%19 = bitcast i8* %18 to i32*
%20 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %19, i32 8)
%21 = load i64, i64* %4
%22 = sitofp i64 %21 to float
%23 = fmul float %22, 0x3E10000000000000
%24 = getelementptr inbounds float, float* %2, i64 2
store float %23, float* %24
%25 = getelementptr inbounds i8, i8* %0, i64 96
%26 = bitcast i8* %25 to i32*
%27 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %26, i32 8)
%28 = load i64, i64* %4
%29 = sitofp i64 %28 to float
%30 = fmul float %29, 0x3E10000000000000
%31 = getelementptr inbounds float, float* %2, i64 3
store float %30, float* %31
%32 = getelementptr inbounds i8, i8* %0, i64 128
%33 = bitcast i8* %32 to i32*
%34 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %33, i32 8)
%35 = load i64, i64* %4
%36 = sitofp i64 %35 to float
%37 = fmul float %36, 0x3E10000000000000
%38 = getelementptr inbounds float, float* %2, i64 4
store float %37, float* %38
%39 = getelementptr inbounds i8, i8* %0, i64 160
%40 = bitcast i8* %39 to i32*
%41 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %40, i32 8)
%42 = load i64, i64* %4
%43 = sitofp i64 %42 to float
%44 = fmul float %43, 0x3E10000000000000
%45 = getelementptr inbounds float, float* %2, i64 5
store float %44, float* %45
%46 = getelementptr inbounds i8, i8* %0, i64 192
%47 = bitcast i8* %46 to i32*
%48 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %47, i32 8)
%49 = load i64, i64* %4
%50 = sitofp i64 %49 to float
%51 = fmul float %50, 0x3E10000000000000
%52 = getelementptr inbounds float, float* %2, i64 6
store float %51, float* %52
%53 = getelementptr inbounds i8, i8* %0, i64 224
%54 = bitcast i8* %53 to i32*
%55 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %54, i32 8)
%56 = load i64, i64* %4
%57 = sitofp i64 %56 to float
%58 = fmul float %57, 0x3E10000000000000
%59 = getelementptr inbounds float, float* %2, i64 7
store float %58, float* %59
%60 = getelementptr inbounds i8, i8* %0, i64 256
%61 = bitcast i8* %60 to i32*
%62 = call i32 @FifoProtocol_memcpy(i64* %4, i32* %61, i32 8)
%63 = load i64, i64* %4
%64 = sitofp i64 %63 to float
%65 = fmul float %64, 0x3E10000000000000
%66 = getelementptr inbounds float, float* %2, i64 8
store float %65, float* %66
ret i32 0
}