#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*/ _EEPROMSectorMaskClear();
int /*<<< orphan*/ _EEPROMSectorMaskSet(int);
uint32_t EEPROMProgram(uint32_t *pui32Data, uint32_t ui32Address,
                       uint32_t ui32Count) {
  uint32_t ui32Status;
  ;
  ;

  ;
  ;
  ;
  do {
    ui32Status = (*((volatile uint32_t *)(0x400AF018)));
  } while (ui32Status & 0x00000001);
  (*((volatile uint32_t *)(0x400AF004))) = ((ui32Address) >> 6);
  (*((volatile uint32_t *)(0x400AF008))) = (((ui32Address) >> 2) & 0x0F);
  ui32Count /= 4;
  while (ui32Count) {
    if ((((*((volatile uint32_t *)(0x400FE000))) & (0x70000000 | 0x00FF0000)) ==
         (0x10000000 | 0x00050000)) &&
        (((*((volatile uint32_t *)(0x400FE000))) & (0x0000FF00 | 0x000000FF)) ==
         (0x00000000 | 0x00000000))) {
      _EEPROMSectorMaskSet(ui32Address);
    }
    (*((volatile uint32_t *)(0x400AF014))) = *pui32Data;
    SysCtlDelay(10);
    do {
      ui32Status = (*((volatile uint32_t *)(0x400AF018)));
    } while (ui32Status & 0x00000001);
    if (ui32Status & 0x00000010) {
      if ((((*((volatile uint32_t *)(0x400FE000))) &
            (0x70000000 | 0x00FF0000)) == (0x10000000 | 0x00050000)) &&
          (((*((volatile uint32_t *)(0x400FE000))) &
            (0x0000FF00 | 0x000000FF)) == (0x00000000 | 0x00000000))) {
        _EEPROMSectorMaskClear();
      }
      return (ui32Status);
    }
    pui32Data++;
    ui32Count--;
    if (ui32Count && ((*((volatile uint32_t *)(0x400AF008))) == 0)) {
      (*((volatile uint32_t *)(0x400AF004))) += 1;
    }
  }
  if ((((*((volatile uint32_t *)(0x400FE000))) & (0x70000000 | 0x00FF0000)) ==
       (0x10000000 | 0x00050000)) &&
      (((*((volatile uint32_t *)(0x400FE000))) & (0x0000FF00 | 0x000000FF)) ==
       (0x00000000 | 0x00000000))) {
    _EEPROMSectorMaskClear();
  }
  return ((*((volatile uint32_t *)(0x400AF018))));
}


x86 assembly (clang, -O0):
<EEPROMProgram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    $0x400af018,%eax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1142 <EEPROMProgram+0x12>
mov    -0x14(%rbp),%ecx
sar    $0x6,%ecx
mov    $0x400af004,%eax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x2,%ecx
and    $0xf,%ecx
mov    $0x400af008,%eax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1286 <EEPROMProgram+0x156>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x10050000,%eax
jne    11c4 <EEPROMProgram+0x94>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0xffff,%eax
cmp    $0x0,%eax
jne    11c4 <EEPROMProgram+0x94>
mov    -0x14(%rbp),%edi
call   1050 <_EEPROMSectorMaskSet@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    $0x400af014,%eax
mov    %ecx,(%rax)
mov    $0xa,%edi
call   1040 <SysCtlDelay@plt>
mov    $0x400af018,%eax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    11db <EEPROMProgram+0xab>
mov    -0x1c(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1241 <EEPROMProgram+0x111>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x10050000,%eax
jne    1236 <EEPROMProgram+0x106>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0xffff,%eax
cmp    $0x0,%eax
jne    1236 <EEPROMProgram+0x106>
mov    $0x0,%al
call   1030 <_EEPROMSectorMaskClear@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12c3 <EEPROMProgram+0x193>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1281 <EEPROMProgram+0x151>
mov    $0x400af008,%eax
mov    (%rax),%eax
cmp    $0x0,%eax
jne    1281 <EEPROMProgram+0x151>
mov    $0x400af004,%eax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    $0x400af004,%eax
mov    %ecx,(%rax)
jmp    1186 <EEPROMProgram+0x56>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x10050000,%eax
jne    12b9 <EEPROMProgram+0x189>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0xffff,%eax
cmp    $0x0,%eax
jne    12b9 <EEPROMProgram+0x189>
mov    $0x0,%al
call   1030 <_EEPROMSectorMaskClear@plt>
mov    $0x400af018,%eax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMProgram>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
xchg   %ax,%ax
mov    0x400af018,%eax
test   $0x1,%al
jne    1140 <EEPROMProgram+0x10>
mov    %r14d,%eax
sar    $0x6,%eax
mov    %eax,0x400af004
mov    %r14d,%eax
shr    $0x2,%eax
and    $0xf,%eax
mov    %eax,0x400af008
lea    0x3(%rdx),%ebx
cmp    $0x7,%ebx
jae    11a8 <EEPROMProgram+0x78>
mov    $0x70ff0000,%eax
and    0x400fe000,%eax
cmp    $0x10050000,%eax
jne    1196 <EEPROMProgram+0x66>
mov    0x400fe000,%eax
test   %ax,%ax
jne    1196 <EEPROMProgram+0x66>
xor    %eax,%eax
call   1030 <_EEPROMSectorMaskClear@plt>
mov    0x400af018,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
test   %edx,%edx
cmovns %edx,%ebx
sar    $0x2,%ebx
mov    $0x70ff0000,%r12d
cs nopw 0x0(%rax,%rax,1)
mov    0x400fe000,%eax
and    %r12d,%eax
cmp    $0x10050000,%eax
jne    11f0 <EEPROMProgram+0xc0>
mov    0x400fe000,%eax
test   %ax,%ax
jne    11f0 <EEPROMProgram+0xc0>
mov    %r14d,%edi
call   1050 <_EEPROMSectorMaskSet@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%eax
mov    %eax,0x400af014
mov    $0xa,%edi
call   1040 <SysCtlDelay@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x400af018,%ebp
test   $0x1,%bpl
jne    1210 <EEPROMProgram+0xe0>
test   $0x10,%bpl
jne    1247 <EEPROMProgram+0x117>
add    $0xffffffff,%ebx
je     1170 <EEPROMProgram+0x40>
add    $0x4,%r15
cmpl   $0x0,0x400af008
jne    11c0 <EEPROMProgram+0x90>
addl   $0x1,0x400af004
01
jmp    11c0 <EEPROMProgram+0x90>
mov    $0x70ff0000,%eax
and    0x400fe000,%eax
cmp    $0x10050000,%eax
jne    119d <EEPROMProgram+0x6d>
mov    0x400fe000,%eax
test   %ax,%ax
jne    119d <EEPROMProgram+0x6d>
xor    %eax,%eax
call   1030 <_EEPROMSectorMaskClear@plt>
jmp    119d <EEPROMProgram+0x6d>

LLVM IR (-O0):
define i32 @EEPROMProgram(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
br label %9
9: ; preds = %11, %3
%10 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
store i32 %10, i32* %8
br label %11
11: ; preds = %9
%12 = load i32, i32* %8
%13 = and i32 %12, 1
%14 = icmp ne i32 %13, 0
br i1 %14, label %9, label %15
15: ; preds = %11
%16 = load i32, i32* %6
%17 = ashr i32 %16, 6
store volatile i32 %17, i32* inttoptr (i64 1074458628 to i32*)
%18 = load i32, i32* %6
%19 = ashr i32 %18, 2
%20 = and i32 %19, 15
store volatile i32 %20, i32* inttoptr (i64 1074458632 to i32*)
%21 = load i32, i32* %7
%22 = sdiv i32 %21, 4
store i32 %22, i32* %7
br label %23
23: ; preds = %76, %15
%24 = load i32, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %77
26: ; preds = %23
%27 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%28 = and i32 %27, 1895759872
%29 = icmp eq i32 %28, 268763136
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%32 = and i32 %31, 65535
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %6
%36 = call i32 @_EEPROMSectorMaskSet(i32 %35)
br label %37
37: ; preds = %34, %30, %26
%38 = load i32*, i32** %5
%39 = load i32, i32* %38
store volatile i32 %39, i32* inttoptr (i64 1074458644 to i32*)
%40 = call i32 @SysCtlDelay(i32 10)
br label %41
41: ; preds = %43, %37
%42 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
store i32 %42, i32* %8
br label %43
43: ; preds = %41
%44 = load i32, i32* %8
%45 = and i32 %44, 1
%46 = icmp ne i32 %45, 0
br i1 %46, label %41, label %47
47: ; preds = %43
%48 = load i32, i32* %8
%49 = and i32 %48, 16
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %63
51: ; preds = %47
%52 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%53 = and i32 %52, 1895759872
%54 = icmp eq i32 %53, 268763136
br i1 %54, label %55, label %61
55: ; preds = %51
%56 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%57 = and i32 %56, 65535
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %55
%60 = call i32 (...) @_EEPROMSectorMaskClear()
br label %61
61: ; preds = %59, %55, %51
%62 = load i32, i32* %8
store i32 %62, i32* %4
br label %89
63: ; preds = %47
%64 = load i32*, i32** %5
%65 = getelementptr inbounds i32, i32* %64, i32 1
store i32* %65, i32** %5
%66 = load i32, i32* %7
%67 = add nsw i32 %66, -1
store i32 %67, i32* %7
%68 = load i32, i32* %7
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %76
70: ; preds = %63
%71 = load volatile i32, i32* inttoptr (i64 1074458632 to i32*)
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = load volatile i32, i32* inttoptr (i64 1074458628 to i32*)
%75 = add nsw i32 %74, 1
store volatile i32 %75, i32* inttoptr (i64 1074458628 to i32*)
br label %76
76: ; preds = %73, %70, %63
br label %23
77: ; preds = %23
%78 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%79 = and i32 %78, 1895759872
%80 = icmp eq i32 %79, 268763136
br i1 %80, label %81, label %87
81: ; preds = %77
%82 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%83 = and i32 %82, 65535
%84 = icmp eq i32 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %81
%86 = call i32 (...) @_EEPROMSectorMaskClear()
br label %87
87: ; preds = %85, %81, %77
%88 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
store i32 %88, i32* %4
br label %89
89: ; preds = %87, %61
%90 = load i32, i32* %4
ret i32 %90
}

LLVM IR (-O2):
define i32 @EEPROMProgram(i32* nocapture %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %4
8: ; preds = %4
%9 = ashr i32 %1, 6
store volatile i32 %9, i32* inttoptr (i64 1074458628 to i32*)
%10 = lshr i32 %1, 2
%11 = and i32 %10, 15
store volatile i32 %11, i32* inttoptr (i64 1074458632 to i32*)
%12 = add i32 %2, 3
%13 = icmp ult i32 %12, 7
br i1 %13, label %59, label %14
14: ; preds = %8
%15 = sdiv i32 %2, 4
br label %16
16: ; preds = %58, %14
%17 = phi i32 [ %15, %14 ], [ %50, %58 ]
%18 = phi i32* [ %0, %14 ], [ %49, %58 ]
%19 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%20 = and i32 %19, 1895759872
%21 = icmp eq i32 %20, 268763136
br i1 %21, label %22, label %28
22: ; preds = %16
%23 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%24 = and i32 %23, 65535
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = tail call i32 @_EEPROMSectorMaskSet(i32 %1)
br label %28
28: ; preds = %26, %22, %16
%29 = load i32, i32* %18
store volatile i32 %29, i32* inttoptr (i64 1074458644 to i32*)
%30 = tail call i32 @SysCtlDelay(i32 10)
br label %31
31: ; preds = %31, %28
%32 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
%33 = and i32 %32, 1
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %31
35: ; preds = %31
%36 = and i32 %32, 16
%37 = icmp eq i32 %36, 0
br i1 %37, label %48, label %38
38: ; preds = %35
%39 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%40 = and i32 %39, 1895759872
%41 = icmp eq i32 %40, 268763136
br i1 %41, label %42, label %71
42: ; preds = %38
%43 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%44 = and i32 %43, 65535
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %71
46: ; preds = %42
%47 = tail call i32 (...) @_EEPROMSectorMaskClear()
br label %71
48: ; preds = %35
%49 = getelementptr inbounds i32, i32* %18, i64 1
%50 = add nsw i32 %17, -1
%51 = icmp eq i32 %50, 0
br i1 %51, label %59, label %52
52: ; preds = %48
%53 = load volatile i32, i32* inttoptr (i64 1074458632 to i32*)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load volatile i32, i32* inttoptr (i64 1074458628 to i32*)
%57 = add nsw i32 %56, 1
store volatile i32 %57, i32* inttoptr (i64 1074458628 to i32*)
br label %58
58: ; preds = %55, %52
br label %16
59: ; preds = %48, %8
%60 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%61 = and i32 %60, 1895759872
%62 = icmp eq i32 %61, 268763136
br i1 %62, label %63, label %69
63: ; preds = %59
%64 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%65 = and i32 %64, 65535
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = tail call i32 (...) @_EEPROMSectorMaskClear()
br label %69
69: ; preds = %67, %63, %59
%70 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
br label %71
71: ; preds = %38, %42, %46, %69
%72 = phi i32 [ %70, %69 ], [ %32, %46 ], [ %32, %42 ], [ %32, %38 ]
ret i32 %72
}