#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ id_read(int /*<<< orphan*/ *);
int /*<<< orphan*/ mcp2515_spi_select();
int /*<<< orphan*/ mcp2515_spi_transfer(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ mcp2515_spi_unselect();
void mcp2515_id_multi_read(uint8_t regAddr, uint32_t *canID) {
  switch (regAddr) {
  case 0x00:
  case 0x04:
  case 0x08:
  case 0x10:
  case 0x18:
  case 0x20:
  case 0x24:
  case 0x61:
  case 0x71:
  case 0x31:
  case 0x41:
  case 0x51:
    mcp2515_spi_select();
    mcp2515_spi_transfer(0x03, NULL);
    mcp2515_spi_transfer(regAddr, NULL);
    id_read(canID);
    mcp2515_spi_unselect();
    break;
  default:
    assert(0);
  }
}


x86 assembly (clang, -O0):
<mcp2515_id_multi_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x71,%rax
ja     11ba <mcp2515_id_multi_read+0x6a>
mov    -0x18(%rbp),%rax
lea    0xe85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <mcp2515_spi_select@plt>
mov    $0x3,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <mcp2515_spi_transfer@plt>
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <mcp2515_spi_transfer@plt>
mov    -0x10(%rbp),%rdi
call   1040 <id_read@plt>
mov    $0x0,%al
call   1070 <mcp2515_spi_unselect@plt>
jmp    11c1 <mcp2515_id_multi_read+0x71>
xor    %edi,%edi
call   1050 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcp2515_id_multi_read>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x71,%edi
ja     11a0 <mcp2515_id_multi_read+0x50>
mov    %edi,%ebp
mov    %edi,%eax
lea    0xe9d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rsi,%rbx
xor    %eax,%eax
call   1030 <mcp2515_spi_select@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   1060 <mcp2515_spi_transfer@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <mcp2515_spi_transfer@plt>
mov    %rbx,%rdi
call   1040 <id_read@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <mcp2515_spi_unselect@plt>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <assert@plt>

LLVM IR (-O0):
define void @mcp2515_id_multi_read(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
switch i32 %5, label %14 [
i32 0, label %6
i32 4, label %6
i32 8, label %6
i32 16, label %6
i32 24, label %6
i32 32, label %6
i32 36, label %6
i32 97, label %6
i32 113, label %6
i32 49, label %6
i32 65, label %6
i32 81, label %6
]
6: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2
%7 = call i32 (...) @mcp2515_spi_select()
%8 = call i32 @mcp2515_spi_transfer(i32 3, i32* null)
%9 = load i32, i32* %3
%10 = call i32 @mcp2515_spi_transfer(i32 %9, i32* null)
%11 = load i32*, i32** %4
%12 = call i32 @id_read(i32* %11)
%13 = call i32 (...) @mcp2515_spi_unselect()
br label %16
14: ; preds = %2
%15 = call i32 @assert(i32 0)
br label %16
16: ; preds = %14, %6
ret void
}

LLVM IR (-O2):
define void @mcp2515_id_multi_read(i32 %0, i32* %1) {
switch i32 %0, label %9 [
i32 0, label %3
i32 4, label %3
i32 8, label %3
i32 16, label %3
i32 24, label %3
i32 32, label %3
i32 36, label %3
i32 97, label %3
i32 113, label %3
i32 49, label %3
i32 65, label %3
i32 81, label %3
]
3: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2
%4 = tail call i32 (...) @mcp2515_spi_select()
%5 = tail call i32 @mcp2515_spi_transfer(i32 3, i32* null)
%6 = tail call i32 @mcp2515_spi_transfer(i32 %0, i32* null)
%7 = tail call i32 @id_read(i32* %1)
%8 = tail call i32 (...) @mcp2515_spi_unselect()
br label %11
9: ; preds = %2
%10 = tail call i32 @assert(i32 0)
br label %11
11: ; preds = %9, %3
ret void
}