#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*/ RegWriteA(int, int);
void IniPtMovMod(unsigned char UcPtMod) {
  switch (UcPtMod) {
  case 0x00:
    RegWriteA(0x0154, 0x00);
    RegWriteA(0x0155, 0x54);
    RegWriteA(0x0156, 0x14);
    RegWriteA(0x0157, 0x94);
    RegWriteA(0x0158, 0x00);
    break;
  case 0x01:
    RegWriteA(0x0154, 0x00);
    RegWriteA(0x0155, 0x00);
    RegWriteA(0x0156, 0x14);
    RegWriteA(0x0157, 0x94);
    RegWriteA(0x0158, 0x00);
    break;
  }
}


x86 assembly (clang, -O0):
<IniPtMovMod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1143 <IniPtMovMod+0x33>
jmp    1132 <IniPtMovMod+0x22>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     118d <IniPtMovMod+0x7d>
jmp    11cf <IniPtMovMod+0xbf>
mov    $0x154,%edi
xor    %esi,%esi
call   1030 <RegWriteA@plt>
mov    $0x155,%edi
mov    $0x54,%esi
call   1030 <RegWriteA@plt>
mov    $0x156,%edi
mov    $0x14,%esi
call   1030 <RegWriteA@plt>
mov    $0x157,%edi
mov    $0x94,%esi
call   1030 <RegWriteA@plt>
mov    $0x158,%edi
xor    %esi,%esi
call   1030 <RegWriteA@plt>
jmp    11cf <IniPtMovMod+0xbf>
mov    $0x154,%edi
xor    %esi,%esi
call   1030 <RegWriteA@plt>
mov    $0x155,%edi
xor    %esi,%esi
call   1030 <RegWriteA@plt>
mov    $0x156,%edi
mov    $0x14,%esi
call   1030 <RegWriteA@plt>
mov    $0x157,%edi
mov    $0x94,%esi
call   1030 <RegWriteA@plt>
mov    $0x158,%edi
xor    %esi,%esi
call   1030 <RegWriteA@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IniPtMovMod>:
push   %rbx
test   %edi,%edi
je     111f <IniPtMovMod+0xf>
cmp    $0x1,%dil
jne    1167 <IniPtMovMod+0x57>
xor    %ebx,%ebx
jmp    1124 <IniPtMovMod+0x14>
mov    $0x54,%ebx
mov    $0x154,%edi
xor    %esi,%esi
call   1030 <RegWriteA@plt>
mov    $0x155,%edi
mov    %ebx,%esi
call   1030 <RegWriteA@plt>
mov    $0x156,%edi
mov    $0x14,%esi
call   1030 <RegWriteA@plt>
mov    $0x157,%edi
mov    $0x94,%esi
call   1030 <RegWriteA@plt>
mov    $0x158,%edi
xor    %esi,%esi
pop    %rbx
jmp    1030 <RegWriteA@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @IniPtMovMod(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
switch i32 %4, label %17 [
i32 0, label %5
i32 1, label %11
]
5: ; preds = %1
%6 = call i32 @RegWriteA(i32 340, i32 0)
%7 = call i32 @RegWriteA(i32 341, i32 84)
%8 = call i32 @RegWriteA(i32 342, i32 20)
%9 = call i32 @RegWriteA(i32 343, i32 148)
%10 = call i32 @RegWriteA(i32 344, i32 0)
br label %17
11: ; preds = %1
%12 = call i32 @RegWriteA(i32 340, i32 0)
%13 = call i32 @RegWriteA(i32 341, i32 0)
%14 = call i32 @RegWriteA(i32 342, i32 20)
%15 = call i32 @RegWriteA(i32 343, i32 148)
%16 = call i32 @RegWriteA(i32 344, i32 0)
br label %17
17: ; preds = %1, %11, %5
ret void
}

LLVM IR (-O2):
define void @IniPtMovMod(i8 zeroext %0) {
switch i8 %0, label %10 [
i8 0, label %3
i8 1, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i32 [ 0, %2 ], [ 84, %1 ]
%5 = tail call i32 @RegWriteA(i32 340, i32 0)
%6 = tail call i32 @RegWriteA(i32 341, i32 %4)
%7 = tail call i32 @RegWriteA(i32 342, i32 20)
%8 = tail call i32 @RegWriteA(i32 343, i32 148)
%9 = tail call i32 @RegWriteA(i32 344, i32 0)
br label %10
10: ; preds = %3, %1
ret void
}