#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*/ const_DES_cblock;
typedef int /*<<< orphan*/ block_key;
typedef int /*<<< orphan*/ DES_key_schedule;
typedef int /*<<< orphan*/ DES_cblock;

/* Variables and functions */
int /*<<< orphan*/ DES_DECRYPT;
int /*<<< orphan*/ DES_ENCRYPT;
int /*<<< orphan*/ DES_ecb3_encrypt(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DES_set_key_unchecked(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(unsigned char *, ...);
int /*<<< orphan*/ memset(unsigned char *, unsigned char, int);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main(void) {
  int count;
  int i;
  int len;
  char *data = "hello world!";
  int data_len;
  int data_rest;
  unsigned char ch;
  unsigned char *src = NULL;
  unsigned char *dst = NULL;
  unsigned char tmp[8];
  unsigned char in[8];
  unsigned char out[8];
  char *k = "01234567899876543210";
  int key_len;
  unsigned char key[24];
  unsigned char block_key[9];
  DES_key_schedule ks, ks2, ks3;
  key_len = strlen(k);
  memcpy(key, k, key_len);
  memset(key + key_len, 0x00, 24 - key_len);
  data_len = strlen(data);
  data_rest = data_len % 8;
  len = data_len + (8 - data_rest);
  ch = 8 - data_rest;
  src = (unsigned char *)malloc(len);
  dst = (unsigned char *)malloc(len);
  if (NULL == src || NULL == dst) {
    goto end;
  }
  memset(src, 0, len);
  memcpy(src, data, data_len);
  memset(src + data_len, ch, 8 - data_rest);
  memset(block_key, 0, sizeof(block_key));
  memcpy(block_key, key + 0, 8);
  DES_set_key_unchecked((const_DES_cblock *)block_key, &ks);
  memcpy(block_key, key + 8, 8);
  DES_set_key_unchecked((const_DES_cblock *)block_key, &ks2);
  memcpy(block_key, key + 16, 8);
  DES_set_key_unchecked((const_DES_cblock *)block_key, &ks3);
  printf("before encrypt:\n");
  for (i = 0; i < len; i++) {
    printf("0x%.2X ", *(src + i));
  }
  printf("\n");
  count = len / 8;
  for (i = 0; i < count; i++) {
    memset(tmp, 0, 8);
    memset(in, 0, 8);
    memset(out, 0, 8);
    memcpy(tmp, src + 8 * i, 8);
    DES_ecb3_encrypt((const_DES_cblock *)tmp, (DES_cblock *)in, &ks, &ks2, &ks3,
                     DES_ENCRYPT);
    DES_ecb3_encrypt((const_DES_cblock *)in, (DES_cblock *)out, &ks, &ks2, &ks3,
                     DES_DECRYPT);
    memcpy(dst + 8 * i, out, 8);
  }
  printf("after decrypt :\n");
  for (i = 0; i < len; i++) {
    printf("0x%.2X ", *(dst + i));
  }
  printf("\n");
  printf("解密后的字符串:%s\n", dst);
end:
  if (NULL != src) {
    free(src);
    src = NULL;
  }
  if (NULL != dst) {
    free(dst);
    dst = NULL;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe67(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
lea    0xe59(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x5c(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x5c(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
lea    -0x80(%rbp),%rdi
movslq -0x5c(%rbp),%rax
add    %rax,%rdi
mov    $0x18,%edx
sub    -0x5c(%rbp),%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x8,%ecx
sub    -0x20(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x8,%eax
sub    -0x20(%rbp),%eax
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
xor    %eax,%eax
cmp    -0x30(%rbp),%rax
je     1255 <main+0xd5>
xor    %eax,%eax
cmp    -0x38(%rbp),%rax
jne    125a <main+0xda>
jmp    14e6 <main+0x366>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %eax,%eax
call   1080 <memcpy@plt>
mov    -0x30(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    -0x21(%rbp),%al
mov    $0x8,%edx
sub    -0x20(%rbp),%edx
movzbl %al,%esi
call   1070 <memset@plt>
lea    -0x89(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1070 <memset@plt>
lea    -0x89(%rbp),%rdi
lea    -0x80(%rbp),%rsi
xor    %eax,%eax
mov    $0x8,%edx
call   1080 <memcpy@plt>
lea    -0x89(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   10a0 <DES_set_key_unchecked@plt>
lea    -0x89(%rbp),%rdi
lea    -0x80(%rbp),%rsi
add    $0x8,%rsi
xor    %eax,%eax
mov    $0x8,%edx
call   1080 <memcpy@plt>
lea    -0x89(%rbp),%rdi
lea    -0x94(%rbp),%rsi
call   10a0 <DES_set_key_unchecked@plt>
lea    -0x89(%rbp),%rdi
lea    -0x80(%rbp),%rsi
add    $0x10,%rsi
xor    %eax,%eax
mov    $0x8,%edx
call   1080 <memcpy@plt>
lea    -0x89(%rbp),%rdi
lea    -0x98(%rbp),%rsi
call   10a0 <DES_set_key_unchecked@plt>
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    137a <main+0x1fa>
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1346 <main+0x1c6>
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    147d <main+0x2fd>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
lea    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
lea    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
cltq
add    %rax,%rsi
xor    %eax,%eax
mov    $0x8,%edx
call   1080 <memcpy@plt>
lea    -0x40(%rbp),%rdi
lea    -0x48(%rbp),%rsi
mov    0x2bd9(%rip),%rax
mov    (%rax),%r9d
lea    -0x90(%rbp),%rdx
lea    -0x94(%rbp),%rcx
lea    -0x98(%rbp),%r8
call   1040 <DES_ecb3_encrypt@plt>
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    0x2ba5(%rip),%rax
mov    (%rax),%r9d
lea    -0x90(%rbp),%rdx
lea    -0x94(%rbp),%rcx
lea    -0x98(%rbp),%r8
call   1040 <DES_ecb3_encrypt@plt>
mov    -0x38(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
cltq
add    %rax,%rdi
lea    -0x50(%rbp),%rsi
xor    %eax,%eax
mov    $0x8,%edx
call   1080 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    139d <main+0x21d>
lea    0xbb7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    14c6 <main+0x346>
mov    -0x38(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xb82(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1492 <main+0x312>
lea    0xb7d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xb6d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
cmp    -0x30(%rbp),%rax
je     1503 <main+0x383>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x30(%rbp)
xor    %eax,%eax
cmp    -0x38(%rbp),%rax
je     1520 <main+0x3a0>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x38(%rbp)
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xe58(%rip),%rbx
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %eax,%ebp
lea    0x40(%rsp),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <memcpy@plt>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x40,%rdi
mov    $0x18,%edx
sub    %eax,%edx
xor    %esi,%esi
call   1090 <memset@plt>
lea    0xe10(%rip),%rdi
call   1070 <strlen@plt>
mov    %eax,%ebp
lea    0x7(%rbp),%ebx
test   %eax,%eax
cmovns %eax,%ebx
and    $0xfffffff8,%ebx
sub    %eax,%ebx
lea    (%rbx,%rbp,1),%r13d
add    $0x8,%r13d
mov    %r13d,%edi
call   10b0 <malloc@plt>
mov    %rax,%r15
mov    %r13d,%edi
call   10b0 <malloc@plt>
mov    %rax,%r14
test   %r15,%r15
je     149b <main+0x2fb>
test   %r14,%r14
je     149b <main+0x2fb>
add    $0x8,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    %r13d,%edx
call   1090 <memset@plt>
lea    0xdb5(%rip),%rsi
mov    %r15,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <memcpy@plt>
movslq %ebp,%rdi
add    %r15,%rdi
movzbl %bl,%esi
mov    %ebx,%edx
call   1090 <memset@plt>
lea    0x6f(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1090 <memset@plt>
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
xor    %eax,%eax
call   10a0 <memcpy@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   10c0 <DES_set_key_unchecked@plt>
lea    0x48(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
xor    %eax,%eax
call   10a0 <memcpy@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   10c0 <DES_set_key_unchecked@plt>
lea    0x50(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
xor    %eax,%eax
call   10a0 <memcpy@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10c0 <DES_set_key_unchecked@plt>
lea    0xd5f(%rip),%rdi
call   1050 <puts@plt>
test   %r13d,%r13d
jle    146a <main+0x2ca>
mov    %r14,0x20(%rsp)
mov    %r13d,%ebx
lea    0xd20(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r15,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1310 <main+0x170>
mov    %rbx,0x28(%rsp)
mov    %r15,0x18(%rsp)
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r13d,0x8(%rsp)
cmp    $0x8,%r13d
jl     1420 <main+0x280>
mov    0x8(%rsp),%eax
mov    %eax,%r13d
shr    $0x3,%r13d
mov    0x18(%rsp),%r15
mov    0x20(%rsp),%r14
lea    0x67(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1090 <memset@plt>
lea    0x38(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1090 <memset@plt>
lea    0x30(%rsp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1090 <memset@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   10a0 <memcpy@plt>
mov    0x2c2e(%rip),%rax
mov    (%rax),%r9d
mov    %rbx,%rdi
mov    %rbp,%rsi
lea    0xc(%rsp),%rdx
lea    0x14(%rsp),%r12
mov    %r12,%rcx
lea    0x10(%rsp),%rbp
mov    %rbp,%r8
call   1060 <DES_ecb3_encrypt@plt>
mov    0x2bfc(%rip),%rax
mov    (%rax),%r9d
lea    0x38(%rsp),%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
lea    0xc(%rsp),%rdx
mov    %r12,%rcx
mov    %rbp,%r8
call   1060 <DES_ecb3_encrypt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   10a0 <memcpy@plt>
add    $0x8,%r14
add    $0x8,%r15
add    $0xffffffffffffffff,%r13
jne    1360 <main+0x1c0>
lea    0xc2d(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0x8(%rsp)
mov    0x20(%rsp),%r14
mov    0x18(%rsp),%r15
mov    0x28(%rsp),%rbx
jle    1480 <main+0x2e0>
lea    0xbd9(%rip),%r12
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%r14,%rbp,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1450 <main+0x2b0>
jmp    1480 <main+0x2e0>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xbd9(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xb99(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r15,%r15
je     14a8 <main+0x308>
mov    %r15,%rdi
call   1030 <free@plt>
test   %r14,%r14
je     14b5 <main+0x315>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"hello world!\00"
@.str.1 = [21 x i8] c"01234567899876543210\00"
@.str.2 = [17 x i8] c"before encrypt:\0A\00"
@.str.3 = [8 x i8] c"0x%.2X \00"
@.str.4 = [2 x i8] c"\0A\00"
@DES_ENCRYPT = global i32 0
@DES_DECRYPT = global i32 0
@.str.5 = [17 x i8] c"after decrypt :\0A\00"
@.str.6 = [26 x i8] c"\E8\A7\A3\E5\AF\86\E5\90\8E\E7\9A\84\E5\AD\97\E7\AC\A6\E4\B8\B2:%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [8 x i8]
%12 = alloca [8 x i8]
%13 = alloca [8 x i8]
%14 = alloca i8*
%15 = alloca i32
%16 = alloca [24 x i8]
%17 = alloca [9 x i8]
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* null, i8** %9
store i8* null, i8** %10
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %14
%21 = load i8*, i8** %14
%22 = call i32 @strlen(i8* %21)
store i32 %22, i32* %15
%23 = getelementptr inbounds [24 x i8], [24 x i8]* %16, i64 0, i64 0
%24 = load i8*, i8** %14
%25 = load i32, i32* %15
%26 = call i32 (i8*, ...) @memcpy(i8* %23, i8* %24, i32 %25)
%27 = getelementptr inbounds [24 x i8], [24 x i8]* %16, i64 0, i64 0
%28 = load i32, i32* %15
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i32, i32* %15
%32 = sub nsw i32 24, %31
%33 = call i32 @memset(i8* %30, i8 zeroext 0, i32 %32)
%34 = load i8*, i8** %5
%35 = call i32 @strlen(i8* %34)
store i32 %35, i32* %6
%36 = load i32, i32* %6
%37 = srem i32 %36, 8
store i32 %37, i32* %7
%38 = load i32, i32* %6
%39 = load i32, i32* %7
%40 = sub nsw i32 8, %39
%41 = add nsw i32 %38, %40
store i32 %41, i32* %4
%42 = load i32, i32* %7
%43 = sub nsw i32 8, %42
%44 = trunc i32 %43 to i8
store i8 %44, i8* %8
%45 = load i32, i32* %4
%46 = call i64 @malloc(i32 %45)
%47 = inttoptr i64 %46 to i8*
store i8* %47, i8** %9
%48 = load i32, i32* %4
%49 = call i64 @malloc(i32 %48)
%50 = inttoptr i64 %49 to i8*
store i8* %50, i8** %10
%51 = load i8*, i8** %9
%52 = icmp eq i8* null, %51
br i1 %52, label %56, label %53
53: ; preds = %0
%54 = load i8*, i8** %10
%55 = icmp eq i8* null, %54
br i1 %55, label %56, label %57
56: ; preds = %53, %0
br label %177
57: ; preds = %53
%58 = load i8*, i8** %9
%59 = load i32, i32* %4
%60 = call i32 @memset(i8* %58, i8 zeroext 0, i32 %59)
%61 = load i8*, i8** %9
%62 = load i8*, i8** %5
%63 = load i32, i32* %6
%64 = call i32 (i8*, ...) @memcpy(i8* %61, i8* %62, i32 %63)
%65 = load i8*, i8** %9
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
%69 = load i8, i8* %8
%70 = load i32, i32* %7
%71 = sub nsw i32 8, %70
%72 = call i32 @memset(i8* %68, i8 zeroext %69, i32 %71)
%73 = getelementptr inbounds [9 x i8], [9 x i8]* %17, i64 0, i64 0
%74 = call i32 @memset(i8* %73, i8 zeroext 0, i32 9)
%75 = getelementptr inbounds [9 x i8], [9 x i8]* %17, i64 0, i64 0
%76 = getelementptr inbounds [24 x i8], [24 x i8]* %16, i64 0, i64 0
%77 = getelementptr inbounds i8, i8* %76, i64 0
%78 = call i32 (i8*, ...) @memcpy(i8* %75, i8* %77, i32 8)
%79 = getelementptr inbounds [9 x i8], [9 x i8]* %17, i64 0, i64 0
%80 = bitcast i8* %79 to i32*
%81 = call i32 @DES_set_key_unchecked(i32* %80, i32* %18)
%82 = getelementptr inbounds [9 x i8], [9 x i8]* %17, i64 0, i64 0
%83 = getelementptr inbounds [24 x i8], [24 x i8]* %16, i64 0, i64 0
%84 = getelementptr inbounds i8, i8* %83, i64 8
%85 = call i32 (i8*, ...) @memcpy(i8* %82, i8* %84, i32 8)
%86 = getelementptr inbounds [9 x i8], [9 x i8]* %17, i64 0, i64 0
%87 = bitcast i8* %86 to i32*
%88 = call i32 @DES_set_key_unchecked(i32* %87, i32* %19)
%89 = getelementptr inbounds [9 x i8], [9 x i8]* %17, i64 0, i64 0
%90 = getelementptr inbounds [24 x i8], [24 x i8]* %16, i64 0, i64 0
%91 = getelementptr inbounds i8, i8* %90, i64 16
%92 = call i32 (i8*, ...) @memcpy(i8* %89, i8* %91, i32 8)
%93 = getelementptr inbounds [9 x i8], [9 x i8]* %17, i64 0, i64 0
%94 = bitcast i8* %93 to i32*
%95 = call i32 @DES_set_key_unchecked(i32* %94, i32* %20)
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %97
97: ; preds = %109, %57
%98 = load i32, i32* %3
%99 = load i32, i32* %4
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %112
101: ; preds = %97
%102 = load i8*, i8** %9
%103 = load i32, i32* %3
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %102, i64 %104
%106 = load i8, i8* %105
%107 = zext i8 %106 to i32
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %107)
br label %109
109: ; preds = %101
%110 = load i32, i32* %3
%111 = add nsw i32 %110, 1
store i32 %111, i32* %3
br label %97
112: ; preds = %97
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%114 = load i32, i32* %4
%115 = sdiv i32 %114, 8
store i32 %115, i32* %2
store i32 0, i32* %3
br label %116
116: ; preds = %153, %112
%117 = load i32, i32* %3
%118 = load i32, i32* %2
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %156
120: ; preds = %116
%121 = getelementptr inbounds [8 x i8], [8 x i8]* %11, i64 0, i64 0
%122 = call i32 @memset(i8* %121, i8 zeroext 0, i32 8)
%123 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%124 = call i32 @memset(i8* %123, i8 zeroext 0, i32 8)
%125 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%126 = call i32 @memset(i8* %125, i8 zeroext 0, i32 8)
%127 = getelementptr inbounds [8 x i8], [8 x i8]* %11, i64 0, i64 0
%128 = load i8*, i8** %9
%129 = load i32, i32* %3
%130 = mul nsw i32 8, %129
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %128, i64 %131
%133 = call i32 (i8*, ...) @memcpy(i8* %127, i8* %132, i32 8)
%134 = getelementptr inbounds [8 x i8], [8 x i8]* %11, i64 0, i64 0
%135 = bitcast i8* %134 to i32*
%136 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%137 = bitcast i8* %136 to i32*
%138 = load i32, i32* @DES_ENCRYPT
%139 = call i32 @DES_ecb3_encrypt(i32* %135, i32* %137, i32* %18, i32* %19, i32* %20, i32 %138)
%140 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%141 = bitcast i8* %140 to i32*
%142 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%143 = bitcast i8* %142 to i32*
%144 = load i32, i32* @DES_DECRYPT
%145 = call i32 @DES_ecb3_encrypt(i32* %141, i32* %143, i32* %18, i32* %19, i32* %20, i32 %144)
%146 = load i8*, i8** %10
%147 = load i32, i32* %3
%148 = mul nsw i32 8, %147
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8, i8* %146, i64 %149
%151 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%152 = call i32 (i8*, ...) @memcpy(i8* %150, i8* %151, i32 8)
br label %153
153: ; preds = %120
%154 = load i32, i32* %3
%155 = add nsw i32 %154, 1
store i32 %155, i32* %3
br label %116
156: ; preds = %116
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %158
158: ; preds = %170, %156
%159 = load i32, i32* %3
%160 = load i32, i32* %4
%161 = icmp slt i32 %159, %160
br i1 %161, label %162, label %173
162: ; preds = %158
%163 = load i8*, i8** %10
%164 = load i32, i32* %3
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8, i8* %163, i64 %165
%167 = load i8, i8* %166
%168 = zext i8 %167 to i32
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %168)
br label %170
170: ; preds = %162
%171 = load i32, i32* %3
%172 = add nsw i32 %171, 1
store i32 %172, i32* %3
br label %158
173: ; preds = %158
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%175 = load i8*, i8** %10
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %175)
br label %177
177: ; preds = %173, %56
%178 = load i8*, i8** %9
%179 = icmp ne i8* null, %178
br i1 %179, label %180, label %183
180: ; preds = %177
%181 = load i8*, i8** %9
%182 = call i32 @free(i8* %181)
store i8* null, i8** %9
br label %183
183: ; preds = %180, %177
%184 = load i8*, i8** %10
%185 = icmp ne i8* null, %184
br i1 %185, label %186, label %189
186: ; preds = %183
%187 = load i8*, i8** %10
%188 = call i32 @free(i8* %187)
store i8* null, i8** %10
br label %189
189: ; preds = %186, %183
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"hello world!\00"
@.str.1 = [21 x i8] c"01234567899876543210\00"
@.str.3 = [8 x i8] c"0x%.2X \00"
@DES_ENCRYPT = global i32 0
@DES_DECRYPT = global i32 0
@.str.6 = [26 x i8] c"\E8\A7\A3\E5\AF\86\E5\90\8E\E7\9A\84\E5\AD\97\E7\AC\A6\E4\B8\B2:%s\0A\00"
@str = [16 x i8] c"before encrypt:\00"
@str.7 = [16 x i8] c"after decrypt :\00"
define i32 @main() {
%1 = alloca [8 x i8]
%2 = alloca [8 x i8]
%3 = alloca [8 x i8]
%4 = alloca [24 x i8]
%5 = alloca [9 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [24 x i8], [24 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = tail call i32 @strlen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (i8*, ...) @memcpy(i8* %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds [24 x i8], [24 x i8]* %4, i64 0, i64 %19
%21 = sub nsw i32 24, %17
%22 = call i32 @memset(i8* %20, i8 zeroext 0, i32 %21)
%23 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%24 = srem i32 %23, 8
%25 = sub nsw i32 8, %24
%26 = add nsw i32 %25, %23
%27 = call i64 @malloc(i32 %26)
%28 = inttoptr i64 %27 to i8*
%29 = call i64 @malloc(i32 %26)
%30 = inttoptr i64 %29 to i8*
%31 = icmp eq i64 %27, 0
%32 = icmp eq i64 %29, 0
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %106, label %34
34: ; preds = %0
%35 = trunc i32 %25 to i8
%36 = call i32 @memset(i8* %28, i8 zeroext 0, i32 %26)
%37 = call i32 (i8*, ...) @memcpy(i8* %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %23)
%38 = sext i32 %23 to i64
%39 = getelementptr inbounds i8, i8* %28, i64 %38
%40 = call i32 @memset(i8* %39, i8 zeroext %35, i32 %25)
%41 = call i32 @memset(i8* %13, i8 zeroext 0, i32 9)
%42 = call i32 (i8*, ...) @memcpy(i8* %13, i8* %12, i32 8)
%43 = bitcast [9 x i8]* %5 to i32*
%44 = call i32 @DES_set_key_unchecked(i32* %43, i32* %6)
%45 = getelementptr inbounds [24 x i8], [24 x i8]* %4, i64 0, i64 8
%46 = call i32 (i8*, ...) @memcpy(i8* %13, i8* %45, i32 8)
%47 = call i32 @DES_set_key_unchecked(i32* %43, i32* %7)
%48 = getelementptr inbounds [24 x i8], [24 x i8]* %4, i64 0, i64 16
%49 = call i32 (i8*, ...) @memcpy(i8* %13, i8* %48, i32 8)
%50 = call i32 @DES_set_key_unchecked(i32* %43, i32* %8)
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%52 = icmp sgt i32 %26, 0
br i1 %52, label %56, label %53
53: ; preds = %34
%54 = call i32 @putchar(i32 10)
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.7, i64 0, i64 0))
br label %103
56: ; preds = %34
%57 = zext i32 %26 to i64
br label %58
58: ; preds = %56, %58
%59 = phi i64 [ 0, %56 ], [ %64, %58 ]
%60 = getelementptr inbounds i8, i8* %28, i64 %59
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %62)
%64 = add nuw nsw i64 %59, 1
%65 = icmp eq i64 %64, %57
br i1 %65, label %66, label %58
66: ; preds = %58
%67 = call i32 @putchar(i32 10)
%68 = icmp sgt i32 %26, 7
br i1 %68, label %69, label %91
69: ; preds = %66
%70 = lshr i32 %26, 3
%71 = bitcast [8 x i8]* %1 to i32*
%72 = bitcast [8 x i8]* %2 to i32*
%73 = bitcast [8 x i8]* %3 to i32*
%74 = zext i32 %70 to i64
br label %75
75: ; preds = %69, %75
%76 = phi i64 [ 0, %69 ], [ %89, %75 ]
%77 = call i32 @memset(i8* %9, i8 zeroext 0, i32 8)
%78 = call i32 @memset(i8* %10, i8 zeroext 0, i32 8)
%79 = call i32 @memset(i8* %11, i8 zeroext 0, i32 8)
%80 = shl nsw i64 %76, 3
%81 = getelementptr inbounds i8, i8* %28, i64 %80
%82 = call i32 (i8*, ...) @memcpy(i8* %9, i8* %81, i32 8)
%83 = load i32, i32* @DES_ENCRYPT
%84 = call i32 @DES_ecb3_encrypt(i32* %71, i32* %72, i32* %6, i32* %7, i32* %8, i32 %83)
%85 = load i32, i32* @DES_DECRYPT
%86 = call i32 @DES_ecb3_encrypt(i32* %72, i32* %73, i32* %6, i32* %7, i32* %8, i32 %85)
%87 = getelementptr inbounds i8, i8* %30, i64 %80
%88 = call i32 (i8*, ...) @memcpy(i8* %87, i8* %11, i32 8)
%89 = add nuw nsw i64 %76, 1
%90 = icmp eq i64 %89, %74
br i1 %90, label %91, label %75
91: ; preds = %75, %66
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.7, i64 0, i64 0))
br i1 %52, label %93, label %103
93: ; preds = %91
%94 = zext i32 %26 to i64
br label %95
95: ; preds = %93, %95
%96 = phi i64 [ 0, %93 ], [ %101, %95 ]
%97 = getelementptr inbounds i8, i8* %30, i64 %96
%98 = load i8, i8* %97
%99 = zext i8 %98 to i32
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %99)
%101 = add nuw nsw i64 %96, 1
%102 = icmp eq i64 %101, %94
br i1 %102, label %103, label %95
103: ; preds = %95, %53, %91
%104 = call i32 @putchar(i32 10)
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %30)
br label %106
106: ; preds = %0, %103
br i1 %31, label %109, label %107
107: ; preds = %106
%108 = call i32 @free(i8* %28)
br label %109
109: ; preds = %107, %106
br i1 %32, label %112, label %110
110: ; preds = %109
%111 = call i32 @free(i8* %30)
br label %112
112: ; preds = %110, %109
ret i32 0
}