#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 */

/* Variables and functions */
int /*<<< orphan*/ SPI_put(unsigned int);
int /*<<< orphan*/ SPI_set_12_bit();
int /*<<< orphan*/ SPI_set_16_bit();
unsigned short MRF24_Read_Long(unsigned int data) {
  unsigned int temp;
  SPI_set_12_bit();
  while ((*((volatile unsigned char *)0xE006800C)) & 0x4) {
    temp = (*((volatile unsigned short *)0xE0068008));
  }
  (*((volatile unsigned long *)0xE002800C)) = 1 << 29;
  SPI_put(((data & 0xFFF000) >> 12) | 0x800);
  while ((*((volatile unsigned char *)0xE006800C)) & 0x10)
    ;
  temp = (*((volatile unsigned short *)0xE0068008));
  SPI_put(data & 0xFFF);
  while ((*((volatile unsigned char *)0xE006800C)) & 0x10)
    ;
  SPI_set_16_bit();
  (*((volatile unsigned long *)0xE0028004)) = 1 << 29;
  return (*((volatile unsigned short *)0xE0068008));
}


x86 assembly (clang, -O0):
<MRF24_Read_Long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <SPI_set_12_bit@plt>
mov    $0xe006800c,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     116b <MRF24_Read_Long+0x3b>
mov    $0xe0068008,%eax
mov    (%rax),%ax
movzwl %ax,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <MRF24_Read_Long+0x12>
mov    $0xe002800c,%eax
movq   $0x20000000,(%rax)
mov    -0x4(%rbp),%edi
and    $0xfff000,%edi
shr    $0xc,%edi
or     $0x800,%edi
call   1050 <SPI_put@plt>
mov    $0xe006800c,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11a9 <MRF24_Read_Long+0x79>
jmp    118e <MRF24_Read_Long+0x5e>
mov    $0xe0068008,%eax
mov    (%rax),%ax
movzwl %ax,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
and    $0xfff,%edi
call   1050 <SPI_put@plt>
mov    $0xe006800c,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11e0 <MRF24_Read_Long+0xb0>
jmp    11c5 <MRF24_Read_Long+0x95>
mov    $0x0,%al
call   1040 <SPI_set_16_bit@plt>
mov    $0xe0028004,%eax
movq   $0x20000000,(%rax)
mov    $0xe0068008,%eax
mov    (%rax),%ax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MRF24_Read_Long>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0xe006800c,%ebx
xor    %eax,%eax
call   1030 <SPI_set_12_bit@plt>
testb  $0x4,(%rbx)
je     1159 <MRF24_Read_Long+0x29>
cs nopw 0x0(%rax,%rax,1)
movzwl -0x4(%rbx),%eax
testb  $0x4,(%rbx)
jne    1150 <MRF24_Read_Long+0x20>
movq   $0x20000000,-0x40000(%rbx)
mov    %ebp,%edi
shr    $0xc,%edi
and    $0x7ff,%edi
or     $0x800,%edi
call   1050 <SPI_put@plt>
nopw   0x0(%rax,%rax,1)
testb  $0x10,(%rbx)
jne    1180 <MRF24_Read_Long+0x50>
movzwl -0x4(%rbx),%eax
and    $0xfff,%ebp
mov    %ebp,%edi
call   1050 <SPI_put@plt>
cs nopw 0x0(%rax,%rax,1)
testb  $0x10,(%rbx)
jne    11a0 <MRF24_Read_Long+0x70>
xor    %eax,%eax
call   1040 <SPI_set_16_bit@plt>
movq   $0x20000000,-0x40008(%rbx)
movzwl -0x4(%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i16 @MRF24_Read_Long(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @SPI_set_12_bit()
br label %5
5: ; preds = %10, %1
%6 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%7 = zext i8 %6 to i32
%8 = and i32 %7, 4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load volatile i16, i16* inttoptr (i64 3758522376 to i16*)
%12 = zext i16 %11 to i32
store i32 %12, i32* %3
br label %5
13: ; preds = %5
store volatile i64 536870912, i64* inttoptr (i64 3758260236 to i64*)
%14 = load i32, i32* %2
%15 = and i32 %14, 16773120
%16 = lshr i32 %15, 12
%17 = or i32 %16, 2048
%18 = call i32 @SPI_put(i32 %17)
br label %19
19: ; preds = %24, %13
%20 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%21 = zext i8 %20 to i32
%22 = and i32 %21, 16
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
br label %19
25: ; preds = %19
%26 = load volatile i16, i16* inttoptr (i64 3758522376 to i16*)
%27 = zext i16 %26 to i32
store i32 %27, i32* %3
%28 = load i32, i32* %2
%29 = and i32 %28, 4095
%30 = call i32 @SPI_put(i32 %29)
br label %31
31: ; preds = %36, %25
%32 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%33 = zext i8 %32 to i32
%34 = and i32 %33, 16
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %31
br label %31
37: ; preds = %31
%38 = call i32 (...) @SPI_set_16_bit()
store volatile i64 536870912, i64* inttoptr (i64 3758260228 to i64*)
%39 = load volatile i16, i16* inttoptr (i64 3758522376 to i16*)
ret i16 %39
}

LLVM IR (-O2):
define zeroext i16 @MRF24_Read_Long(i32 %0) {
%2 = tail call i32 (...) @SPI_set_12_bit()
%3 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%4 = and i8 %3, 4
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1, %6
%7 = load volatile i16, i16* inttoptr (i64 3758522376 to i16*)
%8 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%9 = and i8 %8, 4
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %1
store volatile i64 536870912, i64* inttoptr (i64 3758260236 to i64*)
%12 = lshr i32 %0, 12
%13 = and i32 %12, 2047
%14 = or i32 %13, 2048
%15 = tail call i32 @SPI_put(i32 %14)
br label %16
16: ; preds = %16, %11
%17 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%18 = and i8 %17, 16
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %16
20: ; preds = %16
%21 = load volatile i16, i16* inttoptr (i64 3758522376 to i16*)
%22 = and i32 %0, 4095
%23 = tail call i32 @SPI_put(i32 %22)
br label %24
24: ; preds = %24, %20
%25 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%26 = and i8 %25, 16
%27 = icmp eq i8 %26, 0
br i1 %27, label %28, label %24
28: ; preds = %24
%29 = tail call i32 (...) @SPI_set_16_bit()
store volatile i64 536870912, i64* inttoptr (i64 3758260228 to i64*)
%30 = load volatile i16, i16* inttoptr (i64 3758522376 to i16*)
ret i16 %30
}