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

/* Variables and functions */
int /*<<< orphan*/ fd_binary_unpack_uint16(int /*<<< orphan*/ *);
int /*<<< orphan*/ fd_nrf8001_error();
int /*<<< orphan*/ fd_nrf8001_timing_event(int /*<<< orphan*/,
                                           int /*<<< orphan*/,
                                           int /*<<< orphan*/);
void fd_nrf8001_decode_timing_event(uint8_t *buffer, uint32_t length) {
  if (length != 7) {
    fd_nrf8001_error();
    return;
  }
  uint16_t connection_interval = fd_binary_unpack_uint16(&buffer[1]);
  uint16_t slave_latency = fd_binary_unpack_uint16(&buffer[3]);
  uint16_t supervision_timeout = fd_binary_unpack_uint16(&buffer[5]);
  fd_nrf8001_timing_event(connection_interval, slave_latency,
                          supervision_timeout);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
je     1155 <fd_nrf8001_decode_timing_event+0x25>
mov    $0x0,%al
call   1040 <fd_nrf8001_error@plt>
jmp    1193 <fd_nrf8001_decode_timing_event+0x63>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0xc,%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x14,%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <fd_nrf8001_timing_event@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
cmp    $0x7,%esi
jne    116f <fd_nrf8001_decode_timing_event+0x3f>
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
add    $0x4,%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mov    %eax,%r14d
lea    0xc(%rbx),%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mov    %eax,%ebp
add    $0x14,%rbx
mov    %rbx,%rdi
call   1030 <fd_binary_unpack_uint16@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fd_nrf8001_timing_event@plt>
xor    %eax,%eax
jmp    1040 <fd_nrf8001_error@plt>

LLVM IR (-O0):
define void @fd_nrf8001_decode_timing_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, 7
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 = call i32 @fd_binary_unpack_uint16(i32* %14)
store i32 %15, i32* %5
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i64 3
%18 = call i32 @fd_binary_unpack_uint16(i32* %17)
store i32 %18, i32* %6
%19 = load i32*, i32** %3
%20 = getelementptr inbounds i32, i32* %19, i64 5
%21 = call i32 @fd_binary_unpack_uint16(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_timing_event(i32 %22, i32 %23, i32 %24)
br label %26
26: ; preds = %12, %10
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_decode_timing_event(i32* %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 %14
6: ; preds = %2
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = tail call i32 @fd_binary_unpack_uint16(i32* %7)
%9 = getelementptr inbounds i32, i32* %0, i64 3
%10 = tail call i32 @fd_binary_unpack_uint16(i32* %9)
%11 = getelementptr inbounds i32, i32* %0, i64 5
%12 = tail call i32 @fd_binary_unpack_uint16(i32* %11)
%13 = tail call i32 @fd_nrf8001_timing_event(i32 %8, i32 %10, i32 %12)
br label %14
14: ; preds = %6, %4
ret void
}