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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ mcp2515_spi_select();
int /*<<< orphan*/ mcp2515_spi_transfer(int, int *);
int /*<<< orphan*/ mcp2515_spi_unselect();
void mcp2515_rts(uint8_t nBuf) {
  uint8_t dataIn;
  mcp2515_spi_select();
  switch (nBuf) {
  case 0:
    mcp2515_spi_transfer(0x81, &dataIn);
    break;
  case 1:
    mcp2515_spi_transfer(0x82, &dataIn);
    break;
  case 2:
    mcp2515_spi_transfer(0x84, &dataIn);
    break;
  default:
    assert(0);
  }
  mcp2515_spi_unselect();
}


x86 assembly (clang, -O0):
<mcp2515_rts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
call   1030 <mcp2515_spi_select@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1187 <mcp2515_rts+0x47>
jmp    1165 <mcp2515_rts+0x25>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     119a <mcp2515_rts+0x5a>
jmp    1176 <mcp2515_rts+0x36>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11ad <mcp2515_rts+0x6d>
jmp    11c0 <mcp2515_rts+0x80>
mov    $0x81,%edi
lea    -0x8(%rbp),%rsi
call   1050 <mcp2515_spi_transfer@plt>
jmp    11c7 <mcp2515_rts+0x87>
mov    $0x82,%edi
lea    -0x8(%rbp),%rsi
call   1050 <mcp2515_spi_transfer@plt>
jmp    11c7 <mcp2515_rts+0x87>
mov    $0x84,%edi
lea    -0x8(%rbp),%rsi
call   1050 <mcp2515_spi_transfer@plt>
jmp    11c7 <mcp2515_rts+0x87>
xor    %edi,%edi
call   1040 <assert@plt>
mov    $0x0,%al
call   1060 <mcp2515_spi_unselect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcp2515_rts>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <mcp2515_spi_select@plt>
cmp    $0x2,%ebx
je     116d <mcp2515_rts+0x2d>
cmp    $0x1,%ebx
je     117e <mcp2515_rts+0x3e>
test   %ebx,%ebx
jne    118f <mcp2515_rts+0x4f>
lea    0xc(%rsp),%rsi
mov    $0x81,%edi
call   1050 <mcp2515_spi_transfer@plt>
jmp    1196 <mcp2515_rts+0x56>
lea    0xc(%rsp),%rsi
mov    $0x84,%edi
call   1050 <mcp2515_spi_transfer@plt>
jmp    1196 <mcp2515_rts+0x56>
lea    0xc(%rsp),%rsi
mov    $0x82,%edi
call   1050 <mcp2515_spi_transfer@plt>
jmp    1196 <mcp2515_rts+0x56>
xor    %edi,%edi
call   1040 <assert@plt>
xor    %eax,%eax
call   1060 <mcp2515_spi_unselect@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @mcp2515_rts(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @mcp2515_spi_select()
%5 = load i32, i32* %2
switch i32 %5, label %12 [
i32 0, label %6
i32 1, label %8
i32 2, label %10
]
6: ; preds = %1
%7 = call i32 @mcp2515_spi_transfer(i32 129, i32* %3)
br label %14
8: ; preds = %1
%9 = call i32 @mcp2515_spi_transfer(i32 130, i32* %3)
br label %14
10: ; preds = %1
%11 = call i32 @mcp2515_spi_transfer(i32 132, i32* %3)
br label %14
12: ; preds = %1
%13 = call i32 @assert(i32 0)
br label %14
14: ; preds = %12, %10, %8, %6
%15 = call i32 (...) @mcp2515_spi_unselect()
ret void
}

LLVM IR (-O2):
define void @mcp2515_rts(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (...) @mcp2515_spi_select()
switch i32 %0, label %11 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
]
5: ; preds = %1
%6 = call i32 @mcp2515_spi_transfer(i32 129, i32* %2)
br label %13
7: ; preds = %1
%8 = call i32 @mcp2515_spi_transfer(i32 130, i32* %2)
br label %13
9: ; preds = %1
%10 = call i32 @mcp2515_spi_transfer(i32 132, i32* %2)
br label %13
11: ; preds = %1
%12 = tail call i32 @assert(i32 0)
br label %13
13: ; preds = %11, %9, %7, %5
%14 = call i32 (...) @mcp2515_spi_unselect()
ret void
}