#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(0x10B5, 0x00000000);
    } else {
      RegWriteA(0x0171, 0x03);
      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     1188 <SrvCon+0x68>
cmpb   $0x0,-0x1(%rbp)
jne    1168 <SrvCon+0x48>
mov    $0x170,%edi
mov    $0x3,%esi
call   1040 <RegWriteA@plt>
mov    $0x10b5,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
jmp    1183 <SrvCon+0x63>
mov    $0x171,%edi
mov    $0x3,%esi
call   1040 <RegWriteA@plt>
mov    $0x11b5,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
jmp    11d2 <SrvCon+0xb2>
cmpb   $0x0,-0x1(%rbp)
jne    11b2 <SrvCon+0x92>
mov    $0x170,%edi
mov    $0x2,%esi
call   1040 <RegWriteA@plt>
mov    $0x1477,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
jmp    11cd <SrvCon+0xad>
mov    $0x171,%edi
mov    $0x2,%esi
call   1040 <RegWriteA@plt>
mov    $0x14f7,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
jmp    11d2 <SrvCon+0xb2>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SrvCon>:
push   %rax
test   %esi,%esi
je     1140 <SrvCon+0x20>
test   %dil,%dil
je     115b <SrvCon+0x3b>
mov    $0x171,%edi
mov    $0x3,%esi
call   1040 <RegWriteA@plt>
mov    $0x11b5,%edi
jmp    1185 <SrvCon+0x65>
test   %dil,%dil
je     1171 <SrvCon+0x51>
mov    $0x171,%edi
mov    $0x2,%esi
call   1040 <RegWriteA@plt>
mov    $0x14f7,%edi
jmp    1185 <SrvCon+0x65>
mov    $0x170,%edi
mov    $0x3,%esi
call   1040 <RegWriteA@plt>
mov    $0x10b5,%edi
jmp    1185 <SrvCon+0x65>
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 %17
7: ; preds = %2
%8 = load i8, i8* %3
%9 = icmp ne i8 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = call i32 @RegWriteA(i32 368, i32 3)
%12 = call i32 @RamWrite32A(i32 4277, i32 0)
br label %16
13: ; preds = %7
%14 = call i32 @RegWriteA(i32 369, i32 3)
%15 = call i32 @RamWrite32A(i32 4533, i32 0)
br label %16
16: ; preds = %13, %10
br label %27
17: ; preds = %2
%18 = load i8, i8* %3
%19 = icmp ne i8 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = call i32 @RegWriteA(i32 368, i32 2)
%22 = call i32 @RamWrite32A(i32 5239, i32 0)
br label %26
23: ; preds = %17
%24 = call i32 @RegWriteA(i32 369, i32 2)
%25 = call i32 @RamWrite32A(i32 5367, i32 0)
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %16
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 %10, label %5
5: ; preds = %2
br i1 %4, label %6, label %8
6: ; preds = %5
%7 = tail call i32 @RegWriteA(i32 368, i32 3)
br label %15
8: ; preds = %5
%9 = tail call i32 @RegWriteA(i32 369, i32 3)
br label %15
10: ; preds = %2
br i1 %4, label %11, label %13
11: ; preds = %10
%12 = tail call i32 @RegWriteA(i32 368, i32 2)
br label %15
13: ; preds = %10
%14 = tail call i32 @RegWriteA(i32 369, i32 2)
br label %15
15: ; preds = %11, %13, %6, %8
%16 = phi i32 [ 5239, %11 ], [ 5367, %13 ], [ 4277, %6 ], [ 4533, %8 ]
%17 = tail call i32 @RamWrite32A(i32 %16, i32 0)
ret void
}