#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*/ ClrGyr(int, int);
int /*<<< orphan*/ RamWrite32A(int, int);
int /*<<< orphan*/ RegWriteA(int, int);
int /*<<< orphan*/ SetPanTiltMode(int);
void RemOff(unsigned char UcMod) {
  switch (UcMod) {
  case 0x00:
    RegWriteA(0x010A, 0x11);
    RegWriteA(0x018D, 0x01);
    RamWrite32A(0x1043, 0x39D2BD40);
    RamWrite32A(0x1044, 0x39D2BD40);
    RamWrite32A(0x1045, 0x3F7FCB40);
    RegWriteA(0x018D, 0x00);
    RegWriteA(0x010A, 0x00);
    break;
  case 0x01:
    ClrGyr(0x007F, 0x02);
    RegWriteA(0x018D, 0x01);
    RamWrite32A(0x1043, 0x3aaf73c0);
    RamWrite32A(0x1044, 0x3aaf73c0);
    RamWrite32A(0x1045, 0x3F7F5080);
    RegWriteA(0x018D, 0x00);
    SetPanTiltMode(0x01);
    RegWriteA(0x010A, 0x44);
    break;
  }
}


x86 assembly (clang, -O0):
<RemOff>:
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     1173 <RemOff+0x33>
jmp    1162 <RemOff+0x22>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     11db <RemOff+0x9b>
jmp    124b <RemOff+0x10b>
mov    $0x10a,%edi
mov    $0x11,%esi
call   1060 <RegWriteA@plt>
mov    $0x18d,%edi
mov    $0x1,%esi
call   1060 <RegWriteA@plt>
mov    $0x1043,%edi
mov    $0x39d2bd40,%esi
call   1050 <RamWrite32A@plt>
mov    $0x1044,%edi
mov    $0x39d2bd40,%esi
call   1050 <RamWrite32A@plt>
mov    $0x1045,%edi
mov    $0x3f7fcb40,%esi
call   1050 <RamWrite32A@plt>
mov    $0x18d,%edi
xor    %esi,%esi
call   1060 <RegWriteA@plt>
mov    $0x10a,%edi
xor    %esi,%esi
call   1060 <RegWriteA@plt>
jmp    124b <RemOff+0x10b>
mov    $0x7f,%edi
mov    $0x2,%esi
call   1030 <ClrGyr@plt>
mov    $0x18d,%edi
mov    $0x1,%esi
call   1060 <RegWriteA@plt>
mov    $0x1043,%edi
mov    $0x3aaf73c0,%esi
call   1050 <RamWrite32A@plt>
mov    $0x1044,%edi
mov    $0x3aaf73c0,%esi
call   1050 <RamWrite32A@plt>
mov    $0x1045,%edi
mov    $0x3f7f5080,%esi
call   1050 <RamWrite32A@plt>
mov    $0x18d,%edi
xor    %esi,%esi
call   1060 <RegWriteA@plt>
mov    $0x1,%edi
call   1040 <SetPanTiltMode@plt>
mov    $0x10a,%edi
mov    $0x44,%esi
call   1060 <RegWriteA@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RemOff>:
push   %rbx
cmp    $0x1,%dil
je     11ab <RemOff+0x6b>
test   %dil,%dil
jne    121e <RemOff+0xde>
mov    $0x10a,%edi
mov    $0x11,%esi
call   1060 <RegWriteA@plt>
mov    $0x18d,%edi
mov    $0x1,%esi
call   1060 <RegWriteA@plt>
mov    $0x1043,%edi
mov    $0x39d2bd40,%esi
call   1050 <RamWrite32A@plt>
mov    $0x1044,%edi
mov    $0x39d2bd40,%esi
call   1050 <RamWrite32A@plt>
mov    $0x1045,%edi
mov    $0x3f7fcb40,%esi
call   1050 <RamWrite32A@plt>
xor    %ebx,%ebx
mov    $0x18d,%edi
xor    %esi,%esi
call   1060 <RegWriteA@plt>
jmp    1211 <RemOff+0xd1>
mov    $0x7f,%edi
mov    $0x2,%esi
call   1030 <ClrGyr@plt>
mov    $0x18d,%edi
mov    $0x1,%esi
call   1060 <RegWriteA@plt>
mov    $0x1043,%edi
mov    $0x3aaf73c0,%esi
call   1050 <RamWrite32A@plt>
mov    $0x1044,%edi
mov    $0x3aaf73c0,%esi
call   1050 <RamWrite32A@plt>
mov    $0x1045,%edi
mov    $0x3f7f5080,%esi
call   1050 <RamWrite32A@plt>
mov    $0x18d,%edi
xor    %esi,%esi
call   1060 <RegWriteA@plt>
mov    $0x1,%edi
call   1040 <SetPanTiltMode@plt>
mov    $0x44,%ebx
mov    $0x10a,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1060 <RegWriteA@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @RemOff(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 %22 [
i32 0, label %5
i32 1, label %13
]
5: ; preds = %1
%6 = call i32 @RegWriteA(i32 266, i32 17)
%7 = call i32 @RegWriteA(i32 397, i32 1)
%8 = call i32 @RamWrite32A(i32 4163, i32 970112320)
%9 = call i32 @RamWrite32A(i32 4164, i32 970112320)
%10 = call i32 @RamWrite32A(i32 4165, i32 1065339712)
%11 = call i32 @RegWriteA(i32 397, i32 0)
%12 = call i32 @RegWriteA(i32 266, i32 0)
br label %22
13: ; preds = %1
%14 = call i32 @ClrGyr(i32 127, i32 2)
%15 = call i32 @RegWriteA(i32 397, i32 1)
%16 = call i32 @RamWrite32A(i32 4163, i32 984576960)
%17 = call i32 @RamWrite32A(i32 4164, i32 984576960)
%18 = call i32 @RamWrite32A(i32 4165, i32 1065308288)
%19 = call i32 @RegWriteA(i32 397, i32 0)
%20 = call i32 @SetPanTiltMode(i32 1)
%21 = call i32 @RegWriteA(i32 266, i32 68)
br label %22
22: ; preds = %1, %13, %5
ret void
}

LLVM IR (-O2):
define void @RemOff(i8 zeroext %0) {
switch i8 %0, label %20 [
i8 0, label %2
i8 1, label %9
]
2: ; preds = %1
%3 = tail call i32 @RegWriteA(i32 266, i32 17)
%4 = tail call i32 @RegWriteA(i32 397, i32 1)
%5 = tail call i32 @RamWrite32A(i32 4163, i32 970112320)
%6 = tail call i32 @RamWrite32A(i32 4164, i32 970112320)
%7 = tail call i32 @RamWrite32A(i32 4165, i32 1065339712)
%8 = tail call i32 @RegWriteA(i32 397, i32 0)
br label %17
9: ; preds = %1
%10 = tail call i32 @ClrGyr(i32 127, i32 2)
%11 = tail call i32 @RegWriteA(i32 397, i32 1)
%12 = tail call i32 @RamWrite32A(i32 4163, i32 984576960)
%13 = tail call i32 @RamWrite32A(i32 4164, i32 984576960)
%14 = tail call i32 @RamWrite32A(i32 4165, i32 1065308288)
%15 = tail call i32 @RegWriteA(i32 397, i32 0)
%16 = tail call i32 @SetPanTiltMode(i32 1)
br label %17
17: ; preds = %2, %9
%18 = phi i32 [ 68, %9 ], [ 0, %2 ]
%19 = tail call i32 @RegWriteA(i32 266, i32 %18)
br label %20
20: ; preds = %17, %1
ret void
}