#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(int, int);
int /*<<< orphan*/ RegWriteA(int, int);
void SrvCon(unsigned char UcDirSel, unsigned char UcSwcCon) {
  if (UcSwcCon) {
    if (!UcDirSel) {
      RegWriteA(0x0170, 0x03);
      RamWrite32A(0x1021, 0x00000000);
      RamWrite32A(0x10B5, 0x00000000);
    } else {
      RegWriteA(0x0171, 0x03);
      RamWrite32A(0x1121, 0x00000000);
      RamWrite32A(0x11B5, 0x00000000);
    }
  } else {
    if (!UcDirSel) {
      RegWriteA(0x0170, 0x02);
      RamWrite32A(0x1477, 0x00000000);
    } else {
      RegWriteA(0x0171, 0x02);
      RamWrite32A(0x14F7, 0x00000000);
    }
  }
}


x86 assembly (clang, -O0):
<SrvCon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     11a0 <SrvCon+0x80>
cmpb   $0x0,-0x1(%rbp)
jne    1174 <SrvCon+0x54>
mov    $0x170,%edi
mov    $0x3,%esi
call   1040 <RegWriteA@plt>
mov    $0x1021,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
mov    $0x10b5,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
jmp    119b <SrvCon+0x7b>
mov    $0x171,%edi
mov    $0x3,%esi
call   1040 <RegWriteA@plt>
mov    $0x1121,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
mov    $0x11b5,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
jmp    11ea <SrvCon+0xca>
cmpb   $0x0,-0x1(%rbp)
jne    11ca <SrvCon+0xaa>
mov    $0x170,%edi
mov    $0x2,%esi
call   1040 <RegWriteA@plt>
mov    $0x1477,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
jmp    11e5 <SrvCon+0xc5>
mov    $0x171,%edi
mov    $0x2,%esi
call   1040 <RegWriteA@plt>
mov    $0x14f7,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
jmp    11ea <SrvCon+0xca>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SrvCon>:
push   %rax
test   %esi,%esi
je     114c <SrvCon+0x2c>
test   %dil,%dil
je     1167 <SrvCon+0x47>
mov    $0x171,%edi
mov    $0x3,%esi
call   1040 <RegWriteA@plt>
mov    $0x1121,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
mov    $0x11b5,%edi
jmp    119d <SrvCon+0x7d>
test   %dil,%dil
je     1189 <SrvCon+0x69>
mov    $0x171,%edi
mov    $0x2,%esi
call   1040 <RegWriteA@plt>
mov    $0x14f7,%edi
jmp    119d <SrvCon+0x7d>
mov    $0x170,%edi
mov    $0x3,%esi
call   1040 <RegWriteA@plt>
mov    $0x1021,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
mov    $0x10b5,%edi
jmp    119d <SrvCon+0x7d>
mov    $0x170,%edi
mov    $0x2,%esi
call   1040 <RegWriteA@plt>
mov    $0x1477,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <RamWrite32A@plt>

LLVM IR (-O0):
define void @SrvCon(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %2
%8 = load i8, i8* %3
%9 = icmp ne i8 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = call i32 @RegWriteA(i32 368, i32 3)
%12 = call i32 @RamWrite32A(i32 4129, i32 0)
%13 = call i32 @RamWrite32A(i32 4277, i32 0)
br label %18
14: ; preds = %7
%15 = call i32 @RegWriteA(i32 369, i32 3)
%16 = call i32 @RamWrite32A(i32 4385, i32 0)
%17 = call i32 @RamWrite32A(i32 4533, i32 0)
br label %18
18: ; preds = %14, %10
br label %29
19: ; preds = %2
%20 = load i8, i8* %3
%21 = icmp ne i8 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = call i32 @RegWriteA(i32 368, i32 2)
%24 = call i32 @RamWrite32A(i32 5239, i32 0)
br label %28
25: ; preds = %19
%26 = call i32 @RegWriteA(i32 369, i32 2)
%27 = call i32 @RamWrite32A(i32 5367, i32 0)
br label %28
28: ; preds = %25, %22
br label %29
29: ; preds = %28, %18
ret void
}

LLVM IR (-O2):
define void @SrvCon(i8 zeroext %0, i8 zeroext %1) {
%3 = icmp eq i8 %1, 0
%4 = icmp eq i8 %0, 0
br i1 %3, label %12, label %5
5: ; preds = %2
br i1 %4, label %6, label %9
6: ; preds = %5
%7 = tail call i32 @RegWriteA(i32 368, i32 3)
%8 = tail call i32 @RamWrite32A(i32 4129, i32 0)
br label %17
9: ; preds = %5
%10 = tail call i32 @RegWriteA(i32 369, i32 3)
%11 = tail call i32 @RamWrite32A(i32 4385, i32 0)
br label %17
12: ; preds = %2
br i1 %4, label %13, label %15
13: ; preds = %12
%14 = tail call i32 @RegWriteA(i32 368, i32 2)
br label %17
15: ; preds = %12
%16 = tail call i32 @RegWriteA(i32 369, i32 2)
br label %17
17: ; preds = %13, %15, %6, %9
%18 = phi i32 [ 5239, %13 ], [ 5367, %15 ], [ 4277, %6 ], [ 4533, %9 ]
%19 = tail call i32 @RamWrite32A(i32 %18, i32 0)
ret void
}