#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 MD5_DIGEST_LENGTH;
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
char *pt(unsigned char *md) {
  int i;
  static char buf[80];
  for (i = 0; i < MD5_DIGEST_LENGTH; i++)
    sprintf(&(buf[i * 2]), "%02x", md[i]);
  return (buf);
}


x86 assembly (clang, -O0):
<pt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jge    116d <pt+0x5d>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
lea    0x2efc(%rip),%rdi
add    %rax,%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
lea    0xeaa(%rip),%rsi
movzbl (%rax,%rcx,1),%edx
call   1030 <sprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <pt+0x13>
lea    0x2ecc(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pt>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x2ec0(%rip),%r12
cmpl   $0x0,(%r12)
jle    1161 <pt+0x51>
mov    %rdi,%r14
lea    0x2f0f(%rip),%r13
xor    %ebx,%ebx
lea    0xec6(%rip),%r15
nopw   0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%edx
mov    %r13,%rdi
mov    %r15,%rsi
call   1030 <sprintf@plt>
add    $0x1,%rbx
movslq (%r12),%rax
add    $0x2,%r13
cmp    %rax,%rbx
jl     1140 <pt+0x30>
lea    0x2ed8(%rip),%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@pt.buf = internal global [80 x i8] zeroinitializer
@MD5_DIGEST_LENGTH = global i32 0
@.str = [5 x i8] c"%02x\00"
define i8* @pt(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %19, %1
%5 = load i32, i32* %3
%6 = load i32, i32* @MD5_DIGEST_LENGTH
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [80 x i8], [80 x i8]* @pt.buf, i64 0, i64 %11
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %17)
br label %19
19: ; preds = %8
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pt.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@pt.buf = internal global [80 x i8] zeroinitializer
@MD5_DIGEST_LENGTH = global i32 0
@.str = [5 x i8] c"%02x\00"
define i8* @pt(i8* nocapture %0) {
%2 = load i32, i32* @MD5_DIGEST_LENGTH
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %15
4: ; preds = %1, %4
%5 = phi i64 [ %11, %4 ], [ 0, %1 ]
%6 = shl nuw nsw i64 %5, 1
%7 = getelementptr inbounds [80 x i8], [80 x i8]* @pt.buf, i64 0, i64 %6
%8 = getelementptr inbounds i8, i8* %0, i64 %5
%9 = load i8, i8* %8
%10 = tail call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %9)
%11 = add nuw nsw i64 %5, 1
%12 = load i32, i32* @MD5_DIGEST_LENGTH
%13 = sext i32 %12 to i64
%14 = icmp slt i64 %11, %13
br i1 %14, label %4, label %15
15: ; preds = %4, %1
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pt.buf, i64 0, i64 0)
}