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


x86 assembly (clang, -O0):
<Diss_WriteHexByte>:
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    $0x4,%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
and    $0xf,%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)
mov    -0x8(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @Diss_WriteHexByte(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, 4
%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 = and i32 %17, 15
%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** %3
%25 = getelementptr inbounds i8, i8* %24, i64 3
store i8* %25, i8** %3
%26 = load i8*, i8** %3
ret i8* %26
}

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