#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)) {
    return (2);
  }
  SysCtlPeripheralReset(0xf0005800);
  SysCtlDelay(2);
  _EEPROMWaitForDone();
  ui32Status = (*((volatile uint32_t *)(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),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xc,%eax
cmp    $0x0,%eax
je     116e <EEPROMInit+0x3e>
movl   $0x2,-0x4(%rbp)
jmp    11b5 <EEPROMInit+0x85>
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     11ae <EEPROMInit+0x7e>
movl   $0x2,-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   %rbx
mov    $0x2,%ebx
mov    $0x2,%edi
call   1040 <SysCtlDelay@plt>
xor    %eax,%eax
call   1050 <_EEPROMWaitForDone@plt>
testl  $0xc,0x400af01c
jne    1181 <EEPROMInit+0x51>
mov    $0xf0005800,%edi
call   1030 <SysCtlPeripheralReset@plt>
mov    $0x2,%edi
call   1040 <SysCtlDelay@plt>
xor    %eax,%eax
call   1050 <_EEPROMWaitForDone@plt>
xor    %ebx,%ebx
testl  $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 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 %10
9: ; preds = %0
store i32 2, i32* %1
br label %20
10: ; preds = %0
%11 = call i32 @SysCtlPeripheralReset(i32 -268412928)
%12 = call i32 @SysCtlDelay(i32 2)
%13 = call i32 (...) @_EEPROMWaitForDone()
%14 = load volatile i32, i32* inttoptr (i64 1074458652 to i32*)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = and i32 %15, 12
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %10
store i32 2, i32* %1
br label %20
19: ; preds = %10
store i32 0, i32* %1
br label %20
20: ; preds = %19, %18, %9
%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 %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 i32, i32* inttoptr (i64 1074458652 to i32*)
%11 = and i32 %10, 12
%12 = icmp eq i32 %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
}