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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void hexdump_8b(unsigned int start, uint64_t *data, unsigned int len) {
  int i;
  while (len) {
    printf("0x%08x:", start);
    for (i = 0; i < 4 && len; ++i, --len)
      printf(" %016llx", (unsigned long long)*data++);
    printf("\n");
    start += 32;
  }
}


x86 assembly (clang, -O0):
<hexdump_8b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11c0 <hexdump_8b+0xb0>
mov    -0x4(%rbp),%esi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x4,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jge    115d <hexdump_8b+0x4d>
cmpl   $0x0,-0x14(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    116d <hexdump_8b+0x5d>
jmp    11a4 <hexdump_8b+0x94>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movslq (%rax),%rsi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <hexdump_8b+0x34>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1122 <hexdump_8b+0x12>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexdump_8b>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
je     119d <hexdump_8b+0x7d>
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%r12d
lea    0xec9(%rip),%rbp
nop
lea    0xeb9(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x1(%r14),%r13d
cmp    $0x3,%r13d
mov    $0x3,%eax
cmovae %eax,%r13d
add    $0x1,%r13
xor    %r15d,%r15d
nopl   0x0(%rax)
movslq (%rbx),%rsi
add    $0x4,%rbx
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15d,%r13d
jne    1170 <hexdump_8b+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%r12d
sub    %r15d,%r14d
jne    1140 <hexdump_8b+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"0x%08x:\00"
@.str.1 = [9 x i8] c" %016llx\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @hexdump_8b(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
br label %8
8: ; preds = %33, %3
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %37
11: ; preds = %8
%12 = load i32, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 0, i32* %7
br label %14
14: ; preds = %28, %11
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %6
%19 = icmp ne i32 %18, 0
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br i1 %21, label %22, label %33
22: ; preds = %20
%23 = load i32*, i32** %5
%24 = getelementptr inbounds i32, i32* %23, i32 1
store i32* %24, i32** %5
%25 = load i32, i32* %23
%26 = sext i32 %25 to i64
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %26)
br label %28
28: ; preds = %22
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
%31 = load i32, i32* %6
%32 = add i32 %31, -1
store i32 %32, i32* %6
br label %14
33: ; preds = %20
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = load i32, i32* %4
%36 = add i32 %35, 32
store i32 %36, i32* %4
br label %8
37: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"0x%08x:\00"
@.str.1 = [9 x i8] c" %016llx\00"
define void @hexdump_8b(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %27, label %5
5: ; preds = %3, %23
%6 = phi i32 [ %21, %23 ], [ %2, %3 ]
%7 = phi i32* [ %16, %23 ], [ %1, %3 ]
%8 = phi i32 [ %25, %23 ], [ %0, %3 ]
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add i32 %6, -1
%11 = call i32 @llvm.umin.i32(i32 %10, i32 3)
br label %12
12: ; preds = %5, %12
%13 = phi i32 [ 0, %5 ], [ %20, %12 ]
%14 = phi i32 [ %6, %5 ], [ %21, %12 ]
%15 = phi i32* [ %7, %5 ], [ %16, %12 ]
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %15
%18 = sext i32 %17 to i64
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %18)
%20 = add nuw nsw i32 %13, 1
%21 = add i32 %14, -1
%22 = icmp eq i32 %13, %11
br i1 %22, label %23, label %12
23: ; preds = %12
%24 = tail call i32 @putchar(i32 10)
%25 = add i32 %8, 32
%26 = icmp eq i32 %21, 0
br i1 %26, label %27, label %5
27: ; preds = %23, %3
ret void
}