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

/* Variables and functions */
int /*<<< orphan*/ AES_Encrypt(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void AES_Encrypt_all(uint8_t *inputs, uint8_t *key, int expandKeyLen,
                     uint32_t BLOCK_count) {
  uint8_t *p2block;
  for (uint32_t i = 0; i < BLOCK_count; i++) {
    p2block = inputs + i * 16;
    AES_Encrypt(p2block, key, expandKeyLen);
  }
}


x86 assembly (clang, -O0):
<AES_Encrypt_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    116f <AES_Encrypt_all+0x5f>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x4,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <AES_Encrypt@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112d <AES_Encrypt_all+0x1d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AES_Encrypt_all>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %ecx,%ecx
jle    1148 <AES_Encrypt_all+0x38>
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
mov    %ecx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1030 <AES_Encrypt@plt>
add    $0x40,%rbp
add    $0xffffffffffffffff,%rbx
jne    1130 <AES_Encrypt_all+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @AES_Encrypt_all(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %10
br label %11
11: ; preds = %25, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %8
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %28
15: ; preds = %11
%16 = load i32*, i32** %5
%17 = load i32, i32* %10
%18 = mul nsw i32 %17, 16
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %16, i64 %19
store i32* %20, i32** %9
%21 = load i32*, i32** %9
%22 = load i32*, i32** %6
%23 = load i32, i32* %7
%24 = call i32 @AES_Encrypt(i32* %21, i32* %22, i32 %23)
br label %25
25: ; preds = %15
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
store i32 %27, i32* %10
br label %11
28: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @AES_Encrypt_all(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %9
8: ; preds = %9, %4
ret void
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %14, %9 ]
%11 = shl nsw i64 %10, 4
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = tail call i32 @AES_Encrypt(i32* %12, i32* %1, i32 %2)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %8, label %9
}