#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 */
scalar_t__ isprint(unsigned char);
int /*<<< orphan*/ printf(char *, ...);
void human_dump(const unsigned char *packet, size_t size) {
  unsigned char *byte = (unsigned char *)packet;
  int count = 0;
  printf("\t\t");
  for (; byte < ((unsigned char *)packet) + size; byte++) {
    count++;
    if (isprint(*byte))
      printf("%c", *byte);
    else
      printf(".");
    if (count % 32 == 0)
      printf("\n\t\t");
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<human_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    -0x10(%rbp),%rcx
cmp    %rcx,%rax
jae    11e1 <human_dump+0xc1>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     119b <human_dump+0x7b>
mov    -0x18(%rbp),%rax
movzbl (%rax),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a9 <human_dump+0x89>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11cb <human_dump+0xab>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d0 <human_dump+0xb0>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114d <human_dump+0x2d>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<human_dump>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14,%r14
jle    11bc <human_dump+0x7c>
add    %rbx,%r14
mov    $0x1,%ebp
lea    0xe91(%rip),%r15
jmp    118c <human_dump+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0x1,%ebp
cmp    %r14,%rbx
jae    11bc <human_dump+0x7c>
movzbl (%rbx),%edi
call   1060 <isprint@plt>
test   %rax,%rax
je     11a0 <human_dump+0x60>
movzbl (%rbx),%edi
jmp    11a5 <human_dump+0x65>
xchg   %ax,%ax
mov    $0x2e,%edi
call   1030 <putchar@plt>
test   $0x1f,%bpl
jne    1180 <human_dump+0x40>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1180 <human_dump+0x40>
lea    0xe41(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

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