#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*/);
bool AESDataProcess(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest,
                    uint32_t ui32Length) {
  uint32_t ui32Count;
  ;
  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)
mov    -0x1c(%rbp),%esi
mov    $0x44036000,%edi
call   1040 <AESLengthSet@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b4 <AESDataProcess+0x84>
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    115a <AESDataProcess+0x2a>
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
mov    $0x44036000,%edi
mov    %ecx,%esi
call   1040 <AESLengthSet@plt>
test   %r12d,%r12d
jle    117f <AESDataProcess+0x4f>
xor    %ebx,%ebx
cs nopw 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     1160 <AESDataProcess+0x30>
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* %8
%11 = call i32 @AESLengthSet(i32 1141071872, i32 %10)
store i32 0, i32* %9
br label %12
12: ; preds = %31, %4
%13 = load i32, i32* %9
%14 = load i32, i32* %8
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %34
16: ; preds = %12
%17 = load i32, i32* %5
%18 = load i32*, i32** %6
%19 = load i32, i32* %9
%20 = sdiv i32 %19, 4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
%23 = call i32 @AESDataWrite(i32 %17, i32* %22)
%24 = load i32, i32* %5
%25 = load i32*, i32** %7
%26 = load i32, i32* %9
%27 = sdiv i32 %26, 4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %25, i64 %28
%30 = call i32 @AESDataRead(i32 %24, i32* %29)
br label %31
31: ; preds = %16
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 16
store i32 %33, i32* %9
br label %12
34: ; preds = %12
ret i32 1
}

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