#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_device_started_event(int /*<<< orphan*/,
                                                   int /*<<< orphan*/,
                                                   int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_error();
void fd_nrf8001_decode_device_started_event(uint8_t *buffer, uint32_t length) {
  if (length != 4) {
    fd_nrf8001_error();
    return;
  }
  uint8_t operating_mode = buffer[1];
  uint8_t hardware_error = buffer[2];
  uint8_t data_credit_available = buffer[3];
  fd_nrf8001_device_started_event(operating_mode, hardware_error,
                                  data_credit_available);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
je     1145 <fd_nrf8001_decode_device_started_event+0x25>
mov    $0x0,%al
call   1030 <fd_nrf8001_error@plt>
jmp    1171 <fd_nrf8001_decode_device_started_event+0x51>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <fd_nrf8001_device_started_event@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
cmp    $0x4,%esi
jne    1135 <fd_nrf8001_decode_device_started_event+0x15>
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%esi
mov    0xc(%rdi),%edx
mov    %eax,%edi
jmp    1040 <fd_nrf8001_device_started_event@plt>
xor    %eax,%eax
jmp    1030 <fd_nrf8001_error@plt>

LLVM IR (-O0):
define void @fd_nrf8001_decode_device_started_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 ne i32 %8, 4
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @fd_nrf8001_error()
br label %26
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
%18 = load i32, i32* %17
store i32 %18, i32* %6
%19 = load i32*, i32** %3
%20 = getelementptr inbounds i32, i32* %19, i64 3
%21 = load i32, i32* %20
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = call i32 @fd_nrf8001_device_started_event(i32 %22, i32 %23, i32 %24)
br label %26
26: ; preds = %12, %10
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_decode_device_started_event(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @fd_nrf8001_error()
br label %14
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 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = tail call i32 @fd_nrf8001_device_started_event(i32 %8, i32 %10, i32 %12)
br label %14
14: ; preds = %6, %4
ret void
}