int pack_data(unsigned char Flag1, unsigned char *device_id, unsigned char cmd1,
              unsigned char cmd2, unsigned char *data,
              unsigned char *bsd_data) {
  int pack_len = 0;
  int index = 0;
  int data_len = (strlen((char *)(data)) / 2);
  int time_len = 6;
  unsigned char *SkySimDevKey = (unsigned char *)("E91440CE747F325289");
  unsigned char md5_value[512] = {'\0'};
  unsigned char md5_32[32] = {'\0'};
  unsigned char md5_result[16] = {'\0'};
  unsigned char md5_hex[512] = {'\0'};
  unsigned char packed_data[512] = {'\0'};
  printf("data len is %d \r\n", data_len);
  time_len = get_time((packed_data + 16));
  printf("check pakced_data time %02x \r\n", packed_data[16]);
  printf("time_len is %d \r\n", time_len);
  pack_len = 2 + 8 + 2 + 2 + time_len + data_len + 16;
  printf("pakced_pkl %d\r\n", pack_len);
  int_to_hex(pack_len, packed_data);
  printf("packed_pkl is %02x, %02x\r\n", packed_data[0], packed_data[1]);
  index += 2;
  *(packed_data + index) = Flag1;
  index++;
  *(packed_data + index) = 0x55;
  index++;
  uCharToHex(device_id, (packed_data + index), 16);
  index += 8;
  *(packed_data + index) = cmd1;
  index++;
  *(packed_data + index) = cmd2;
  index++;
  int_to_hex((data_len + time_len), (packed_data + index));
  index += 2;
  index += time_len;
  uCharToHex(data, (packed_data + index), data_len * 2);
  index += data_len;
  printf("start md5--\r\n");
  memcpy((char *)(md5_hex), (char *)(packed_data + 16), data_len + time_len);
  Str2BCD(md5_value, md5_hex, data_len + time_len);
  Uptolow(md5_value, (data_len + time_len) * 2);
  memcpy(((char *)md5_value + ((data_len + time_len) * 2)),
         (char *)(SkySimDevKey), strlen(SkySimDevKey));
  printf("md5 value is %s \r\n", md5_value);
  printf("start md5--2\r\n");
  md5(md5_value, (data_len + time_len) * 2 + strlen(SkySimDevKey));
  printf("md5_value--- is :%02x \r\n", md5_value[16]);
  printf("md5_value--- is :%02x \r\n", md5_value[17]);
  printf("md5_value--- is :%02x \r\n", md5_value[18]);
  md5_pack((packed_data + index));
  printf("md5 is %02x \r\n", (packed_data[index]));
  printf("md5 is %02x \r\n", (packed_data[index + 1]));
  printf("md5 is %02x \r\n", (packed_data[index + 2]));
  printf("md5 is %02x \r\n", (packed_data[index + 3]));
  index += 16;
  printf("packed _data is :%s \r\n", packed_data);
  Str2BCD(bsd_data, (char *)(packed_data), pack_len + 2);
  return (pack_len + 2) * 2;
}


x86 assembly (clang, -O0):
<pack_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x690,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
shr    $0x1,%rax
mov    %eax,-0x34(%rbp)
movl   $0x6,-0x38(%rbp)
lea    0xdfd(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    -0x240(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1050 <memset@plt>
lea    -0x260(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
lea    -0x270(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
lea    -0x470(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1050 <memset@plt>
lea    -0x670(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1050 <memset@plt>
mov    -0x34(%rbp),%esi
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x670(%rbp),%rdi
add    $0x10,%rdi
mov    $0x0,%al
call   1080 <get_time@plt>
mov    %eax,-0x38(%rbp)
movzbl -0x660(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0xe,%eax
add    -0x34(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%edi
lea    -0x670(%rbp),%rsi
mov    $0x0,%al
call   1090 <int_to_hex@plt>
movzbl -0x670(%rbp),%esi
movzbl -0x66f(%rbp),%edx
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x30(%rbp)
mov    -0x1(%rbp),%cl
movslq -0x30(%rbp),%rax
mov    %cl,-0x670(%rbp,%rax,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
movslq -0x30(%rbp),%rax
movb   $0x55,-0x670(%rbp,%rax,1)
55
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x670(%rbp),%rsi
movslq -0x30(%rbp),%rax
add    %rax,%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   10b0 <uCharToHex@plt>
mov    -0x30(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x30(%rbp)
mov    -0x11(%rbp),%cl
movslq -0x30(%rbp),%rax
mov    %cl,-0x670(%rbp,%rax,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x12(%rbp),%cl
movslq -0x30(%rbp),%rax
mov    %cl,-0x670(%rbp,%rax,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x34(%rbp),%edi
add    -0x38(%rbp),%edi
lea    -0x670(%rbp),%rsi
movslq -0x30(%rbp),%rax
add    %rax,%rsi
mov    $0x0,%al
call   1090 <int_to_hex@plt>
mov    -0x30(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x30(%rbp)
mov    -0x38(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x670(%rbp),%rsi
movslq -0x30(%rbp),%rax
add    %rax,%rsi
mov    -0x34(%rbp),%edx
shl    $0x1,%edx
mov    $0x0,%al
call   10b0 <uCharToHex@plt>
mov    -0x34(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
lea    0xc9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x470(%rbp),%rdi
lea    -0x670(%rbp),%rsi
add    $0x10,%rsi
mov    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
movslq %eax,%rdx
call   10a0 <memcpy@plt>
lea    -0x240(%rbp),%rdi
lea    -0x470(%rbp),%rsi
mov    -0x34(%rbp),%edx
add    -0x38(%rbp),%edx
mov    $0x0,%al
call   10c0 <Str2BCD@plt>
lea    -0x240(%rbp),%rdi
mov    -0x34(%rbp),%esi
add    -0x38(%rbp),%esi
shl    $0x1,%esi
mov    $0x0,%al
call   1060 <Uptolow@plt>
lea    -0x240(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x690(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x688(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x690(%rbp),%rdi
mov    -0x688(%rbp),%rsi
mov    %rax,%rdx
call   10a0 <memcpy@plt>
lea    -0x240(%rbp),%rsi
lea    0xbfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x240(%rbp),%rax
mov    %rax,-0x678(%rbp)
mov    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
shl    $0x1,%eax
cltq
mov    %rax,-0x680(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x680(%rbp),%rsi
mov    -0x678(%rbp),%rdi
add    %rax,%rsi
mov    $0x0,%al
call   10d0 <md5@plt>
movzbl -0x230(%rbp),%esi
lea    0xbba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movzbl -0x22f(%rbp),%esi
lea    0xba5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movzbl -0x22e(%rbp),%esi
lea    0xb90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x670(%rbp),%rdi
movslq -0x30(%rbp),%rax
add    %rax,%rdi
mov    $0x0,%al
call   1070 <md5_pack@plt>
movslq -0x30(%rbp),%rax
movzbl -0x670(%rbp,%rax,1),%esi
ff
lea    0xb7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
cltq
movzbl -0x670(%rbp,%rax,1),%esi
ff
lea    0xb5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x2,%eax
cltq
movzbl -0x670(%rbp,%rax,1),%esi
ff
lea    0xb3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x3,%eax
cltq
movzbl -0x670(%rbp,%rax,1),%esi
ff
lea    0xb20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x30(%rbp)
lea    -0x670(%rbp),%rsi
lea    0xb11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
lea    -0x670(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    $0x2,%edx
mov    $0x0,%al
call   10c0 <Str2BCD@plt>
mov    -0x2c(%rbp),%eax
add    $0x2,%eax
shl    $0x1,%eax
add    $0x690,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x638,%rsp
mov    %r9,0x28(%rsp)
mov    %r8,%rbp
mov    %ecx,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %rsi,0x18(%rsp)
mov    %edi,0xc(%rsp)
mov    %r8,%rdi
call   1040 <strlen@plt>
mov    %rax,%r12
shr    %r12
lea    0x230(%rsp),%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x430(%rsp),%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x30(%rsp),%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xddb(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x40(%rsp),%rdi
xor    %eax,%eax
call   1090 <get_time@plt>
mov    %eax,%r14d
movzbl 0x40(%rsp),%esi
lea    0xdc8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdd9(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    (%r14,%r12,1),%r15d
lea    (%r14,%r12,1),%r13d
add    $0x1e,%r13d
lea    0xdce(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <int_to_hex@plt>
movzbl 0x30(%rsp),%esi
movzbl 0x31(%rsp),%edx
lea    0xdb1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
mov    %al,0x32(%rsp)
movb   $0x55,0x33(%rsp)
lea    0x34(%rsp),%rsi
mov    0x18(%rsp),%rdi
mov    $0x10,%edx
xor    %eax,%eax
call   10c0 <uCharToHex@plt>
mov    0x10(%rsp),%eax
mov    %al,0x3c(%rsp)
mov    0x14(%rsp),%eax
mov    %al,0x3d(%rsp)
lea    0x3e(%rsp),%rsi
mov    %r15d,%edi
xor    %eax,%eax
call   10a0 <int_to_hex@plt>
mov    %r14,0x20(%rsp)
movslq %r14d,%rax
lea    (%rax,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r12d,%edx
add    %r12d,%edx
mov    %rbp,%rdi
xor    %eax,%eax
call   10c0 <uCharToHex@plt>
lea    (%r14,%r12,1),%r13d
add    $0x10,%r13d
lea    0xda6(%rip),%rdi
call   1030 <puts@plt>
movslq %r15d,%r14
lea    0x430(%rsp),%rbp
mov    %rbp,%rdi
lea    0x40(%rsp),%rsi
mov    %r14,%rdx
call   10b0 <memcpy@plt>
lea    0x230(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   10d0 <Str2BCD@plt>
lea    (%r14,%r14,1),%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <Uptolow@plt>
movslq %ebp,%rbp
movups 0xc81(%rip),%xmm0
movups %xmm0,0x230(%rsp,%rbp,1)
movw   $0x3938,0x240(%rsp,%rbp,1)
lea    0xce9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd37(%rip),%rdi
call   1030 <puts@plt>
add    $0x12,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10e0 <md5@plt>
movzbl 0x240(%rsp),%esi
lea    0xcc6(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x241(%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x242(%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq %r13d,%rbx
lea    (%rsp,%rbx,1),%rdi
add    $0x30,%rdi
xor    %eax,%eax
call   1080 <md5_pack@plt>
movzbl 0x30(%rsp,%rbx,1),%esi
lea    0xc93(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x31(%rsp,%rbx,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x32(%rsp,%rbx,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x33(%rsp,%rbx,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc64(%rip),%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%rax
lea    (%rax,%r12,1),%edx
add    $0x20,%edx
mov    0x28(%rsp),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10d0 <Str2BCD@plt>
lea    (%r14,%r14,1),%eax
add    $0x40,%eax
add    $0x638,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"E91440CE747F325289\00"
@.str.1 = [18 x i8] c"data len is %d \0D\0A\00"
@.str.2 = [31 x i8] c"check pakced_data time %02x \0D\0A\00"
@.str.3 = [18 x i8] c"time_len is %d \0D\0A\00"
@.str.4 = [16 x i8] c"pakced_pkl %d\0D\0A\00"
@.str.5 = [27 x i8] c"packed_pkl is %02x, %02x\0D\0A\00"
@.str.6 = [14 x i8] c"start md5--\0D\0A\00"
@.str.7 = [19 x i8] c"md5 value is %s \0D\0A\00"
@.str.8 = [15 x i8] c"start md5--2\0D\0A\00"
@.str.9 = [25 x i8] c"md5_value--- is :%02x \0D\0A\00"
@.str.10 = [15 x i8] c"md5 is %02x \0D\0A\00"
@.str.11 = [23 x i8] c"packed _data is :%s \0D\0A\00"
define i32 @pack_data(i8 zeroext %0, i8* %1, i8 zeroext %2, i8 zeroext %3, i8* %4, i8* %5) {
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca [512 x i8]
%19 = alloca [32 x i8]
%20 = alloca [16 x i8]
%21 = alloca [512 x i8]
%22 = alloca [512 x i8]
store i8 %0, i8* %7
store i8* %1, i8** %8
store i8 %2, i8* %9
store i8 %3, i8* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
store i32 0, i32* %13
store i32 0, i32* %14
%23 = load i8*, i8** %11
%24 = call i64 @strlen(i8* %23)
%25 = udiv i64 %24, 2
%26 = trunc i64 %25 to i32
store i32 %26, i32* %15
store i32 6, i32* %16
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %17
%27 = bitcast [512 x i8]* %18 to i8*
%28 = bitcast [32 x i8]* %19 to i8*
%29 = bitcast [16 x i8]* %20 to i8*
%30 = bitcast [512 x i8]* %21 to i8*
%31 = bitcast [512 x i8]* %22 to i8*
%32 = load i32, i32* %15
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%35 = getelementptr inbounds i8, i8* %34, i64 16
%36 = call i32 (i8*, ...) bitcast (i32 (...)* @get_time to i32 (i8*, ...)*)(i8* %35)
store i32 %36, i32* %16
%37 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 16
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %16
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %16
%44 = add nsw i32 14, %43
%45 = load i32, i32* %15
%46 = add nsw i32 %44, %45
%47 = add nsw i32 %46, 16
store i32 %47, i32* %13
%48 = load i32, i32* %13
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %13
%51 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%52 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @int_to_hex to i32 (i32, i8*, ...)*)(i32 %50, i8* %51)
%53 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 1
%57 = load i8, i8* %56
%58 = zext i8 %57 to i32
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %55, i32 %58)
%60 = load i32, i32* %14
%61 = add nsw i32 %60, 2
store i32 %61, i32* %14
%62 = load i8, i8* %7
%63 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%64 = load i32, i32* %14
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
store i8 %62, i8* %66
%67 = load i32, i32* %14
%68 = add nsw i32 %67, 1
store i32 %68, i32* %14
%69 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%70 = load i32, i32* %14
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
store i8 85, i8* %72
%73 = load i32, i32* %14
%74 = add nsw i32 %73, 1
store i32 %74, i32* %14
%75 = load i8*, i8** %8
%76 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%77 = load i32, i32* %14
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @uCharToHex to i32 (i8*, i8*, i32, ...)*)(i8* %75, i8* %79, i32 16)
%81 = load i32, i32* %14
%82 = add nsw i32 %81, 8
store i32 %82, i32* %14
%83 = load i8, i8* %9
%84 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%85 = load i32, i32* %14
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
store i8 %83, i8* %87
%88 = load i32, i32* %14
%89 = add nsw i32 %88, 1
store i32 %89, i32* %14
%90 = load i8, i8* %10
%91 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%92 = load i32, i32* %14
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
store i8 %90, i8* %94
%95 = load i32, i32* %14
%96 = add nsw i32 %95, 1
store i32 %96, i32* %14
%97 = load i32, i32* %15
%98 = load i32, i32* %16
%99 = add nsw i32 %97, %98
%100 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%101 = load i32, i32* %14
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8, i8* %100, i64 %102
%104 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @int_to_hex to i32 (i32, i8*, ...)*)(i32 %99, i8* %103)
%105 = load i32, i32* %14
%106 = add nsw i32 %105, 2
store i32 %106, i32* %14
%107 = load i32, i32* %16
%108 = load i32, i32* %14
%109 = add nsw i32 %108, %107
store i32 %109, i32* %14
%110 = load i8*, i8** %11
%111 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%112 = load i32, i32* %14
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i8, i8* %111, i64 %113
%115 = load i32, i32* %15
%116 = mul nsw i32 %115, 2
%117 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @uCharToHex to i32 (i8*, i8*, i32, ...)*)(i8* %110, i8* %114, i32 %116)
%118 = load i32, i32* %15
%119 = load i32, i32* %14
%120 = add nsw i32 %119, %118
store i32 %120, i32* %14
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%122 = getelementptr inbounds [512 x i8], [512 x i8]* %21, i64 0, i64 0
%123 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%124 = getelementptr inbounds i8, i8* %123, i64 16
%125 = load i32, i32* %15
%126 = load i32, i32* %16
%127 = add nsw i32 %125, %126
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [512 x i8], [512 x i8]* %18, i64 0, i64 0
%130 = getelementptr inbounds [512 x i8], [512 x i8]* %21, i64 0, i64 0
%131 = load i32, i32* %15
%132 = load i32, i32* %16
%133 = add nsw i32 %131, %132
%134 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Str2BCD to i32 (i8*, i8*, i32, ...)*)(i8* %129, i8* %130, i32 %133)
%135 = getelementptr inbounds [512 x i8], [512 x i8]* %18, i64 0, i64 0
%136 = load i32, i32* %15
%137 = load i32, i32* %16
%138 = add nsw i32 %136, %137
%139 = mul nsw i32 %138, 2
%140 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @Uptolow to i32 (i8*, i32, ...)*)(i8* %135, i32 %139)
%141 = getelementptr inbounds [512 x i8], [512 x i8]* %18, i64 0, i64 0
%142 = load i32, i32* %15
%143 = load i32, i32* %16
%144 = add nsw i32 %142, %143
%145 = mul nsw i32 %144, 2
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i8, i8* %141, i64 %146
%148 = load i8*, i8** %17
%149 = load i8*, i8** %17
%150 = call i64 @strlen(i8* %149)
%151 = getelementptr inbounds [512 x i8], [512 x i8]* %18, i64 0, i64 0
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8* %151)
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%154 = getelementptr inbounds [512 x i8], [512 x i8]* %18, i64 0, i64 0
%155 = load i32, i32* %15
%156 = load i32, i32* %16
%157 = add nsw i32 %155, %156
%158 = mul nsw i32 %157, 2
%159 = sext i32 %158 to i64
%160 = load i8*, i8** %17
%161 = call i64 @strlen(i8* %160)
%162 = add i64 %159, %161
%163 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @md5 to i32 (i8*, i64, ...)*)(i8* %154, i64 %162)
%164 = getelementptr inbounds [512 x i8], [512 x i8]* %18, i64 0, i64 16
%165 = load i8, i8* %164
%166 = zext i8 %165 to i32
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %166)
%168 = getelementptr inbounds [512 x i8], [512 x i8]* %18, i64 0, i64 17
%169 = load i8, i8* %168
%170 = zext i8 %169 to i32
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %170)
%172 = getelementptr inbounds [512 x i8], [512 x i8]* %18, i64 0, i64 18
%173 = load i8, i8* %172
%174 = zext i8 %173 to i32
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %174)
%176 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%177 = load i32, i32* %14
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i8, i8* %176, i64 %178
%180 = call i32 (i8*, ...) bitcast (i32 (...)* @md5_pack to i32 (i8*, ...)*)(i8* %179)
%181 = load i32, i32* %14
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 %182
%184 = load i8, i8* %183
%185 = zext i8 %184 to i32
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %185)
%187 = load i32, i32* %14
%188 = add nsw i32 %187, 1
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 %189
%191 = load i8, i8* %190
%192 = zext i8 %191 to i32
%193 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %192)
%194 = load i32, i32* %14
%195 = add nsw i32 %194, 2
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 %196
%198 = load i8, i8* %197
%199 = zext i8 %198 to i32
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %199)
%201 = load i32, i32* %14
%202 = add nsw i32 %201, 3
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 %203
%205 = load i8, i8* %204
%206 = zext i8 %205 to i32
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %206)
%208 = load i32, i32* %14
%209 = add nsw i32 %208, 16
store i32 %209, i32* %14
%210 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i8* %210)
%212 = load i8*, i8** %12
%213 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%214 = load i32, i32* %13
%215 = add nsw i32 %214, 2
%216 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Str2BCD to i32 (i8*, i8*, i32, ...)*)(i8* %212, i8* %213, i32 %215)
%217 = load i32, i32* %13
%218 = add nsw i32 %217, 2
%219 = mul nsw i32 %218, 2
ret i32 %219
}

LLVM IR (-O2):
@.str = [19 x i8] c"E91440CE747F325289\00"
@.str.1 = [18 x i8] c"data len is %d \0D\0A\00"
@.str.2 = [31 x i8] c"check pakced_data time %02x \0D\0A\00"
@.str.3 = [18 x i8] c"time_len is %d \0D\0A\00"
@.str.4 = [16 x i8] c"pakced_pkl %d\0D\0A\00"
@.str.5 = [27 x i8] c"packed_pkl is %02x, %02x\0D\0A\00"
@.str.7 = [19 x i8] c"md5 value is %s \0D\0A\00"
@.str.9 = [25 x i8] c"md5_value--- is :%02x \0D\0A\00"
@.str.10 = [15 x i8] c"md5 is %02x \0D\0A\00"
@.str.11 = [23 x i8] c"packed _data is :%s \0D\0A\00"
@str = [13 x i8] c"start md5--\0D\00"
@str.12 = [14 x i8] c"start md5--2\0D\00"
define i32 @pack_data(i8 zeroext %0, i8* %1, i8 zeroext %2, i8 zeroext %3, i8* %4, i8* %5) {
%7 = alloca [512 x i8]
%8 = alloca [512 x i8]
%9 = alloca [512 x i8]
%10 = tail call i64 @strlen(i8* dereferenceable(1) %4)
%11 = lshr i64 %10, 1
%12 = trunc i64 %11 to i32
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 16
%18 = call i32 (i8*, ...) bitcast (i32 (...)* @get_time to i32 (i8*, ...)*)(i8* %17)
%19 = load i8, i8* %17
%20 = zext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%23 = add i32 %18, %12
%24 = add i32 %23, 30
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @int_to_hex to i32 (i32, i8*, ...)*)(i32 %24, i8* %15)
%27 = load i8, i8* %15
%28 = zext i8 %27 to i32
%29 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 1
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %28, i32 %31)
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 2
store i8 %0, i8* %33
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 3
store i8 85, i8* %34
%35 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 4
%36 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @uCharToHex to i32 (i8*, i8*, i32, ...)*)(i8* %1, i8* %35, i32 16)
%37 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 12
store i8 %2, i8* %37
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 13
store i8 %3, i8* %38
%39 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 14
%40 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @int_to_hex to i32 (i32, i8*, ...)*)(i32 %23, i8* %39)
%41 = add nsw i32 %18, 16
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 %42
%44 = shl nsw i32 %12, 1
%45 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @uCharToHex to i32 (i8*, i8*, i32, ...)*)(i8* %4, i8* %43, i32 %44)
%46 = add nsw i32 %41, %12
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%48 = sext i32 %23 to i64
%49 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Str2BCD to i32 (i8*, i8*, i32, ...)*)(i8* %13, i8* %14, i32 %23)
%50 = shl nsw i32 %23, 1
%51 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @Uptolow to i32 (i8*, i32, ...)*)(i8* %13, i32 %50)
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8* %13)
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.12, i64 0, i64 0))
%56 = add nsw i64 %52, 18
%57 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @md5 to i32 (i8*, i64, ...)*)(i8* %13, i64 %56)
%58 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 16
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 17
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %64)
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 18
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %68)
%70 = sext i32 %46 to i64
%71 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 %70
%72 = call i32 (i8*, ...) bitcast (i32 (...)* @md5_pack to i32 (i8*, ...)*)(i8* %71)
%73 = load i8, i8* %71
%74 = zext i8 %73 to i32
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %74)
%76 = add nsw i32 %46, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 %77
%79 = load i8, i8* %78
%80 = zext i8 %79 to i32
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %80)
%82 = add nsw i32 %46, 2
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = zext i8 %85 to i32
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %86)
%88 = add nsw i32 %46, 3
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = zext i8 %91 to i32
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %92)
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i8* %15)
%95 = add i32 %23, 32
%96 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Str2BCD to i32 (i8*, i8*, i32, ...)*)(i8* %5, i8* %15, i32 %95)
%97 = shl nsw i32 %95, 1
ret i32 %97
}