#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*/ rkey;
typedef int /*<<< orphan*/ iv;
typedef int /*<<< orphan*/ ciphertext;
typedef int /*<<< orphan*/ AES_KEY;

/* Variables and functions */
int AES_BLOCK_SIZE;
int /*<<< orphan*/ AES_DECRYPT;
int /*<<< orphan*/ AES_ENCRYPT;
int /*<<< orphan*/ AES_cfb128_encrypt(unsigned char *, unsigned char *, int,
                                      int /*<<< orphan*/ *, unsigned char *,
                                      int *, int /*<<< orphan*/);
int /*<<< orphan*/ AES_set_decrypt_key(unsigned char *, int,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ AES_set_encrypt_key(unsigned char *, int,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ RAND_pseudo_bytes(unsigned char *, int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, unsigned char *);
int main(int argc, char **argv) {
  unsigned char rkey[16];
  AES_KEY key;
  unsigned char iv[AES_BLOCK_SIZE * 4];
  unsigned char saved_iv[AES_BLOCK_SIZE * 4];
  int nr_of_bits = 0;
  int nr_of_bytes = 0;
  int num;
  unsigned char plaintext[AES_BLOCK_SIZE * 4];
  unsigned char ciphertext[AES_BLOCK_SIZE * 4];
  unsigned char checktext[AES_BLOCK_SIZE * 4];
  memset(plaintext, 0, sizeof plaintext);
  memset(ciphertext, 0, sizeof ciphertext);
  memset(checktext, 0, sizeof checktext);
  RAND_pseudo_bytes(plaintext, sizeof plaintext);
  RAND_pseudo_bytes(rkey, sizeof rkey);
  RAND_pseudo_bytes(saved_iv, sizeof saved_iv);
  num = 0;
  memcpy(iv, saved_iv, sizeof(iv));
  nr_of_bits = 8 * sizeof(rkey);
  AES_set_encrypt_key(rkey, nr_of_bits, &key);
  nr_of_bytes = sizeof(ciphertext) / 2;
  AES_cfb128_encrypt(ciphertext, checktext, nr_of_bytes, &key, iv, &num,
                     AES_ENCRYPT);
  num = 0;
  memcpy(iv, saved_iv, sizeof(iv));
  nr_of_bits = 8 * sizeof(rkey);
  AES_set_decrypt_key(rkey, nr_of_bits, &key);
  AES_cfb128_encrypt(ciphertext + nr_of_bytes, checktext + nr_of_bytes,
                     nr_of_bytes, &key, iv, &num, AES_DECRYPT);
  printf("字符串为:%s\n", checktext);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e58(%rip),%rcx
mov    (%rcx),%eax
shl    $0x2,%eax
mov    %rax,-0x88(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x78(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x38(%rbp)
mov    (%rcx),%eax
shl    $0x2,%eax
mov    %rax,-0xa0(%rbp)
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x90(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    (%rcx),%eax
shl    $0x2,%eax
mov    %rax,-0xa8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rdi
sub    %rdx,%rdi
mov    %rdi,-0xb0(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x58(%rbp)
mov    (%rcx),%edx
shl    $0x2,%edx
mov    %rdx,-0x98(%rbp)
mov    %rdx,%r8
add    $0xf,%r8
and    $0xfffffffffffffff0,%r8
mov    %rsp,%rsi
sub    %r8,%rsi
mov    %rsi,-0x80(%rbp)
mov    %rsi,%rsp
mov    %rdx,-0x60(%rbp)
mov    (%rcx),%ecx
shl    $0x2,%ecx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x70(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x68(%rbp)
mov    %eax,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x80(%rbp),%rdi
mov    -0x98(%rbp),%rax
mov    %eax,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x70(%rbp),%rdi
mov    -0xb8(%rbp),%rax
mov    %eax,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa8(%rbp),%rax
mov    %eax,%esi
call   1070 <RAND_pseudo_bytes@plt>
lea    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1070 <RAND_pseudo_bytes@plt>
mov    -0x90(%rbp),%rdi
mov    -0xa0(%rbp),%rax
mov    %eax,%esi
call   1070 <RAND_pseudo_bytes@plt>
mov    -0x90(%rbp),%rsi
mov    -0x78(%rbp),%rdi
mov    -0x88(%rbp),%rax
movl   $0x0,-0x4c(%rbp)
mov    %eax,%edx
call   1060 <memcpy@plt>
movl   $0x80,-0x44(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x44(%rbp),%esi
lea    -0x24(%rbp),%rdx
call   1030 <AES_set_encrypt_key@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%r8
mov    -0x70(%rbp),%rsi
mov    -0x98(%rbp),%rax
shr    $0x1,%rax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%edx
mov    0x2c99(%rip),%rax
mov    (%rax),%eax
lea    -0x24(%rbp),%rcx
lea    -0x4c(%rbp),%r9
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1090 <AES_cfb128_encrypt@plt>
mov    -0x90(%rbp),%rsi
mov    -0x78(%rbp),%rdi
add    $0x10,%rsp
mov    -0x88(%rbp),%rax
movl   $0x0,-0x4c(%rbp)
mov    %eax,%edx
call   1060 <memcpy@plt>
movl   $0x80,-0x44(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x44(%rbp),%esi
lea    -0x24(%rbp),%rdx
call   1080 <AES_set_decrypt_key@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%r8
mov    -0x70(%rbp),%rsi
movslq -0x48(%rbp),%rax
add    %rax,%rdi
movslq -0x48(%rbp),%rax
add    %rax,%rsi
mov    -0x48(%rbp),%edx
mov    0x2c34(%rip),%rax
mov    (%rax),%eax
lea    -0x24(%rbp),%rcx
lea    -0x4c(%rbp),%r9
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1090 <AES_cfb128_encrypt@plt>
mov    -0x70(%rbp),%rsi
add    $0x10,%rsp
lea    0xc2f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsp,-0x48(%rbp)
mov    0x2e5c(%rip),%rax
mov    (%rax),%ecx
shl    $0x2,%ecx
mov    %rcx,-0x38(%rbp)
mov    %rsp,%rdx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    (%rax),%ebx
shl    $0x2,%ebx
mov    %rsp,%r15
lea    0xf(%rbx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %rsp,%r14
sub    %rax,%r14
mov    %r14,%rsp
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1050 <memset@plt>
mov    %r13,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1050 <memset@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1050 <memset@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1070 <RAND_pseudo_bytes@plt>
lea    -0x60(%rbp),%rdi
mov    $0x10,%esi
call   1070 <RAND_pseudo_bytes@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1070 <RAND_pseudo_bytes@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x40(%rbp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    -0x38(%rbp),%rdx
call   1060 <memcpy@plt>
lea    -0x30(%rbp),%rdx
lea    -0x60(%rbp),%rdi
mov    $0x80,%esi
call   1030 <AES_set_encrypt_key@plt>
shr    %ebx
mov    0x2d7a(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
lea    -0x2c(%rbp),%r9
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
lea    -0x30(%rbp),%rcx
mov    %r14,%r8
push   %rax
call   1090 <AES_cfb128_encrypt@plt>
add    $0x10,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    -0x38(%rbp),%rdx
call   1060 <memcpy@plt>
lea    -0x60(%rbp),%rdi
mov    $0x80,%esi
lea    -0x30(%rbp),%r15
mov    %r15,%rdx
call   1080 <AES_set_decrypt_key@plt>
add    %rbx,%r13
lea    (%r12,%rbx,1),%rsi
mov    0x2d2e(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %ebx,%edx
mov    %r15,%rcx
mov    %r14,%r8
lea    -0x2c(%rbp),%r9
push   %rax
call   1090 <AES_cfb128_encrypt@plt>
add    $0x10,%rsp
lea    0xd28(%rip),%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
mov    -0x48(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@AES_BLOCK_SIZE = global i32 0
@AES_ENCRYPT = global i32 0
@AES_DECRYPT = global i32 0
@.str = [17 x i8] c"\E5\AD\97\E7\AC\A6\E4\B8\B2\E4\B8\BA:%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* @AES_BLOCK_SIZE
%18 = mul nsw i32 %17, 4
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %8
%21 = alloca i8, i64 %19
store i64 %19, i64* %9
%22 = load i32, i32* @AES_BLOCK_SIZE
%23 = mul nsw i32 %22, 4
%24 = zext i32 %23 to i64
%25 = alloca i8, i64 %24
store i64 %24, i64* %10
store i32 0, i32* %11
store i32 0, i32* %12
%26 = load i32, i32* @AES_BLOCK_SIZE
%27 = mul nsw i32 %26, 4
%28 = zext i32 %27 to i64
%29 = alloca i8, i64 %28
store i64 %28, i64* %14
%30 = load i32, i32* @AES_BLOCK_SIZE
%31 = mul nsw i32 %30, 4
%32 = zext i32 %31 to i64
%33 = alloca i8, i64 %32
store i64 %32, i64* %15
%34 = load i32, i32* @AES_BLOCK_SIZE
%35 = mul nsw i32 %34, 4
%36 = zext i32 %35 to i64
%37 = alloca i8, i64 %36
store i64 %36, i64* %16
%38 = trunc i64 %28 to i32
%39 = call i32 @memset(i8* %29, i32 0, i32 %38)
%40 = trunc i64 %32 to i32
%41 = call i32 @memset(i8* %33, i32 0, i32 %40)
%42 = trunc i64 %36 to i32
%43 = call i32 @memset(i8* %37, i32 0, i32 %42)
%44 = trunc i64 %28 to i32
%45 = call i32 @RAND_pseudo_bytes(i8* %29, i32 %44)
%46 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%47 = call i32 @RAND_pseudo_bytes(i8* %46, i32 16)
%48 = trunc i64 %24 to i32
%49 = call i32 @RAND_pseudo_bytes(i8* %25, i32 %48)
store i32 0, i32* %13
%50 = trunc i64 %19 to i32
%51 = call i32 @memcpy(i8* %21, i8* %25, i32 %50)
store i32 128, i32* %11
%52 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%53 = load i32, i32* %11
%54 = call i32 @AES_set_encrypt_key(i8* %52, i32 %53, i32* %7)
%55 = udiv i64 %32, 2
%56 = trunc i64 %55 to i32
store i32 %56, i32* %12
%57 = load i32, i32* %12
%58 = load i32, i32* @AES_ENCRYPT
%59 = call i32 @AES_cfb128_encrypt(i8* %33, i8* %37, i32 %57, i32* %7, i8* %21, i32* %13, i32 %58)
store i32 0, i32* %13
%60 = trunc i64 %19 to i32
%61 = call i32 @memcpy(i8* %21, i8* %25, i32 %60)
store i32 128, i32* %11
%62 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%63 = load i32, i32* %11
%64 = call i32 @AES_set_decrypt_key(i8* %62, i32 %63, i32* %7)
%65 = load i32, i32* %12
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %33, i64 %66
%68 = load i32, i32* %12
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %37, i64 %69
%71 = load i32, i32* %12
%72 = load i32, i32* @AES_DECRYPT
%73 = call i32 @AES_cfb128_encrypt(i8* %67, i8* %70, i32 %71, i32* %7, i8* %21, i32* %13, i32 %72)
%74 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %37)
store i32 0, i32* %3
%75 = load i8*, i8** %8
%76 = load i32, i32* %3
ret i32 %76
}

LLVM IR (-O2):
@AES_BLOCK_SIZE = global i32 0
@AES_ENCRYPT = global i32 0
@AES_DECRYPT = global i32 0
@.str = [17 x i8] c"\E5\AD\97\E7\AC\A6\E4\B8\B2\E4\B8\BA:%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = load i32, i32* @AES_BLOCK_SIZE
%9 = shl nsw i32 %8, 2
%10 = zext i32 %9 to i64
%11 = tail call i8* @llvm.stacksave()
%12 = alloca i8, i64 %10
%13 = load i32, i32* @AES_BLOCK_SIZE
%14 = shl nsw i32 %13, 2
%15 = zext i32 %14 to i64
%16 = alloca i8, i64 %15
%17 = bitcast i32* %5 to i8*
%18 = alloca i8, i64 %15
%19 = alloca i8, i64 %15
%20 = alloca i8, i64 %15
%21 = call i32 @memset(i8* %18, i32 0, i32 %14)
%22 = call i32 @memset(i8* %19, i32 0, i32 %14)
%23 = call i32 @memset(i8* %20, i32 0, i32 %14)
%24 = call i32 @RAND_pseudo_bytes(i8* %18, i32 %14)
%25 = call i32 @RAND_pseudo_bytes(i8* %6, i32 16)
%26 = call i32 @RAND_pseudo_bytes(i8* %16, i32 %14)
store i32 0, i32* %5
%27 = call i32 @memcpy(i8* %12, i8* %16, i32 %9)
%28 = call i32 @AES_set_encrypt_key(i8* %6, i32 128, i32* %4)
%29 = lshr exact i32 %14, 1
%30 = load i32, i32* @AES_ENCRYPT
%31 = call i32 @AES_cfb128_encrypt(i8* %19, i8* %20, i32 %29, i32* %4, i8* %12, i32* %5, i32 %30)
store i32 0, i32* %5
%32 = call i32 @memcpy(i8* %12, i8* %16, i32 %9)
%33 = call i32 @AES_set_decrypt_key(i8* %6, i32 128, i32* %4)
%34 = zext i32 %29 to i64
%35 = getelementptr inbounds i8, i8* %19, i64 %34
%36 = getelementptr inbounds i8, i8* %20, i64 %34
%37 = load i32, i32* @AES_DECRYPT
%38 = call i32 @AES_cfb128_encrypt(i8* %35, i8* %36, i32 %29, i32* %4, i8* %12, i32* %5, i32 %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %20)
ret i32 0
}