#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 */

/* Variables and functions */
int /*<<< orphan*/ AES_ECB_encrypt(unsigned char *, unsigned char *,
                                   unsigned long, char const *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  unsigned char *in;
  unsigned char is[16] = "kung fu fighting";
  unsigned char *out;
  unsigned char os[4096] = "";
  unsigned long length = 16;
  const char *key = "12345";
  int number_of_rounds = 14;
  in = &is[0];
  out = &os[0];
  printf("AES ECB Encrypt - Decrypt\n");
  AES_ECB_encrypt(in, out, length, key, number_of_rounds);
  printf("%s\n", is);
  printf("%s\n", os);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x1030(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1040 <memset@plt>
movq   $0x10,-0x1038(%rbp)
lea    0xe93(%rip),%rax
mov    %rax,-0x1040(%rbp)
movl   $0xe,-0x1044(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x1030(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1038(%rbp),%rdx
mov    -0x1040(%rbp),%rcx
mov    -0x1044(%rbp),%r8d
call   1050 <AES_ECB_encrypt@plt>
lea    -0x20(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1030(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1018,%rsp
movaps 0xebf(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r14
mov    $0x1000,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rcx
mov    %rsp,%rbx
mov    $0x10,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xe,%r8d
call   1050 <AES_ECB_encrypt@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1018,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.is = [16 x i8] c"kung fu fighting"
@.str = [6 x i8] c"12345\00"
@.str.1 = [27 x i8] c"AES ECB Encrypt - Decrypt\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [16 x i8]
%4 = alloca i8*
%5 = alloca [4096 x i8]
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [16 x i8]* %3 to i8*
%10 = bitcast [4096 x i8]* %5 to i8*
store i64 16, i64* %6
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %7
store i32 14, i32* %8
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
store i8* %11, i8** %2
%12 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
store i8* %12, i8** %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8*, i8** %2
%15 = load i8*, i8** %4
%16 = load i64, i64* %6
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = call i32 @AES_ECB_encrypt(i8* %14, i8* %15, i64 %16, i8* %17, i32 %18)
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %22)
ret i32 0
}

LLVM IR (-O2):
@__const.main.is = [16 x i8] c"kung fu fighting"
@.str = [6 x i8] c"12345\00"
@str = [26 x i8] c"AES ECB Encrypt - Decrypt\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%6 = call i32 @AES_ECB_encrypt(i8* %3, i8* %4, i64 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 14)
%7 = call i32 @puts(i8* %3)
%8 = call i32 @puts(i8* %4)
ret i32 0
}