#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 */
char Diss_GetHexDigitAsChar(unsigned char);
char *Diss_WriteHexWord(char *pString, unsigned char Value) {
  unsigned char HexDigit;
  pString[0] = '#';
  HexDigit = Value >> 12;
  pString[1] = Diss_GetHexDigitAsChar(HexDigit);
  HexDigit = Value >> 8;
  pString[2] = Diss_GetHexDigitAsChar(HexDigit);
  HexDigit = Value >> 4;
  pString[3] = Diss_GetHexDigitAsChar(HexDigit);
  HexDigit = Value;
  pString[4] = Diss_GetHexDigitAsChar(HexDigit);
  pString += 5;
  return pString;
}


x86 assembly (clang, -O0):
<Diss_WriteHexWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x23,(%rax)
movzbl -0x9(%rbp),%eax
sar    $0xc,%eax
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%edi
call   1030 <Diss_GetHexDigitAsChar@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
movzbl -0x9(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%edi
call   1030 <Diss_GetHexDigitAsChar@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
movzbl -0x9(%rbp),%eax
sar    $0x4,%eax
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%edi
call   1030 <Diss_GetHexDigitAsChar@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x9(%rbp),%al
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%edi
call   1030 <Diss_GetHexDigitAsChar@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x8(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Diss_WriteHexWord>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
movb   $0x23,(%rdi)
xor    %edi,%edi
call   1030 <Diss_GetHexDigitAsChar@plt>
mov    %al,0x1(%rbx)
xor    %edi,%edi
call   1030 <Diss_GetHexDigitAsChar@plt>
mov    %al,0x2(%rbx)
mov    %ebp,%eax
shr    $0x4,%al
movzbl %al,%edi
call   1030 <Diss_GetHexDigitAsChar@plt>
mov    %al,0x3(%rbx)
mov    %ebp,%edi
call   1030 <Diss_GetHexDigitAsChar@plt>
mov    %al,0x4(%rbx)
add    $0x5,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @Diss_WriteHexWord(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 35, i8* %7
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = ashr i32 %9, 12
%11 = trunc i32 %10 to i8
store i8 %11, i8* %5
%12 = load i8, i8* %5
%13 = call signext i8 @Diss_GetHexDigitAsChar(i8 zeroext %12)
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %13, i8* %15
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = ashr i32 %17, 8
%19 = trunc i32 %18 to i8
store i8 %19, i8* %5
%20 = load i8, i8* %5
%21 = call signext i8 @Diss_GetHexDigitAsChar(i8 zeroext %20)
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 2
store i8 %21, i8* %23
%24 = load i8, i8* %4
%25 = zext i8 %24 to i32
%26 = ashr i32 %25, 4
%27 = trunc i32 %26 to i8
store i8 %27, i8* %5
%28 = load i8, i8* %5
%29 = call signext i8 @Diss_GetHexDigitAsChar(i8 zeroext %28)
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 3
store i8 %29, i8* %31
%32 = load i8, i8* %4
store i8 %32, i8* %5
%33 = load i8, i8* %5
%34 = call signext i8 @Diss_GetHexDigitAsChar(i8 zeroext %33)
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i64 4
store i8 %34, i8* %36
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i64 5
store i8* %38, i8** %3
%39 = load i8*, i8** %3
ret i8* %39
}

LLVM IR (-O2):
define i8* @Diss_WriteHexWord(i8* writeonly %0, i8 zeroext %1) {
store i8 35, i8* %0
%3 = tail call signext i8 @Diss_GetHexDigitAsChar(i8 zeroext 0)
%4 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %3, i8* %4
%5 = tail call signext i8 @Diss_GetHexDigitAsChar(i8 zeroext 0)
%6 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %5, i8* %6
%7 = lshr i8 %1, 4
%8 = tail call signext i8 @Diss_GetHexDigitAsChar(i8 zeroext %7)
%9 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %8, i8* %9
%10 = tail call signext i8 @Diss_GetHexDigitAsChar(i8 zeroext %1)
%11 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %10, i8* %11
%12 = getelementptr inbounds i8, i8* %0, i64 5
ret i8* %12
}