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

/* Variables and functions */
int /*<<< orphan*/ AES_ECB_encrypt(int *, int *, int *, int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ phex(int *);
int /*<<< orphan*/ printf(char *);
void test_encrypt_ecb_verbose(void) {
  uint8_t i, buf[64], buf2[64];
  uint8_t key[16] = {
      (uint8_t)0x2b, (uint8_t)0x7e, (uint8_t)0x15, (uint8_t)0x16,
      (uint8_t)0x28, (uint8_t)0xae, (uint8_t)0xd2, (uint8_t)0xa6,
      (uint8_t)0xab, (uint8_t)0xf7, (uint8_t)0x15, (uint8_t)0x88,
      (uint8_t)0x09, (uint8_t)0xcf, (uint8_t)0x4f, (uint8_t)0x3c};
  uint8_t plain_text[64] = {
      (uint8_t)0x6b, (uint8_t)0xc1, (uint8_t)0xbe, (uint8_t)0xe2, (uint8_t)0x2e,
      (uint8_t)0x40, (uint8_t)0x9f, (uint8_t)0x96, (uint8_t)0xe9, (uint8_t)0x3d,
      (uint8_t)0x7e, (uint8_t)0x11, (uint8_t)0x73, (uint8_t)0x93, (uint8_t)0x17,
      (uint8_t)0x2a, (uint8_t)0xae, (uint8_t)0x2d, (uint8_t)0x8a, (uint8_t)0x57,
      (uint8_t)0x1e, (uint8_t)0x03, (uint8_t)0xac, (uint8_t)0x9c, (uint8_t)0x9e,
      (uint8_t)0xb7, (uint8_t)0x6f, (uint8_t)0xac, (uint8_t)0x45, (uint8_t)0xaf,
      (uint8_t)0x8e, (uint8_t)0x51, (uint8_t)0x30, (uint8_t)0xc8, (uint8_t)0x1c,
      (uint8_t)0x46, (uint8_t)0xa3, (uint8_t)0x5c, (uint8_t)0xe4, (uint8_t)0x11,
      (uint8_t)0xe5, (uint8_t)0xfb, (uint8_t)0xc1, (uint8_t)0x19, (uint8_t)0x1a,
      (uint8_t)0x0a, (uint8_t)0x52, (uint8_t)0xef, (uint8_t)0xf6, (uint8_t)0x9f,
      (uint8_t)0x24, (uint8_t)0x45, (uint8_t)0xdf, (uint8_t)0x4f, (uint8_t)0x9b,
      (uint8_t)0x17, (uint8_t)0xad, (uint8_t)0x2b, (uint8_t)0x41, (uint8_t)0x7b,
      (uint8_t)0xe6, (uint8_t)0x6c, (uint8_t)0x37, (uint8_t)0x10};
  memset(buf, 0, 64);
  memset(buf2, 0, 64);
  printf("ECB encrypt verbose:\n\n");
  printf("plain text:\n");
  for (i = (uint8_t)0; i < (uint8_t)4; ++i) {
    phex(plain_text + i * (uint8_t)16);
  }
  printf("\n");
  printf("key:\n");
  phex(key);
  printf("\n");
  printf("ciphertext:\n");
  for (i = 0; i < 4; ++i) {
    AES_ECB_encrypt(plain_text + (i * 16), key, buf + (i * 16), 16);
    phex(buf + (i * 16));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<test_encrypt_ecb_verbose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
lea    -0x250(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0x40,%edx
call   1060 <memcpy@plt>
lea    -0x350(%rbp),%rdi
lea    0xebf(%rip),%rsi
mov    $0x100,%edx
call   1060 <memcpy@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
lea    0xf88(%rip),%rdi
call   1030 <printf@plt>
lea    0xf93(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    1203 <test_encrypt_ecb_verbose+0xb3>
lea    -0x350(%rbp),%rdi
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
call   1050 <phex@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11d0 <test_encrypt_ecb_verbose+0x80>
lea    0xf4b(%rip),%rdi
call   1030 <printf@plt>
lea    0xf4e(%rip),%rdi
call   1030 <printf@plt>
lea    -0x250(%rbp),%rdi
call   1050 <phex@plt>
lea    0xf27(%rip),%rdi
call   1030 <printf@plt>
lea    0xf30(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    12b6 <test_encrypt_ecb_verbose+0x166>
lea    -0x350(%rbp),%rdi
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x250(%rbp),%rsi
lea    -0x110(%rbp),%rdx
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdx
mov    $0x10,%ecx
call   1070 <AES_ECB_encrypt@plt>
lea    -0x110(%rbp),%rdi
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
call   1050 <phex@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1246 <test_encrypt_ecb_verbose+0xf6>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_encrypt_ecb_verbose>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x348,%rsp
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe80(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe64(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xe99(%rip),%rsi
lea    0x40(%rsp),%r14
mov    $0x100,%edx
mov    %r14,%rdi
call   1070 <memcpy@plt>
lea    0x140(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    0x240(%rsp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    0xf55(%rip),%rdi
call   1040 <puts@plt>
lea    0xf5f(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <phex@plt>
lea    0x80(%rsp),%r13
mov    %r13,%rdi
call   1060 <phex@plt>
lea    0xc0(%rsp),%r12
mov    %r12,%rdi
call   1060 <phex@plt>
lea    0x100(%rsp),%r15
mov    %r15,%rdi
call   1060 <phex@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf1d(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
call   1060 <phex@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf01(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    $0x10,%ecx
call   1080 <AES_ECB_encrypt@plt>
mov    %rbx,%rdi
call   1060 <phex@plt>
lea    0x180(%rsp),%rbx
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    $0x10,%ecx
call   1080 <AES_ECB_encrypt@plt>
mov    %rbx,%rdi
call   1060 <phex@plt>
lea    0x1c0(%rsp),%rbx
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    $0x10,%ecx
call   1080 <AES_ECB_encrypt@plt>
mov    %rbx,%rdi
call   1060 <phex@plt>
lea    0x200(%rsp),%rbx
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    $0x10,%ecx
call   1080 <AES_ECB_encrypt@plt>
mov    %rbx,%rdi
call   1060 <phex@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x348,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.test_encrypt_ecb_verbose.key = [16 x i32] [i32 43, i32 126, i32 21, i32 22, i32 40, i32 174, i32 210, i32 166, i32 171, i32 247, i32 21, i32 136, i32 9, i32 207, i32 79, i32 60]
@__const.test_encrypt_ecb_verbose.plain_text = [64 x i32] [i32 107, i32 193, i32 190, i32 226, i32 46, i32 64, i32 159, i32 150, i32 233, i32 61, i32 126, i32 17, i32 115, i32 147, i32 23, i32 42, i32 174, i32 45, i32 138, i32 87, i32 30, i32 3, i32 172, i32 156, i32 158, i32 183, i32 111, i32 172, i32 69, i32 175, i32 142, i32 81, i32 48, i32 200, i32 28, i32 70, i32 163, i32 92, i32 228, i32 17, i32 229, i32 251, i32 193, i32 25, i32 26, i32 10, i32 82, i32 239, i32 246, i32 159, i32 36, i32 69, i32 223, i32 79, i32 155, i32 23, i32 173, i32 43, i32 65, i32 123, i32 230, i32 108, i32 55, i32 16]
@.str = [23 x i8] c"ECB encrypt verbose:\0A\0A\00"
@.str.1 = [13 x i8] c"plain text:\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [6 x i8] c"key:\0A\00"
@.str.4 = [13 x i8] c"ciphertext:\0A\00"
define void @test_encrypt_ecb_verbose() {
%1 = alloca i32
%2 = alloca [64 x i32]
%3 = alloca [64 x i32]
%4 = alloca [16 x i32]
%5 = alloca [64 x i32]
%6 = bitcast [16 x i32]* %4 to i8*
%7 = bitcast [64 x i32]* %5 to i8*
%8 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%9 = call i32 @memset(i32* %8, i32 0, i32 64)
%10 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%11 = call i32 @memset(i32* %10, i32 0, i32 64)
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %14
14: ; preds = %24, %0
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = getelementptr inbounds [64 x i32], [64 x i32]* %5, i64 0, i64 0
%19 = load i32, i32* %1
%20 = mul nsw i32 %19, 16
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
%23 = call i32 @phex(i32* %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %14
27: ; preds = %14
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%30 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%31 = call i32 @phex(i32* %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %34
34: ; preds = %56, %27
%35 = load i32, i32* %1
%36 = icmp slt i32 %35, 4
br i1 %36, label %37, label %59
37: ; preds = %34
%38 = getelementptr inbounds [64 x i32], [64 x i32]* %5, i64 0, i64 0
%39 = load i32, i32* %1
%40 = mul nsw i32 %39, 16
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %38, i64 %41
%43 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%44 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%45 = load i32, i32* %1
%46 = mul nsw i32 %45, 16
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %44, i64 %47
%49 = call i32 @AES_ECB_encrypt(i32* %42, i32* %43, i32* %48, i32 16)
%50 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%51 = load i32, i32* %1
%52 = mul nsw i32 %51, 16
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %50, i64 %53
%55 = call i32 @phex(i32* %54)
br label %56
56: ; preds = %37
%57 = load i32, i32* %1
%58 = add nsw i32 %57, 1
store i32 %58, i32* %1
br label %34
59: ; preds = %34
%60 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test_encrypt_ecb_verbose.key = [16 x i32] [i32 43, i32 126, i32 21, i32 22, i32 40, i32 174, i32 210, i32 166, i32 171, i32 247, i32 21, i32 136, i32 9, i32 207, i32 79, i32 60]
@__const.test_encrypt_ecb_verbose.plain_text = [64 x i32] [i32 107, i32 193, i32 190, i32 226, i32 46, i32 64, i32 159, i32 150, i32 233, i32 61, i32 126, i32 17, i32 115, i32 147, i32 23, i32 42, i32 174, i32 45, i32 138, i32 87, i32 30, i32 3, i32 172, i32 156, i32 158, i32 183, i32 111, i32 172, i32 69, i32 175, i32 142, i32 81, i32 48, i32 200, i32 28, i32 70, i32 163, i32 92, i32 228, i32 17, i32 229, i32 251, i32 193, i32 25, i32 26, i32 10, i32 82, i32 239, i32 246, i32 159, i32 36, i32 69, i32 223, i32 79, i32 155, i32 23, i32 173, i32 43, i32 65, i32 123, i32 230, i32 108, i32 55, i32 16]
@str = [22 x i8] c"ECB encrypt verbose:\0A\00"
@str.5 = [12 x i8] c"plain text:\00"
@str.6 = [5 x i8] c"key:\00"
@str.7 = [12 x i8] c"ciphertext:\00"
define void @test_encrypt_ecb_verbose() {
%1 = alloca [64 x i32]
%2 = alloca [64 x i32]
%3 = alloca [16 x i32]
%4 = alloca [64 x i32]
%5 = bitcast [64 x i32]* %1 to i8*
%6 = bitcast [64 x i32]* %2 to i8*
%7 = bitcast [16 x i32]* %3 to i8*
%8 = bitcast [64 x i32]* %4 to i8*
%9 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 0
%10 = call i32 @memset(i32* %9, i32 0, i32 64)
%11 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%12 = call i32 @memset(i32* %11, i32 0, i32 64)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
%15 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%16 = call i32 @phex(i32* %15)
%17 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 16
%18 = call i32 @phex(i32* %17)
%19 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 32
%20 = call i32 @phex(i32* %19)
%21 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 48
%22 = call i32 @phex(i32* %21)
%23 = call i32 @putchar(i32 10)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%25 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%26 = call i32 @phex(i32* %25)
%27 = call i32 @putchar(i32 10)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.7, i64 0, i64 0))
%29 = call i32 @AES_ECB_encrypt(i32* %15, i32* %25, i32* %9, i32 16)
%30 = call i32 @phex(i32* %9)
%31 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 16
%32 = call i32 @AES_ECB_encrypt(i32* %17, i32* %25, i32* %31, i32 16)
%33 = call i32 @phex(i32* %31)
%34 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 32
%35 = call i32 @AES_ECB_encrypt(i32* %19, i32* %25, i32* %34, i32 16)
%36 = call i32 @phex(i32* %34)
%37 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 48
%38 = call i32 @AES_ECB_encrypt(i32* %21, i32* %25, i32* %37, i32 16)
%39 = call i32 @phex(i32* %37)
%40 = call i32 @putchar(i32 10)
ret void
}