#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_bond_status_event(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_error();
void fd_nrf8001_decode_bond_status_event(uint8_t *buffer, uint32_t length) {
  if (length != 7) {
    fd_nrf8001_error();
    return;
  }
  uint8_t bond_status_code = buffer[1];
  uint8_t bond_status_source = buffer[2];
  uint8_t bond_status_sec_mode1 = buffer[3];
  uint8_t bond_status_sec_mode2 = buffer[4];
  uint8_t bond_status_key_exch_slave = buffer[5];
  uint8_t bond_status_key_exch_master = buffer[6];
  fd_nrf8001_bond_status_event(bond_status_code, bond_status_source,
                               bond_status_sec_mode1, bond_status_sec_mode2,
                               bond_status_key_exch_slave,
                               bond_status_key_exch_master);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
je     1145 <fd_nrf8001_decode_bond_status_event+0x25>
mov    $0x0,%al
call   1030 <fd_nrf8001_error@plt>
jmp    119a <fd_nrf8001_decode_bond_status_event+0x7a>
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    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
call   1040 <fd_nrf8001_bond_status_event@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
cmp    $0x7,%esi
jne    1140 <fd_nrf8001_decode_bond_status_event+0x20>
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%esi
mov    0xc(%rdi),%edx
mov    0x10(%rdi),%ecx
mov    0x14(%rdi),%r8d
mov    0x18(%rdi),%r9d
mov    %eax,%edi
jmp    1040 <fd_nrf8001_bond_status_event@plt>
xor    %eax,%eax
jmp    1030 <fd_nrf8001_error@plt>

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

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