#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int MD5_DIGEST_LENGTH;
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned char);
char *pt(unsigned char *md) {
  int i;
  static char buf[80];
  for (i = 0; i < MD5_DIGEST_LENGTH; i++)
    snprintf(buf + i * 2, sizeof(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    1180 <pt+0x70>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
lea    0x2efc(%rip),%rdi
add    %rax,%rdi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
movslq %eax,%rcx
mov    $0x50,%eax
sub    %rcx,%rax
mov    %eax,%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
lea    0xe97(%rip),%rdx
movzbl (%rax,%rcx,1),%ecx
call   1030 <snprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <pt+0x13>
lea    0x2eb9(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2ebe(%rip),%r12
cmpl   $0x0,(%r12)
jle    1178 <pt+0x68>
mov    %rdi,%r14
mov    $0x50,%r13d
lea    0x2f07(%rip),%rbx
xor    %ebp,%ebp
lea    0xebe(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r14,%rbp,1),%ecx
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r15,%rdx
call   1030 <snprintf@plt>
add    $0x1,%rbp
movslq (%r12),%rax
add    $0xfffffffe,%r13d
add    $0x2,%rbx
cmp    %rax,%rbp
jl     1150 <pt+0x40>
lea    0x2ec1(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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 = %24, %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 %27
8: ; preds = %4
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pt.buf, i64 0, i64 0), i64 %11
%13 = load i32, i32* %3
%14 = mul nsw i32 %13, 2
%15 = sext i32 %14 to i64
%16 = sub i64 80, %15
%17 = trunc i64 %16 to i32
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @snprintf(i8* %12, i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %22)
br label %24
24: ; preds = %8
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %4
27: ; 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 %17
4: ; preds = %1, %4
%5 = phi i64 [ %13, %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 = trunc i64 %6 to i32
%11 = sub i32 80, %10
%12 = tail call i32 @snprintf(i8* %7, i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %9)
%13 = add nuw nsw i64 %5, 1
%14 = load i32, i32* @MD5_DIGEST_LENGTH
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
br i1 %16, label %4, label %17
17: ; preds = %4, %1
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pt.buf, i64 0, i64 0)
}