#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 */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
void BSP_Accelerometer_Input(uint16_t *x, uint16_t *y, uint16_t *z) {
  (*((volatile uint32_t *)0x40038028)) = 0x0004;
  while (((*((volatile uint32_t *)0x40038004)) & 0x04) == 0) {
  };
  *x = (*((volatile uint32_t *)0x40038088)) >> 2;
  *y = (*((volatile uint32_t *)0x40038088)) >> 2;
  *z = (*((volatile uint32_t *)0x40038088)) >> 2;
  (*((volatile uint32_t *)0x4003800C)) = 0x0004;
}


x86 assembly (clang, -O0):
<BSP_Accelerometer_Input>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x40038028,%eax
movl   $0x4,(%rax)
mov    $0x40038004,%eax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1133 <BSP_Accelerometer_Input+0x33>
jmp    111b <BSP_Accelerometer_Input+0x1b>
mov    $0x40038088,%eax
mov    (%rax),%ecx
sar    $0x2,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x40038088,%eax
mov    (%rax),%ecx
sar    $0x2,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x40038088,%eax
mov    (%rax),%ecx
sar    $0x2,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x4003800c,%eax
movl   $0x4,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_Accelerometer_Input>:
movl   $0x4,0x40038028
nopl   0x0(%rax,%rax,1)
testl  $0x4,0x40038004
je     1110 <BSP_Accelerometer_Input+0x10>
mov    0x40038088,%eax
sar    $0x2,%eax
mov    %eax,(%rdi)
mov    0x40038088,%eax
sar    $0x2,%eax
mov    %eax,(%rsi)
mov    0x40038088,%eax
sar    $0x2,%eax
mov    %eax,(%rdx)
movl   $0x4,0x4003800c
ret

LLVM IR (-O0):
define void @BSP_Accelerometer_Input(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store volatile i32 4, i32* inttoptr (i64 1073971240 to i32*)
br label %7
7: ; preds = %11, %3
%8 = load volatile i32, i32* inttoptr (i64 1073971204 to i32*)
%9 = and i32 %8, 4
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %7
12: ; preds = %7
%13 = load volatile i32, i32* inttoptr (i64 1073971336 to i32*)
%14 = ashr i32 %13, 2
%15 = load i32*, i32** %4
store i32 %14, i32* %15
%16 = load volatile i32, i32* inttoptr (i64 1073971336 to i32*)
%17 = ashr i32 %16, 2
%18 = load i32*, i32** %5
store i32 %17, i32* %18
%19 = load volatile i32, i32* inttoptr (i64 1073971336 to i32*)
%20 = ashr i32 %19, 2
%21 = load i32*, i32** %6
store i32 %20, i32* %21
store volatile i32 4, i32* inttoptr (i64 1073971212 to i32*)
ret void
}

LLVM IR (-O2):
define void @BSP_Accelerometer_Input(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store volatile i32 4, i32* inttoptr (i64 1073971240 to i32*)
br label %4
4: ; preds = %4, %3
%5 = load volatile i32, i32* inttoptr (i64 1073971204 to i32*)
%6 = and i32 %5, 4
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
%9 = load volatile i32, i32* inttoptr (i64 1073971336 to i32*)
%10 = ashr i32 %9, 2
store i32 %10, i32* %0
%11 = load volatile i32, i32* inttoptr (i64 1073971336 to i32*)
%12 = ashr i32 %11, 2
store i32 %12, i32* %1
%13 = load volatile i32, i32* inttoptr (i64 1073971336 to i32*)
%14 = ashr i32 %13, 2
store i32 %14, i32* %2
store volatile i32 4, i32* inttoptr (i64 1073971212 to i32*)
ret void
}