#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, int);
int /*<<< orphan*/ SrvCon(int, int);
int /*<<< orphan*/ WitTim(int);
void StbOnn(void) {
  unsigned char UcRegValx, UcRegValy;
  unsigned char UcRegIni;
  unsigned char UcCnt;
  RegReadA(0x0170, &UcRegValx);
  RegReadA(0x0171, &UcRegValy);
  if (((UcRegValx & 0x01) != 0x01) && ((UcRegValy & 0x01) != 0x01)) {
    RegWriteA(0x017C, 0x01);
    SrvCon(0x00, 0x01);
    SrvCon(0x01, 0x01);
    for (UcCnt = 0; UcCnt < 60; UcCnt++) {
      RegReadA(0x01F8, &UcRegIni);
      if ((UcRegIni & 0x77) == 0x66)
        break;
      WitTim(10);
    }
    RegWriteA(0x017C, 0x00);
  } else {
    SrvCon(0x00, 0x01);
    SrvCon(0x01, 0x01);
  }
}


x86 assembly (clang, -O0):
<StbOnn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x170,%edi
lea    -0x1(%rbp),%rsi
call   1050 <RegReadA@plt>
mov    $0x171,%edi
lea    -0x2(%rbp),%rsi
call   1050 <RegReadA@plt>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
je     1207 <StbOnn+0xc7>
movzbl -0x2(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
je     1207 <StbOnn+0xc7>
mov    $0x17c,%edi
mov    $0x1,%esi
call   1060 <RegWriteA@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <SrvCon@plt>
movb   $0x0,-0x4(%rbp)
movzbl -0x4(%rbp),%eax
cmp    $0x3c,%eax
jge    11f6 <StbOnn+0xb6>
mov    $0x1f8,%edi
lea    -0x3(%rbp),%rsi
call   1050 <RegReadA@plt>
movzbl -0x3(%rbp),%eax
and    $0x77,%eax
cmp    $0x66,%eax
jne    11df <StbOnn+0x9f>
jmp    11f6 <StbOnn+0xb6>
mov    $0xa,%edi
call   1040 <WitTim@plt>
mov    -0x4(%rbp),%al
add    $0x1,%al
mov    %al,-0x4(%rbp)
jmp    11af <StbOnn+0x6f>
mov    $0x17c,%edi
xor    %esi,%esi
call   1060 <RegWriteA@plt>
jmp    121f <StbOnn+0xdf>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <SrvCon@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StbOnn>:
push   %r14
push   %rbx
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x170,%edi
call   1050 <RegReadA@plt>
lea    0x6(%rsp),%rsi
mov    $0x171,%edi
call   1050 <RegReadA@plt>
testb  $0x1,0x7(%rsp)
jne    11e5 <StbOnn+0xa5>
testb  $0x1,0x6(%rsp)
jne    11e5 <StbOnn+0xa5>
mov    $0x17c,%edi
mov    $0x1,%esi
call   1060 <RegWriteA@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x3c,%bl
lea    0x5(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1f8,%edi
mov    %r14,%rsi
call   1050 <RegReadA@plt>
movzbl 0x5(%rsp),%eax
and    $0x77,%al
cmp    $0x66,%al
je     11d7 <StbOnn+0x97>
mov    $0xa,%edi
call   1040 <WitTim@plt>
add    $0xff,%bl
jne    11b0 <StbOnn+0x70>
mov    $0x17c,%edi
xor    %esi,%esi
call   1060 <RegWriteA@plt>
jmp    1200 <StbOnn+0xc0>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @StbOnn() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = call i32 @RegReadA(i32 368, i8* %1)
%6 = call i32 @RegReadA(i32 369, i8* %2)
%7 = load i8, i8* %1
%8 = zext i8 %7 to i32
%9 = and i32 %8, 1
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %38
11: ; preds = %0
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = and i32 %13, 1
%15 = icmp ne i32 %14, 1
br i1 %15, label %16, label %38
16: ; preds = %11
%17 = call i32 @RegWriteA(i32 380, i32 1)
%18 = call i32 @SrvCon(i32 0, i32 1)
%19 = call i32 @SrvCon(i32 1, i32 1)
store i8 0, i8* %4
br label %20
20: ; preds = %33, %16
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = icmp slt i32 %22, 60
br i1 %23, label %24, label %36
24: ; preds = %20
%25 = call i32 @RegReadA(i32 504, i8* %3)
%26 = load i8, i8* %3
%27 = zext i8 %26 to i32
%28 = and i32 %27, 119
%29 = icmp eq i32 %28, 102
br i1 %29, label %30, label %31
30: ; preds = %24
br label %36
31: ; preds = %24
%32 = call i32 @WitTim(i32 10)
br label %33
33: ; preds = %31
%34 = load i8, i8* %4
%35 = add i8 %34, 1
store i8 %35, i8* %4
br label %20
36: ; preds = %30, %20
%37 = call i32 @RegWriteA(i32 380, i32 0)
br label %41
38: ; preds = %11, %0
%39 = call i32 @SrvCon(i32 0, i32 1)
%40 = call i32 @SrvCon(i32 1, i32 1)
br label %41
41: ; preds = %38, %36
ret void
}

LLVM IR (-O2):
define void @StbOnn() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = call i32 @RegReadA(i32 368, i8* %1)
%5 = call i32 @RegReadA(i32 369, i8* %2)
%6 = load i8, i8* %1
%7 = and i8 %6, 1
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %29
9: ; preds = %0
%10 = load i8, i8* %2
%11 = and i8 %10, 1
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %29
13: ; preds = %9
%14 = call i32 @RegWriteA(i32 380, i32 1)
%15 = call i32 @SrvCon(i32 0, i32 1)
%16 = call i32 @SrvCon(i32 1, i32 1)
br label %17
17: ; preds = %13, %23
%18 = phi i8 [ 0, %13 ], [ %25, %23 ]
%19 = call i32 @RegReadA(i32 504, i8* %3)
%20 = load i8, i8* %3
%21 = and i8 %20, 119
%22 = icmp eq i8 %21, 102
br i1 %22, label %27, label %23
23: ; preds = %17
%24 = call i32 @WitTim(i32 10)
%25 = add nuw nsw i8 %18, 1
%26 = icmp eq i8 %25, 60
br i1 %26, label %27, label %17
27: ; preds = %17, %23
%28 = call i32 @RegWriteA(i32 380, i32 0)
br label %32
29: ; preds = %9, %0
%30 = call i32 @SrvCon(i32 0, i32 1)
%31 = call i32 @SrvCon(i32 1, i32 1)
br label %32
32: ; preds = %29, %27
ret void
}