#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_calibrationoffsets(const void *in,
                                                            uint16_t len,
                                                            float *data) {
  const uint8_t *buf = (const uint8_t *)in;
  int i;
  for (i = 0; i < 3; 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 << (16)));
  }
  (void)len;
  return 0;
}


x86 assembly (clang, -O0):
<inv_fifo_protocol_helper_decode_calibrationoffsets>:
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   $0x3,-0x24(%rbp)
jge    1192 <inv_fifo_protocol_helper_decode_calibrationoffsets+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_calibrationoffsets+0x22>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_fifo_protocol_helper_decode_calibrationoffsets>:
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)
add    $0x40,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xe69(%rip),%xmm0
movss  %xmm0,0x8(%r14)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @inv_fifo_protocol_helper_decode_calibrationoffsets(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, 3
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, 6.553600e+04
%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_calibrationoffsets(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, 0x3EF0000000000000
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, 0x3EF0000000000000
%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, 0x3EF0000000000000
%24 = getelementptr inbounds float, float* %2, i64 2
store float %23, float* %24
ret i32 0
}