#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 */

/* Variables and functions */
int /*<<< orphan*/ MD5(unsigned char const *, int /*<<< orphan*/,
                       unsigned char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strlen(char const *);
void get_md5_string(char *hwaddr, char *out_md5string) {
  unsigned char md[16] = {0};
  int i = 0;
  MD5((const unsigned char *)hwaddr, strlen((const char *)hwaddr), md);
  memset(out_md5string, 0, 33 + 1);
  for (i = 0; i < 16; i++) {
    char tmp[3] = {0};
    sprintf(tmp, "%02x", md[i]);
    strcat(out_md5string, tmp);
  }
  printf(">>>>>md5stirng =%s", out_md5string);
}


x86 assembly (clang, -O0):
<get_md5_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
lea    -0x20(%rbp),%rdx
call   1060 <MD5@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x22,%edx
call   1050 <memset@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x10,-0x24(%rbp)
jge    120c <get_md5_string+0xac>
lea    -0x27(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1050 <memset@plt>
lea    -0x27(%rbp),%rdi
movslq -0x24(%rbp),%rax
lea    0xe19(%rip),%rsi
movzbl -0x20(%rbp,%rax,1),%edx
call   1080 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x27(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11be <get_md5_string+0x5e>
mov    -0x10(%rbp),%rsi
lea    0xdee(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_md5_string>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
call   1030 <strlen@plt>
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <MD5@plt>
xor    %ebx,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x22,%edx
call   1050 <memset@plt>
lea    0xe5b(%rip),%r14
lea    0xc(%rsp),%r12
nopw   0x0(%rax,%rax,1)
movb   $0x0,0xe(%rsp)
movw   $0x0,0xc(%rsp)
movzbl 0x10(%rsp,%rbx,1),%edx
mov    %r12,%rdi
mov    %r14,%rsi
call   1080 <sprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <strcat@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
jne    11b0 <get_md5_string+0x50>
lea    0xe1d(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
@.str.1 = [19 x i8] c">>>>>md5stirng =%s\00"
define void @get_md5_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [16 x i8]
%6 = alloca i32
%7 = alloca [3 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = bitcast [16 x i8]* %5 to i8*
store i32 0, i32* %6
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%13 = call i32 @MD5(i8* %9, i32 %11, i8* %12)
%14 = load i8*, i8** %4
%15 = call i32 @memset(i8* %14, i32 0, i32 34)
store i32 0, i32* %6
br label %16
16: ; preds = %30, %2
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 16
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = bitcast [3 x i8]* %7 to i8*
%21 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %25)
%27 = load i8*, i8** %4
%28 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%29 = call i32 @strcat(i8* %27, i8* %28)
br label %30
30: ; preds = %19
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %16
33: ; preds = %16
%34 = load i8*, i8** %4
%35 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %34)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
@.str.1 = [19 x i8] c">>>>>md5stirng =%s\00"
define void @get_md5_string(i8* %0, i8* %1) {
%3 = alloca [16 x i8]
%4 = alloca [3 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @strlen(i8* %0)
%7 = call i32 @MD5(i8* %0, i32 %6, i8* %5)
%8 = call i32 @memset(i8* %1, i32 0, i32 34)
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
br label %10
10: ; preds = %2, %10
%11 = phi i64 [ 0, %2 ], [ %16, %10 ]
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %13)
%15 = call i32 @strcat(i8* %1, i8* %9)
%16 = add nuw nsw i64 %11, 1
%17 = icmp eq i64 %16, 16
br i1 %17, label %18, label %10
18: ; preds = %10
%19 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret void
}