#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 int /*<<< orphan*/ mag;
typedef scalar_t__ int16_t;

/* Variables and functions */
int /*<<< orphan*/ FifoProtocol_memcpy(scalar_t__ *, int /*<<< orphan*/ const *,
                                       int);
void inv_fifo_protocol_helper_decode_mag_bias_data(const void *in, uint16_t len,
                                                   float *bx, float *by,
                                                   float *bz) {
  const uint8_t *buf = (const uint8_t *)in;
  int16_t mag;
  FifoProtocol_memcpy((&mag), (&buf[6]), (sizeof(mag)));
  *bx = ((float)(int16_t)(mag) / (float)(1ULL << (4)));
  FifoProtocol_memcpy((&mag), (&buf[8]), (sizeof(mag)));
  *by = ((float)(int16_t)(mag) / (float)(1ULL << (4)));
  FifoProtocol_memcpy((&mag), (&buf[10]), (sizeof(mag)));
  *bz = ((float)(int16_t)(mag) / (float)(1ULL << (4)));
  (void)len;
}


x86 assembly (clang, -O0):
<inv_fifo_protocol_helper_decode_mag_bias_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
add    $0x18,%rsi
lea    -0x38(%rbp),%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
cvtsi2ssq -0x38(%rbp),%xmm0
movss  0xea9(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x30(%rbp),%rsi
add    $0x20,%rsi
lea    -0x38(%rbp),%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
cvtsi2ssq -0x38(%rbp),%xmm0
movss  0xe79(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x30(%rbp),%rsi
add    $0x28,%rsi
lea    -0x38(%rbp),%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
cvtsi2ssq -0x38(%rbp),%xmm0
movss  0xe49(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_fifo_protocol_helper_decode_mag_bias_data>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rdi,%rbx
lea    0x18(%rdi),%rsi
lea    0x8(%rsp),%r13
mov    %r13,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xeb2(%rip),%xmm0
movss  %xmm0,(%r12)
lea    0x20(%rbx),%rsi
mov    %r13,%rdi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xe89(%rip),%xmm0
movss  %xmm0,(%r15)
add    $0x28,%rbx
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1030 <FifoProtocol_memcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rsp),%xmm0
mulss  0xe5e(%rip),%xmm0
movss  %xmm0,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @inv_fifo_protocol_helper_decode_mag_bias_data(i8* %0, i32 %1, float* %2, float* %3, float* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
%11 = alloca i32*
%12 = alloca i64
store i8* %0, i8** %6
store i32 %1, i32* %7
store float* %2, float** %8
store float* %3, float** %9
store float* %4, float** %10
%13 = load i8*, i8** %6
%14 = bitcast i8* %13 to i32*
store i32* %14, i32** %11
%15 = load i32*, i32** %11
%16 = getelementptr inbounds i32, i32* %15, i64 6
%17 = call i32 @FifoProtocol_memcpy(i64* %12, i32* %16, i32 8)
%18 = load i64, i64* %12
%19 = sitofp i64 %18 to float
%20 = fdiv float %19, 1.600000e+01
%21 = load float*, float** %8
store float %20, float* %21
%22 = load i32*, i32** %11
%23 = getelementptr inbounds i32, i32* %22, i64 8
%24 = call i32 @FifoProtocol_memcpy(i64* %12, i32* %23, i32 8)
%25 = load i64, i64* %12
%26 = sitofp i64 %25 to float
%27 = fdiv float %26, 1.600000e+01
%28 = load float*, float** %9
store float %27, float* %28
%29 = load i32*, i32** %11
%30 = getelementptr inbounds i32, i32* %29, i64 10
%31 = call i32 @FifoProtocol_memcpy(i64* %12, i32* %30, i32 8)
%32 = load i64, i64* %12
%33 = sitofp i64 %32 to float
%34 = fdiv float %33, 1.600000e+01
%35 = load float*, float** %10
store float %34, float* %35
%36 = load i32, i32* %7
ret void
}

LLVM IR (-O2):
define void @inv_fifo_protocol_helper_decode_mag_bias_data(i8* %0, i32 %1, float* nocapture writeonly %2, float* nocapture writeonly %3, float* nocapture writeonly %4) {
%6 = alloca i64
%7 = bitcast i64* %6 to i8*
%8 = getelementptr inbounds i8, i8* %0, i64 24
%9 = bitcast i8* %8 to i32*
%10 = call i32 @FifoProtocol_memcpy(i64* %6, i32* %9, i32 8)
%11 = load i64, i64* %6
%12 = sitofp i64 %11 to float
%13 = fmul float %12, 6.250000e-02
store float %13, float* %2
%14 = getelementptr inbounds i8, i8* %0, i64 32
%15 = bitcast i8* %14 to i32*
%16 = call i32 @FifoProtocol_memcpy(i64* %6, i32* %15, i32 8)
%17 = load i64, i64* %6
%18 = sitofp i64 %17 to float
%19 = fmul float %18, 6.250000e-02
store float %19, float* %3
%20 = getelementptr inbounds i8, i8* %0, i64 40
%21 = bitcast i8* %20 to i32*
%22 = call i32 @FifoProtocol_memcpy(i64* %6, i32* %21, i32 8)
%23 = load i64, i64* %6
%24 = sitofp i64 %23 to float
%25 = fmul float %24, 6.250000e-02
store float %25, float* %4
ret void
}