#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*/ printf(char *, ...);
void bfd_dump_data(unsigned char *d, unsigned int len) {
  unsigned int i;
  for (i = 0; i < len; i++) {
    if ((i & 0xf) == 0)
      printf("%u\t ", i);
    printf("%02x", d[i]);
    if ((i & 0xf) == 0xf)
      printf("\n");
    else if ((i & 0x7) == 0x7)
      printf("   ");
    else
      printf(" ");
  }
  if ((i & 0xf) != 0x0)
    printf("\n");
}


x86 assembly (clang, -O0):
<bfd_dump_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11d5 <bfd_dump_data+0xc5>
mov    -0x10(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    1152 <bfd_dump_data+0x42>
mov    -0x10(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movzbl (%rax,%rcx,1),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jne    118d <bfd_dump_data+0x7d>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <bfd_dump_data+0xb2>
mov    -0x10(%rbp),%eax
and    $0x7,%eax
cmp    $0x7,%eax
jne    11af <bfd_dump_data+0x9f>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <bfd_dump_data+0xad>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <bfd_dump_data+0xb2>
jmp    11c7 <bfd_dump_data+0xb7>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <bfd_dump_data+0x16>
mov    -0x10(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
je     11f2 <bfd_dump_data+0xe2>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bfd_dump_data>:
test   %esi,%esi
je     11de <bfd_dump_data+0xbe>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %esi,0x4(%rsp)
mov    %esi,%r14d
lea    0xebc(%rip),%r15
lea    0xeba(%rip),%r13
xor    %ebp,%ebp
jmp    1167 <bfd_dump_data+0x47>
nop
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
je     11be <bfd_dump_data+0x9e>
mov    %ebp,%r12d
and    $0xf,%r12d
je     1190 <bfd_dump_data+0x70>
movzbl (%rbx,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xf,%r12d
jne    11aa <bfd_dump_data+0x8a>
mov    $0xa,%edi
jmp    11b7 <bfd_dump_data+0x97>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl (%rbx,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
not    %eax
test   $0x7,%al
je     1150 <bfd_dump_data+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    115e <bfd_dump_data+0x3e>
testb  $0xf,0x4(%rsp)
lea    0x8(%rsp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
je     11de <bfd_dump_data+0xbe>
mov    $0xa,%edi
jmp    1030 <putchar@plt>
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%u\09 \00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c" \00"
@.str.4 = [2 x i8] c" \00"
define void @bfd_dump_data(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %40, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %43
10: ; preds = %6
%11 = load i32, i32* %5
%12 = and i32 %11, 15
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %10
%18 = load i8*, i8** %3
%19 = load i32, i32* %5
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %5
%26 = and i32 %25, 15
%27 = icmp eq i32 %26, 15
br i1 %27, label %28, label %30
28: ; preds = %17
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
30: ; preds = %17
%31 = load i32, i32* %5
%32 = and i32 %31, 7
%33 = icmp eq i32 %32, 7
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %38
36: ; preds = %30
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36, %34
br label %39
39: ; preds = %38, %28
br label %40
40: ; preds = %39
%41 = load i32, i32* %5
%42 = add i32 %41, 1
store i32 %42, i32* %5
br label %6
43: ; preds = %6
%44 = load i32, i32* %5
%45 = and i32 %44, 15
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %49
49: ; preds = %47, %43
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%u\09 \00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.3 = [4 x i8] c" \00"
define void @bfd_dump_data(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %40, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %32
%7 = phi i64 [ 0, %4 ], [ %33, %32 ]
%8 = trunc i64 %7 to i32
%9 = and i32 %8, 15
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%13 = getelementptr inbounds i8, i8* %0, i64 %7
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %25
17: ; preds = %6
%18 = getelementptr inbounds i8, i8* %0, i64 %7
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = icmp eq i32 %9, 15
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = tail call i32 @putchar(i32 10)
br label %32
25: ; preds = %11, %17
%26 = and i32 %8, 7
%27 = icmp eq i32 %26, 7
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %32
30: ; preds = %25
%31 = tail call i32 @putchar(i32 32)
br label %32
32: ; preds = %23, %30, %28
%33 = add nuw nsw i64 %7, 1
%34 = icmp eq i64 %33, %5
br i1 %34, label %35, label %6
35: ; preds = %32
%36 = and i32 %1, 15
%37 = icmp eq i32 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %35
%39 = tail call i32 @putchar(i32 10)
br label %40
40: ; preds = %2, %38, %35
ret void
}