#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*/ RamRead32A(int, unsigned long *);
int /*<<< orphan*/ RamWrite32A(int, unsigned long);
void GyrGan(unsigned char UcGygmode, unsigned long UlGygXval,
            unsigned long UlGygYval) {
  switch (UcGygmode) {
  case 0x00:
    RamWrite32A(0x1020, UlGygXval);
    RamWrite32A(0x1120, UlGygYval);
    break;
  case 0x01:
    RamWrite32A(0x1020, UlGygXval);
    RamWrite32A(0x1120, UlGygYval);
    break;
  case 0x02:
    RamRead32A(0x1020, &UlGygXval);
    RamRead32A(0x1120, &UlGygYval);
    break;
  }
}


x86 assembly (clang, -O0):
<GyrGan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     116c <GyrGan+0x4c>
jmp    114a <GyrGan+0x2a>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
je     118d <GyrGan+0x6d>
jmp    115b <GyrGan+0x3b>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     11ae <GyrGan+0x8e>
jmp    11ca <GyrGan+0xaa>
mov    -0x10(%rbp),%rsi
mov    $0x1020,%edi
call   1040 <RamWrite32A@plt>
mov    -0x18(%rbp),%rsi
mov    $0x1120,%edi
call   1040 <RamWrite32A@plt>
jmp    11ca <GyrGan+0xaa>
mov    -0x10(%rbp),%rsi
mov    $0x1020,%edi
call   1040 <RamWrite32A@plt>
mov    -0x18(%rbp),%rsi
mov    $0x1120,%edi
call   1040 <RamWrite32A@plt>
jmp    11ca <GyrGan+0xaa>
mov    $0x1020,%edi
lea    -0x10(%rbp),%rsi
call   1030 <RamRead32A@plt>
mov    $0x1120,%edi
lea    -0x18(%rbp),%rsi
call   1030 <RamRead32A@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GyrGan>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdx,(%rsp)
cmp    $0x2,%dil
je     115e <GyrGan+0x3e>
mov    %rdx,%rbx
cmp    $0x1,%dil
je     1142 <GyrGan+0x22>
test   %dil,%dil
jne    117a <GyrGan+0x5a>
mov    $0x1020,%edi
call   1040 <RamWrite32A@plt>
mov    $0x1120,%edi
mov    %rbx,%rsi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <RamWrite32A@plt>
lea    0x8(%rsp),%rsi
mov    $0x1020,%edi
call   1030 <RamRead32A@plt>
mov    %rsp,%rsi
mov    $0x1120,%edi
call   1030 <RamRead32A@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @GyrGan(i8 zeroext %0, i64 %1, i64 %2) {
%4 = alloca i8
%5 = alloca i64
%6 = alloca i64
store i8 %0, i8* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %22 [
i32 0, label %9
i32 1, label %14
i32 2, label %19
]
9: ; preds = %3
%10 = load i64, i64* %5
%11 = call i32 @RamWrite32A(i32 4128, i64 %10)
%12 = load i64, i64* %6
%13 = call i32 @RamWrite32A(i32 4384, i64 %12)
br label %22
14: ; preds = %3
%15 = load i64, i64* %5
%16 = call i32 @RamWrite32A(i32 4128, i64 %15)
%17 = load i64, i64* %6
%18 = call i32 @RamWrite32A(i32 4384, i64 %17)
br label %22
19: ; preds = %3
%20 = call i32 @RamRead32A(i32 4128, i64* %5)
%21 = call i32 @RamRead32A(i32 4384, i64* %6)
br label %22
22: ; preds = %3, %19, %14, %9
ret void
}

LLVM IR (-O2):
define void @GyrGan(i8 zeroext %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
store i64 %1, i64* %4
store i64 %2, i64* %5
switch i8 %0, label %15 [
i8 0, label %6
i8 1, label %9
i8 2, label %12
]
6: ; preds = %3
%7 = tail call i32 @RamWrite32A(i32 4128, i64 %1)
%8 = tail call i32 @RamWrite32A(i32 4384, i64 %2)
br label %15
9: ; preds = %3
%10 = tail call i32 @RamWrite32A(i32 4128, i64 %1)
%11 = tail call i32 @RamWrite32A(i32 4384, i64 %2)
br label %15
12: ; preds = %3
%13 = call i32 @RamRead32A(i32 4128, i64* %4)
%14 = call i32 @RamRead32A(i32 4384, i64* %5)
br label %15
15: ; preds = %3, %12, %9, %6
ret void
}