#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*/ SSIDataGet(int, unsigned long *);
int /*<<< orphan*/ SSIDataPut(int, int);
unsigned char PDCRead(unsigned char ucAddr) {
  unsigned long ulTemp;
  SSIDataPut(0x40008000, (ucAddr & 0x0F) | 0x80);
  SSIDataPut(0x40008000, 0x00);
  SSIDataGet(0x40008000, &ulTemp);
  if ((ucAddr == 0x6) || (ucAddr == 0x7)) {
    SSIDataPut(0x40008000, 0x00);
    SSIDataGet(0x40008000, &ulTemp);
  }
  SSIDataGet(0x40008000, &ulTemp);
  return (ulTemp & 0xFF);
}


x86 assembly (clang, -O0):
<PDCRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%esi
and    $0xf,%esi
or     $0x80,%esi
mov    $0x40008000,%edi
call   1040 <SSIDataPut@plt>
mov    $0x40008000,%edi
xor    %esi,%esi
call   1040 <SSIDataPut@plt>
mov    $0x40008000,%edi
lea    -0x10(%rbp),%rsi
call   1030 <SSIDataGet@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x6,%eax
je     1179 <PDCRead+0x59>
movzbl -0x1(%rbp),%eax
cmp    $0x7,%eax
jne    1193 <PDCRead+0x73>
mov    $0x40008000,%edi
xor    %esi,%esi
call   1040 <SSIDataPut@plt>
mov    $0x40008000,%edi
lea    -0x10(%rbp),%rsi
call   1030 <SSIDataGet@plt>
mov    $0x40008000,%edi
lea    -0x10(%rbp),%rsi
call   1030 <SSIDataGet@plt>
mov    -0x10(%rbp),%rax
and    $0xff,%rax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDCRead>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %ebx,%eax
and    $0xf,%al
or     $0x80,%al
movzbl %al,%esi
mov    $0x40008000,%edi
call   1040 <SSIDataPut@plt>
mov    $0x40008000,%edi
xor    %esi,%esi
call   1040 <SSIDataPut@plt>
lea    0x8(%rsp),%rsi
mov    $0x40008000,%edi
call   1030 <SSIDataGet@plt>
and    $0xfe,%bl
cmp    $0x6,%bl
jne    1178 <PDCRead+0x58>
mov    $0x40008000,%edi
xor    %esi,%esi
call   1040 <SSIDataPut@plt>
lea    0x8(%rsp),%rsi
mov    $0x40008000,%edi
call   1030 <SSIDataGet@plt>
lea    0x8(%rsp),%rsi
mov    $0x40008000,%edi
call   1030 <SSIDataGet@plt>
mov    0x8(%rsp),%al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @PDCRead(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i64
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = and i32 %5, 15
%7 = or i32 %6, 128
%8 = call i32 @SSIDataPut(i32 1073774592, i32 %7)
%9 = call i32 @SSIDataPut(i32 1073774592, i32 0)
%10 = call i32 @SSIDataGet(i32 1073774592, i64* %3)
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = icmp eq i32 %12, 6
br i1 %13, label %18, label %14
14: ; preds = %1
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = icmp eq i32 %16, 7
br i1 %17, label %18, label %21
18: ; preds = %14, %1
%19 = call i32 @SSIDataPut(i32 1073774592, i32 0)
%20 = call i32 @SSIDataGet(i32 1073774592, i64* %3)
br label %21
21: ; preds = %18, %14
%22 = call i32 @SSIDataGet(i32 1073774592, i64* %3)
%23 = load i64, i64* %3
%24 = and i64 %23, 255
%25 = trunc i64 %24 to i8
ret i8 %25
}

LLVM IR (-O2):
define zeroext i8 @PDCRead(i8 zeroext %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = and i8 %0, 15
%5 = or i8 %4, -128
%6 = zext i8 %5 to i32
%7 = tail call i32 @SSIDataPut(i32 1073774592, i32 %6)
%8 = tail call i32 @SSIDataPut(i32 1073774592, i32 0)
%9 = call i32 @SSIDataGet(i32 1073774592, i64* %2)
%10 = and i8 %0, -2
%11 = icmp eq i8 %10, 6
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = call i32 @SSIDataPut(i32 1073774592, i32 0)
%14 = call i32 @SSIDataGet(i32 1073774592, i64* %2)
br label %15
15: ; preds = %1, %12
%16 = call i32 @SSIDataGet(i32 1073774592, i64* %2)
%17 = load i64, i64* %2
%18 = trunc i64 %17 to i8
ret i8 %18
}