#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fd_nrf8001_data_received_event(int /*<<< orphan*/,
                                                  int /*<<< orphan*/ *, int);
int /*<<< orphan*/ fd_nrf8001_error();
void fd_nrf8001_decode_data_received_event(uint8_t *buffer, uint32_t length) {
  if (length < 2) {
    fd_nrf8001_error();
    return;
  }
  uint8_t service_pipe_number = buffer[1];
  uint8_t *data = &buffer[2];
  uint32_t data_length = length - 2;
  fd_nrf8001_data_received_event(service_pipe_number, data, data_length);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1145 <fd_nrf8001_decode_data_received_event+0x25>
mov    $0x0,%al
call   1030 <fd_nrf8001_error@plt>
jmp    1173 <fd_nrf8001_decode_data_received_event+0x53>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <fd_nrf8001_data_received_event@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %esi,%edx
cmp    $0x1,%esi
jg     112e <fd_nrf8001_decode_data_received_event+0xe>
xor    %eax,%eax
jmp    1030 <fd_nrf8001_error@plt>
mov    %rdi,%rsi
mov    0x4(%rdi),%edi
add    $0x8,%rsi
add    $0xfffffffe,%edx
jmp    1040 <fd_nrf8001_data_received_event@plt>

LLVM IR (-O0):
define void @fd_nrf8001_decode_data_received_event(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @fd_nrf8001_error()
br label %24
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* %14
store i32 %15, i32* %5
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i64 2
store i32* %17, i32** %6
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 2
store i32 %19, i32* %7
%20 = load i32, i32* %5
%21 = load i32*, i32** %6
%22 = load i32, i32* %7
%23 = call i32 @fd_nrf8001_data_received_event(i32 %20, i32* %21, i32 %22)
br label %24
24: ; preds = %12, %10
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_decode_data_received_event(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @fd_nrf8001_error()
br label %12
6: ; preds = %2
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = add nsw i32 %1, -2
%11 = tail call i32 @fd_nrf8001_data_received_event(i32 %8, i32* %9, i32 %10)
br label %12
12: ; preds = %6, %4
ret void
}