int DB_DES(char *inbuf, int inlen, char *outbuf, int *outlen, int flag) {
  unsigned char r[17];
  unsigned char r1[17];
  unsigned char r2[17];
  unsigned char src[256];
  unsigned char sHex[512];
  unsigned char sDest[512];
  int i;
  int nSrcLen;
  int nHexLen;
  memset(r, 0, 17);
  memset(r2, 0, 17);
  memset(src, 0, sizeof(src));
  memset(sHex, 0, sizeof(sHex));
  memset(sDest, 0, sizeof(sDest));
  if (inlen > 255)
    return -1;
  memcpy(src, inbuf, inlen);
  nSrcLen = strlen(src);
  printf("nSrcLen=%d  src[%s]\n", nSrcLen, src);
  if (flag == 0) {
    for (i = 0; i < nSrcLen; i++)
      sprintf(sHex + 2 * i, "%02x", src[i]);
    nHexLen = 2 * nSrcLen;
    printf("nHexLen=%d  sHex[%s]\n", nHexLen, sHex);
  } else if (flag == 1) {
    nHexLen = nSrcLen;
    memcpy(sHex, src, nHexLen);
  }
  printf("Des KEY ==%s== \n", "1A2B3C4D5E6F9999");
  for (i = 0; i < nHexLen; i += 16) {
    printf("---------i=%d----------\n", i);
    memset(r, 0, sizeof(r));
    memset(r1, 0, sizeof(r1));
    if ((nHexLen - i) < 16) {
      memset(r, '0', 16);
      memcpy(r, sHex + i, nHexLen - i);
    } else
      memcpy(r, sHex + i, 16);
    printf("Des ==%s== \n", r);
    if (flag == 0)
      Des("1A2B3C4D5E6F9999", r, r1);
    else if (flag == 1)
      _Des("1A2B3C4D5E6F9999", r, r1);
    printf("Des result ==%s== \n", r1);
    memcpy(sDest + i, r1, 16);
  }
  printf("sDest[%s]\n", sDest);
  *outlen = strlen(sDest);
  memcpy(outbuf, sDest, *outlen);
  if (flag == 1) {
    memset(outbuf, 0, sizeof(outbuf));
    Str2Hex(sDest, outbuf, *outlen);
    *outlen = *outlen / 2;
  }
  printf("outlen=%d\n", *outlen);
  return 0;
}


x86 assembly (clang, -O0):
<DB_DES>:
push   %rbp
mov    %rsp,%rbp
sub    $0x590,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x11,%edx
call   1060 <memset@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x11,%edx
call   1060 <memset@plt>
lea    -0x180(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
lea    -0x380(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1060 <memset@plt>
lea    -0x580(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1060 <memset@plt>
cmpl   $0xff,-0x14(%rbp)
jle    1210 <DB_DES+0x90>
movl   $0xffffffff,-0x4(%rbp)
jmp    153f <DB_DES+0x3bf>
lea    -0x180(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rdx
call   1070 <memcpy@plt>
lea    -0x180(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x588(%rbp)
mov    -0x588(%rbp),%esi
lea    -0x180(%rbp),%rdx
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    12ec <DB_DES+0x16c>
movl   $0x0,-0x584(%rbp)
mov    -0x584(%rbp),%eax
cmp    -0x588(%rbp),%eax
jge    12bd <DB_DES+0x13d>
lea    -0x380(%rbp),%rdi
mov    -0x584(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rdi
movslq -0x584(%rbp),%rax
movzbl -0x180(%rbp,%rax,1),%edx
ff
lea    0xd73(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    -0x584(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x584(%rbp)
jmp    1265 <DB_DES+0xe5>
mov    -0x588(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x58c(%rbp)
mov    -0x58c(%rbp),%esi
lea    -0x380(%rbp),%rdx
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1321 <DB_DES+0x1a1>
cmpl   $0x1,-0x2c(%rbp)
jne    131c <DB_DES+0x19c>
mov    -0x588(%rbp),%eax
mov    %eax,-0x58c(%rbp)
lea    -0x380(%rbp),%rdi
lea    -0x180(%rbp),%rsi
movslq -0x58c(%rbp),%rdx
call   1070 <memcpy@plt>
jmp    1321 <DB_DES+0x1a1>
lea    0xd08(%rip),%rdi
lea    0xd12(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x584(%rbp)
mov    -0x584(%rbp),%eax
cmp    -0x58c(%rbp),%eax
jge    149c <DB_DES+0x31c>
mov    -0x584(%rbp),%esi
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x11,%edx
call   1060 <memset@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x11,%edx
call   1060 <memset@plt>
mov    -0x58c(%rbp),%eax
sub    -0x584(%rbp),%eax
cmp    $0x10,%eax
jge    13dc <DB_DES+0x25c>
lea    -0x40(%rbp),%rdi
mov    $0x30,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    -0x40(%rbp),%rdi
lea    -0x380(%rbp),%rsi
movslq -0x584(%rbp),%rax
add    %rax,%rsi
mov    -0x58c(%rbp),%eax
sub    -0x584(%rbp),%eax
movslq %eax,%rdx
call   1070 <memcpy@plt>
jmp    13fb <DB_DES+0x27b>
movslq -0x584(%rbp),%rax
mov    -0x380(%rbp,%rax,1),%rcx
ff
mov    %rcx,-0x40(%rbp)
mov    -0x378(%rbp,%rax,1),%rax
ff
mov    %rax,-0x38(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    1432 <DB_DES+0x2b2>
lea    -0x40(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   1030 <Des@plt>
jmp    1457 <DB_DES+0x2d7>
cmpl   $0x1,-0x2c(%rbp)
jne    1452 <DB_DES+0x2d2>
lea    -0x40(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    0xbf6(%rip),%rdi
mov    $0x0,%al
call   1080 <_Des@plt>
jmp    1457 <DB_DES+0x2d7>
lea    -0x60(%rbp),%rsi
lea    0xc16(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x584(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    %rcx,-0x580(%rbp,%rax,1)
ff
mov    -0x58(%rbp),%rcx
mov    %rcx,-0x578(%rbp,%rax,1)
ff
mov    -0x584(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x584(%rbp)
jmp    1340 <DB_DES+0x1c0>
lea    -0x580(%rbp),%rsi
lea    0xbe2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x580(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rdi
lea    -0x580(%rbp),%rsi
mov    -0x28(%rbp),%rax
movslq (%rax),%rdx
call   1070 <memcpy@plt>
cmpl   $0x1,-0x2c(%rbp)
jne    1524 <DB_DES+0x3a4>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
lea    -0x580(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    $0x0,%al
call   10a0 <Str2Hex@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xb66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x590,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DB_DES>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x568,%rsp
mov    %r8d,%r12d
mov    %rcx,0x30(%rsp)
mov    %rdx,%r13
mov    %esi,%r15d
mov    %rdi,%r14
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movb   $0x0,0x20(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x150(%rsp)
lea    0x360(%rsp),%rbx
mov    $0x200,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x160(%rsp),%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    $0xffffffff,%ebp
cmp    $0xff,%r15d
jg     1500 <DB_DES+0x380>
movslq %r15d,%rdx
lea    0x60(%rsp),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
call   1070 <memcpy@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %rax,%r14
lea    0xd75(%rip),%rdi
mov    %r14d,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
test   %r12d,%r12d
mov    %r12d,0xc(%rsp)
mov    %r13,0x28(%rsp)
je     12c8 <DB_DES+0x148>
cmp    $0x1,%r12d
jne    1468 <DB_DES+0x2e8>
movslq %r14d,%rdx
lea    0x360(%rsp),%rdi
lea    0x60(%rsp),%rsi
call   1070 <memcpy@plt>
jmp    131b <DB_DES+0x19b>
test   %r14d,%r14d
jle    12ff <DB_DES+0x17f>
mov    %r14d,%r12d
lea    0xd3e(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax)
movzbl 0x60(%rsp,%rbp,1),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1090 <sprintf@plt>
add    $0x1,%rbp
add    $0x2,%rbx
cmp    %rbp,%r12
jne    12e0 <DB_DES+0x160>
add    %r14d,%r14d
lea    0xd11(%rip),%rdi
lea    0x360(%rsp),%rdx
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd0e(%rip),%rdi
lea    0xd18(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    147d <DB_DES+0x2fd>
mov    %r14d,%ebp
mov    $0x10,%eax
sub    %rbp,%rax
mov    %rax,0x38(%rsp)
lea    0x10(%rsp),%rbx
lea    0x40(%rsp),%r15
mov    %rbp,%r12
xor    %r13d,%r13d
jmp    13a4 <DB_DES+0x224>
nopl   0x0(%rax,%rax,1)
lea    0xcda(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <Des@plt>
lea    0xcfd(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movaps 0x40(%rsp),%xmm0
movaps %xmm0,0x160(%rsp,%r13,1)
add    $0x10,%r13
add    $0xfffffffffffffff0,%r12
cmp    %rbp,%r13
jge    147d <DB_DES+0x2fd>
lea    0xca7(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movb   $0x0,0x20(%rsp)
movaps %xmm0,0x40(%rsp)
movb   $0x0,0x50(%rsp)
lea    (%rsp,%r13,1),%r14
add    $0x360,%r14
cmp    $0xf,%r12
jg     1420 <DB_DES+0x2a0>
mov    0x38(%rsp),%rax
add    %r13,%rax
cmp    $0x10,%r12
mov    $0x0,%edx
cmovb  %rax,%rdx
lea    (%rsp,%r12,1),%rdi
add    $0x10,%rdi
mov    $0x30,%esi
call   1060 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1070 <memcpy@plt>
jmp    1429 <DB_DES+0x2a9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movaps (%r14),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xc3b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1360 <DB_DES+0x1e0>
cmp    $0x1,%eax
jne    1374 <DB_DES+0x1f4>
lea    0xbeb(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <_Des@plt>
jmp    1374 <DB_DES+0x1f4>
lea    0xbc1(%rip),%rdi
lea    0xbcb(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc08(%rip),%rdi
lea    0x160(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    0x30(%rsp),%rbp
mov    %eax,0x0(%rbp)
movslq %eax,%rdx
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <memcpy@plt>
cmpl   $0x1,0xc(%rsp)
jne    14ed <DB_DES+0x36d>
movq   $0x0,(%rbx)
mov    0x0(%rbp),%edx
lea    0x160(%rsp),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <Str2Hex@plt>
mov    0x0(%rbp),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
mov    %esi,0x0(%rbp)
jmp    14f0 <DB_DES+0x370>
mov    0x0(%rbp),%esi
lea    0xba0(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%eax
add    $0x568,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"nSrcLen=%d src[%s]\0A\00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [22 x i8] c"nHexLen=%d sHex[%s]\0A\00"
@.str.3 = [17 x i8] c"Des KEY ==%s== \0A\00"
@.str.4 = [17 x i8] c"1A2B3C4D5E6F9999\00"
@.str.5 = [25 x i8] c"---------i=%d----------\0A\00"
@.str.6 = [13 x i8] c"Des ==%s== \0A\00"
@.str.7 = [20 x i8] c"Des result ==%s== \0A\00"
@.str.8 = [11 x i8] c"sDest[%s]\0A\00"
@.str.9 = [11 x i8] c"outlen=%d\0A\00"
define i32 @DB_DES(i8* %0, i32 %1, i8* %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca [17 x i8]
%13 = alloca [17 x i8]
%14 = alloca [17 x i8]
%15 = alloca [256 x i8]
%16 = alloca [512 x i8]
%17 = alloca [512 x i8]
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32* %3, i32** %10
store i32 %4, i32* %11
%21 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%22 = getelementptr inbounds [17 x i8], [17 x i8]* %14, i64 0, i64 0
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %16, i64 0, i64 0
%25 = getelementptr inbounds [512 x i8], [512 x i8]* %17, i64 0, i64 0
%26 = load i32, i32* %8
%27 = icmp sgt i32 %26, 255
br i1 %27, label %28, label %29
28: ; preds = %5
store i32 -1, i32* %6
br label %167
29: ; preds = %5
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%31 = load i8*, i8** %7
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%35 = call i64 @strlen(i8* %34)
%36 = trunc i64 %35 to i32
store i32 %36, i32* %19
%37 = load i32, i32* %19
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %37, i8* %38)
%40 = load i32, i32* %11
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %68
42: ; preds = %29
store i32 0, i32* %18
br label %43
43: ; preds = %59, %42
%44 = load i32, i32* %18
%45 = load i32, i32* %19
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %62
47: ; preds = %43
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %16, i64 0, i64 0
%49 = load i32, i32* %18
%50 = mul nsw i32 2, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %48, i64 %51
%53 = load i32, i32* %18
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = call i32 (i8*, i8*, ...) @sprintf(i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %47
%60 = load i32, i32* %18
%61 = add nsw i32 %60, 1
store i32 %61, i32* %18
br label %43
62: ; preds = %43
%63 = load i32, i32* %19
%64 = mul nsw i32 2, %63
store i32 %64, i32* %20
%65 = load i32, i32* %20
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %16, i64 0, i64 0
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %65, i8* %66)
br label %78
68: ; preds = %29
%69 = load i32, i32* %11
%70 = icmp eq i32 %69, 1
br i1 %70, label %71, label %77
71: ; preds = %68
%72 = load i32, i32* %19
store i32 %72, i32* %20
%73 = getelementptr inbounds [512 x i8], [512 x i8]* %16, i64 0, i64 0
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%75 = load i32, i32* %20
%76 = sext i32 %75 to i64
br label %77
77: ; preds = %71, %68
br label %78
78: ; preds = %77, %62
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %18
br label %80
80: ; preds = %135, %78
%81 = load i32, i32* %18
%82 = load i32, i32* %20
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %138
84: ; preds = %80
%85 = load i32, i32* %18
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %85)
%87 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%88 = getelementptr inbounds [17 x i8], [17 x i8]* %13, i64 0, i64 0
%89 = load i32, i32* %20
%90 = load i32, i32* %18
%91 = sub nsw i32 %89, %90
%92 = icmp slt i32 %91, 16
br i1 %92, label %93, label %104
93: ; preds = %84
%94 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%95 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%96 = getelementptr inbounds [512 x i8], [512 x i8]* %16, i64 0, i64 0
%97 = load i32, i32* %18
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %96, i64 %98
%100 = load i32, i32* %20
%101 = load i32, i32* %18
%102 = sub nsw i32 %100, %101
%103 = sext i32 %102 to i64
br label %110
104: ; preds = %84
%105 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%106 = getelementptr inbounds [512 x i8], [512 x i8]* %16, i64 0, i64 0
%107 = load i32, i32* %18
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8, i8* %106, i64 %108
br label %110
110: ; preds = %104, %93
%111 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %111)
%113 = load i32, i32* %11
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %119
115: ; preds = %110
%116 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%117 = getelementptr inbounds [17 x i8], [17 x i8]* %13, i64 0, i64 0
%118 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @Des to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %116, i8* %117)
br label %127
119: ; preds = %110
%120 = load i32, i32* %11
%121 = icmp eq i32 %120, 1
br i1 %121, label %122, label %126
122: ; preds = %119
%123 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%124 = getelementptr inbounds [17 x i8], [17 x i8]* %13, i64 0, i64 0
%125 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @_Des to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %123, i8* %124)
br label %126
126: ; preds = %122, %119
br label %127
127: ; preds = %126, %115
%128 = getelementptr inbounds [17 x i8], [17 x i8]* %13, i64 0, i64 0
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %128)
%130 = getelementptr inbounds [512 x i8], [512 x i8]* %17, i64 0, i64 0
%131 = load i32, i32* %18
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i8, i8* %130, i64 %132
%134 = getelementptr inbounds [17 x i8], [17 x i8]* %13, i64 0, i64 0
br label %135
135: ; preds = %127
%136 = load i32, i32* %18
%137 = add nsw i32 %136, 16
store i32 %137, i32* %18
br label %80
138: ; preds = %80
%139 = getelementptr inbounds [512 x i8], [512 x i8]* %17, i64 0, i64 0
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %139)
%141 = getelementptr inbounds [512 x i8], [512 x i8]* %17, i64 0, i64 0
%142 = call i64 @strlen(i8* %141)
%143 = trunc i64 %142 to i32
%144 = load i32*, i32** %10
store i32 %143, i32* %144
%145 = load i8*, i8** %9
%146 = getelementptr inbounds [512 x i8], [512 x i8]* %17, i64 0, i64 0
%147 = load i32*, i32** %10
%148 = load i32, i32* %147
%149 = sext i32 %148 to i64
%150 = load i32, i32* %11
%151 = icmp eq i32 %150, 1
br i1 %151, label %152, label %163
152: ; preds = %138
%153 = load i8*, i8** %9
%154 = getelementptr inbounds [512 x i8], [512 x i8]* %17, i64 0, i64 0
%155 = load i8*, i8** %9
%156 = load i32*, i32** %10
%157 = load i32, i32* %156
%158 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Str2Hex to i32 (i8*, i8*, i32, ...)*)(i8* %154, i8* %155, i32 %157)
%159 = load i32*, i32** %10
%160 = load i32, i32* %159
%161 = sdiv i32 %160, 2
%162 = load i32*, i32** %10
store i32 %161, i32* %162
br label %163
163: ; preds = %152, %138
%164 = load i32*, i32** %10
%165 = load i32, i32* %164
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 %165)
store i32 0, i32* %6
br label %167
167: ; preds = %163, %28
%168 = load i32, i32* %6
ret i32 %168
}

LLVM IR (-O2):
@.str = [21 x i8] c"nSrcLen=%d src[%s]\0A\00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [22 x i8] c"nHexLen=%d sHex[%s]\0A\00"
@.str.3 = [17 x i8] c"Des KEY ==%s== \0A\00"
@.str.4 = [17 x i8] c"1A2B3C4D5E6F9999\00"
@.str.5 = [25 x i8] c"---------i=%d----------\0A\00"
@.str.6 = [13 x i8] c"Des ==%s== \0A\00"
@.str.7 = [20 x i8] c"Des result ==%s== \0A\00"
@.str.8 = [11 x i8] c"sDest[%s]\0A\00"
@.str.9 = [11 x i8] c"outlen=%d\0A\00"
define i32 @DB_DES(i8* nocapture %0, i32 %1, i8* %2, i32* nocapture %3, i32 %4) {
%6 = alloca [17 x i8]
%7 = alloca [17 x i8]
%8 = alloca [256 x i8]
%9 = alloca [512 x i8]
%10 = alloca [512 x i8]
%11 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%16 = icmp sgt i32 %1, 255
br i1 %16, label %97, label %17
17: ; preds = %5
%18 = sext i32 %1 to i64
%19 = call i64 @strlen(i8* %13)
%20 = trunc i64 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %20, i8* %13)
%22 = icmp eq i32 %4, 0
br i1 %22, label %23, label %40
23: ; preds = %17
%24 = icmp sgt i32 %20, 0
br i1 %24, label %25, label %37
25: ; preds = %23
%26 = and i64 %19, 4294967295
br label %27
27: ; preds = %25, %27
%28 = phi i64 [ 0, %25 ], [ %35, %27 ]
%29 = shl nuw nsw i64 %28, 1
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 %29
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 %28
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = call i32 (i8*, i8*, ...) @sprintf(i8* %30, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = add nuw nsw i64 %28, 1
%36 = icmp eq i64 %35, %26
br i1 %36, label %37, label %27
37: ; preds = %27, %23
%38 = shl nsw i32 %20, 1
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %38, i8* %14)
br label %47
40: ; preds = %17
%41 = icmp eq i32 %4, 1
br i1 %41, label %44, label %42
42: ; preds = %40
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %79
44: ; preds = %40
%45 = shl i64 %19, 32
%46 = ashr exact i64 %45, 32
br label %47
47: ; preds = %44, %37
%48 = phi i32 [ %38, %37 ], [ %20, %44 ]
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%50 = icmp sgt i32 %48, 0
br i1 %50, label %51, label %79
51: ; preds = %47
%52 = icmp eq i32 %4, 1
%53 = zext i32 %48 to i64
br label %54
54: ; preds = %51, %74
%55 = phi i64 [ 0, %51 ], [ %77, %74 ]
%56 = trunc i64 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %56)
%58 = sub nsw i64 %53, %55
%59 = icmp slt i64 %58, 16
%60 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 %55
br i1 %59, label %61, label %66
61: ; preds = %54
%62 = icmp ugt i64 %58, 15
%63 = sub i64 16, %58
%64 = select i1 %62, i64 0, i64 %63
%65 = getelementptr [17 x i8], [17 x i8]* %6, i64 0, i64 %58
br label %67
66: ; preds = %54
br label %67
67: ; preds = %66, %61
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %11)
br i1 %22, label %69, label %71
69: ; preds = %67
%70 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @Des to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %11, i8* %12)
br label %74
71: ; preds = %67
br i1 %52, label %72, label %74
72: ; preds = %71
%73 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @_Des to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %11, i8* %12)
br label %74
74: ; preds = %71, %72, %69
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %12)
%76 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 %55
%77 = add nuw i64 %55, 16
%78 = icmp slt i64 %77, %53
br i1 %78, label %54, label %79
79: ; preds = %74, %42, %47
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %15)
%81 = call i64 @strlen(i8* %15)
%82 = trunc i64 %81 to i32
store i32 %82, i32* %3
%83 = shl i64 %81, 32
%84 = ashr exact i64 %83, 32
%85 = icmp eq i32 %4, 1
br i1 %85, label %88, label %86
86: ; preds = %79
%87 = load i32, i32* %3
br label %94
88: ; preds = %79
%89 = bitcast i8* %2 to i64*
store i64 0, i64* %89
%90 = load i32, i32* %3
%91 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Str2Hex to i32 (i8*, i8*, i32, ...)*)(i8* %15, i8* %2, i32 %90)
%92 = load i32, i32* %3
%93 = sdiv i32 %92, 2
store i32 %93, i32* %3
br label %94
94: ; preds = %86, %88
%95 = phi i32 [ %87, %86 ], [ %93, %88 ]
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 %95)
br label %97
97: ; preds = %5, %94
%98 = phi i32 [ 0, %94 ], [ -1, %5 ]
ret i32 %98
}