#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 dump_data(const void *buf, size_t len, const char *header) {
  size_t i;
  printf("%s:", header);
  for (i = 0; i < len / sizeof(unsigned int); i++) {
    if (i % 4 == 0)
      printf("\n\t");
    printf(" %08x", ((unsigned int *)buf)[i]);
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<dump_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x2,%rcx
cmp    %rcx,%rax
jae    119d <dump_data+0x8d>
mov    -0x20(%rbp),%rax
and    $0x3,%rax
cmp    $0x0,%rax
jne    1173 <dump_data+0x63>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113e <dump_data+0x2e>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_data>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r13
mov    %rdi,%r14
lea    0xeca(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x4,%r13
jae    115b <dump_data+0x3b>
lea    0xec0(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <puts@plt>
shr    $0x2,%r13
lea    0xe9e(%rip),%r15
lea    0xe9a(%rip),%r12
xor    %ebx,%ebx
jmp    1197 <dump_data+0x77>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
je     1146 <dump_data+0x26>
test   $0x3,%bl
jne    1180 <dump_data+0x60>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <dump_data+0x60>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s:\00"
@.str.1 = [3 x i8] c"\0A\09\00"
@.str.2 = [6 x i8] c" %08x\00"
@str = [2 x i8] c"\0A\00"
define void @dump_data(i8* nocapture %0, i64 %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = icmp ult i64 %1, 4
br i1 %5, label %21, label %6
6: ; preds = %3
%7 = lshr i64 %1, 2
%8 = bitcast i8* %0 to i32*
br label %9
9: ; preds = %6, %15
%10 = phi i64 [ 0, %6 ], [ %19, %15 ]
%11 = and i64 %10, 3
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = getelementptr inbounds i32, i32* %8, i64 %10
%17 = load i32, i32* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = add nuw nsw i64 %10, 1
%20 = icmp eq i64 %19, %7
br i1 %20, label %21, label %9
21: ; preds = %15, %3
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}