#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*/ RegReadA_lc898122_sharp(int, unsigned char *);
int /*<<< orphan*/ RegWriteA_lc898122_sharp(int, unsigned char);
void ClrGyr_lc898122_sharp(unsigned short UsClrFil, unsigned char UcClrMod) {
  unsigned char UcRamClr;
  RegWriteA_lc898122_sharp(0x018F, (unsigned char)(UsClrFil >> 8));
  RegWriteA_lc898122_sharp(0x018E, (unsigned char)UsClrFil);
  RegWriteA_lc898122_sharp(0x0102, UcClrMod);
  do {
    RegReadA_lc898122_sharp(0x0102, &UcRamClr);
    UcRamClr &= UcClrMod;
  } while (UcRamClr != 0x00);
}


x86 assembly (clang, -O0):
<ClrGyr_lc898122_sharp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
mov    $0x18f,%edi
movzbl %al,%esi
call   1030 <RegWriteA_lc898122_sharp@plt>
mov    -0x2(%rbp),%ax
mov    $0x18e,%edi
movzbl %al,%esi
call   1030 <RegWriteA_lc898122_sharp@plt>
mov    $0x102,%edi
movzbl -0x3(%rbp),%esi
call   1030 <RegWriteA_lc898122_sharp@plt>
mov    $0x102,%edi
lea    -0x4(%rbp),%rsi
call   1040 <RegReadA_lc898122_sharp@plt>
movzbl -0x3(%rbp),%ecx
movzbl -0x4(%rbp),%eax
and    %ecx,%eax
mov    %al,-0x4(%rbp)
movzbl -0x4(%rbp),%eax
cmp    $0x0,%eax
jne    1168 <ClrGyr_lc898122_sharp+0x48>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClrGyr_lc898122_sharp>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edi,%esi
shr    $0x8,%esi
mov    $0x18f,%edi
call   1030 <RegWriteA_lc898122_sharp@plt>
movzbl %bpl,%esi
mov    $0x18e,%edi
call   1030 <RegWriteA_lc898122_sharp@plt>
mov    $0x102,%edi
mov    %ebx,%esi
call   1030 <RegWriteA_lc898122_sharp@plt>
lea    0xf(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    $0x102,%edi
mov    %r14,%rsi
call   1040 <RegReadA_lc898122_sharp@plt>
and    %bl,0xf(%rsp)
jne    1160 <ClrGyr_lc898122_sharp+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @ClrGyr_lc898122_sharp(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
%5 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%6 = load i16, i16* %3
%7 = zext i16 %6 to i32
%8 = ashr i32 %7, 8
%9 = trunc i32 %8 to i8
%10 = call i32 @RegWriteA_lc898122_sharp(i32 399, i8 zeroext %9)
%11 = load i16, i16* %3
%12 = trunc i16 %11 to i8
%13 = call i32 @RegWriteA_lc898122_sharp(i32 398, i8 zeroext %12)
%14 = load i8, i8* %4
%15 = call i32 @RegWriteA_lc898122_sharp(i32 258, i8 zeroext %14)
br label %16
16: ; preds = %24, %2
%17 = call i32 @RegReadA_lc898122_sharp(i32 258, i8* %5)
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = and i32 %21, %19
%23 = trunc i32 %22 to i8
store i8 %23, i8* %5
br label %24
24: ; preds = %16
%25 = load i8, i8* %5
%26 = zext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %16, label %28
28: ; preds = %24
ret void
}

LLVM IR (-O2):
define void @ClrGyr_lc898122_sharp(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = lshr i16 %0, 8
%5 = trunc i16 %4 to i8
%6 = tail call i32 @RegWriteA_lc898122_sharp(i32 399, i8 zeroext %5)
%7 = trunc i16 %0 to i8
%8 = tail call i32 @RegWriteA_lc898122_sharp(i32 398, i8 zeroext %7)
%9 = tail call i32 @RegWriteA_lc898122_sharp(i32 258, i8 zeroext %1)
br label %10
10: ; preds = %10, %2
%11 = call i32 @RegReadA_lc898122_sharp(i32 258, i8* %3)
%12 = load i8, i8* %3
%13 = and i8 %12, %1
store i8 %13, i8* %3
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %10
15: ; preds = %10
ret void
}