#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*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ hex_2_ascii(unsigned char *, char *, unsigned int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ output(char const *);
void klogBin(const char *description, unsigned char *bindata,
             unsigned int binlen) {
  char buffer[512];
  memset(buffer, 0, sizeof(buffer));
  hex_2_ascii(bindata, buffer, binlen);
  output(description);
  output("[");
  output(buffer);
  output("]\r\n");
}


x86 assembly (clang, -O0):
<klogBin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
lea    -0x220(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <hex_2_ascii@plt>
mov    -0x8(%rbp),%rdi
call   1030 <output@plt>
lea    0xe84(%rip),%rdi
call   1030 <output@plt>
lea    -0x220(%rbp),%rdi
call   1030 <output@plt>
lea    0xe6e(%rip),%rdi
call   1030 <output@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<klogBin>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <hex_2_ascii@plt>
mov    %r14,%rdi
call   1030 <output@plt>
lea    0xe8d(%rip),%rdi
call   1030 <output@plt>
mov    %r15,%rdi
call   1030 <output@plt>
lea    0xe7b(%rip),%rdi
call   1030 <output@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"[\00"
@.str.1 = [4 x i8] c"]\0D\0A\00"
define void @klogBin(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [512 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 512)
%10 = load i8*, i8** %5
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%12 = load i32, i32* %6
%13 = call i32 @hex_2_ascii(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %4
%15 = call i32 @output(i8* %14)
%16 = call i32 @output(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%18 = call i32 @output(i8* %17)
%19 = call i32 @output(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"[\00"
@.str.1 = [4 x i8] c"]\0D\0A\00"
define void @klogBin(i8* %0, i8* %1, i32 %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 512)
%7 = call i32 @hex_2_ascii(i8* %1, i8* %5, i32 %2)
%8 = call i32 @output(i8* %0)
%9 = call i32 @output(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @output(i8* %5)
%11 = call i32 @output(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}