#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*/ RamWrite32A_Ofilm(int, int);
int /*<<< orphan*/ RegReadA_Ofilm(int, unsigned char *);
int /*<<< orphan*/ RegWriteA_Ofilm(int, unsigned char);
void LopSin_OFILM(unsigned char UcDirSel_OFILM, unsigned char UcSonOff_OFILM) {
  unsigned short UsFreqVal_OFILM;
  unsigned char UcEqSwX_OFILM, UcEqSwY_OFILM;
  RegReadA_Ofilm(0x0170, &UcEqSwX_OFILM);
  RegReadA_Ofilm(0x0171, &UcEqSwY_OFILM);
  if (UcSonOff_OFILM) {
    UsFreqVal_OFILM = 0x14F8;
    RegWriteA_Ofilm(0x0181, (unsigned char)UsFreqVal_OFILM);
    RegWriteA_Ofilm(0x0182, (unsigned char)(UsFreqVal_OFILM >> 8));
    if (!UcDirSel_OFILM) {
      UcEqSwX_OFILM |= 0x10;
      UcEqSwY_OFILM &= ~0x3C;
      RamWrite32A_Ofilm(0x10D5, 0x3CA3D70A);
    } else {
      UcEqSwX_OFILM &= ~0x3C;
      UcEqSwY_OFILM |= 0x10;
      RamWrite32A_Ofilm(0x11D5, 0x3CA3D70A);
    }
    RegWriteA_Ofilm(0x0183, 0x00);
    RegWriteA_Ofilm(0x0184, 0x00);
    RegWriteA_Ofilm(0x0170, UcEqSwX_OFILM);
    RegWriteA_Ofilm(0x0171, UcEqSwY_OFILM);
    RegWriteA_Ofilm(0x0180, 0x01);
  } else {
    UcEqSwX_OFILM &= ~0x3C;
    UcEqSwY_OFILM &= ~0x3C;
    RegWriteA_Ofilm(0x0180, 0x00);
    if (!UcDirSel_OFILM) {
      RamWrite32A_Ofilm(0x10D5, 0x00000000);
    } else {
      RamWrite32A_Ofilm(0x11D5, 0x00000000);
    }
    RegWriteA_Ofilm(0x0170, UcEqSwX_OFILM);
    RegWriteA_Ofilm(0x0171, UcEqSwY_OFILM);
  }
}


x86 assembly (clang, -O0):
<LopSin_OFILM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    $0x170,%edi
lea    -0x5(%rbp),%rsi
call   1030 <RegReadA_Ofilm@plt>
mov    $0x171,%edi
lea    -0x6(%rbp),%rsi
call   1030 <RegReadA_Ofilm@plt>
cmpb   $0x0,-0x2(%rbp)
je     1232 <LopSin_OFILM+0x102>
movw   $0x14f8,-0x4(%rbp)
mov    -0x4(%rbp),%ax
mov    $0x181,%edi
movzbl %al,%esi
call   1040 <RegWriteA_Ofilm@plt>
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
mov    $0x182,%edi
movzbl %al,%esi
call   1040 <RegWriteA_Ofilm@plt>
cmpb   $0x0,-0x1(%rbp)
jne    11c7 <LopSin_OFILM+0x97>
movzbl -0x5(%rbp),%eax
or     $0x10,%eax
mov    %al,-0x5(%rbp)
movzbl -0x6(%rbp),%eax
and    $0xffffffc3,%eax
mov    %al,-0x6(%rbp)
mov    $0x10d5,%edi
mov    $0x3ca3d70a,%esi
call   1050 <RamWrite32A_Ofilm@plt>
jmp    11ea <LopSin_OFILM+0xba>
movzbl -0x5(%rbp),%eax
and    $0xffffffc3,%eax
mov    %al,-0x5(%rbp)
movzbl -0x6(%rbp),%eax
or     $0x10,%eax
mov    %al,-0x6(%rbp)
mov    $0x11d5,%edi
mov    $0x3ca3d70a,%esi
call   1050 <RamWrite32A_Ofilm@plt>
mov    $0x183,%edi
xor    %esi,%esi
call   1040 <RegWriteA_Ofilm@plt>
mov    $0x184,%edi
xor    %esi,%esi
call   1040 <RegWriteA_Ofilm@plt>
mov    $0x170,%edi
movzbl -0x5(%rbp),%esi
call   1040 <RegWriteA_Ofilm@plt>
mov    $0x171,%edi
movzbl -0x6(%rbp),%esi
call   1040 <RegWriteA_Ofilm@plt>
mov    $0x180,%edi
mov    $0x1,%esi
call   1040 <RegWriteA_Ofilm@plt>
jmp    1295 <LopSin_OFILM+0x165>
movzbl -0x5(%rbp),%eax
and    $0xffffffc3,%eax
mov    %al,-0x5(%rbp)
movzbl -0x6(%rbp),%eax
and    $0xffffffc3,%eax
mov    %al,-0x6(%rbp)
mov    $0x180,%edi
xor    %esi,%esi
call   1040 <RegWriteA_Ofilm@plt>
cmpb   $0x0,-0x1(%rbp)
jne    126d <LopSin_OFILM+0x13d>
mov    $0x10d5,%edi
xor    %esi,%esi
call   1050 <RamWrite32A_Ofilm@plt>
jmp    1279 <LopSin_OFILM+0x149>
mov    $0x11d5,%edi
xor    %esi,%esi
call   1050 <RamWrite32A_Ofilm@plt>
mov    $0x170,%edi
movzbl -0x5(%rbp),%esi
call   1040 <RegWriteA_Ofilm@plt>
mov    $0x171,%edi
movzbl -0x6(%rbp),%esi
call   1040 <RegWriteA_Ofilm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LopSin_OFILM>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0x7(%rsp),%rsi
mov    $0x170,%edi
call   1030 <RegReadA_Ofilm@plt>
lea    0x6(%rsp),%rsi
mov    $0x171,%edi
call   1030 <RegReadA_Ofilm@plt>
test   %ebp,%ebp
je     1192 <LopSin_OFILM+0x62>
mov    $0x181,%edi
mov    $0xf8,%esi
call   1040 <RegWriteA_Ofilm@plt>
mov    $0x182,%edi
mov    $0x14,%esi
call   1040 <RegWriteA_Ofilm@plt>
mov    0x7(%rsp),%al
test   %bl,%bl
je     11db <LopSin_OFILM+0xab>
and    $0xc3,%al
mov    %al,0x7(%rsp)
mov    0x6(%rsp),%al
or     $0x10,%al
mov    $0x11d5,%edi
jmp    11ec <LopSin_OFILM+0xbc>
andb   $0xc3,0x7(%rsp)
andb   $0xc3,0x6(%rsp)
mov    $0x180,%edi
xor    %esi,%esi
call   1040 <RegWriteA_Ofilm@plt>
xor    %edi,%edi
test   %bl,%bl
setne  %dil
shl    $0x8,%edi
or     $0x10d5,%edi
xor    %esi,%esi
call   1050 <RamWrite32A_Ofilm@plt>
movzbl 0x7(%rsp),%esi
mov    $0x170,%edi
call   1040 <RegWriteA_Ofilm@plt>
movzbl 0x6(%rsp),%esi
mov    $0x171,%edi
jmp    123a <LopSin_OFILM+0x10a>
or     $0x10,%al
mov    %al,0x7(%rsp)
mov    0x6(%rsp),%al
and    $0xc3,%al
mov    $0x10d5,%edi
mov    %al,0x6(%rsp)
mov    $0x3ca3d70a,%esi
call   1050 <RamWrite32A_Ofilm@plt>
mov    $0x183,%edi
xor    %esi,%esi
call   1040 <RegWriteA_Ofilm@plt>
mov    $0x184,%edi
xor    %esi,%esi
call   1040 <RegWriteA_Ofilm@plt>
movzbl 0x7(%rsp),%esi
mov    $0x170,%edi
call   1040 <RegWriteA_Ofilm@plt>
movzbl 0x6(%rsp),%esi
mov    $0x171,%edi
call   1040 <RegWriteA_Ofilm@plt>
mov    $0x180,%edi
mov    $0x1,%esi
call   1040 <RegWriteA_Ofilm@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @LopSin_OFILM(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i16
%6 = alloca i8
%7 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%8 = call i32 @RegReadA_Ofilm(i32 368, i8* %6)
%9 = call i32 @RegReadA_Ofilm(i32 369, i8* %7)
%10 = load i8, i8* %4
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %51
12: ; preds = %2
store i16 5368, i16* %5
%13 = load i16, i16* %5
%14 = trunc i16 %13 to i8
%15 = call i32 @RegWriteA_Ofilm(i32 385, i8 zeroext %14)
%16 = load i16, i16* %5
%17 = zext i16 %16 to i32
%18 = ashr i32 %17, 8
%19 = trunc i32 %18 to i8
%20 = call i32 @RegWriteA_Ofilm(i32 386, i8 zeroext %19)
%21 = load i8, i8* %3
%22 = icmp ne i8 %21, 0
br i1 %22, label %33, label %23
23: ; preds = %12
%24 = load i8, i8* %6
%25 = zext i8 %24 to i32
%26 = or i32 %25, 16
%27 = trunc i32 %26 to i8
store i8 %27, i8* %6
%28 = load i8, i8* %7
%29 = zext i8 %28 to i32
%30 = and i32 %29, -61
%31 = trunc i32 %30 to i8
store i8 %31, i8* %7
%32 = call i32 @RamWrite32A_Ofilm(i32 4309, i32 1017370378)
br label %43
33: ; preds = %12
%34 = load i8, i8* %6
%35 = zext i8 %34 to i32
%36 = and i32 %35, -61
%37 = trunc i32 %36 to i8
store i8 %37, i8* %6
%38 = load i8, i8* %7
%39 = zext i8 %38 to i32
%40 = or i32 %39, 16
%41 = trunc i32 %40 to i8
store i8 %41, i8* %7
%42 = call i32 @RamWrite32A_Ofilm(i32 4565, i32 1017370378)
br label %43
43: ; preds = %33, %23
%44 = call i32 @RegWriteA_Ofilm(i32 387, i8 zeroext 0)
%45 = call i32 @RegWriteA_Ofilm(i32 388, i8 zeroext 0)
%46 = load i8, i8* %6
%47 = call i32 @RegWriteA_Ofilm(i32 368, i8 zeroext %46)
%48 = load i8, i8* %7
%49 = call i32 @RegWriteA_Ofilm(i32 369, i8 zeroext %48)
%50 = call i32 @RegWriteA_Ofilm(i32 384, i8 zeroext 1)
br label %72
51: ; preds = %2
%52 = load i8, i8* %6
%53 = zext i8 %52 to i32
%54 = and i32 %53, -61
%55 = trunc i32 %54 to i8
store i8 %55, i8* %6
%56 = load i8, i8* %7
%57 = zext i8 %56 to i32
%58 = and i32 %57, -61
%59 = trunc i32 %58 to i8
store i8 %59, i8* %7
%60 = call i32 @RegWriteA_Ofilm(i32 384, i8 zeroext 0)
%61 = load i8, i8* %3
%62 = icmp ne i8 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %51
%64 = call i32 @RamWrite32A_Ofilm(i32 4309, i32 0)
br label %67
65: ; preds = %51
%66 = call i32 @RamWrite32A_Ofilm(i32 4565, i32 0)
br label %67
67: ; preds = %65, %63
%68 = load i8, i8* %6
%69 = call i32 @RegWriteA_Ofilm(i32 368, i8 zeroext %68)
%70 = load i8, i8* %7
%71 = call i32 @RegWriteA_Ofilm(i32 369, i8 zeroext %70)
br label %72
72: ; preds = %67, %43
ret void
}

LLVM IR (-O2):
define void @LopSin_OFILM(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = call i32 @RegReadA_Ofilm(i32 368, i8* %3)
%6 = call i32 @RegReadA_Ofilm(i32 369, i8* %4)
%7 = icmp eq i8 %1, 0
br i1 %7, label %32, label %8
8: ; preds = %2
%9 = call i32 @RegWriteA_Ofilm(i32 385, i8 zeroext -8)
%10 = call i32 @RegWriteA_Ofilm(i32 386, i8 zeroext 20)
%11 = icmp eq i8 %0, 0
%12 = load i8, i8* %3
br i1 %11, label %13, label %17
13: ; preds = %8
%14 = or i8 %12, 16
store i8 %14, i8* %3
%15 = load i8, i8* %4
%16 = and i8 %15, -61
br label %21
17: ; preds = %8
%18 = and i8 %12, -61
store i8 %18, i8* %3
%19 = load i8, i8* %4
%20 = or i8 %19, 16
br label %21
21: ; preds = %17, %13
%22 = phi i8 [ %20, %17 ], [ %16, %13 ]
%23 = phi i32 [ 4565, %17 ], [ 4309, %13 ]
store i8 %22, i8* %4
%24 = call i32 @RamWrite32A_Ofilm(i32 %23, i32 1017370378)
%25 = call i32 @RegWriteA_Ofilm(i32 387, i8 zeroext 0)
%26 = call i32 @RegWriteA_Ofilm(i32 388, i8 zeroext 0)
%27 = load i8, i8* %3
%28 = call i32 @RegWriteA_Ofilm(i32 368, i8 zeroext %27)
%29 = load i8, i8* %4
%30 = call i32 @RegWriteA_Ofilm(i32 369, i8 zeroext %29)
%31 = call i32 @RegWriteA_Ofilm(i32 384, i8 zeroext 1)
br label %45
32: ; preds = %2
%33 = load i8, i8* %3
%34 = and i8 %33, -61
store i8 %34, i8* %3
%35 = load i8, i8* %4
%36 = and i8 %35, -61
store i8 %36, i8* %4
%37 = call i32 @RegWriteA_Ofilm(i32 384, i8 zeroext 0)
%38 = icmp eq i8 %0, 0
%39 = select i1 %38, i32 4309, i32 4565
%40 = call i32 @RamWrite32A_Ofilm(i32 %39, i32 0)
%41 = load i8, i8* %3
%42 = call i32 @RegWriteA_Ofilm(i32 368, i8 zeroext %41)
%43 = load i8, i8* %4
%44 = call i32 @RegWriteA_Ofilm(i32 369, i8 zeroext %43)
br label %45
45: ; preds = %32, %21
ret void
}