#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 unsigned long *)(0x400AF01C)));
  if (ui32Status & (0x00000008 | 0x00000004)) {
    return (2);
  }
  SysCtlPeripheralReset(0xf0005800);
  SysCtlDelay(2);
  _EEPROMWaitForDone();
  ui32Status = (*((volatile unsigned long *)(0x400AF01C)));
  if (ui32Status & (0x00000008 | 0x00000004)) {
    return (2);
  }
  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),%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xc,%eax
cmp    $0x0,%eax
je     116f <EEPROMInit+0x3f>
movl   $0x2,-0x4(%rbp)
jmp    11b7 <EEPROMInit+0x87>
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),%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xc,%eax
cmp    $0x0,%eax
je     11b0 <EEPROMInit+0x80>
movl   $0x2,-0x4(%rbp)
jmp    11b7 <EEPROMInit+0x87>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMInit>:
push   %rbx
mov    $0x2,%ebx
mov    $0x2,%edi
call   1040 <SysCtlDelay@plt>
xor    %eax,%eax
call   1050 <_EEPROMWaitForDone@plt>
testq  $0xc,0x400af01c
jne    1183 <EEPROMInit+0x53>
mov    $0xf0005800,%edi
call   1030 <SysCtlPeripheralReset@plt>
mov    $0x2,%edi
call   1040 <SysCtlDelay@plt>
xor    %eax,%eax
call   1050 <_EEPROMWaitForDone@plt>
xor    %ebx,%ebx
testq  $0xc,0x400af01c
setne  %bl
add    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
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 i64, i64* inttoptr (i64 1074458652 to i64*)
%6 = trunc i64 %5 to i32
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = and i32 %7, 12
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 2, i32* %1
br label %22
11: ; preds = %0
%12 = call i32 @SysCtlPeripheralReset(i32 -268412928)
%13 = call i32 @SysCtlDelay(i32 2)
%14 = call i32 (...) @_EEPROMWaitForDone()
%15 = load volatile i64, i64* inttoptr (i64 1074458652 to i64*)
%16 = trunc i64 %15 to i32
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = and i32 %17, 12
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %11
store i32 2, i32* %1
br label %22
21: ; preds = %11
store i32 0, i32* %1
br label %22
22: ; preds = %21, %20, %10
%23 = load i32, i32* %1
ret i32 %23
}

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