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

/* Variables and functions */
float fd_binary_unpack_uint16(int *);
int /*<<< orphan*/ fd_nrf8001_get_battery_level_error(int);
int /*<<< orphan*/ fd_nrf8001_get_battery_level_success(float);
void fd_nrf8001_dispatch_get_battery_level_response(
    uint8_t status, uint8_t *response_data,
    uint32_t response_data_length __attribute__((unused))) {
  if (status != 0x00) {
    fd_nrf8001_get_battery_level_error(status);
    return;
  }
  uint16_t level = fd_binary_unpack_uint16(response_data);
  float voltage = level * 3.52f;
  fd_nrf8001_get_battery_level_success(voltage);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1159 <fd_nrf8001_dispatch_get_battery_level_response+0x29>
mov    -0x4(%rbp),%edi
call   1040 <fd_nrf8001_get_battery_level_error@plt>
jmp    1183 <fd_nrf8001_dispatch_get_battery_level_response+0x53>
mov    -0x10(%rbp),%rdi
call   1030 <fd_binary_unpack_uint16@plt>
movss  %xmm0,-0x18(%rbp)
movss  0xe91(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1050 <fd_nrf8001_get_battery_level_success@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
test   %edi,%edi
je     1139 <fd_nrf8001_dispatch_get_battery_level_response+0x9>
jmp    1040 <fd_nrf8001_get_battery_level_error@plt>
push   %rax
mov    %rsi,%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mulss  0xeb6(%rip),%xmm0
pop    %rax
jmp    1050 <fd_nrf8001_get_battery_level_success@plt>

LLVM IR (-O0):
define void @fd_nrf8001_dispatch_get_battery_level_response(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load i32, i32* %4
%13 = call i32 @fd_nrf8001_get_battery_level_error(i32 %12)
br label %21
14: ; preds = %3
%15 = load i32*, i32** %5
%16 = call float @fd_binary_unpack_uint16(i32* %15)
store float %16, float* %7
%17 = load float, float* %7
%18 = fmul float %17, 0x400C28F5C0000000
store float %18, float* %8
%19 = load float, float* %8
%20 = call i32 @fd_nrf8001_get_battery_level_success(float %19)
br label %21
21: ; preds = %14, %11
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_dispatch_get_battery_level_response(i32 %0, i32* %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @fd_nrf8001_get_battery_level_error(i32 %0)
br label %11
7: ; preds = %3
%8 = tail call float @fd_binary_unpack_uint16(i32* %1)
%9 = fmul float %8, 0x400C28F5C0000000
%10 = tail call i32 @fd_nrf8001_get_battery_level_success(float %9)
br label %11
11: ; preds = %7, %5
ret void
}