#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 int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ fd_binary_unpack_uint16(int *);
int /*<<< orphan*/ fd_binary_unpack_uint32(int *);
int /*<<< orphan*/ fd_nrf8001_get_device_version_error(int);
int /*<<< orphan*/ fd_nrf8001_get_device_version_success(int /*<<< orphan*/,
                                                         int, int,
                                                         int /*<<< orphan*/,
                                                         int);
void fd_nrf8001_dispatch_get_device_version_response(
    uint8_t status, uint8_t *response_data,
    uint32_t response_data_length __attribute__((unused))) {
  if (status != 0x00) {
    fd_nrf8001_get_device_version_error(status);
    return;
  }
  uint16_t configuration_id = fd_binary_unpack_uint16(response_data);
  uint8_t aci_protocol_version = response_data[2];
  uint8_t current_setup_format = response_data[3];
  uint32_t setup_id = fd_binary_unpack_uint32(&response_data[4]);
  uint8_t configuration_status = response_data[8];
  fd_nrf8001_get_device_version_success(configuration_id, aci_protocol_version,
                                        current_setup_format, setup_id,
                                        configuration_status);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1169 <fd_nrf8001_dispatch_get_device_version_response+0x29>
mov    -0x4(%rbp),%edi
call   1060 <fd_nrf8001_get_device_version_error@plt>
jmp    11b8 <fd_nrf8001_dispatch_get_device_version_response+0x78>
mov    -0x10(%rbp),%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
call   1050 <fd_binary_unpack_uint32@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
call   1040 <fd_nrf8001_get_device_version_success@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
test   %edi,%edi
je     1149 <fd_nrf8001_dispatch_get_device_version_response+0x9>
jmp    1060 <fd_nrf8001_get_device_version_error@plt>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%r14d
mov    0xc(%rbx),%r15d
lea    0x10(%rbx),%rdi
call   1050 <fd_binary_unpack_uint32@plt>
mov    0x20(%rbx),%r8d
mov    %ebp,%edi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fd_nrf8001_get_device_version_success@plt>

LLVM IR (-O0):
define void @fd_nrf8001_dispatch_get_device_version_response(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load i32, i32* %4
%16 = call i32 @fd_nrf8001_get_device_version_error(i32 %15)
br label %38
17: ; preds = %3
%18 = load i32*, i32** %5
%19 = call i32 @fd_binary_unpack_uint16(i32* %18)
store i32 %19, i32* %7
%20 = load i32*, i32** %5
%21 = getelementptr inbounds i32, i32* %20, i64 2
%22 = load i32, i32* %21
store i32 %22, i32* %8
%23 = load i32*, i32** %5
%24 = getelementptr inbounds i32, i32* %23, i64 3
%25 = load i32, i32* %24
store i32 %25, i32* %9
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 4
%28 = call i32 @fd_binary_unpack_uint32(i32* %27)
store i32 %28, i32* %10
%29 = load i32*, i32** %5
%30 = getelementptr inbounds i32, i32* %29, i64 8
%31 = load i32, i32* %30
store i32 %31, i32* %11
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = load i32, i32* %9
%35 = load i32, i32* %10
%36 = load i32, i32* %11
%37 = call i32 @fd_nrf8001_get_device_version_success(i32 %32, i32 %33, i32 %34, i32 %35, i32 %36)
br label %38
38: ; preds = %17, %14
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_dispatch_get_device_version_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_device_version_error(i32 %0)
br label %18
7: ; preds = %3
%8 = tail call i32 @fd_binary_unpack_uint16(i32* %1)
%9 = getelementptr inbounds i32, i32* %1, i64 2
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %1, i64 3
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 4
%14 = tail call i32 @fd_binary_unpack_uint32(i32* %13)
%15 = getelementptr inbounds i32, i32* %1, i64 8
%16 = load i32, i32* %15
%17 = tail call i32 @fd_nrf8001_get_device_version_success(i32 %8, i32 %10, i32 %12, i32 %14, i32 %16)
br label %18
18: ; preds = %7, %5
ret void
}