#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);
void StbOnn(void) {
  unsigned char UcRegValx, UcRegValy;
  unsigned char UcRegIni;
  RegReadA(0x0170, &UcRegValx);
  RegReadA(0x0171, &UcRegValy);
  if (((UcRegValx & 0x01) != 0x01) && ((UcRegValy & 0x01) != 0x01)) {
    RegWriteA(0x017C, 0x01);
    SrvCon(0x00, 0x01);
    SrvCon(0x01, 0x01);
    UcRegIni = 0x11;
    while ((UcRegIni & 0x77) != 0x66) {
      RegReadA(0x01F8, &UcRegIni);
    }
    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   1040 <RegReadA@plt>
mov    $0x171,%edi
lea    -0x2(%rbp),%rsi
call   1040 <RegReadA@plt>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
je     11d3 <StbOnn+0xa3>
movzbl -0x2(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
je     11d3 <StbOnn+0xa3>
mov    $0x17c,%edi
mov    $0x1,%esi
call   1050 <RegWriteA@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <SrvCon@plt>
movb   $0x11,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
and    $0x77,%eax
cmp    $0x66,%eax
je     11c2 <StbOnn+0x92>
mov    $0x1f8,%edi
lea    -0x3(%rbp),%rsi
call   1040 <RegReadA@plt>
jmp    119f <StbOnn+0x6f>
mov    $0x17c,%edi
xor    %esi,%esi
call   1050 <RegWriteA@plt>
jmp    11eb <StbOnn+0xbb>
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   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%rsi
mov    $0x170,%edi
call   1040 <RegReadA@plt>
lea    0xe(%rsp),%rsi
mov    $0x171,%edi
call   1040 <RegReadA@plt>
testb  $0x1,0xf(%rsp)
jne    11c6 <StbOnn+0x96>
testb  $0x1,0xe(%rsp)
jne    11c6 <StbOnn+0x96>
mov    $0x17c,%edi
mov    $0x1,%esi
call   1050 <RegWriteA@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
movb   $0x11,0xd(%rsp)
lea    0xd(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1f8,%edi
mov    %rbx,%rsi
call   1040 <RegReadA@plt>
movzbl 0xd(%rsp),%eax
and    $0x77,%al
cmp    $0x66,%al
jne    11a0 <StbOnn+0x70>
mov    $0x17c,%edi
xor    %esi,%esi
call   1050 <RegWriteA@plt>
jmp    11e1 <StbOnn+0xb1>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
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 = zext i8 %6 to i32
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %28
10: ; preds = %0
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = and i32 %12, 1
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %28
15: ; preds = %10
%16 = call i32 @RegWriteA(i32 380, i32 1)
%17 = call i32 @SrvCon(i32 0, i32 1)
%18 = call i32 @SrvCon(i32 1, i32 1)
store i8 17, i8* %3
br label %19
19: ; preds = %24, %15
%20 = load i8, i8* %3
%21 = zext i8 %20 to i32
%22 = and i32 %21, 119
%23 = icmp ne i32 %22, 102
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 @RegReadA(i32 504, i8* %3)
br label %19
26: ; preds = %19
%27 = call i32 @RegWriteA(i32 380, i32 0)
br label %31
28: ; preds = %10, %0
%29 = call i32 @SrvCon(i32 0, i32 1)
%30 = call i32 @SrvCon(i32 1, i32 1)
br label %31
31: ; preds = %28, %26
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 %24
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 %24
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)
store i8 17, i8* %3
br label %17
17: ; preds = %13, %17
%18 = call i32 @RegReadA(i32 504, i8* %3)
%19 = load i8, i8* %3
%20 = and i8 %19, 119
%21 = icmp eq i8 %20, 102
br i1 %21, label %22, label %17
22: ; preds = %17
%23 = call i32 @RegWriteA(i32 380, i32 0)
br label %27
24: ; preds = %9, %0
%25 = call i32 @SrvCon(i32 0, i32 1)
%26 = call i32 @SrvCon(i32 1, i32 1)
br label %27
27: ; preds = %24, %22
ret void
}