#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*/ lprintf(int, char *, ...);
void dump_end(unsigned char *data, int length) {
  if (length <= 0)
    return;
  for (; length > 0; length--, data++)
    lprintf(13, " %02x", *data);
  lprintf(13, "\n");
}


x86 assembly (clang, -O0):
<dump_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     112e <dump_end+0x1e>
jmp    1184 <dump_end+0x74>
jmp    1133 <dump_end+0x23>
cmpl   $0x0,-0xc(%rbp)
jle    1171 <dump_end+0x61>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
mov    $0xd,%edi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <lprintf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1133 <dump_end+0x23>
mov    $0xd,%edi
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1030 <lprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_end>:
test   %esi,%esi
jle    1165 <dump_end+0x55>
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
lea    0xed9(%rip),%r14
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%edx
mov    $0xd,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <lprintf@plt>
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1130 <dump_end+0x20>
lea    0xeb1(%rip),%rsi
mov    $0xd,%edi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <lprintf@plt>
ret

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

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