#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_128_encrypt(unsigned char *, unsigned char *);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ print_bytes(unsigned char *);
int /*<<< orphan*/ sscanf(char *, char *, unsigned char *);
int strlen(char *);
int main(int argc, char **argv) {
  assert(argc == 2);
  assert(strlen(argv[1]) == 32);
  unsigned char plaintext[16];
  unsigned char ciphertext[16];
  char *pos = argv[1];
  for (int count = 0; count < 16; count++) {
    sscanf(pos, "%2hhx", &plaintext[count]);
    pos += 2;
  }
  AES_128_encrypt(ciphertext, plaintext);
  print_bytes(ciphertext);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
cmp    $0x20,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x10,-0x3c(%rbp)
jge    11e6 <main+0x96>
mov    -0x38(%rbp),%rdi
movslq -0x3c(%rbp),%rax
lea    -0x20(%rbp),%rdx
add    %rax,%rdx
lea    0xe39(%rip),%rsi
call   1060 <sscanf@plt>
mov    -0x38(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11a7 <main+0x57>
lea    -0x30(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <AES_128_encrypt@plt>
lea    -0x30(%rbp),%rdi
call   1070 <print_bytes@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x2,%edi
sete   %al
mov    %eax,%edi
call   1050 <assert@plt>
mov    0x8(%rbx),%rdi
call   1040 <strlen@plt>
xor    %edi,%edi
cmp    $0x20,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x8(%rbx),%rbx
lea    0xe73(%rip),%r15
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1060 <sscanf@plt>
lea    0x2(%rbx),%rdi
lea    0x1(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x4(%rbx),%rdi
lea    0x2(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x6(%rbx),%rdi
lea    0x3(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x8(%rbx),%rdi
lea    0x4(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0xa(%rbx),%rdi
lea    0x5(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0xc(%rbx),%rdi
lea    0x6(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0xe(%rbx),%rdi
lea    0x7(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x10(%rbx),%rdi
lea    0x8(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x12(%rbx),%rdi
lea    0x9(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x14(%rbx),%rdi
lea    0xa(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x16(%rbx),%rdi
lea    0xb(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x18(%rbx),%rdi
lea    0xc(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x1a(%rbx),%rdi
lea    0xd(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x1c(%rbx),%rdi
lea    0xe(%rsp),%rdx
mov    %r15,%rsi
call   1060 <sscanf@plt>
add    $0x1e,%rbx
lea    0xf(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <sscanf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <AES_128_encrypt@plt>
mov    %rbx,%rdi
call   1070 <print_bytes@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%2hhx\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
%7 = alloca [16 x i8]
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 2
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strlen(i8* %16)
%18 = icmp eq i32 %17, 32
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
store i8* %23, i8** %8
store i32 0, i32* %9
br label %24
24: ; preds = %35, %2
%25 = load i32, i32* %9
%26 = icmp slt i32 %25, 16
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load i8*, i8** %8
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 %30
%32 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = load i8*, i8** %8
%34 = getelementptr inbounds i8, i8* %33, i64 2
store i8* %34, i8** %8
br label %35
35: ; preds = %27
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
store i32 %37, i32* %9
br label %24
38: ; preds = %24
%39 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%40 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%41 = call i32 @AES_128_encrypt(i8* %39, i8* %40)
%42 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%43 = call i32 @print_bytes(i8* %42)
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [6 x i8] c"%2hhx\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = icmp eq i32 %0, 2
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strlen(i8* %9)
%11 = icmp eq i32 %10, 32
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%16 = load i8*, i8** %8
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %14)
%18 = getelementptr inbounds i8, i8* %16, i64 2
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 1
%20 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds i8, i8* %16, i64 4
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 2
%23 = call i32 @sscanf(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds i8, i8* %16, i64 6
%25 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 3
%26 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds i8, i8* %16, i64 8
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 4
%29 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds i8, i8* %16, i64 10
%31 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 5
%32 = call i32 @sscanf(i8* %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds i8, i8* %16, i64 12
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 6
%35 = call i32 @sscanf(i8* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds i8, i8* %16, i64 14
%37 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 7
%38 = call i32 @sscanf(i8* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds i8, i8* %16, i64 16
%40 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 8
%41 = call i32 @sscanf(i8* %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds i8, i8* %16, i64 18
%43 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 9
%44 = call i32 @sscanf(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %43)
%45 = getelementptr inbounds i8, i8* %16, i64 20
%46 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 10
%47 = call i32 @sscanf(i8* %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %46)
%48 = getelementptr inbounds i8, i8* %16, i64 22
%49 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 11
%50 = call i32 @sscanf(i8* %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds i8, i8* %16, i64 24
%52 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 12
%53 = call i32 @sscanf(i8* %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %52)
%54 = getelementptr inbounds i8, i8* %16, i64 26
%55 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 13
%56 = call i32 @sscanf(i8* %54, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %55)
%57 = getelementptr inbounds i8, i8* %16, i64 28
%58 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 14
%59 = call i32 @sscanf(i8* %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %58)
%60 = getelementptr inbounds i8, i8* %16, i64 30
%61 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 15
%62 = call i32 @sscanf(i8* %60, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %61)
%63 = call i32 @AES_128_encrypt(i8* %15, i8* %14)
%64 = call i32 @print_bytes(i8* %15)
ret i32 0
}