#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*/ aes128_dec(char *, char *);
int /*<<< orphan*/ aes128_enc(char *, char *);
int /*<<< orphan*/ aes128_load_key(char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ showblock(char *);
int /*<<< orphan*/ stdout;
int main(void) {
  char text[16] = "ABCDEFGHIJKLMNOP";
  char key[16] = "0123456789ABCDEF";
  char cypher[16], ctext[16];
  aes128_load_key(key);
  aes128_enc(cypher, text);
  aes128_dec(ctext, cypher);
  fputs("key[]    = ", stdout);
  showblock(key);
  fputs("text[]   = ", stdout);
  showblock(text);
  fputs("cypher[] = ", stdout);
  showblock(cypher);
  fputs("ctext[]  = ", stdout);
  showblock(ctext);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe94(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe91(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <aes128_load_key@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <aes128_enc@plt>
lea    -0x50(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1060 <aes128_dec@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%esi
lea    0xe62(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x30(%rbp),%rdi
call   1050 <showblock@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%esi
lea    0xe50(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x20(%rbp),%rdi
call   1050 <showblock@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%esi
lea    0xe3e(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x40(%rbp),%rdi
call   1050 <showblock@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%esi
lea    0xe2c(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x50(%rbp),%rdi
call   1050 <showblock@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r12
mov    %r12,%rdi
call   1040 <aes128_load_key@plt>
lea    0x30(%rsp),%r13
lea    0x10(%rsp),%r15
mov    %r13,%rdi
mov    %r15,%rsi
call   1070 <aes128_enc@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %r13,%rsi
call   1060 <aes128_dec@plt>
mov    0x2e35(%rip),%rbx
mov    (%rbx),%esi
lea    0xe6c(%rip),%rdi
call   1030 <fputs@plt>
mov    %r12,%rdi
call   1050 <showblock@plt>
mov    (%rbx),%esi
lea    0xe62(%rip),%rdi
call   1030 <fputs@plt>
mov    %r15,%rdi
call   1050 <showblock@plt>
mov    (%rbx),%esi
lea    0xe58(%rip),%rdi
call   1030 <fputs@plt>
mov    %r13,%rdi
call   1050 <showblock@plt>
mov    (%rbx),%esi
lea    0xe4e(%rip),%rdi
call   1030 <fputs@plt>
mov    %r14,%rdi
call   1050 <showblock@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.text = [16 x i8] c"ABCDEFGHIJKLMNOP"
@__const.main.key = [16 x i8] c"0123456789ABCDEF"
@.str = [12 x i8] c"key[] = \00"
@stdout = global i32 0
@.str.1 = [12 x i8] c"text[] = \00"
@.str.2 = [12 x i8] c"cypher[] = \00"
@.str.3 = [12 x i8] c"ctext[] = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = alloca [16 x i8]
store i32 0, i32* %1
%6 = bitcast [16 x i8]* %2 to i8*
%7 = bitcast [16 x i8]* %3 to i8*
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%9 = call i32 @aes128_load_key(i8* %8)
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%12 = call i32 @aes128_enc(i8* %10, i8* %11)
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%15 = call i32 @aes128_dec(i8* %13, i8* %14)
%16 = load i32, i32* @stdout
%17 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%19 = call i32 @showblock(i8* %18)
%20 = load i32, i32* @stdout
%21 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%23 = call i32 @showblock(i8* %22)
%24 = load i32, i32* @stdout
%25 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%27 = call i32 @showblock(i8* %26)
%28 = load i32, i32* @stdout
%29 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%31 = call i32 @showblock(i8* %30)
ret i32 0
}

LLVM IR (-O2):
@__const.main.text = [16 x i8] c"ABCDEFGHIJKLMNOP"
@__const.main.key = [16 x i8] c"0123456789ABCDEF"
@.str = [12 x i8] c"key[] = \00"
@stdout = global i32 0
@.str.1 = [12 x i8] c"text[] = \00"
@.str.2 = [12 x i8] c"cypher[] = \00"
@.str.3 = [12 x i8] c"ctext[] = \00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca [16 x i8]
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%9 = call i32 @aes128_load_key(i8* %6)
%10 = call i32 @aes128_enc(i8* %7, i8* %5)
%11 = call i32 @aes128_dec(i8* %8, i8* %7)
%12 = load i32, i32* @stdout
%13 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @showblock(i8* %6)
%15 = load i32, i32* @stdout
%16 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = call i32 @showblock(i8* %5)
%18 = load i32, i32* @stdout
%19 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = call i32 @showblock(i8* %7)
%21 = load i32, i32* @stdout
%22 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = call i32 @showblock(i8* %8)
ret i32 0
}