#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, int /*<<< orphan*/ *);
void id_write(uint32_t canID) {
  uint8_t ubtempo = 0;
  mcp2515_spi_transfer((uint8_t)(canID >> 21), NULL);
  ubtempo = ((uint8_t)(canID >> 13)) & 0xE0;
  ubtempo |= ((uint8_t)(canID >> 16)) & 0x03;
  if (canID & 0x20000000)
    ubtempo |= 0x08;
  mcp2515_spi_transfer(ubtempo, NULL);
  mcp2515_spi_transfer((uint8_t)(canID >> 8), NULL);
  mcp2515_spi_transfer((uint8_t)canID, NULL);
}


x86 assembly (clang, -O0):
<id_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x15,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <mcp2515_spi_transfer@plt>
mov    -0x4(%rbp),%eax
sar    $0xd,%eax
and    $0xe0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
and    $0x3,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x20000000,%eax
cmp    $0x0,%eax
je     1168 <id_write+0x58>
mov    -0x8(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <mcp2515_spi_transfer@plt>
mov    -0x4(%rbp),%edi
sar    $0x8,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <mcp2515_spi_transfer@plt>
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <mcp2515_spi_transfer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id_write>:
push   %rbx
mov    %edi,%ebx
sar    $0x15,%edi
xor    %esi,%esi
call   1030 <mcp2515_spi_transfer@plt>
mov    %ebx,%eax
shr    $0xd,%eax
and    $0xe0,%eax
mov    %ebx,%ecx
shr    $0x10,%ecx
and    $0x3,%ecx
or     %eax,%ecx
mov    %ebx,%edi
shr    $0x1a,%edi
and    $0x8,%edi
or     %ecx,%edi
xor    %esi,%esi
call   1030 <mcp2515_spi_transfer@plt>
mov    %ebx,%edi
sar    $0x8,%edi
xor    %esi,%esi
call   1030 <mcp2515_spi_transfer@plt>
mov    %ebx,%edi
xor    %esi,%esi
pop    %rbx
jmp    1030 <mcp2515_spi_transfer@plt>

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

LLVM IR (-O2):
define void @id_write(i32 %0) {
%2 = ashr i32 %0, 21
%3 = tail call i32 @mcp2515_spi_transfer(i32 %2, i32* null)
%4 = lshr i32 %0, 13
%5 = and i32 %4, 224
%6 = lshr i32 %0, 16
%7 = and i32 %6, 3
%8 = or i32 %5, %7
%9 = lshr i32 %0, 26
%10 = and i32 %9, 8
%11 = or i32 %8, %10
%12 = tail call i32 @mcp2515_spi_transfer(i32 %11, i32* null)
%13 = ashr i32 %0, 8
%14 = tail call i32 @mcp2515_spi_transfer(i32 %13, i32* null)
%15 = tail call i32 @mcp2515_spi_transfer(i32 %0, i32* null)
ret void
}