#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*/ util_byte_to_hex(char *, unsigned char);
void util_dword_to_hex(char *dst, unsigned long long dw) {
  unsigned char byte;
  byte = (unsigned char)((dw >> 56) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)((dw >> 48) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)((dw >> 40) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)((dw >> 32) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)((dw >> 24) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)((dw >> 16) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)((dw >> 8) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)(dw & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  *dst = 0;
}


x86 assembly (clang, -O0):
<util_dword_to_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x38,%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x30,%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x28,%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x20,%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_dword_to_hex>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsi,%r14
shr    $0x38,%rsi
call   1030 <util_byte_to_hex@plt>
lea    0x2(%rbx),%rdi
mov    %r14,%rax
shr    $0x30,%rax
movzbl %al,%esi
call   1030 <util_byte_to_hex@plt>
lea    0x4(%rbx),%rdi
mov    %r14,%rax
shr    $0x28,%rax
movzbl %al,%esi
call   1030 <util_byte_to_hex@plt>
lea    0x6(%rbx),%rdi
mov    %r14,%rax
shr    $0x20,%rax
movzbl %al,%esi
call   1030 <util_byte_to_hex@plt>
lea    0x8(%rbx),%rdi
mov    %r14d,%eax
shr    $0x18,%eax
mov    %eax,%esi
call   1030 <util_byte_to_hex@plt>
lea    0xa(%rbx),%rdi
mov    %r14d,%eax
shr    $0x10,%eax
movzbl %al,%esi
call   1030 <util_byte_to_hex@plt>
lea    0xc(%rbx),%rdi
mov    %r14,%rax
movzbl %ah,%esi
call   1030 <util_byte_to_hex@plt>
lea    0xe(%rbx),%rdi
movzbl %r14b,%esi
call   1030 <util_byte_to_hex@plt>
movb   $0x0,0x10(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @util_dword_to_hex(i8* %0, i64 %1) {
%3 = lshr i64 %1, 56
%4 = trunc i64 %3 to i8
%5 = tail call i32 @util_byte_to_hex(i8* %0, i8 zeroext %4)
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = lshr i64 %1, 48
%8 = trunc i64 %7 to i8
%9 = tail call i32 @util_byte_to_hex(i8* %6, i8 zeroext %8)
%10 = getelementptr inbounds i8, i8* %0, i64 4
%11 = lshr i64 %1, 40
%12 = trunc i64 %11 to i8
%13 = tail call i32 @util_byte_to_hex(i8* %10, i8 zeroext %12)
%14 = getelementptr inbounds i8, i8* %0, i64 6
%15 = lshr i64 %1, 32
%16 = trunc i64 %15 to i8
%17 = tail call i32 @util_byte_to_hex(i8* %14, i8 zeroext %16)
%18 = getelementptr inbounds i8, i8* %0, i64 8
%19 = lshr i64 %1, 24
%20 = trunc i64 %19 to i8
%21 = tail call i32 @util_byte_to_hex(i8* %18, i8 zeroext %20)
%22 = getelementptr inbounds i8, i8* %0, i64 10
%23 = lshr i64 %1, 16
%24 = trunc i64 %23 to i8
%25 = tail call i32 @util_byte_to_hex(i8* %22, i8 zeroext %24)
%26 = getelementptr inbounds i8, i8* %0, i64 12
%27 = lshr i64 %1, 8
%28 = trunc i64 %27 to i8
%29 = tail call i32 @util_byte_to_hex(i8* %26, i8 zeroext %28)
%30 = getelementptr inbounds i8, i8* %0, i64 14
%31 = trunc i64 %1 to i8
%32 = tail call i32 @util_byte_to_hex(i8* %30, i8 zeroext %31)
%33 = getelementptr inbounds i8, i8* %0, i64 16
store i8 0, i8* %33
ret void
}