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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void displayByteString(FILE *f, const char *synopsis, const unsigned char *data,
                       unsigned int length) {
  unsigned int i;
  fprintf(f, "%s:", synopsis);
  for (i = 0; i < length; i++)
    fprintf(f, " %02x", (unsigned int)data[i]);
  fprintf(f, "\n");
}


x86 assembly (clang, -O0):
<displayByteString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    117b <displayByteString+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1144 <displayByteString+0x34>
mov    -0x8(%rbp),%rdi
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayByteString>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%rdx
mov    %rdi,%r12
lea    0xec6(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %ebp,%ebp
je     116b <displayByteString+0x4b>
mov    %ebp,%ebp
lea    0xeb6(%rip),%r15
xor    %ebx,%ebx
movzbl (%r14,%rbx,1),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <displayByteString+0x30>
mov    $0xa,%edi
mov    %r12,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s:\00"
@.str.1 = [6 x i8] c" %02x\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @displayByteString(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32*, i32** %5
%11 = load i8*, i8** %6
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 0, i32* %9
br label %13
13: ; preds = %26, %4
%14 = load i32, i32* %9
%15 = load i32, i32* %8
%16 = icmp ult i32 %14, %15
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = load i32*, i32** %5
%19 = load i8*, i8** %7
%20 = load i32, i32* %9
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %17
%27 = load i32, i32* %9
%28 = add i32 %27, 1
store i32 %28, i32* %9
br label %13
29: ; preds = %13
%30 = load i32*, i32** %5
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s:\00"
@.str.1 = [6 x i8] c" %02x\00"
define void @displayByteString(i32* nocapture %0, i8* %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = icmp eq i32 %3, 0
br i1 %6, label %17, label %7
7: ; preds = %4
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %15, %9 ]
%11 = getelementptr inbounds i8, i8* %2, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %4
%18 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}