#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*/ EFifoStart(unsigned long);
int /*<<< orphan*/ McDevIf_AddPacket(int, unsigned char);
int /*<<< orphan*/ McDevIf_ExecutePacket();
int /*<<< orphan*/ McDevIf_ReadDirect(int, unsigned char *);
long OFifoStart(unsigned long);
signed long DecStart(unsigned long dCoderId) {
  signed long sdRet = ((signed long)0);
  unsigned char bData;
  EFifoStart(dCoderId);
  McDevIf_ReadDirect(((0x00004000UL) | (unsigned long)(15)), &bData);
  if ((0UL) == dCoderId) {
    bData |= (0x01);
  } else {
    bData |= (0x08);
  }
  McDevIf_AddPacket(((0x20000000UL) | (0x00004000UL) | (unsigned long)(15)),
                    bData);
  McDevIf_ExecutePacket();
  sdRet = OFifoStart(dCoderId);
  return sdRet;
}


x86 assembly (clang, -O0):
<DecStart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <EFifoStart@plt>
mov    $0x400f,%edi
lea    -0x11(%rbp),%rsi
call   1040 <McDevIf_ReadDirect@plt>
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    1196 <DecStart+0x46>
movzbl -0x11(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x11(%rbp)
jmp    11a0 <DecStart+0x50>
movzbl -0x11(%rbp),%eax
or     $0x8,%eax
mov    %al,-0x11(%rbp)
mov    $0x2000400f,%edi
movzbl -0x11(%rbp),%esi
call   1060 <McDevIf_AddPacket@plt>
mov    $0x0,%al
call   1050 <McDevIf_ExecutePacket@plt>
mov    -0x8(%rbp),%rdi
call   1030 <OFifoStart@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DecStart>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1070 <EFifoStart@plt>
lea    0xf(%rsp),%rsi
mov    $0x400f,%edi
call   1040 <McDevIf_ReadDirect@plt>
test   %rbx,%rbx
mov    $0x1,%eax
mov    $0x8,%ecx
cmove  %eax,%ecx
or     0xf(%rsp),%cl
mov    %cl,0xf(%rsp)
movzbl %cl,%esi
mov    $0x2000400f,%edi
call   1060 <McDevIf_AddPacket@plt>
xor    %eax,%eax
call   1050 <McDevIf_ExecutePacket@plt>
mov    %rbx,%rdi
call   1030 <OFifoStart@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @DecStart(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %2
store i64 0, i64* %3
%5 = load i64, i64* %2
%6 = call i32 @EFifoStart(i64 %5)
%7 = call i32 @McDevIf_ReadDirect(i32 16399, i8* %4)
%8 = load i64, i64* %2
%9 = icmp eq i64 0, %8
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = or i32 %12, 1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %4
br label %20
15: ; preds = %1
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = or i32 %17, 8
%19 = trunc i32 %18 to i8
store i8 %19, i8* %4
br label %20
20: ; preds = %15, %10
%21 = load i8, i8* %4
%22 = call i32 @McDevIf_AddPacket(i32 536887311, i8 zeroext %21)
%23 = call i32 (...) @McDevIf_ExecutePacket()
%24 = load i64, i64* %2
%25 = call i64 @OFifoStart(i64 %24)
store i64 %25, i64* %3
%26 = load i64, i64* %3
ret i64 %26
}

LLVM IR (-O2):
define i64 @DecStart(i64 %0) {
%2 = alloca i8
%3 = tail call i32 @EFifoStart(i64 %0)
%4 = call i32 @McDevIf_ReadDirect(i32 16399, i8* %2)
%5 = icmp eq i64 %0, 0
%6 = load i8, i8* %2
%7 = select i1 %5, i8 1, i8 8
%8 = or i8 %6, %7
store i8 %8, i8* %2
%9 = call i32 @McDevIf_AddPacket(i32 536887311, i8 zeroext %8)
%10 = call i32 (...) @McDevIf_ExecutePacket()
%11 = call i64 @OFifoStart(i64 %0)
ret i64 %11
}