#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 dasdview_dump_array(char *name, int size, unsigned char *addr) {
  int i;
  for (i = 0; i < size; i++) {
    if (i % 16 == 0) {
      if (i == 0)
        printf("%-23.23s: ", name);
      else
        printf("\n%25s", "");
    } else {
      if (i % 8 == 0)
        printf(" ");
      if (i % 4 == 0)
        printf(" ");
    }
    printf("%02x", addr[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dasdview_dump_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f6 <dasdview_dump_array+0xe6>
mov    -0x1c(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1185 <dasdview_dump_array+0x75>
cmpl   $0x0,-0x1c(%rbp)
jne    116b <dasdview_dump_array+0x5b>
mov    -0x8(%rbp),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1180 <dasdview_dump_array+0x70>
lea    0xe99(%rip),%rdi
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <dasdview_dump_array+0xbe>
mov    -0x1c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a7 <dasdview_dump_array+0x97>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c9 <dasdview_dump_array+0xb9>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <dasdview_dump_array+0xbe>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <dasdview_dump_array+0x1a>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dasdview_dump_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
test   %esi,%esi
jle    115d <dasdview_dump_array+0x3d>
mov    %rdx,%r13
mov    %rdi,%rsi
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x0(%r13),%esi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%ebp
jne    1175 <dasdview_dump_array+0x55>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
mov    %ebp,%ebp
mov    $0x1,%ebx
lea    0xe88(%rip),%r14
lea    0xe80(%rip),%r15
lea    0xe80(%rip),%r12
jmp    11c6 <dasdview_dump_array+0xa6>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x0(%r13,%rbx,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     115d <dasdview_dump_array+0x3d>
test   $0xf,%bl
je     11a0 <dasdview_dump_array+0x80>
test   $0x7,%bl
je     11e0 <dasdview_dump_array+0xc0>
test   $0x3,%bl
jne    11ad <dasdview_dump_array+0x8d>
jmp    11ef <dasdview_dump_array+0xcf>
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
test   $0x3,%bl
jne    11ad <dasdview_dump_array+0x8d>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11ad <dasdview_dump_array+0x8d>

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

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