#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*/ AESDataWrite(int, int *);
int /*<<< orphan*/ AESLengthSet(int, int /*<<< orphan*/);
int /*<<< orphan*/ AESTagRead(int, int *);
bool AESDataAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t ui32Length,
                 uint32_t *pui32Tag) {
  uint32_t ui32Count;
  ;
  AESLengthSet(ui32Base, (uint64_t)ui32Length);
  for (ui32Count = 0; ui32Count < ui32Length; ui32Count += 16) {
    AESDataWrite(ui32Base, pui32Src + (ui32Count / 4));
  }
  AESTagRead(ui32Base, pui32Tag);
  return (1);
}


x86 assembly (clang, -O0):
<AESDataAuth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <AESLengthSet@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1192 <AESDataAuth+0x62>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   1050 <AESDataWrite@plt>
mov    -0x24(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x24(%rbp)
jmp    1158 <AESDataAuth+0x28>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <AESTagRead@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AESDataAuth>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %edx,%ebx
mov    %rsi,%r15
mov    %edi,%r12d
mov    %edx,%esi
call   1040 <AESLengthSet@plt>
test   %ebx,%ebx
jle    1164 <AESDataAuth+0x34>
xor    %ebp,%ebp
lea    (%r15,%rbp,1),%rsi
mov    %r12d,%edi
call   1050 <AESDataWrite@plt>
add    $0x10,%rbp
cmp    %ebx,%ebp
jl     1150 <AESDataAuth+0x20>
mov    %r12d,%edi
mov    %r14,%rsi
call   1030 <AESTagRead@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @AESDataAuth(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 = load i32, i32* %7
%12 = call i32 @AESLengthSet(i32 %10, i32 %11)
store i32 0, i32* %9
br label %13
13: ; preds = %25, %4
%14 = load i32, i32* %9
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i32, i32* %5
%19 = load i32*, i32** %6
%20 = load i32, i32* %9
%21 = sdiv i32 %20, 4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %19, i64 %22
%24 = call i32 @AESDataWrite(i32 %18, i32* %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 16
store i32 %27, i32* %9
br label %13
28: ; preds = %13
%29 = load i32, i32* %5
%30 = load i32*, i32** %8
%31 = call i32 @AESTagRead(i32 %29, i32* %30)
ret i32 1
}

LLVM IR (-O2):
define i32 @AESDataAuth(i32 %0, i32* %1, i32 %2, i32* %3) {
%5 = tail call i32 @AESLengthSet(i32 %0, i32 %2)
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %15
7: ; preds = %4, %7
%8 = phi i64 [ %12, %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 = add nuw i64 %8, 16
%13 = trunc i64 %12 to i32
%14 = icmp slt i32 %13, %2
br i1 %14, label %7, label %15
15: ; preds = %7, %4
%16 = tail call i32 @AESTagRead(i32 %0, i32* %3)
ret i32 1
}