#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*/ AutoGainControlSw(int);
int /*<<< orphan*/ ClrGyr(int, int);
int /*<<< orphan*/ RamWrite32A(int, int);
int /*<<< orphan*/ RegWriteA(int, int);
void GyrCon(unsigned char UcGyrCon) {
  RegWriteA(0x0107, 0x00);
  if (UcGyrCon == 0x01) {
    AutoGainControlSw(0x01);
    ClrGyr(0x000E, 0x02);
    RamWrite32A(0x10B5, 0x3F800000);
    RamWrite32A(0x11B5, 0x3F800000);
  } else if (UcGyrCon == 0x02) {
    AutoGainControlSw(0x01);
    RamWrite32A(0x10B5, 0x3F800000);
    RamWrite32A(0x11B5, 0x3F800000);
  } else {
    RamWrite32A(0x10B5, 0x00000000);
    RamWrite32A(0x11B5, 0x00000000);
    AutoGainControlSw(0x00);
  }
}


x86 assembly (clang, -O0):
<GyrCon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x107,%edi
xor    %esi,%esi
call   1050 <RegWriteA@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    11a3 <GyrCon+0x63>
mov    $0x1,%edi
call   1060 <AutoGainControlSw@plt>
mov    $0xe,%edi
mov    $0x2,%esi
call   1030 <ClrGyr@plt>
mov    $0x10b5,%edi
mov    $0x3f800000,%esi
call   1040 <RamWrite32A@plt>
mov    $0x11b5,%edi
mov    $0x3f800000,%esi
call   1040 <RamWrite32A@plt>
jmp    1201 <GyrCon+0xc1>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    11dd <GyrCon+0x9d>
mov    $0x1,%edi
call   1060 <AutoGainControlSw@plt>
mov    $0x10b5,%edi
mov    $0x3f800000,%esi
call   1040 <RamWrite32A@plt>
mov    $0x11b5,%edi
mov    $0x3f800000,%esi
call   1040 <RamWrite32A@plt>
jmp    11fc <GyrCon+0xbc>
mov    $0x10b5,%edi
xor    %esi,%esi
call   1040 <RamWrite32A@plt>
mov    $0x11b5,%edi
xor    %esi,%esi
call   1040 <RamWrite32A@plt>
xor    %edi,%edi
call   1060 <AutoGainControlSw@plt>
jmp    1201 <GyrCon+0xc1>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GyrCon>:
push   %rbx
mov    %edi,%ebx
mov    $0x107,%edi
xor    %esi,%esi
call   1050 <RegWriteA@plt>
cmp    $0x2,%bl
je     1174 <GyrCon+0x34>
cmp    $0x1,%bl
jne    119d <GyrCon+0x5d>
mov    $0x1,%edi
call   1060 <AutoGainControlSw@plt>
mov    $0xe,%edi
mov    $0x2,%esi
call   1030 <ClrGyr@plt>
jmp    117e <GyrCon+0x3e>
mov    $0x1,%edi
call   1060 <AutoGainControlSw@plt>
mov    $0x10b5,%edi
mov    $0x3f800000,%esi
call   1040 <RamWrite32A@plt>
mov    $0x11b5,%edi
mov    $0x3f800000,%esi
pop    %rbx
jmp    1040 <RamWrite32A@plt>
mov    $0x10b5,%edi
xor    %esi,%esi
call   1040 <RamWrite32A@plt>
mov    $0x11b5,%edi
xor    %esi,%esi
call   1040 <RamWrite32A@plt>
xor    %edi,%edi
pop    %rbx
jmp    1060 <AutoGainControlSw@plt>

LLVM IR (-O0):
define void @GyrCon(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @RegWriteA(i32 263, i32 0)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = call i32 @AutoGainControlSw(i32 1)
%9 = call i32 @ClrGyr(i32 14, i32 2)
%10 = call i32 @RamWrite32A(i32 4277, i32 1065353216)
%11 = call i32 @RamWrite32A(i32 4533, i32 1065353216)
br label %25
12: ; preds = %1
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = call i32 @AutoGainControlSw(i32 1)
%18 = call i32 @RamWrite32A(i32 4277, i32 1065353216)
%19 = call i32 @RamWrite32A(i32 4533, i32 1065353216)
br label %24
20: ; preds = %12
%21 = call i32 @RamWrite32A(i32 4277, i32 0)
%22 = call i32 @RamWrite32A(i32 4533, i32 0)
%23 = call i32 @AutoGainControlSw(i32 0)
br label %24
24: ; preds = %20, %16
br label %25
25: ; preds = %24, %7
ret void
}

LLVM IR (-O2):
define void @GyrCon(i8 zeroext %0) {
%2 = tail call i32 @RegWriteA(i32 263, i32 0)
switch i8 %0, label %12 [
i8 1, label %3
i8 2, label %8
]
3: ; preds = %1
%4 = tail call i32 @AutoGainControlSw(i32 1)
%5 = tail call i32 @ClrGyr(i32 14, i32 2)
%6 = tail call i32 @RamWrite32A(i32 4277, i32 1065353216)
%7 = tail call i32 @RamWrite32A(i32 4533, i32 1065353216)
br label %16
8: ; preds = %1
%9 = tail call i32 @AutoGainControlSw(i32 1)
%10 = tail call i32 @RamWrite32A(i32 4277, i32 1065353216)
%11 = tail call i32 @RamWrite32A(i32 4533, i32 1065353216)
br label %16
12: ; preds = %1
%13 = tail call i32 @RamWrite32A(i32 4277, i32 0)
%14 = tail call i32 @RamWrite32A(i32 4533, i32 0)
%15 = tail call i32 @AutoGainControlSw(i32 0)
br label %16
16: ; preds = %8, %12, %3
ret void
}