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

/* Variables and functions */
int /*<<< orphan*/ mcp2515_spi_transfer(int /*<<< orphan*/, int *);
void id_read(uint32_t *canID) {
  uint8_t dataIn;
  uint32_t uwID = 0;
  mcp2515_spi_transfer(0, &dataIn);
  uwID = (((uint32_t)dataIn) << 21);
  mcp2515_spi_transfer(0, &dataIn);
  uwID |= (((uint32_t)(dataIn & 0xE0)) << 13);
  uwID |= (((uint32_t)(dataIn & 0x03)) << 16);
  if (dataIn & 0x08)
    uwID |= 0x20000000;
  mcp2515_spi_transfer(0, &dataIn);
  uwID |= (((uint32_t)dataIn) << 8);
  mcp2515_spi_transfer(0, &dataIn);
  uwID |= (uint32_t)dataIn;
  *canID = uwID;
}


x86 assembly (clang, -O0):
<id_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
xor    %edi,%edi
lea    -0xc(%rbp),%rsi
call   1030 <mcp2515_spi_transfer@plt>
mov    -0xc(%rbp),%eax
shl    $0x15,%eax
mov    %eax,-0x10(%rbp)
xor    %edi,%edi
lea    -0xc(%rbp),%rsi
call   1030 <mcp2515_spi_transfer@plt>
mov    -0xc(%rbp),%eax
and    $0xe0,%eax
shl    $0xd,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3,%eax
shl    $0x10,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     117c <id_read+0x6c>
mov    -0x10(%rbp),%eax
or     $0x20000000,%eax
mov    %eax,-0x10(%rbp)
xor    %edi,%edi
lea    -0xc(%rbp),%rsi
call   1030 <mcp2515_spi_transfer@plt>
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    %edi,%edi
lea    -0xc(%rbp),%rsi
call   1030 <mcp2515_spi_transfer@plt>
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id_read>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
lea    0xc(%rsp),%r15
xor    %edi,%edi
mov    %r15,%rsi
call   1030 <mcp2515_spi_transfer@plt>
mov    0xc(%rsp),%ebp
shl    $0x15,%ebp
xor    %edi,%edi
mov    %r15,%rsi
call   1030 <mcp2515_spi_transfer@plt>
mov    0xc(%rsp),%r12d
mov    %r12d,%eax
shl    $0xd,%eax
and    $0x1c0000,%eax
or     %ebp,%eax
mov    %r12d,%ebp
and    $0x3,%ebp
shl    $0x10,%ebp
or     %eax,%ebp
and    $0x8,%r12d
shl    $0x1a,%r12d
xor    %edi,%edi
mov    %r15,%rsi
call   1030 <mcp2515_spi_transfer@plt>
mov    0xc(%rsp),%ebx
shl    $0x8,%ebx
or     %r12d,%ebx
or     %ebp,%ebx
xor    %edi,%edi
mov    %r15,%rsi
call   1030 <mcp2515_spi_transfer@plt>
or     0xc(%rsp),%ebx
mov    %ebx,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @id_read(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
%5 = call i32 @mcp2515_spi_transfer(i32 0, i32* %3)
%6 = load i32, i32* %3
%7 = shl i32 %6, 21
store i32 %7, i32* %4
%8 = call i32 @mcp2515_spi_transfer(i32 0, i32* %3)
%9 = load i32, i32* %3
%10 = and i32 %9, 224
%11 = shl i32 %10, 13
%12 = load i32, i32* %4
%13 = or i32 %12, %11
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = and i32 %14, 3
%16 = shl i32 %15, 16
%17 = load i32, i32* %4
%18 = or i32 %17, %16
store i32 %18, i32* %4
%19 = load i32, i32* %3
%20 = and i32 %19, 8
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %1
%23 = load i32, i32* %4
%24 = or i32 %23, 536870912
store i32 %24, i32* %4
br label %25
25: ; preds = %22, %1
%26 = call i32 @mcp2515_spi_transfer(i32 0, i32* %3)
%27 = load i32, i32* %3
%28 = shl i32 %27, 8
%29 = load i32, i32* %4
%30 = or i32 %29, %28
store i32 %30, i32* %4
%31 = call i32 @mcp2515_spi_transfer(i32 0, i32* %3)
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = or i32 %33, %32
store i32 %34, i32* %4
%35 = load i32, i32* %4
%36 = load i32*, i32** %2
store i32 %35, i32* %36
ret void
}

LLVM IR (-O2):
define void @id_read(i32* nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @mcp2515_spi_transfer(i32 0, i32* %2)
%5 = load i32, i32* %2
%6 = shl i32 %5, 21
%7 = call i32 @mcp2515_spi_transfer(i32 0, i32* %2)
%8 = load i32, i32* %2
%9 = shl i32 %8, 13
%10 = and i32 %9, 1835008
%11 = or i32 %10, %6
%12 = shl i32 %8, 16
%13 = and i32 %12, 196608
%14 = or i32 %11, %13
%15 = shl i32 %8, 26
%16 = and i32 %15, 536870912
%17 = call i32 @mcp2515_spi_transfer(i32 0, i32* %2)
%18 = load i32, i32* %2
%19 = shl i32 %18, 8
%20 = call i32 @mcp2515_spi_transfer(i32 0, i32* %2)
%21 = load i32, i32* %2
%22 = or i32 %19, %16
%23 = or i32 %22, %14
%24 = or i32 %23, %21
store i32 %24, i32* %0
ret void
}