#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ utl_log_write(int, char const *, int, int, char const *,
                                 char const *, char *, char *);
int /*<<< orphan*/ utl_str_bin2str_rev(char *, int /*<<< orphan*/ const *,
                                       size_t);
void utl_log_dump_rev(int Pri, const char *pFname, int Line, int Flag,
                      const char *pTag, const char *pFunc, const void *pData,
                      size_t Len) {
  char *p_str = (char *)malloc(Len * 2 + 1);
  utl_str_bin2str_rev(p_str, (const uint8_t *)pData, Len);
  utl_log_write(Pri, pFname, Line, Flag, pTag, pFunc, "%s\n", p_str);
  {
    free(p_str);
    p_str = NULL;
  };
}


x86 assembly (clang, -O0):
<utl_log_dump_rev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    0x18(%rbp),%rdi
shl    $0x1,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    0x18(%rbp),%rdx
call   1040 <utl_str_bin2str_rev@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%rax
lea    0xe55(%rip),%r10
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <utl_log_write@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x30(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utl_log_dump_rev>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %ecx,0x4(%rsp)
mov    %edx,%r13d
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x50(%rsp),%r14
mov    0x58(%rsp),%r15
lea    (%r15,%r15,1),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <utl_str_bin2str_rev@plt>
lea    0xe6d(%rip),%rax
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r13d,%edx
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
push   %r12
push   %rax
call   1060 <utl_log_write@plt>
add    $0x10,%rsp
mov    %r12,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @utl_log_dump_rev(i32 %0, i8* %1, i32 %2, i32 %3, i8* %4, i8* %5, i8* %6, i64 %7) {
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i8*
store i32 %0, i32* %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i8* %6, i8** %15
store i64 %7, i64* %16
%18 = load i64, i64* %16
%19 = mul i64 %18, 2
%20 = add i64 %19, 1
%21 = call i64 @malloc(i64 %20)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %17
%23 = load i8*, i8** %17
%24 = load i8*, i8** %15
%25 = bitcast i8* %24 to i32*
%26 = load i64, i64* %16
%27 = call i32 @utl_str_bin2str_rev(i8* %23, i32* %25, i64 %26)
%28 = load i32, i32* %9
%29 = load i8*, i8** %10
%30 = load i32, i32* %11
%31 = load i32, i32* %12
%32 = load i8*, i8** %13
%33 = load i8*, i8** %14
%34 = load i8*, i8** %17
%35 = call i32 @utl_log_write(i32 %28, i8* %29, i32 %30, i32 %31, i8* %32, i8* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %17
%37 = call i32 @free(i8* %36)
store i8* null, i8** %17
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @utl_log_dump_rev(i32 %0, i8* %1, i32 %2, i32 %3, i8* %4, i8* %5, i8* %6, i64 %7) {
%9 = shl i64 %7, 1
%10 = or i64 %9, 1
%11 = tail call i64 @malloc(i64 %10)
%12 = inttoptr i64 %11 to i8*
%13 = bitcast i8* %6 to i32*
%14 = tail call i32 @utl_str_bin2str_rev(i8* %12, i32* %13, i64 %7)
%15 = tail call i32 @utl_log_write(i32 %0, i8* %1, i32 %2, i32 %3, i8* %4, i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%16 = tail call i32 @free(i8* %12)
ret void
}