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

/* Variables and functions */
int /*<<< orphan*/ fd_nrf8001_read_dynamic_data_complete();
int /*<<< orphan*/ fd_nrf8001_read_dynamic_data_continue(int, int *,
                                                         int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_read_dynamic_data_error(int);
void fd_nrf8001_dispatch_read_dynamic_data_response(
    uint8_t status, uint8_t *response_data, uint32_t response_data_length) {
  switch (status) {
  case 0x01: {
    uint8_t sequence_number = response_data[0];
    uint8_t *data = &response_data[1];
    uint32_t length = response_data_length - 1;
    fd_nrf8001_read_dynamic_data_continue(sequence_number, data, length);
  } break;
  case 0x02:
    fd_nrf8001_read_dynamic_data_complete();
    break;
  default:
    fd_nrf8001_read_dynamic_data_error(status);
    break;
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1,%eax
je     1167 <fd_nrf8001_dispatch_read_dynamic_data_response+0x37>
jmp    1156 <fd_nrf8001_dispatch_read_dynamic_data_response+0x26>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
je     1199 <fd_nrf8001_dispatch_read_dynamic_data_response+0x69>
jmp    11a5 <fd_nrf8001_dispatch_read_dynamic_data_response+0x75>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1050 <fd_nrf8001_read_dynamic_data_continue@plt>
jmp    11ad <fd_nrf8001_dispatch_read_dynamic_data_response+0x7d>
mov    $0x0,%al
call   1030 <fd_nrf8001_read_dynamic_data_complete@plt>
jmp    11ad <fd_nrf8001_dispatch_read_dynamic_data_response+0x7d>
mov    -0x4(%rbp),%edi
call   1040 <fd_nrf8001_read_dynamic_data_error@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
cmp    $0x2,%edi
je     1148 <fd_nrf8001_dispatch_read_dynamic_data_response+0x18>
cmp    $0x1,%edi
jne    114f <fd_nrf8001_dispatch_read_dynamic_data_response+0x1f>
mov    (%rsi),%edi
add    $0x4,%rsi
add    $0xffffffff,%edx
jmp    1050 <fd_nrf8001_read_dynamic_data_continue@plt>
xor    %eax,%eax
jmp    1030 <fd_nrf8001_read_dynamic_data_complete@plt>
jmp    1040 <fd_nrf8001_read_dynamic_data_error@plt>

LLVM IR (-O0):
define void @fd_nrf8001_dispatch_read_dynamic_data_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
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
switch i32 %10, label %25 [
i32 1, label %11
i32 2, label %23
]
11: ; preds = %3
%12 = load i32*, i32** %5
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
store i32 %14, i32* %7
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32* %16, i32** %8
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %9
%19 = load i32, i32* %7
%20 = load i32*, i32** %8
%21 = load i32, i32* %9
%22 = call i32 @fd_nrf8001_read_dynamic_data_continue(i32 %19, i32* %20, i32 %21)
br label %28
23: ; preds = %3
%24 = call i32 (...) @fd_nrf8001_read_dynamic_data_complete()
br label %28
25: ; preds = %3
%26 = load i32, i32* %4
%27 = call i32 @fd_nrf8001_read_dynamic_data_error(i32 %26)
br label %28
28: ; preds = %25, %23, %11
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_dispatch_read_dynamic_data_response(i32 %0, i32* %1, i32 %2) {
switch i32 %0, label %11 [
i32 1, label %4
i32 2, label %9
]
4: ; preds = %3
%5 = load i32, i32* %1
%6 = getelementptr inbounds i32, i32* %1, i64 1
%7 = add nsw i32 %2, -1
%8 = tail call i32 @fd_nrf8001_read_dynamic_data_continue(i32 %5, i32* %6, i32 %7)
br label %13
9: ; preds = %3
%10 = tail call i32 (...) @fd_nrf8001_read_dynamic_data_complete()
br label %13
11: ; preds = %3
%12 = tail call i32 @fd_nrf8001_read_dynamic_data_error(i32 %0)
br label %13
13: ; preds = %11, %9, %4
ret void
}