#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*/ SysCtlDelay(int);
int /*<<< orphan*/ SysCtlPeripheralReset(int);
int /*<<< orphan*/ _EEPROMWaitForDone();
uint32_t EEPROMInit(void) {
  uint32_t ui32Status;
  SysCtlDelay(2);
  _EEPROMWaitForDone();
  ui32Status = (*((volatile uint32_t *)(0x400AF01C)));
  if (ui32Status & (0x00000008 | 0x00000004)) {
    SysCtlPeripheralReset(0xf0005800);
    SysCtlDelay(2);
    _EEPROMWaitForDone();
    ui32Status = (*((volatile uint32_t *)(0x400AF01C)));
    if (ui32Status & (0x00000008 | 0x00000004)) {
      return (2);
    } else {
      return (1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<EEPROMInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2,%edi
call   1040 <SysCtlDelay@plt>
mov    $0x0,%al
call   1050 <_EEPROMWaitForDone@plt>
mov    $0x400af01c,%eax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xc,%eax
cmp    $0x0,%eax
je     11ae <EEPROMInit+0x7e>
mov    $0xf0005800,%edi
call   1030 <SysCtlPeripheralReset@plt>
mov    $0x2,%edi
call   1040 <SysCtlDelay@plt>
mov    $0x0,%al
call   1050 <_EEPROMWaitForDone@plt>
mov    $0x400af01c,%eax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xc,%eax
cmp    $0x0,%eax
je     11a2 <EEPROMInit+0x72>
movl   $0x2,-0x4(%rbp)
jmp    11b5 <EEPROMInit+0x85>
movl   $0x1,-0x4(%rbp)
jmp    11b5 <EEPROMInit+0x85>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMInit>:
push   %rbp
push   %rbx
push   %rax
mov    $0x2,%ebp
mov    $0x2,%edi
call   1040 <SysCtlDelay@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <_EEPROMWaitForDone@plt>
testl  $0xc,0x400af01c
je     1185 <EEPROMInit+0x55>
mov    $0xf0005800,%edi
call   1030 <SysCtlPeripheralReset@plt>
mov    $0x2,%edi
call   1040 <SysCtlDelay@plt>
xor    %eax,%eax
call   1050 <_EEPROMWaitForDone@plt>
mov    0x400af01c,%eax
and    $0xc,%eax
cmp    $0x1,%eax
sbb    $0x0,%ebp
mov    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @EEPROMInit() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @SysCtlDelay(i32 2)
%4 = call i32 (...) @_EEPROMWaitForDone()
%5 = load volatile i32, i32* inttoptr (i64 1074458652 to i32*)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = and i32 %6, 12
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %0
%10 = call i32 @SysCtlPeripheralReset(i32 -268412928)
%11 = call i32 @SysCtlDelay(i32 2)
%12 = call i32 (...) @_EEPROMWaitForDone()
%13 = load volatile i32, i32* inttoptr (i64 1074458652 to i32*)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = and i32 %14, 12
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %9
store i32 2, i32* %1
br label %20
18: ; preds = %9
store i32 1, i32* %1
br label %20
19: ; preds = %0
store i32 0, i32* %1
br label %20
20: ; preds = %19, %18, %17
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @EEPROMInit() {
%1 = tail call i32 @SysCtlDelay(i32 2)
%2 = tail call i32 (...) @_EEPROMWaitForDone()
%3 = load volatile i32, i32* inttoptr (i64 1074458652 to i32*)
%4 = and i32 %3, 12
%5 = icmp eq i32 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %0
%7 = tail call i32 @SysCtlPeripheralReset(i32 -268412928)
%8 = tail call i32 @SysCtlDelay(i32 2)
%9 = tail call i32 (...) @_EEPROMWaitForDone()
%10 = load volatile i32, i32* inttoptr (i64 1074458652 to i32*)
%11 = and i32 %10, 12
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 1, i32 2
br label %14
14: ; preds = %0, %6
%15 = phi i32 [ %13, %6 ], [ 0, %0 ]
ret i32 %15
}