#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, int);
int /*<<< orphan*/ WitTim(int);
void GetGyroID(unsigned char *UcGid) {
  unsigned long UlCnt;
  unsigned long UlVal;
  for (UlCnt = 0; UlCnt < 8; UlCnt++) {
    RamWrite32A(0xF01E, 0x6D000000);
    WitTim(5);
    RamWrite32A(0xF01E, (0x6E000000 | (UlCnt << 16)));
    WitTim(5);
    RamWrite32A(0xF01D, 0x6F000000);
    WitTim(5);
    RamRead32A(0xF01D, &UlVal);
    WitTim(5);
    UcGid[UlCnt] = (unsigned char)(UlVal >> 24);
  }
}


x86 assembly (clang, -O0):
<GetGyroID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x8,-0x10(%rbp)
jae    11e3 <GetGyroID+0xb3>
mov    $0xf01e,%edi
mov    $0x6d000000,%esi
call   1040 <RamWrite32A@plt>
mov    $0x5,%edi
call   1050 <WitTim@plt>
mov    -0x10(%rbp),%rax
shl    $0x10,%rax
or     $0x6e000000,%rax
mov    %eax,%esi
mov    $0xf01e,%edi
call   1040 <RamWrite32A@plt>
mov    $0x5,%edi
call   1050 <WitTim@plt>
mov    $0xf01d,%edi
mov    $0x6f000000,%esi
call   1040 <RamWrite32A@plt>
mov    $0x5,%edi
call   1050 <WitTim@plt>
mov    $0xf01d,%edi
lea    -0x18(%rbp),%rsi
call   1030 <RamRead32A@plt>
mov    $0x5,%edi
call   1050 <WitTim@plt>
mov    -0x18(%rbp),%rax
shr    $0x18,%rax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <GetGyroID+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetGyroID>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0x8(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xf01e,%edi
mov    $0x6d000000,%esi
call   1040 <RamWrite32A@plt>
mov    $0x5,%edi
call   1050 <WitTim@plt>
mov    %ebx,%esi
or     $0x6e000000,%esi
mov    $0xf01e,%edi
call   1040 <RamWrite32A@plt>
mov    $0x5,%edi
call   1050 <WitTim@plt>
mov    $0xf01d,%edi
mov    $0x6f000000,%esi
call   1040 <RamWrite32A@plt>
mov    $0x5,%edi
call   1050 <WitTim@plt>
mov    $0xf01d,%edi
mov    %r14,%rsi
call   1030 <RamRead32A@plt>
mov    $0x5,%edi
call   1050 <WitTim@plt>
movzbl 0xb(%rsp),%eax
mov    %al,(%r15)
add    $0x10000,%rbx
add    $0x1,%r15
cmp    $0x80000,%rbx
jne    1150 <GetGyroID+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @GetGyroID(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
br label %5
5: ; preds = %27, %1
%6 = load i64, i64* %3
%7 = icmp ult i64 %6, 8
br i1 %7, label %8, label %30
8: ; preds = %5
%9 = call i32 @RamWrite32A(i32 61470, i32 1828716544)
%10 = call i32 @WitTim(i32 5)
%11 = load i64, i64* %3
%12 = shl i64 %11, 16
%13 = or i64 1845493760, %12
%14 = trunc i64 %13 to i32
%15 = call i32 @RamWrite32A(i32 61470, i32 %14)
%16 = call i32 @WitTim(i32 5)
%17 = call i32 @RamWrite32A(i32 61469, i32 1862270976)
%18 = call i32 @WitTim(i32 5)
%19 = call i32 @RamRead32A(i32 61469, i64* %4)
%20 = call i32 @WitTim(i32 5)
%21 = load i64, i64* %4
%22 = lshr i64 %21, 24
%23 = trunc i64 %22 to i8
%24 = load i8*, i8** %2
%25 = load i64, i64* %3
%26 = getelementptr inbounds i8, i8* %24, i64 %25
store i8 %23, i8* %26
br label %27
27: ; preds = %8
%28 = load i64, i64* %3
%29 = add i64 %28, 1
store i64 %29, i64* %3
br label %5
30: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @GetGyroID(i8* nocapture writeonly %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
br label %4
4: ; preds = %1, %4
%5 = phi i64 [ 0, %1 ], [ %21, %4 ]
%6 = call i32 @RamWrite32A(i32 61470, i32 1828716544)
%7 = call i32 @WitTim(i32 5)
%8 = trunc i64 %5 to i32
%9 = shl nuw nsw i32 %8, 16
%10 = or i32 %9, 1845493760
%11 = call i32 @RamWrite32A(i32 61470, i32 %10)
%12 = call i32 @WitTim(i32 5)
%13 = call i32 @RamWrite32A(i32 61469, i32 1862270976)
%14 = call i32 @WitTim(i32 5)
%15 = call i32 @RamRead32A(i32 61469, i64* %2)
%16 = call i32 @WitTim(i32 5)
%17 = load i64, i64* %2
%18 = lshr i64 %17, 24
%19 = trunc i64 %18 to i8
%20 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %19, i8* %20
%21 = add nuw nsw i64 %5, 1
%22 = icmp eq i64 %21, 8
br i1 %22, label %23, label %4
23: ; preds = %4
ret void
}