#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*/ _EEPROMSectorMaskClear();
int /*<<< orphan*/ _EEPROMWaitForDone();
uint32_t EEPROMMassErase(void) {
  if ((((*((volatile uint32_t *)(0x400FE000))) & (0x70000000 | 0x00FF0000)) ==
       (0x10000000 | 0x00050000)) &&
      (((*((volatile uint32_t *)(0x400FE000))) & (0x0000FF00 | 0x000000FF)) ==
       (0x00000000 | 0x00000000))) {
    _EEPROMSectorMaskClear();
  }
  (*((volatile uint32_t *)(0x400AF080))) =
      ((uint32_t)0xE37B << 16) | 0x00000001;
  _EEPROMWaitForDone();
  SysCtlPeripheralReset(0xf0005800);
  SysCtlDelay(2);
  _EEPROMWaitForDone();
  return ((*((volatile uint32_t *)(0x400AF018))));
}


x86 assembly (clang, -O0):
<EEPROMMassErase>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x10050000,%eax
jne    1177 <EEPROMMassErase+0x37>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0xffff,%eax
cmp    $0x0,%eax
jne    1177 <EEPROMMassErase+0x37>
mov    $0x0,%al
call   1040 <_EEPROMSectorMaskClear@plt>
mov    $0x400af080,%eax
movl   $0xe37b0001,(%rax)
mov    $0x0,%al
call   1060 <_EEPROMWaitForDone@plt>
mov    $0xf0005800,%edi
call   1030 <SysCtlPeripheralReset@plt>
mov    $0x2,%edi
call   1050 <SysCtlDelay@plt>
mov    $0x0,%al
call   1060 <_EEPROMWaitForDone@plt>
mov    $0x400af018,%eax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMMassErase>:
push   %rax
mov    $0x70ff0000,%eax
and    0x400fe000,%eax
cmp    $0x10050000,%eax
jne    1167 <EEPROMMassErase+0x27>
mov    0x400fe000,%eax
test   %ax,%ax
jne    1167 <EEPROMMassErase+0x27>
xor    %eax,%eax
call   1040 <_EEPROMSectorMaskClear@plt>
movl   $0xe37b0001,0x400af080
xor    %eax,%eax
call   1060 <_EEPROMWaitForDone@plt>
mov    $0xf0005800,%edi
call   1030 <SysCtlPeripheralReset@plt>
mov    $0x2,%edi
call   1050 <SysCtlDelay@plt>
xor    %eax,%eax
call   1060 <_EEPROMWaitForDone@plt>
mov    0x400af018,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @EEPROMMassErase() {
%1 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%2 = and i32 %1, 1895759872
%3 = icmp eq i32 %2, 268763136
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%6 = and i32 %5, 65535
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 (...) @_EEPROMSectorMaskClear()
br label %10
10: ; preds = %8, %4, %0
store volatile i32 -478478335, i32* inttoptr (i64 1074458752 to i32*)
%11 = call i32 (...) @_EEPROMWaitForDone()
%12 = call i32 @SysCtlPeripheralReset(i32 -268412928)
%13 = call i32 @SysCtlDelay(i32 2)
%14 = call i32 (...) @_EEPROMWaitForDone()
%15 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
ret i32 %15
}

LLVM IR (-O2):
define i32 @EEPROMMassErase() {
%1 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%2 = and i32 %1, 1895759872
%3 = icmp eq i32 %2, 268763136
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%6 = and i32 %5, 65535
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 (...) @_EEPROMSectorMaskClear()
br label %10
10: ; preds = %8, %4, %0
store volatile i32 -478478335, i32* inttoptr (i64 1074458752 to i32*)
%11 = tail call i32 (...) @_EEPROMWaitForDone()
%12 = tail call i32 @SysCtlPeripheralReset(i32 -268412928)
%13 = tail call i32 @SysCtlDelay(i32 2)
%14 = tail call i32 (...) @_EEPROMWaitForDone()
%15 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
ret i32 %15
}