#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*/ ASSERT(int);
int /*<<< orphan*/ _EEPROMSectorMaskSet(int);
uint32_t EEPROMProgramNonBlocking(uint32_t ui32Data, uint32_t ui32Address) {
  ASSERT(ui32Address <
         (((((*((volatile uint32_t *)(0x400AF000)))) & 0x0000FFFF) >> 0) * 4));
  ASSERT((ui32Address & 3) == 0);
  if ((((*((volatile uint32_t *)(0x400FE000))) & (0x70000000 | 0x00FF0000)) ==
       (0x10000000 | 0x00050000)) &&
      (((*((volatile uint32_t *)(0x400FE000))) & (0x0000FF00 | 0x000000FF)) ==
       (0x00000000 | 0x00000000))) {
    _EEPROMSectorMaskSet(ui32Address);
  }
  (*((volatile uint32_t *)(0x400AF004))) = ((ui32Address) >> 6);
  (*((volatile uint32_t *)(0x400AF008))) = (((ui32Address) >> 2) & 0x0F);
  (*((volatile uint32_t *)(0x400AF014))) = ui32Data;
  return ((*((volatile uint32_t *)(0x400AF018))));
}


x86 assembly (clang, -O0):
<EEPROMProgramNonBlocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x400af000,%ecx
mov    (%rcx),%ecx
and    $0xffff,%ecx
sar    $0x0,%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x8(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x10050000,%eax
jne    119d <EEPROMProgramNonBlocking+0x7d>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0xffff,%eax
cmp    $0x0,%eax
jne    119d <EEPROMProgramNonBlocking+0x7d>
mov    -0x8(%rbp),%edi
call   1030 <_EEPROMSectorMaskSet@plt>
mov    -0x8(%rbp),%ecx
sar    $0x6,%ecx
mov    $0x400af004,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
sar    $0x2,%ecx
and    $0xf,%ecx
mov    $0x400af008,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
mov    $0x400af014,%eax
mov    %ecx,(%rax)
mov    $0x400af018,%eax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMProgramNonBlocking>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    0x400af000,%eax
movzwl %ax,%eax
shl    $0x2,%eax
xor    %edi,%edi
cmp    %esi,%eax
setg   %dil
call   1040 <ASSERT@plt>
xor    %edi,%edi
test   $0x3,%bpl
sete   %dil
call   1040 <ASSERT@plt>
mov    $0x70ff0000,%eax
and    0x400fe000,%eax
cmp    $0x10050000,%eax
jne    1176 <EEPROMProgramNonBlocking+0x56>
mov    0x400fe000,%eax
test   %ax,%ax
jne    1176 <EEPROMProgramNonBlocking+0x56>
mov    %ebp,%edi
call   1030 <_EEPROMSectorMaskSet@plt>
mov    %ebp,%eax
sar    $0x6,%eax
mov    %eax,0x400af004
shr    $0x2,%ebp
and    $0xf,%ebp
mov    %ebp,0x400af008
mov    %ebx,0x400af014
mov    0x400af018,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @EEPROMProgramNonBlocking(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load volatile i32, i32* inttoptr (i64 1074458624 to i32*)
%7 = and i32 %6, 65535
%8 = ashr i32 %7, 0
%9 = mul nsw i32 %8, 4
%10 = icmp slt i32 %5, %9
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %4
%14 = and i32 %13, 3
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @ASSERT(i32 %16)
%18 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%19 = and i32 %18, 1895759872
%20 = icmp eq i32 %19, 268763136
br i1 %20, label %21, label %28
21: ; preds = %2
%22 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%23 = and i32 %22, 65535
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %4
%27 = call i32 @_EEPROMSectorMaskSet(i32 %26)
br label %28
28: ; preds = %25, %21, %2
%29 = load i32, i32* %4
%30 = ashr i32 %29, 6
store volatile i32 %30, i32* inttoptr (i64 1074458628 to i32*)
%31 = load i32, i32* %4
%32 = ashr i32 %31, 2
%33 = and i32 %32, 15
store volatile i32 %33, i32* inttoptr (i64 1074458632 to i32*)
%34 = load i32, i32* %3
store volatile i32 %34, i32* inttoptr (i64 1074458644 to i32*)
%35 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
ret i32 %35
}

LLVM IR (-O2):
define i32 @EEPROMProgramNonBlocking(i32 %0, i32 %1) {
%3 = load volatile i32, i32* inttoptr (i64 1074458624 to i32*)
%4 = shl i32 %3, 2
%5 = and i32 %4, 262140
%6 = icmp sgt i32 %5, %1
%7 = zext i1 %6 to i32
%8 = tail call i32 @ASSERT(i32 %7)
%9 = and i32 %1, 3
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @ASSERT(i32 %11)
%13 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%14 = and i32 %13, 1895759872
%15 = icmp eq i32 %14, 268763136
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%18 = and i32 %17, 65535
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 @_EEPROMSectorMaskSet(i32 %1)
br label %22
22: ; preds = %20, %16, %2
%23 = ashr i32 %1, 6
store volatile i32 %23, i32* inttoptr (i64 1074458628 to i32*)
%24 = lshr i32 %1, 2
%25 = and i32 %24, 15
store volatile i32 %25, i32* inttoptr (i64 1074458632 to i32*)
store volatile i32 %0, i32* inttoptr (i64 1074458644 to i32*)
%26 = load volatile i32, i32* inttoptr (i64 1074458648 to i32*)
ret i32 %26
}