#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 ilog10(int);
int /*<<< orphan*/ printf(char *, ...);
void dump(const void *m, int size) {
  const unsigned *p = m;
  int i, j;
  int w = ilog10(size) + 1;
  for (i = 0; i < size; i += 16) {
    printf("%*d:", w, i);
    for (j = 0; j < 16 && i + j < size; j += 4)
      printf(" %08x", p[(i + j) / 4]);
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <ilog10@plt>
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fb <dump+0xdb>
mov    -0x24(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x10,-0x20(%rbp)
mov    %al,-0x25(%rbp)
jge    1191 <dump+0x71>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11a1 <dump+0x81>
jmp    11df <dump+0xbf>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x20(%rbp)
jmp    1173 <dump+0x53>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <dump+0x2c>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
call   1040 <ilog10@plt>
test   %ebx,%ebx
jle    1201 <dump+0xd1>
mov    %eax,%r13d
add    $0x1,%r13d
mov    %ebx,%r12d
lea    0xea0(%rip),%r15
xor    %ebp,%ebp
jmp    1182 <dump+0x52>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rbp
cmp    %ebx,%ebp
jge    1201 <dump+0xd1>
mov    %r15,%rdi
mov    %r13d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r12,%rbp
jge    1170 <dump+0x40>
mov    (%r14,%rbp,1),%esi
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rbp),%rax
cmp    %r12,%rax
jge    1170 <dump+0x40>
mov    0x4(%r14,%rbp,1),%esi
lea    0xe48(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rbp),%rax
cmp    %r12,%rax
jge    1170 <dump+0x40>
mov    0x8(%r14,%rbp,1),%esi
lea    0xe2c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rbp),%rax
cmp    %r12,%rax
jge    1170 <dump+0x40>
mov    0xc(%r14,%rbp,1),%esi
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1170 <dump+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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