#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*/
snprintf(char *, int, char *, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const,
         unsigned char const, unsigned char const, unsigned char const);
char *ConvertHash(const unsigned char *hash, int size, char *result) {
  int tlen;
  char *start;
  start = result;
  result += snprintf(result, size * 2 + 1,
                     "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%"
                     "02x%02x%02x%02x%02x%02x",
                     hash[0], hash[1], hash[2], hash[3], hash[4], hash[5],
                     hash[6], hash[7], hash[8], hash[9], hash[10], hash[11],
                     hash[12], hash[13], hash[14], hash[15], hash[16], hash[17],
                     hash[18], hash[19]);
  *result = '\0';
  return start;
}


x86 assembly (clang, -O0):
<ConvertHash>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rdi,-0x30(%rbp)
mov    %esi,-0x34(%rbp)
mov    %rdx,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%esi
shl    $0x1,%esi
add    $0x1,%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%r8b
mov    -0x30(%rbp),%rax
mov    0x2(%rax),%r9b
mov    -0x30(%rbp),%rax
mov    0x3(%rax),%al
mov    -0x30(%rbp),%rdx
mov    0x4(%rdx),%dl
mov    %dl,-0x60(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x5(%rdx),%dl
mov    %dl,-0x5f(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x6(%rdx),%dl
mov    %dl,-0x5e(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x7(%rdx),%dl
mov    %dl,-0x5d(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x8(%rdx),%dl
mov    %dl,-0x5c(%rbp)
mov    -0x30(%rbp),%rdx
mov    0x9(%rdx),%dl
mov    %dl,-0x5b(%rbp)
mov    -0x30(%rbp),%rdx
mov    0xa(%rdx),%dl
mov    %dl,-0x5a(%rbp)
mov    -0x30(%rbp),%rdx
mov    0xb(%rdx),%dl
mov    %dl,-0x59(%rbp)
mov    -0x30(%rbp),%rdx
mov    0xc(%rdx),%r13b
mov    -0x30(%rbp),%rdx
mov    0xd(%rdx),%r12b
mov    -0x30(%rbp),%rdx
mov    0xe(%rdx),%r15b
mov    -0x30(%rbp),%rdx
mov    0xf(%rdx),%r14b
mov    -0x30(%rbp),%rdx
mov    0x10(%rdx),%bl
mov    -0x30(%rbp),%rdx
mov    0x11(%rdx),%r11b
mov    -0x30(%rbp),%rdx
mov    0x12(%rdx),%r10b
mov    -0x30(%rbp),%rdx
mov    %rdx,-0x58(%rbp)
lea    0xe09(%rip),%rdx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %al,%eax
mov    %eax,(%rsp)
mov    -0x60(%rbp),%al
movzbl %al,%eax
mov    %eax,0x8(%rsp)
mov    -0x5f(%rbp),%al
movzbl %al,%eax
mov    %eax,0x10(%rsp)
mov    -0x5e(%rbp),%al
movzbl %al,%eax
mov    %eax,0x18(%rsp)
mov    -0x5d(%rbp),%al
movzbl %al,%eax
mov    %eax,0x20(%rsp)
mov    -0x5c(%rbp),%al
movzbl %al,%eax
mov    %eax,0x28(%rsp)
mov    -0x5b(%rbp),%al
movzbl %al,%eax
mov    %eax,0x30(%rsp)
mov    -0x5a(%rbp),%al
movzbl %al,%eax
mov    %eax,0x38(%rsp)
mov    -0x59(%rbp),%al
movzbl %al,%eax
mov    %eax,0x40(%rsp)
mov    -0x58(%rbp),%rax
movzbl %r13b,%r13d
mov    %r13d,0x48(%rsp)
movzbl %r12b,%r12d
mov    %r12d,0x50(%rsp)
movzbl %r15b,%r15d
mov    %r15d,0x58(%rsp)
movzbl %r14b,%r14d
mov    %r14d,0x60(%rsp)
movzbl %bl,%ebx
mov    %ebx,0x68(%rsp)
movzbl %r11b,%r11d
mov    %r11d,0x70(%rsp)
movzbl %r10b,%r10d
mov    %r10d,0x78(%rsp)
movzbl 0x13(%rax),%eax
mov    %eax,0x80(%rsp)
call   1030 <snprintf@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x50(%rbp),%rax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertHash>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r12
lea    0x1(%rsi,%rsi,1),%esi
movzbl (%rdi),%ecx
movzbl 0x1(%rdi),%r8d
movzbl 0x2(%rdi),%r9d
movzbl 0x3(%rdi),%eax
mov    %rax,0x40(%rsp)
movzbl 0x4(%rdi),%eax
mov    %rax,0x38(%rsp)
movzbl 0x5(%rdi),%eax
mov    %rax,0x30(%rsp)
movzbl 0x6(%rdi),%eax
mov    %rax,0x28(%rsp)
movzbl 0x7(%rdi),%eax
mov    %rax,0x20(%rsp)
movzbl 0x8(%rdi),%eax
mov    %rax,0x18(%rsp)
movzbl 0x9(%rdi),%eax
mov    %rax,0x10(%rsp)
movzbl 0xa(%rdi),%eax
mov    %rax,0x8(%rsp)
movzbl 0xb(%rdi),%eax
mov    %rax,(%rsp)
movzbl 0xc(%rdi),%ebp
movzbl 0xd(%rdi),%r13d
movzbl 0xe(%rdi),%r15d
movzbl 0xf(%rdi),%r14d
movzbl 0x10(%rdi),%ebx
movzbl 0x11(%rdi),%r11d
movzbl 0x12(%rdi),%r10d
movzbl 0x13(%rdi),%eax
sub    $0x8,%rsp
lea    0xe4e(%rip),%rdx
mov    %r12,%rdi
push   %rax
push   %r10
push   %r11
push   %rbx
push   %r14
push   %r15
push   %r13
push   %rbp
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
push   0x88(%rsp)
push   0x98(%rsp)
push   0xa8(%rsp)
push   0xb8(%rsp)
push   0xc8(%rsp)
call   1030 <snprintf@plt>
add    $0x90,%rsp
cltq
movb   $0x0,(%r12,%rax,1)
mov    %r12,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [81 x i8] c"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\00"
define i8* @ConvertHash(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
store i8* %9, i8** %8
%10 = load i8*, i8** %6
%11 = load i32, i32* %5
%12 = mul nsw i32 %11, 2
%13 = add nsw i32 %12, 1
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = load i8, i8* %21
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 3
%25 = load i8, i8* %24
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = load i8, i8* %27
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i64 5
%31 = load i8, i8* %30
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i64 6
%34 = load i8, i8* %33
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 7
%37 = load i8, i8* %36
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i64 8
%40 = load i8, i8* %39
%41 = load i8*, i8** %4
%42 = getelementptr inbounds i8, i8* %41, i64 9
%43 = load i8, i8* %42
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i64 10
%46 = load i8, i8* %45
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i64 11
%49 = load i8, i8* %48
%50 = load i8*, i8** %4
%51 = getelementptr inbounds i8, i8* %50, i64 12
%52 = load i8, i8* %51
%53 = load i8*, i8** %4
%54 = getelementptr inbounds i8, i8* %53, i64 13
%55 = load i8, i8* %54
%56 = load i8*, i8** %4
%57 = getelementptr inbounds i8, i8* %56, i64 14
%58 = load i8, i8* %57
%59 = load i8*, i8** %4
%60 = getelementptr inbounds i8, i8* %59, i64 15
%61 = load i8, i8* %60
%62 = load i8*, i8** %4
%63 = getelementptr inbounds i8, i8* %62, i64 16
%64 = load i8, i8* %63
%65 = load i8*, i8** %4
%66 = getelementptr inbounds i8, i8* %65, i64 17
%67 = load i8, i8* %66
%68 = load i8*, i8** %4
%69 = getelementptr inbounds i8, i8* %68, i64 18
%70 = load i8, i8* %69
%71 = load i8*, i8** %4
%72 = getelementptr inbounds i8, i8* %71, i64 19
%73 = load i8, i8* %72
%74 = call i32 @snprintf(i8* %10, i32 %13, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8 zeroext %16, i8 zeroext %19, i8 zeroext %22, i8 zeroext %25, i8 zeroext %28, i8 zeroext %31, i8 zeroext %34, i8 zeroext %37, i8 zeroext %40, i8 zeroext %43, i8 zeroext %46, i8 zeroext %49, i8 zeroext %52, i8 zeroext %55, i8 zeroext %58, i8 zeroext %61, i8 zeroext %64, i8 zeroext %67, i8 zeroext %70, i8 zeroext %73)
%75 = load i8*, i8** %6
%76 = sext i32 %74 to i64
%77 = getelementptr inbounds i8, i8* %75, i64 %76
store i8* %77, i8** %6
%78 = load i8*, i8** %6
store i8 0, i8* %78
%79 = load i8*, i8** %8
ret i8* %79
}

LLVM IR (-O2):
@.str = [81 x i8] c"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\00"
define i8* @ConvertHash(i8* nocapture %0, i32 %1, i8* returned %2) {
%4 = shl nsw i32 %1, 1
%5 = or i32 %4, 1
%6 = load i8, i8* %0
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %0, i64 3
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 4
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8, i8* %0, i64 5
%16 = load i8, i8* %15
%17 = getelementptr inbounds i8, i8* %0, i64 6
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %0, i64 7
%20 = load i8, i8* %19
%21 = getelementptr inbounds i8, i8* %0, i64 8
%22 = load i8, i8* %21
%23 = getelementptr inbounds i8, i8* %0, i64 9
%24 = load i8, i8* %23
%25 = getelementptr inbounds i8, i8* %0, i64 10
%26 = load i8, i8* %25
%27 = getelementptr inbounds i8, i8* %0, i64 11
%28 = load i8, i8* %27
%29 = getelementptr inbounds i8, i8* %0, i64 12
%30 = load i8, i8* %29
%31 = getelementptr inbounds i8, i8* %0, i64 13
%32 = load i8, i8* %31
%33 = getelementptr inbounds i8, i8* %0, i64 14
%34 = load i8, i8* %33
%35 = getelementptr inbounds i8, i8* %0, i64 15
%36 = load i8, i8* %35
%37 = getelementptr inbounds i8, i8* %0, i64 16
%38 = load i8, i8* %37
%39 = getelementptr inbounds i8, i8* %0, i64 17
%40 = load i8, i8* %39
%41 = getelementptr inbounds i8, i8* %0, i64 18
%42 = load i8, i8* %41
%43 = getelementptr inbounds i8, i8* %0, i64 19
%44 = load i8, i8* %43
%45 = tail call i32 @snprintf(i8* %2, i32 %5, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8 zeroext %6, i8 zeroext %8, i8 zeroext %10, i8 zeroext %12, i8 zeroext %14, i8 zeroext %16, i8 zeroext %18, i8 zeroext %20, i8 zeroext %22, i8 zeroext %24, i8 zeroext %26, i8 zeroext %28, i8 zeroext %30, i8 zeroext %32, i8 zeroext %34, i8 zeroext %36, i8 zeroext %38, i8 zeroext %40, i8 zeroext %42, i8 zeroext %44)
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %2, i64 %46
store i8 0, i8* %47
ret i8* %2
}