int main(int argc, char **argv) {
  if (argc <= 1 || argc > 2) {
    printf("usage:\n");
    printf("    %s plaintext\n", argv[0]);
    return -1;
  }
  unsigned char pDstEncryptData[128] = {0};
  unsigned char pDstDecryptData[64] = {0};
  if ((-1) == _encrypt(argv[1], pDstEncryptData, sizeof(pDstEncryptData))) {
    printf("fail encrypt\n");
    return -1;
  }
  printf("encrypt result: %s\n", pDstEncryptData);
  if ((-1) ==
      _decrypt(pDstEncryptData, pDstDecryptData, sizeof(pDstDecryptData))) {
    printf("fail decrypt\n");
    return -1;
  }
  printf("decrypt length: %d\n", strlen(pDstDecryptData));
  printf("decrypt result: %s\n", pDstDecryptData);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    117d <main+0x2d>
cmpl   $0x2,-0x8(%rbp)
jle    11ac <main+0x5c>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12a0 <main+0x150>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x80,%edx
mov    $0x0,%al
call   1070 <_encrypt@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1216 <main+0xc6>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12a0 <main+0x150>
lea    -0x90(%rbp),%rsi
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
mov    $0x40,%edx
mov    $0x0,%al
call   1050 <_decrypt@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    126e <main+0x11e>
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12a0 <main+0x150>
lea    -0xd0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rsi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1228 <main+0xd8>
xorps  %xmm0,%xmm0
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    0x8(%rbx),%rdi
lea    0x40(%rsp),%rsi
mov    $0x80,%edx
xor    %eax,%eax
call   1070 <_encrypt@plt>
cmp    $0xffffffff,%eax
je     1247 <main+0xf7>
lea    0xe41(%rip),%rdi
xor    %ebx,%ebx
lea    0x40(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rsi
mov    $0x40,%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <_decrypt@plt>
cmp    $0xffffffff,%eax
je     1250 <main+0x100>
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0xe1b(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe1e(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1261 <main+0x111>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rsi
lea    0xdc2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    125c <main+0x10c>
lea    0xe0d(%rip),%rdi
jmp    1257 <main+0x107>
lea    0xdf7(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"usage:\0A\00"
@.str.1 = [18 x i8] c" %s plaintext\0A\00"
@.str.2 = [14 x i8] c"fail encrypt\0A\00"
@.str.3 = [20 x i8] c"encrypt result: %s\0A\00"
@.str.4 = [14 x i8] c"fail decrypt\0A\00"
@.str.5 = [20 x i8] c"decrypt length: %d\0A\00"
@.str.6 = [20 x i8] c"decrypt result: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 1
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 2
br i1 %12, label %13, label %19
13: ; preds = %10, %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %17)
store i32 -1, i32* %3
br label %45
19: ; preds = %10
%20 = bitcast [128 x i8]* %6 to i8*
%21 = bitcast [64 x i8]* %7 to i8*
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%26 = call i32 (i8*, i8*, i64, ...) bitcast (i32 (...)* @_encrypt to i32 (i8*, i8*, i64, ...)*)(i8* %24, i8* %25, i64 128)
%27 = icmp eq i32 -1, %26
br i1 %27, label %28, label %30
28: ; preds = %19
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %45
30: ; preds = %19
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%35 = call i32 (i8*, i8*, i64, ...) bitcast (i32 (...)* @_decrypt to i32 (i8*, i8*, i64, ...)*)(i8* %33, i8* %34, i64 64)
%36 = icmp eq i32 -1, %35
br i1 %36, label %37, label %39
37: ; preds = %30
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %45
39: ; preds = %30
%40 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%41 = call i64 @strlen(i8* %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i64 %41)
%43 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %39, %37, %28, %13
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c" %s plaintext\0A\00"
@.str.3 = [20 x i8] c"encrypt result: %s\0A\00"
@.str.5 = [20 x i8] c"decrypt length: %d\0A\00"
@.str.6 = [20 x i8] c"decrypt result: %s\0A\00"
@str = [13 x i8] c"fail decrypt\00"
@str.7 = [13 x i8] c"fail encrypt\00"
@str.8 = [7 x i8] c"usage:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = alloca [64 x i8]
%5 = icmp eq i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.8, i64 0, i64 0))
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %31
10: ; preds = %2
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 (i8*, i8*, i64, ...) bitcast (i32 (...)* @_encrypt to i32 (i8*, i8*, i64, ...)*)(i8* %14, i8* %11, i64 128)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.7, i64 0, i64 0))
br label %29
19: ; preds = %10
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%21 = call i32 (i8*, i8*, i64, ...) bitcast (i32 (...)* @_decrypt to i32 (i8*, i8*, i64, ...)*)(i8* %11, i8* %12, i64 64)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %29
25: ; preds = %19
%26 = call i64 @strlen(i8* %12)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i64 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %12)
br label %29
29: ; preds = %25, %23, %17
%30 = phi i32 [ -1, %17 ], [ -1, %23 ], [ 0, %25 ]
br label %31
31: ; preds = %29, %6
%32 = phi i32 [ -1, %6 ], [ %30, %29 ]
ret i32 %32
}