#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;

/* Variables and functions */
int /*<<< orphan*/ adcinit();
void BSP_Accelerometer_Init(void) {
  adcinit();
  (*((volatile uint32_t *)0x400FE608)) |= 0x00000008;
  while (((*((volatile uint32_t *)0x400FEA08)) & 0x08) == 0) {
  };
  (*((volatile uint32_t *)0x40007528)) |= 0x07;
  (*((volatile uint32_t *)0x40007400)) &= ~0x07;
  (*((volatile uint32_t *)0x40007420)) |= 0x07;
  (*((volatile uint32_t *)0x4000751C)) &= ~0x07;
  adcinit();
  (*((volatile uint32_t *)0x40038000)) &= ~0x0004;
  (*((volatile uint32_t *)0x40038014)) &= ~0x0F00;
  (*((volatile uint32_t *)0x40038080)) = 0x0567;
  (*((volatile uint32_t *)0x40038084)) = 0x0600;
  (*((volatile uint32_t *)0x40038008)) &= ~0x0004;
  (*((volatile uint32_t *)0x40038000)) |= 0x0004;
}


x86 assembly (clang, -O0):
<BSP_Accelerometer_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <adcinit@plt>
mov    $0x400fe608,%eax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    $0x400fe608,%eax
mov    %ecx,(%rax)
mov    $0x400fea08,%eax
mov    (%rax),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    1144 <BSP_Accelerometer_Init+0x34>
jmp    112c <BSP_Accelerometer_Init+0x1c>
mov    $0x40007528,%eax
mov    (%rax),%ecx
or     $0x7,%ecx
mov    $0x40007528,%eax
mov    %ecx,(%rax)
mov    $0x40007400,%eax
mov    (%rax),%ecx
and    $0xfffffff8,%ecx
mov    $0x40007400,%eax
mov    %ecx,(%rax)
mov    $0x40007420,%eax
mov    (%rax),%ecx
or     $0x7,%ecx
mov    $0x40007420,%eax
mov    %ecx,(%rax)
mov    $0x4000751c,%eax
mov    (%rax),%ecx
and    $0xfffffff8,%ecx
mov    $0x4000751c,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <adcinit@plt>
mov    $0x40038000,%eax
mov    (%rax),%ecx
and    $0xfffffffb,%ecx
mov    $0x40038000,%eax
mov    %ecx,(%rax)
mov    $0x40038014,%eax
mov    (%rax),%ecx
and    $0xfffff0ff,%ecx
mov    $0x40038014,%eax
mov    %ecx,(%rax)
mov    $0x40038080,%eax
movl   $0x567,(%rax)
mov    $0x40038084,%eax
movl   $0x600,(%rax)
mov    $0x40038008,%eax
mov    (%rax),%ecx
and    $0xfffffffb,%ecx
mov    $0x40038008,%eax
mov    %ecx,(%rax)
mov    $0x40038000,%eax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    $0x40038000,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_Accelerometer_Init>:
push   %rax
xor    %eax,%eax
call   1030 <adcinit@plt>
orl    $0x8,0x400fe608
08
testl  $0x8,0x400fea08
je     1120 <BSP_Accelerometer_Init+0x10>
orl    $0x7,0x40007528
07
andl   $0xfffffff8,0x40007400
f8
orl    $0x7,0x40007420
07
andl   $0xfffffff8,0x4000751c
f8
xor    %eax,%eax
call   1030 <adcinit@plt>
andl   $0xfffffffb,0x40038000
fb
andl   $0xfffff0ff,0x40038014
ff f0 ff ff
movl   $0x567,0x40038080
movl   $0x600,0x40038084
andl   $0xfffffffb,0x40038008
fb
orl    $0x4,0x40038000
04
pop    %rax
ret

LLVM IR (-O0):
define void @BSP_Accelerometer_Init() {
%1 = call i32 (...) @adcinit()
%2 = load volatile i32, i32* inttoptr (i64 1074783752 to i32*)
%3 = or i32 %2, 8
store volatile i32 %3, i32* inttoptr (i64 1074783752 to i32*)
br label %4
4: ; preds = %8, %0
%5 = load volatile i32, i32* inttoptr (i64 1074784776 to i32*)
%6 = and i32 %5, 8
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
%10 = load volatile i32, i32* inttoptr (i64 1073771816 to i32*)
%11 = or i32 %10, 7
store volatile i32 %11, i32* inttoptr (i64 1073771816 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 1073771520 to i32*)
%13 = and i32 %12, -8
store volatile i32 %13, i32* inttoptr (i64 1073771520 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 1073771552 to i32*)
%15 = or i32 %14, 7
store volatile i32 %15, i32* inttoptr (i64 1073771552 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 1073771804 to i32*)
%17 = and i32 %16, -8
store volatile i32 %17, i32* inttoptr (i64 1073771804 to i32*)
%18 = call i32 (...) @adcinit()
%19 = load volatile i32, i32* inttoptr (i64 1073971200 to i32*)
%20 = and i32 %19, -5
store volatile i32 %20, i32* inttoptr (i64 1073971200 to i32*)
%21 = load volatile i32, i32* inttoptr (i64 1073971220 to i32*)
%22 = and i32 %21, -3841
store volatile i32 %22, i32* inttoptr (i64 1073971220 to i32*)
store volatile i32 1383, i32* inttoptr (i64 1073971328 to i32*)
store volatile i32 1536, i32* inttoptr (i64 1073971332 to i32*)
%23 = load volatile i32, i32* inttoptr (i64 1073971208 to i32*)
%24 = and i32 %23, -5
store volatile i32 %24, i32* inttoptr (i64 1073971208 to i32*)
%25 = load volatile i32, i32* inttoptr (i64 1073971200 to i32*)
%26 = or i32 %25, 4
store volatile i32 %26, i32* inttoptr (i64 1073971200 to i32*)
ret void
}

LLVM IR (-O2):
define void @BSP_Accelerometer_Init() {
%1 = tail call i32 (...) @adcinit()
%2 = load volatile i32, i32* inttoptr (i64 1074783752 to i32*)
%3 = or i32 %2, 8
store volatile i32 %3, i32* inttoptr (i64 1074783752 to i32*)
br label %4
4: ; preds = %4, %0
%5 = load volatile i32, i32* inttoptr (i64 1074784776 to i32*)
%6 = and i32 %5, 8
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
%9 = load volatile i32, i32* inttoptr (i64 1073771816 to i32*)
%10 = or i32 %9, 7
store volatile i32 %10, i32* inttoptr (i64 1073771816 to i32*)
%11 = load volatile i32, i32* inttoptr (i64 1073771520 to i32*)
%12 = and i32 %11, -8
store volatile i32 %12, i32* inttoptr (i64 1073771520 to i32*)
%13 = load volatile i32, i32* inttoptr (i64 1073771552 to i32*)
%14 = or i32 %13, 7
store volatile i32 %14, i32* inttoptr (i64 1073771552 to i32*)
%15 = load volatile i32, i32* inttoptr (i64 1073771804 to i32*)
%16 = and i32 %15, -8
store volatile i32 %16, i32* inttoptr (i64 1073771804 to i32*)
%17 = tail call i32 (...) @adcinit()
%18 = load volatile i32, i32* inttoptr (i64 1073971200 to i32*)
%19 = and i32 %18, -5
store volatile i32 %19, i32* inttoptr (i64 1073971200 to i32*)
%20 = load volatile i32, i32* inttoptr (i64 1073971220 to i32*)
%21 = and i32 %20, -3841
store volatile i32 %21, i32* inttoptr (i64 1073971220 to i32*)
store volatile i32 1383, i32* inttoptr (i64 1073971328 to i32*)
store volatile i32 1536, i32* inttoptr (i64 1073971332 to i32*)
%22 = load volatile i32, i32* inttoptr (i64 1073971208 to i32*)
%23 = and i32 %22, -5
store volatile i32 %23, i32* inttoptr (i64 1073971208 to i32*)
%24 = load volatile i32, i32* inttoptr (i64 1073971200 to i32*)
%25 = or i32 %24, 4
store volatile i32 %25, i32* inttoptr (i64 1073971200 to i32*)
ret void
}