#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*/ sprintf(char *, char *, unsigned char);
void mls_type_data_uint_to_str(char *outstr, unsigned int inb) {
  int i, size = 4;
  for (i = 0; i < size; i++) {
    unsigned char byte;
    byte = (unsigned char)((inb >> ((size - i - 1) * 8)) & (unsigned char)0xff);
    sprintf(outstr, "%02X", byte);
    outstr += 2;
  }
}


x86 assembly (clang, -O0):
<mls_type_data_uint_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1180 <mls_type_data_uint_to_str+0x70>
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x10(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x3,%ecx
shr    %cl,%eax
and    $0xff,%eax
mov    %al,-0x15(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea3(%rip),%rsi
movzbl -0x15(%rbp),%edx
call   1030 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <mls_type_data_uint_to_str+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mls_type_data_uint_to_str>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edx
mov    %esi,%ebp
shr    $0x18,%edx
lea    0xedb(%rip),%r14
mov    %r14,%rsi
call   1030 <sprintf@plt>
lea    0x2(%rbx),%rdi
mov    %ebp,%eax
shr    $0x10,%eax
movzbl %al,%edx
mov    %r14,%rsi
call   1030 <sprintf@plt>
lea    0x4(%rbx),%rdi
mov    %ebp,%eax
movzbl %ah,%edx
mov    %r14,%rsi
call   1030 <sprintf@plt>
add    $0x6,%rbx
movzbl %bpl,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02X\00"
define void @mls_type_data_uint_to_str(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 4, i32* %6
store i32 0, i32* %5
br label %8
8: ; preds = %27, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %30
12: ; preds = %8
%13 = load i32, i32* %4
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = sub nsw i32 %14, %15
%17 = sub nsw i32 %16, 1
%18 = mul nsw i32 %17, 8
%19 = lshr i32 %13, %18
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8*, i8** %3
%23 = load i8, i8* %7
%24 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %23)
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 2
store i8* %26, i8** %3
br label %27
27: ; preds = %12
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %8
30: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02X\00"
define void @mls_type_data_uint_to_str(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = trunc i32 %3 to i8
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 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 @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), 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 @sprintf(i8* dereferenceable(1) %10, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %12)
%14 = getelementptr inbounds i8, i8* %0, i64 6
%15 = trunc i32 %1 to i8
%16 = tail call i32 @sprintf(i8* dereferenceable(1) %14, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %15)
ret void
}