#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 */
scalar_t__ CmdRdChk_OFILM();
int /*<<< orphan*/ RegReadA_Ofilm(int, unsigned char *);
int /*<<< orphan*/ RegWriteA_Ofilm(int, int);
int /*<<< orphan*/ SrvCon_OFILM(int, int);
void StbOnn_OFILM(void) {
  unsigned char UcRegValx_OFILM, UcRegValy_OFILM;
  unsigned char UcRegIni_OFILM;
  unsigned char UcRegIniCnt_OFILM = 0;
  RegReadA_Ofilm(0x0170, &UcRegValx_OFILM);
  RegReadA_Ofilm(0x0171, &UcRegValy_OFILM);
  if (((UcRegValx_OFILM & 0x01) != 0x01) &&
      ((UcRegValy_OFILM & 0x01) != 0x01)) {
    ;
    RegWriteA_Ofilm(0x017C, 0x01);
    SrvCon_OFILM(0x00, 0x01);
    SrvCon_OFILM(0x01, 0x01);
    UcRegIni_OFILM = 0x11;
    while ((UcRegIni_OFILM & 0x77) != 0x66) {
      RegReadA_Ofilm(0x01F8, &UcRegIni_OFILM);
      if (CmdRdChk_OFILM() != 0)
        break;
      if ((UcRegIni_OFILM & 0x77) == 0)
        UcRegIniCnt_OFILM++;
      if (UcRegIniCnt_OFILM > 10) {
        ;
        break;
      }
    }
    RegWriteA_Ofilm(0x017C, 0x00);
  } else {
    SrvCon_OFILM(0x00, 0x01);
    SrvCon_OFILM(0x01, 0x01);
    ;
  }
}


x86 assembly (clang, -O0):
<StbOnn_OFILM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x4(%rbp)
mov    $0x170,%edi
lea    -0x1(%rbp),%rsi
call   1030 <RegReadA_Ofilm@plt>
mov    $0x171,%edi
lea    -0x2(%rbp),%rsi
call   1030 <RegReadA_Ofilm@plt>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
je     1227 <StbOnn_OFILM+0xe7>
movzbl -0x2(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
je     1227 <StbOnn_OFILM+0xe7>
mov    $0x17c,%edi
mov    $0x1,%esi
call   1050 <RegWriteA_Ofilm@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1060 <SrvCon_OFILM@plt>
movb   $0x11,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
and    $0x77,%eax
cmp    $0x66,%eax
je     1216 <StbOnn_OFILM+0xd6>
mov    $0x1f8,%edi
lea    -0x3(%rbp),%rsi
call   1030 <RegReadA_Ofilm@plt>
mov    $0x0,%al
call   1040 <CmdRdChk_OFILM@plt>
cmp    $0x0,%rax
je     11e7 <StbOnn_OFILM+0xa7>
jmp    1216 <StbOnn_OFILM+0xd6>
movzbl -0x3(%rbp),%eax
and    $0x77,%eax
cmp    $0x0,%eax
jne    11ff <StbOnn_OFILM+0xbf>
mov    -0x4(%rbp),%al
add    $0x1,%al
mov    %al,-0x4(%rbp)
movzbl -0x4(%rbp),%eax
cmp    $0xa,%eax
jle    1211 <StbOnn_OFILM+0xd1>
jmp    1216 <StbOnn_OFILM+0xd6>
jmp    11b3 <StbOnn_OFILM+0x73>
mov    $0x17c,%edi
xor    %esi,%esi
call   1050 <RegWriteA_Ofilm@plt>
jmp    123f <StbOnn_OFILM+0xff>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1060 <SrvCon_OFILM@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StbOnn_OFILM>:
push   %rbp
push   %rbx
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x170,%edi
call   1030 <RegReadA_Ofilm@plt>
lea    0x6(%rsp),%rsi
mov    $0x171,%edi
call   1030 <RegReadA_Ofilm@plt>
testb  $0x1,0x7(%rsp)
jne    11f4 <StbOnn_OFILM+0xb4>
testb  $0x1,0x6(%rsp)
jne    11f4 <StbOnn_OFILM+0xb4>
mov    $0x17c,%edi
mov    $0x1,%esi
call   1050 <RegWriteA_Ofilm@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
movb   $0x11,0x5(%rsp)
mov    $0x11,%al
lea    0x5(%rsp),%rbx
xor    %ebp,%ebp
nop
and    $0x77,%al
cmp    $0x66,%al
je     11e6 <StbOnn_OFILM+0xa6>
mov    $0x1f8,%edi
mov    %rbx,%rsi
call   1030 <RegReadA_Ofilm@plt>
xor    %eax,%eax
call   1040 <CmdRdChk_OFILM@plt>
test   %rax,%rax
jne    11e6 <StbOnn_OFILM+0xa6>
movzbl 0x5(%rsp),%eax
mov    %eax,%ecx
and    $0x77,%cl
cmp    $0x1,%cl
adc    $0x0,%bpl
cmp    $0xb,%bpl
jb     11b0 <StbOnn_OFILM+0x70>
mov    $0x17c,%edi
xor    %esi,%esi
call   1050 <RegWriteA_Ofilm@plt>
jmp    120f <StbOnn_OFILM+0xcf>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @StbOnn_OFILM() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i8 0, i8* %4
%5 = call i32 @RegReadA_Ofilm(i32 368, i8* %1)
%6 = call i32 @RegReadA_Ofilm(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 %46
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 %46
16: ; preds = %11
%17 = call i32 @RegWriteA_Ofilm(i32 380, i32 1)
%18 = call i32 @SrvCon_OFILM(i32 0, i32 1)
%19 = call i32 @SrvCon_OFILM(i32 1, i32 1)
store i8 17, i8* %3
br label %20
20: ; preds = %43, %16
%21 = load i8, i8* %3
%22 = zext i8 %21 to i32
%23 = and i32 %22, 119
%24 = icmp ne i32 %23, 102
br i1 %24, label %25, label %44
25: ; preds = %20
%26 = call i32 @RegReadA_Ofilm(i32 504, i8* %3)
%27 = call i64 (...) @CmdRdChk_OFILM()
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25
br label %44
30: ; preds = %25
%31 = load i8, i8* %3
%32 = zext i8 %31 to i32
%33 = and i32 %32, 119
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i8, i8* %4
%37 = add i8 %36, 1
store i8 %37, i8* %4
br label %38
38: ; preds = %35, %30
%39 = load i8, i8* %4
%40 = zext i8 %39 to i32
%41 = icmp sgt i32 %40, 10
br i1 %41, label %42, label %43
42: ; preds = %38
br label %44
43: ; preds = %38
br label %20
44: ; preds = %42, %29, %20
%45 = call i32 @RegWriteA_Ofilm(i32 380, i32 0)
br label %49
46: ; preds = %11, %0
%47 = call i32 @SrvCon_OFILM(i32 0, i32 1)
%48 = call i32 @SrvCon_OFILM(i32 1, i32 1)
br label %49
49: ; preds = %46, %44
ret void
}

LLVM IR (-O2):
define void @StbOnn_OFILM() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = call i32 @RegReadA_Ofilm(i32 368, i8* %1)
%5 = call i32 @RegReadA_Ofilm(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 %35
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 %35
13: ; preds = %9
%14 = call i32 @RegWriteA_Ofilm(i32 380, i32 1)
%15 = call i32 @SrvCon_OFILM(i32 0, i32 1)
%16 = call i32 @SrvCon_OFILM(i32 1, i32 1)
store i8 17, i8* %3
br label %17
17: ; preds = %26, %13
%18 = phi i8 [ 17, %13 ], [ %27, %26 ]
%19 = phi i8 [ 0, %13 ], [ %31, %26 ]
%20 = and i8 %18, 119
%21 = icmp eq i8 %20, 102
br i1 %21, label %33, label %22
22: ; preds = %17
%23 = call i32 @RegReadA_Ofilm(i32 504, i8* %3)
%24 = call i64 (...) @CmdRdChk_OFILM()
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %33
26: ; preds = %22
%27 = load i8, i8* %3
%28 = and i8 %27, 119
%29 = icmp eq i8 %28, 0
%30 = zext i1 %29 to i8
%31 = add nuw nsw i8 %19, %30
%32 = icmp ugt i8 %31, 10
br i1 %32, label %33, label %17
33: ; preds = %26, %22, %17
%34 = call i32 @RegWriteA_Ofilm(i32 380, i32 0)
br label %38
35: ; preds = %9, %0
%36 = call i32 @SrvCon_OFILM(i32 0, i32 1)
%37 = call i32 @SrvCon_OFILM(i32 1, i32 1)
br label %38
38: ; preds = %35, %33
ret void
}