#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(int, unsigned char *);
int /*<<< orphan*/ RegWriteA(int, unsigned char);
int /*<<< orphan*/ WitTim(int);
void ClrGyr(unsigned short UsClrFil, unsigned char UcClrMod) {
  unsigned char UcRamClr;
  unsigned char UcCnt;
  RegWriteA(0x018F, (unsigned char)(UsClrFil >> 8));
  RegWriteA(0x018E, (unsigned char)UsClrFil);
  RegWriteA(0x0102, UcClrMod);
  for (UcCnt = 0; UcCnt < 60; UcCnt++) {
    RegReadA(0x0102, &UcRamClr);
    UcRamClr &= UcClrMod;
    if (UcRamClr == 0)
      break;
    WitTim(10);
  }
}


x86 assembly (clang, -O0):
<ClrGyr>:
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   1050 <RegWriteA@plt>
mov    -0x2(%rbp),%ax
mov    $0x18e,%edi
movzbl %al,%esi
call   1050 <RegWriteA@plt>
mov    $0x102,%edi
movzbl -0x3(%rbp),%esi
call   1050 <RegWriteA@plt>
movb   $0x0,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x3c,%eax
jge    11cd <ClrGyr+0x9d>
mov    $0x102,%edi
lea    -0x4(%rbp),%rsi
call   1040 <RegReadA@plt>
movzbl -0x3(%rbp),%ecx
movzbl -0x4(%rbp),%eax
and    %ecx,%eax
mov    %al,-0x4(%rbp)
movzbl -0x4(%rbp),%eax
cmp    $0x0,%eax
jne    11b6 <ClrGyr+0x86>
jmp    11cd <ClrGyr+0x9d>
mov    $0xa,%edi
call   1030 <WitTim@plt>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    117c <ClrGyr+0x4c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClrGyr>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
mov    %edi,%esi
shr    $0x8,%esi
mov    $0x18f,%edi
call   1050 <RegWriteA@plt>
movzbl %bl,%esi
mov    $0x18e,%edi
call   1050 <RegWriteA@plt>
mov    $0x102,%edi
mov    %ebp,%esi
call   1050 <RegWriteA@plt>
mov    $0x3c,%bl
lea    0xf(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    $0x102,%edi
mov    %r14,%rsi
call   1040 <RegReadA@plt>
and    %bpl,0xf(%rsp)
je     1193 <ClrGyr+0x63>
mov    $0xa,%edi
call   1030 <WitTim@plt>
add    $0xff,%bl
jne    1170 <ClrGyr+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @ClrGyr(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%7 = load i16, i16* %3
%8 = zext i16 %7 to i32
%9 = ashr i32 %8, 8
%10 = trunc i32 %9 to i8
%11 = call i32 @RegWriteA(i32 399, i8 zeroext %10)
%12 = load i16, i16* %3
%13 = trunc i16 %12 to i8
%14 = call i32 @RegWriteA(i32 398, i8 zeroext %13)
%15 = load i8, i8* %4
%16 = call i32 @RegWriteA(i32 258, i8 zeroext %15)
store i8 0, i8* %6
br label %17
17: ; preds = %35, %2
%18 = load i8, i8* %6
%19 = zext i8 %18 to i32
%20 = icmp slt i32 %19, 60
br i1 %20, label %21, label %38
21: ; preds = %17
%22 = call i32 @RegReadA(i32 258, i8* %5)
%23 = load i8, i8* %4
%24 = zext i8 %23 to i32
%25 = load i8, i8* %5
%26 = zext i8 %25 to i32
%27 = and i32 %26, %24
%28 = trunc i32 %27 to i8
store i8 %28, i8* %5
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %21
br label %38
33: ; preds = %21
%34 = call i32 @WitTim(i32 10)
br label %35
35: ; preds = %33
%36 = load i8, i8* %6
%37 = add i8 %36, 1
store i8 %37, i8* %6
br label %17
38: ; preds = %32, %17
ret void
}

LLVM IR (-O2):
define void @ClrGyr(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(i32 399, i8 zeroext %5)
%7 = trunc i16 %0 to i8
%8 = tail call i32 @RegWriteA(i32 398, i8 zeroext %7)
%9 = tail call i32 @RegWriteA(i32 258, i8 zeroext %1)
br label %10
10: ; preds = %2, %16
%11 = phi i8 [ 0, %2 ], [ %18, %16 ]
%12 = call i32 @RegReadA(i32 258, i8* %3)
%13 = load i8, i8* %3
%14 = and i8 %13, %1
store i8 %14, i8* %3
%15 = icmp eq i8 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %10
%17 = call i32 @WitTim(i32 10)
%18 = add nuw nsw i8 %11, 1
%19 = icmp eq i8 %18, 60
br i1 %19, label %20, label %10
20: ; preds = %10, %16
ret void
}