#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_word_to_hex(char *dst, unsigned int w) {
  unsigned char byte;
  byte = (unsigned char)((w >> 24) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)((w >> 16) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)((w >> 8) & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  byte = (unsigned char)(w & 0xff);
  util_byte_to_hex(dst, byte);
  dst += 2;
  *dst = 0;
}


x86 assembly (clang, -O0):
<util_word_to_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0xd(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0xd(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0xd(%rbp),%esi
call   1030 <util_byte_to_hex@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0xd(%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    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_word_to_hex>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %esi,%eax
mov    %esi,%ebp
shr    $0x18,%eax
mov    %eax,%esi
call   1030 <util_byte_to_hex@plt>
lea    0x2(%rbx),%rdi
mov    %ebp,%eax
shr    $0x10,%eax
movzbl %al,%esi
call   1030 <util_byte_to_hex@plt>
lea    0x4(%rbx),%rdi
mov    %ebp,%eax
movzbl %ah,%esi
call   1030 <util_byte_to_hex@plt>
lea    0x6(%rbx),%rdi
movzbl %bpl,%esi
call   1030 <util_byte_to_hex@plt>
movb   $0x0,0x8(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @util_word_to_hex(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = lshr i32 %6, 24
%8 = and i32 %7, 255
%9 = trunc i32 %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 i32, i32* %4
%16 = lshr i32 %15, 16
%17 = and i32 %16, 255
%18 = trunc i32 %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 i32, i32* %4
%25 = lshr i32 %24, 8
%26 = and i32 %25, 255
%27 = trunc i32 %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 i32, i32* %4
%34 = and i32 %33, 255
%35 = trunc i32 %34 to i8
store i8 %35, i8* %5
%36 = load i8*, i8** %3
%37 = load i8, i8* %5
%38 = call i32 @util_byte_to_hex(i8* %36, i8 zeroext %37)
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i64 2
store i8* %40, i8** %3
%41 = load i8*, i8** %3
store i8 0, i8* %41
ret void
}

LLVM IR (-O2):
define void @util_word_to_hex(i8* %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = trunc i32 %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 i32 %1, 16
%8 = trunc i32 %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 i32 %1, 8
%12 = trunc i32 %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 = trunc i32 %1 to i8
%16 = tail call i32 @util_byte_to_hex(i8* %14, i8 zeroext %15)
%17 = getelementptr inbounds i8, i8* %0, i64 8
store i8 0, i8* %17
ret void
}