#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;

/* Variables and functions */
int /*<<< orphan*/ aeshw_init();
int /*<<< orphan*/ decrypt_ecb(int, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ const *,
                               int /*<<< orphan*/ *);
int /*<<< orphan*/ setkey_dec(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
void AES_ECB_decrypt_buffer(const uint8_t *input, const uint8_t *key,
                            uint8_t *output) {
  static uint8_t rk[272];
  aeshw_init();
  if (key != NULL)
    setkey_dec(rk, key);
  decrypt_ecb(((128 >> 5) + 6), rk, input, output);
}


x86 assembly (clang, -O0):
<AES_ECB_decrypt_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <aeshw_init@plt>
cmpq   $0x0,-0x10(%rbp)
je     1166 <AES_ECB_decrypt_buffer+0x36>
mov    -0x10(%rbp),%rsi
lea    0x2eef(%rip),%rdi
call   1050 <setkey_dec@plt>
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0xa,%edi
lea    0x2ed6(%rip),%rsi
call   1040 <decrypt_ecb@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AES_ECB_decrypt_buffer>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <aeshw_init@plt>
test   %rbx,%rbx
je     1159 <AES_ECB_decrypt_buffer+0x29>
lea    0x2eff(%rip),%rdi
mov    %rbx,%rsi
call   1050 <setkey_dec@plt>
lea    0x2ef0(%rip),%rsi
mov    $0xa,%edi
mov    %r15,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <decrypt_ecb@plt>

LLVM IR (-O0):
@AES_ECB_decrypt_buffer.rk = internal global [272 x i32] zeroinitializer
define void @AES_ECB_decrypt_buffer(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = call i32 (...) @aeshw_init()
%8 = load i32*, i32** %5
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32*, i32** %5
%12 = call i32 @setkey_dec(i32* getelementptr inbounds ([272 x i32], [272 x i32]* @AES_ECB_decrypt_buffer.rk, i64 0, i64 0), i32* %11)
br label %13
13: ; preds = %10, %3
%14 = load i32*, i32** %4
%15 = load i32*, i32** %6
%16 = call i32 @decrypt_ecb(i32 10, i32* getelementptr inbounds ([272 x i32], [272 x i32]* @AES_ECB_decrypt_buffer.rk, i64 0, i64 0), i32* %14, i32* %15)
ret void
}

LLVM IR (-O2):
@AES_ECB_decrypt_buffer.rk = internal global [272 x i32] zeroinitializer
define void @AES_ECB_decrypt_buffer(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 (...) @aeshw_init()
%5 = icmp eq i32* %1, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @setkey_dec(i32* getelementptr inbounds ([272 x i32], [272 x i32]* @AES_ECB_decrypt_buffer.rk, i64 0, i64 0), i32* %1)
br label %8
8: ; preds = %6, %3
%9 = tail call i32 @decrypt_ecb(i32 10, i32* getelementptr inbounds ([272 x i32], [272 x i32]* @AES_ECB_decrypt_buffer.rk, i64 0, i64 0), i32* %0, i32* %2)
ret void
}