#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 /*<<< orphan*/ uint64_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ AESDataRead(int, int *);
int /*<<< orphan*/ AESDataWrite(int, int *);
int /*<<< orphan*/ AESLengthSet(int, int /*<<< orphan*/);
int /*<<< orphan*/ ASSERT(int);
bool AESDataProcess(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest,
                    uint32_t ui32Length) {
  uint32_t ui32Count;
  ASSERT(ui32Base == 0x44036000);
  AESLengthSet(0x44036000, (uint64_t)ui32Length);
  for (ui32Count = 0; ui32Count < ui32Length; ui32Count += 16) {
    AESDataWrite(ui32Base, pui32Src + (ui32Count / 4));
    AESDataRead(ui32Base, pui32Dest + (ui32Count / 4));
  }
  return (true);
}


x86 assembly (clang, -O0):
<AESDataProcess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x44036000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <ASSERT@plt>
mov    -0x1c(%rbp),%esi
mov    $0x44036000,%edi
call   1040 <AESLengthSet@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d8 <AESDataProcess+0x98>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   1050 <AESDataWrite@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   1030 <AESDataRead@plt>
mov    -0x20(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x20(%rbp)
jmp    117e <AESDataProcess+0x3e>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AESDataProcess>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r12d
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x44036000,%ebp
sete   %dil
call   1060 <ASSERT@plt>
mov    $0x44036000,%edi
mov    %r12d,%esi
call   1040 <AESLengthSet@plt>
test   %r12d,%r12d
jle    119f <AESDataProcess+0x5f>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%r15,%rbx,1),%rsi
mov    %ebp,%edi
call   1050 <AESDataWrite@plt>
lea    (%r14,%rbx,1),%rsi
mov    %ebp,%edi
call   1030 <AESDataRead@plt>
add    $0x10,%rbx
cmp    %r12d,%ebx
jl     1180 <AESDataProcess+0x40>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @AESDataProcess(i32 %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1141071872
%12 = zext i1 %11 to i32
%13 = call i32 @ASSERT(i32 %12)
%14 = load i32, i32* %8
%15 = call i32 @AESLengthSet(i32 1141071872, i32 %14)
store i32 0, i32* %9
br label %16
16: ; preds = %35, %4
%17 = load i32, i32* %9
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %38
20: ; preds = %16
%21 = load i32, i32* %5
%22 = load i32*, i32** %6
%23 = load i32, i32* %9
%24 = sdiv i32 %23, 4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %22, i64 %25
%27 = call i32 @AESDataWrite(i32 %21, i32* %26)
%28 = load i32, i32* %5
%29 = load i32*, i32** %7
%30 = load i32, i32* %9
%31 = sdiv i32 %30, 4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %29, i64 %32
%34 = call i32 @AESDataRead(i32 %28, i32* %33)
br label %35
35: ; preds = %20
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 16
store i32 %37, i32* %9
br label %16
38: ; preds = %16
ret i32 1
}

LLVM IR (-O2):
define i32 @AESDataProcess(i32 %0, i32* %1, i32* %2, i32 %3) {
%5 = icmp eq i32 %0, 1141071872
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = tail call i32 @AESLengthSet(i32 1141071872, i32 %3)
%9 = icmp sgt i32 %3, 0
br i1 %9, label %10, label %20
10: ; preds = %4, %10
%11 = phi i64 [ %17, %10 ], [ 0, %4 ]
%12 = lshr exact i64 %11, 2
%13 = getelementptr inbounds i32, i32* %1, i64 %12
%14 = tail call i32 @AESDataWrite(i32 %0, i32* %13)
%15 = getelementptr inbounds i32, i32* %2, i64 %12
%16 = tail call i32 @AESDataRead(i32 %0, i32* %15)
%17 = add nuw i64 %11, 16
%18 = trunc i64 %17 to i32
%19 = icmp slt i32 %18, %3
br i1 %19, label %10, label %20
20: ; preds = %10, %4
ret i32 1
}