#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 */

/* Variables and functions */
int /*<<< orphan*/ EEPROMSetSectorMask(unsigned long);
unsigned long EEPROMProgramNonBlocking(unsigned long ulData,
                                       unsigned long ulAddress) {
  ;
  ;
  if ((((*((volatile unsigned long *)(0x400FE000))) &
        (0x70000000 | 0x00FF0000)) == (0x10000000 | 0x00050000)) &&
      (((*((volatile unsigned long *)(0x400FE000))) &
        (0x0000FF00 | 0x000000FF)) == (0x00000000 | 0x00000000))) {
    EEPROMSetSectorMask(ulAddress);
  }
  (*((volatile unsigned long *)(0x400AF004))) = ((ulAddress) >> 6);
  (*((volatile unsigned long *)(0x400AF008))) = (((ulAddress) >> 2) & 0x0F);
  (*((volatile unsigned long *)(0x400AF014))) = ulData;
  return ((*((volatile unsigned long *)(0x400AF018))));
}


x86 assembly (clang, -O0):
<EEPROMProgramNonBlocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x400fe000,%eax
mov    (%rax),%rax
and    $0x70ff0000,%rax
cmp    $0x10050000,%rax
jne    115b <EEPROMProgramNonBlocking+0x4b>
mov    $0x400fe000,%eax
mov    (%rax),%rax
and    $0xffff,%rax
cmp    $0x0,%rax
jne    115b <EEPROMProgramNonBlocking+0x4b>
mov    -0x10(%rbp),%rdi
call   1030 <EEPROMSetSectorMask@plt>
mov    -0x10(%rbp),%rcx
shr    $0x6,%rcx
mov    $0x400af004,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x2,%rcx
and    $0xf,%rcx
mov    $0x400af008,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rcx
mov    $0x400af014,%eax
mov    %rcx,(%rax)
mov    $0x400af018,%eax
mov    (%rax),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMProgramNonBlocking>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x400fe000,%rax
40
and    $0x70ff0000,%eax
cmp    $0x10050000,%eax
jne    1143 <EEPROMProgramNonBlocking+0x33>
mov    0x400fe000,%rax
40
test   %ax,%ax
jne    1143 <EEPROMProgramNonBlocking+0x33>
mov    %rbx,%rdi
call   1030 <EEPROMSetSectorMask@plt>
mov    %rbx,%rax
shr    $0x6,%rax
mov    %rax,0x400af004
40
shr    $0x2,%ebx
and    $0xf,%ebx
mov    %rbx,0x400af008
40
mov    %r14,0x400af014
40
mov    0x400af018,%rax
40
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @EEPROMProgramNonBlocking(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load volatile i64, i64* inttoptr (i64 1074782208 to i64*)
%6 = and i64 %5, 1895759872
%7 = icmp eq i64 %6, 268763136
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load volatile i64, i64* inttoptr (i64 1074782208 to i64*)
%10 = and i64 %9, 65535
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i64, i64* %4
%14 = call i32 @EEPROMSetSectorMask(i64 %13)
br label %15
15: ; preds = %12, %8, %2
%16 = load i64, i64* %4
%17 = lshr i64 %16, 6
store volatile i64 %17, i64* inttoptr (i64 1074458628 to i64*)
%18 = load i64, i64* %4
%19 = lshr i64 %18, 2
%20 = and i64 %19, 15
store volatile i64 %20, i64* inttoptr (i64 1074458632 to i64*)
%21 = load i64, i64* %3
store volatile i64 %21, i64* inttoptr (i64 1074458644 to i64*)
%22 = load volatile i64, i64* inttoptr (i64 1074458648 to i64*)
ret i64 %22
}

LLVM IR (-O2):
define i64 @EEPROMProgramNonBlocking(i64 %0, i64 %1) {
%3 = load volatile i64, i64* inttoptr (i64 1074782208 to i64*)
%4 = and i64 %3, 1895759872
%5 = icmp eq i64 %4, 268763136
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = load volatile i64, i64* inttoptr (i64 1074782208 to i64*)
%8 = and i64 %7, 65535
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @EEPROMSetSectorMask(i64 %1)
br label %12
12: ; preds = %10, %6, %2
%13 = lshr i64 %1, 6
store volatile i64 %13, i64* inttoptr (i64 1074458628 to i64*)
%14 = lshr i64 %1, 2
%15 = and i64 %14, 15
store volatile i64 %15, i64* inttoptr (i64 1074458632 to i64*)
store volatile i64 %0, i64* inttoptr (i64 1074458644 to i64*)
%16 = load volatile i64, i64* inttoptr (i64 1074458648 to i64*)
ret i64 %16
}