#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*/ puts(char *);
int /*<<< orphan*/ putxval(char, int);
int dump(char *buf, long size) {
  long i;
  if (size < 0) {
    puts("no data.\n");
    return -1;
  }
  for (i = 0; i < size; i++) {
    putxval(buf[i], 2);
    if ((i & 0xf) == 15) {
      puts("\n");
    } else {
      if ((i & 0xf) == 7)
        puts(" ");
      puts(" ");
    }
  }
  puts("\n");
  return 0;
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1153 <dump+0x33>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f5 <dump+0xd5>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    11e2 <dump+0xc2>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
movsbl (%rax,%rcx,1),%edi
call   1040 <putxval@plt>
mov    -0x20(%rbp),%rax
and    $0xf,%rax
cmp    $0xf,%rax
jne    11a2 <dump+0x82>
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
jmp    11cc <dump+0xac>
mov    -0x20(%rbp),%rax
and    $0xf,%rax
cmp    $0x7,%rax
jne    11c0 <dump+0xa0>
lea    0xe4f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe43(%rip),%rdi
call   1030 <puts@plt>
jmp    11d1 <dump+0xb1>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    115b <dump+0x3b>
lea    0xe1f(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rsi,%rsi
js     1191 <dump+0x71>
je     119f <dump+0x7f>
mov    %rsi,%r13
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0xec9(%rip),%r14
lea    0xec4(%rip),%r12
jmp    1161 <dump+0x41>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
je     118d <dump+0x6d>
movsbl (%r15,%rbx,1),%edi
mov    $0x2,%esi
call   1040 <putxval@plt>
mov    %ebx,%eax
and    $0xf,%eax
mov    %r14,%rdi
cmp    $0xf,%rax
je     1153 <dump+0x33>
cmp    $0x7,%eax
jne    1150 <dump+0x30>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    1150 <dump+0x30>
xor    %ebx,%ebx
jmp    11a8 <dump+0x88>
mov    $0xffffffff,%ebx
lea    0xe63(%rip),%r14
jmp    11a8 <dump+0x88>
xor    %ebx,%ebx
lea    0xe60(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"no data.\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c" \00"
define i32 @dump(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i64, i64* %5
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %41
11: ; preds = %2
store i64 0, i64* %6
br label %12
12: ; preds = %36, %11
%13 = load i64, i64* %6
%14 = load i64, i64* %5
%15 = icmp slt i64 %13, %14
br i1 %15, label %16, label %39
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = load i64, i64* %6
%19 = getelementptr inbounds i8, i8* %17, i64 %18
%20 = load i8, i8* %19
%21 = call i32 @putxval(i8 signext %20, i32 2)
%22 = load i64, i64* %6
%23 = and i64 %22, 15
%24 = icmp eq i64 %23, 15
br i1 %24, label %25, label %27
25: ; preds = %16
%26 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %35
27: ; preds = %16
%28 = load i64, i64* %6
%29 = and i64 %28, 15
%30 = icmp eq i64 %29, 7
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %25
br label %36
36: ; preds = %35
%37 = load i64, i64* %6
%38 = add nsw i64 %37, 1
store i64 %38, i64* %6
br label %12
39: ; preds = %12
%40 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %41
41: ; preds = %39, %9
%42 = load i32, i32* %3
ret i32 %42
}

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