#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 *, int, unsigned char *);
void md5s(unsigned char *src, int src_len, char *dst) {
  int i;
  unsigned char md5_d[16];
  md5(src, src_len, md5_d);
  for (i = 0; i < 16; i++) {
    *dst = ("0123456789abcdef"[md5_d[i] >> 4] + 0);
    dst++;
    *dst = ("0123456789abcdef"[md5_d[i] & 0xf] + 0);
    dst++;
  }
  *dst = '\0';
}


x86 assembly (clang, -O0):
<md5s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
call   1030 <md5@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x10,-0x1c(%rbp)
jge    11b4 <md5s+0xa4>
movslq -0x1c(%rbp),%rax
movzbl -0x30(%rbp,%rax,1),%eax
sar    $0x4,%eax
movslq %eax,%rcx
lea    0xea6(%rip),%rax
movsbl (%rax,%rcx,1),%eax
add    $0x0,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
movslq -0x1c(%rbp),%rax
movzbl -0x30(%rbp,%rax,1),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xe75(%rip),%rax
movsbl (%rax,%rcx,1),%eax
add    $0x0,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113a <md5s+0x2a>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<md5s>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsp,%rdx
call   1030 <md5@plt>
xor    %eax,%eax
lea    0xed7(%rip),%rdi
nopl   0x0(%rax)
movzbl (%rsp,%rax,1),%edx
mov    %rdx,%rsi
shr    $0x4,%rsi
movzbl (%rsi,%rdi,1),%ecx
mov    %cl,(%rbx,%rax,2)
and    $0xf,%edx
movzbl (%rdx,%rdi,1),%ecx
mov    %cl,0x1(%rbx,%rax,2)
movzbl 0x1(%rsp,%rax,1),%ecx
mov    %rcx,%rdx
shr    $0x4,%rdx
movzbl (%rdx,%rdi,1),%edx
mov    %dl,0x2(%rbx,%rax,2)
and    $0xf,%ecx
movzbl (%rcx,%rdi,1),%ecx
mov    %cl,0x3(%rbx,%rax,2)
add    $0x2,%rax
cmp    $0x10,%rax
jne    1130 <md5s+0x20>
movb   $0x0,(%rbx,%rax,2)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789abcdef\00"
define void @md5s(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [16 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%12 = call i32 @md5(i8* %9, i32 %10, i8* %11)
store i32 0, i32* %7
br label %13
13: ; preds = %47, %3
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 16
br i1 %15, label %16, label %50
16: ; preds = %13
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = ashr i32 %21, 4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = add nsw i32 %26, 0
%28 = trunc i32 %27 to i8
%29 = load i8*, i8** %6
store i8 %28, i8* %29
%30 = load i8*, i8** %6
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %6
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = and i32 %36, 15
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = add nsw i32 %41, 0
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %6
store i8 %43, i8* %44
%45 = load i8*, i8** %6
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %6
br label %47
47: ; preds = %16
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %13
50: ; preds = %13
%51 = load i8*, i8** %6
store i8 0, i8* %51
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789abcdef\00"
define void @md5s(i8* %0, i32 %1, i8* nocapture writeonly %2) {
%4 = alloca [16 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%6 = call i32 @md5(i8* %0, i32 %1, i8* %5)
br label %7
7: ; preds = %7, %3
%8 = phi i64 [ 0, %3 ], [ %35, %7 ]
%9 = phi i8* [ %2, %3 ], [ %34, %7 ]
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 %8
%11 = load i8, i8* %10
%12 = lshr i8 %11, 4
%13 = zext i8 %12 to i64
%14 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %13
%15 = load i8, i8* %14
store i8 %15, i8* %9
%16 = getelementptr inbounds i8, i8* %9, i64 1
%17 = and i8 %11, 15
%18 = zext i8 %17 to i64
%19 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %18
%20 = load i8, i8* %19
store i8 %20, i8* %16
%21 = getelementptr inbounds i8, i8* %9, i64 2
%22 = or i64 %8, 1
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = lshr i8 %24, 4
%26 = zext i8 %25 to i64
%27 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %26
%28 = load i8, i8* %27
store i8 %28, i8* %21
%29 = getelementptr inbounds i8, i8* %9, i64 3
%30 = and i8 %24, 15
%31 = zext i8 %30 to i64
%32 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %31
%33 = load i8, i8* %32
store i8 %33, i8* %29
%34 = getelementptr inbounds i8, i8* %9, i64 4
%35 = add nuw nsw i64 %8, 2
%36 = icmp eq i64 %35, 16
br i1 %36, label %37, label %7
37: ; preds = %7
store i8 0, i8* %34
ret void
}