#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 /*<<< orphan*/ pucCfg;

/* Variables and functions */
int PDCRead(int);
int /*<<< orphan*/ PDCWrite(int, unsigned char);
void PDCLCDInit(void) {
  unsigned char pucCfg[] = {
      0x3C, 0x08, 0x01, 0x06, 0x0C,
  };
  unsigned long ulIdx;
  PDCWrite(0x6, 0x30);
  for (ulIdx = 0; ulIdx < 257; ulIdx++) {
    PDCRead(0x0);
  }
  PDCWrite(0x6, 0x30);
  for (ulIdx = 0; ulIdx < 7; ulIdx++) {
    PDCRead(0x0);
  }
  PDCWrite(0x6, 0x30);
  for (ulIdx = 0; ulIdx < (sizeof(pucCfg) / sizeof(pucCfg[0])); ulIdx++) {
    while ((PDCRead(0x6) & 0x80)) {
    }
    PDCWrite(0x6, pucCfg[ulIdx]);
  }
}


x86 assembly (clang, -O0):
<PDCLCDInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x1(%rbp)
mov    $0x6,%edi
mov    $0x30,%esi
call   1040 <PDCWrite@plt>
movq   $0x0,-0x10(%rbp)
cmpq   $0x101,-0x10(%rbp)
jae    1177 <PDCLCDInit+0x57>
xor    %edi,%edi
call   1030 <PDCRead@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1151 <PDCLCDInit+0x31>
mov    $0x6,%edi
mov    $0x30,%esi
call   1040 <PDCWrite@plt>
movq   $0x0,-0x10(%rbp)
cmpq   $0x7,-0x10(%rbp)
jae    11b1 <PDCLCDInit+0x91>
xor    %edi,%edi
call   1030 <PDCRead@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    118e <PDCLCDInit+0x6e>
mov    $0x6,%edi
mov    $0x30,%esi
call   1040 <PDCWrite@plt>
movq   $0x0,-0x10(%rbp)
cmpq   $0x5,-0x10(%rbp)
jae    1219 <PDCLCDInit+0xf9>
jmp    11d8 <PDCLCDInit+0xb8>
mov    $0x6,%edi
call   1030 <PDCRead@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     11f5 <PDCLCDInit+0xd5>
jmp    11d8 <PDCLCDInit+0xb8>
mov    -0x10(%rbp),%rax
mov    $0x6,%edi
movzbl -0x5(%rbp,%rax,1),%esi
call   1040 <PDCWrite@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11c8 <PDCLCDInit+0xa8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDCLCDInit>:
push   %rbx
mov    $0x6,%edi
mov    $0x30,%esi
call   1040 <PDCWrite@plt>
mov    $0x101,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %edi,%edi
call   1030 <PDCRead@plt>
add    $0xffffffffffffffff,%rbx
jne    1140 <PDCLCDInit+0x20>
mov    $0x6,%edi
mov    $0x30,%esi
call   1040 <PDCWrite@plt>
xor    %edi,%edi
call   1030 <PDCRead@plt>
xor    %edi,%edi
call   1030 <PDCRead@plt>
xor    %edi,%edi
call   1030 <PDCRead@plt>
xor    %edi,%edi
call   1030 <PDCRead@plt>
xor    %edi,%edi
call   1030 <PDCRead@plt>
xor    %edi,%edi
call   1030 <PDCRead@plt>
xor    %edi,%edi
call   1030 <PDCRead@plt>
mov    $0x6,%edi
mov    $0x30,%esi
call   1040 <PDCWrite@plt>
nopl   0x0(%rax)
mov    $0x6,%edi
call   1030 <PDCRead@plt>
test   $0x80,%al
jne    11a0 <PDCLCDInit+0x80>
mov    $0x6,%edi
mov    $0x3c,%esi
call   1040 <PDCWrite@plt>
nopl   (%rax)
mov    $0x6,%edi
call   1030 <PDCRead@plt>
test   $0x80,%al
jne    11c0 <PDCLCDInit+0xa0>
mov    $0x6,%edi
mov    $0x8,%esi
call   1040 <PDCWrite@plt>
nopl   (%rax)
mov    $0x6,%edi
call   1030 <PDCRead@plt>
test   $0x80,%al
jne    11e0 <PDCLCDInit+0xc0>
mov    $0x6,%edi
mov    $0x1,%esi
call   1040 <PDCWrite@plt>
nopl   (%rax)
mov    $0x6,%edi
call   1030 <PDCRead@plt>
test   $0x80,%al
jne    1200 <PDCLCDInit+0xe0>
mov    $0x6,%edi
mov    $0x6,%esi
call   1040 <PDCWrite@plt>
nopl   (%rax)
mov    $0x6,%edi
call   1030 <PDCRead@plt>
test   $0x80,%al
jne    1220 <PDCLCDInit+0x100>
mov    $0x6,%edi
mov    $0xc,%esi
pop    %rbx
jmp    1040 <PDCWrite@plt>

LLVM IR (-O0):
@__const.PDCLCDInit.pucCfg = [5 x i8] c"<\08\01\06\0C"
define void @PDCLCDInit() {
%1 = alloca [5 x i8]
%2 = alloca i64
%3 = bitcast [5 x i8]* %1 to i8*
%4 = call i32 @PDCWrite(i32 6, i8 zeroext 48)
store i64 0, i64* %2
br label %5
5: ; preds = %10, %0
%6 = load i64, i64* %2
%7 = icmp ult i64 %6, 257
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i32 @PDCRead(i32 0)
br label %10
10: ; preds = %8
%11 = load i64, i64* %2
%12 = add i64 %11, 1
store i64 %12, i64* %2
br label %5
13: ; preds = %5
%14 = call i32 @PDCWrite(i32 6, i8 zeroext 48)
store i64 0, i64* %2
br label %15
15: ; preds = %20, %13
%16 = load i64, i64* %2
%17 = icmp ult i64 %16, 7
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = call i32 @PDCRead(i32 0)
br label %20
20: ; preds = %18
%21 = load i64, i64* %2
%22 = add i64 %21, 1
store i64 %22, i64* %2
br label %15
23: ; preds = %15
%24 = call i32 @PDCWrite(i32 6, i8 zeroext 48)
store i64 0, i64* %2
br label %25
25: ; preds = %39, %23
%26 = load i64, i64* %2
%27 = icmp ult i64 %26, 5
br i1 %27, label %28, label %42
28: ; preds = %25
br label %29
29: ; preds = %33, %28
%30 = call i32 @PDCRead(i32 6)
%31 = and i32 %30, 128
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29
br label %29
34: ; preds = %29
%35 = load i64, i64* %2
%36 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @PDCWrite(i32 6, i8 zeroext %37)
br label %39
39: ; preds = %34
%40 = load i64, i64* %2
%41 = add i64 %40, 1
store i64 %41, i64* %2
br label %25
42: ; preds = %25
ret void
}

LLVM IR (-O2):
define void @PDCLCDInit() {
%1 = tail call i32 @PDCWrite(i32 6, i8 zeroext 48)
br label %2
2: ; preds = %0, %2
%3 = phi i64 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @PDCRead(i32 0)
%5 = add nuw nsw i64 %3, 1
%6 = icmp eq i64 %5, 257
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @PDCWrite(i32 6, i8 zeroext 48)
%9 = tail call i32 @PDCRead(i32 0)
%10 = tail call i32 @PDCRead(i32 0)
%11 = tail call i32 @PDCRead(i32 0)
%12 = tail call i32 @PDCRead(i32 0)
%13 = tail call i32 @PDCRead(i32 0)
%14 = tail call i32 @PDCRead(i32 0)
%15 = tail call i32 @PDCRead(i32 0)
%16 = tail call i32 @PDCWrite(i32 6, i8 zeroext 48)
br label %17
17: ; preds = %7, %17
%18 = tail call i32 @PDCRead(i32 6)
%19 = and i32 %18, 128
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %17
21: ; preds = %17
%22 = tail call i32 @PDCWrite(i32 6, i8 zeroext 60)
br label %23
23: ; preds = %23, %21
%24 = tail call i32 @PDCRead(i32 6)
%25 = and i32 %24, 128
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %23
27: ; preds = %23
%28 = tail call i32 @PDCWrite(i32 6, i8 zeroext 8)
br label %29
29: ; preds = %29, %27
%30 = tail call i32 @PDCRead(i32 6)
%31 = and i32 %30, 128
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %29
33: ; preds = %29
%34 = tail call i32 @PDCWrite(i32 6, i8 zeroext 1)
br label %35
35: ; preds = %35, %33
%36 = tail call i32 @PDCRead(i32 6)
%37 = and i32 %36, 128
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %35
39: ; preds = %35
%40 = tail call i32 @PDCWrite(i32 6, i8 zeroext 6)
br label %41
41: ; preds = %41, %39
%42 = tail call i32 @PDCRead(i32 6)
%43 = and i32 %42, 128
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %41
45: ; preds = %41
%46 = tail call i32 @PDCWrite(i32 6, i8 zeroext 12)
ret void
}