#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*/ dump_line(char *, int, int);
int /*<<< orphan*/ printf(char *);
void dump_zone(void *buf, int len) {
  int i;
  char *data = buf;
  printf("====================================================================="
         "===========\n");
  for (i = 0; i < len; i += 16) {
    int limit;
    limit = 16;
    if (i + limit > len)
      limit = len - i;
    dump_line(data, i, limit);
  }
  printf("====================================================================="
         "===========\n");
}


x86 assembly (clang, -O0):
<dump_zone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1192 <dump_zone+0x72>
movl   $0x10,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1175 <dump_zone+0x55>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <dump_line@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x10(%rbp)
jmp    114a <dump_zone+0x2a>
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_zone>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
test   %r15d,%r15d
jle    1175 <dump_zone+0x55>
mov    $0x10,%ebp
xor    %ebx,%ebx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
lea    0x10(%rsi),%r12d
cmp    %ebp,%r15d
mov    %ebp,%edx
cmovl  %r15d,%edx
add    %ebx,%edx
mov    %r14,%rdi
call   1040 <dump_line@plt>
add    $0x10,%ebp
add    $0xfffffff0,%ebx
mov    %r12d,%esi
cmp    %r15d,%r12d
jl     1150 <dump_zone+0x30>
lea    0xe84(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str.1 = [81 x i8] c"================================================================================\00"
define void @dump_zone(i8* %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.1, i64 0, i64 0))
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %13
5: ; preds = %2, %5
%6 = phi i32 [ %7, %5 ], [ 0, %2 ]
%7 = add nuw nsw i32 %6, 16
%8 = icmp sgt i32 %7, %1
%9 = sub nsw i32 %1, %6
%10 = select i1 %8, i32 %9, i32 16
%11 = tail call i32 @dump_line(i8* %0, i32 %6, i32 %10)
%12 = icmp slt i32 %7, %1
br i1 %12, label %5, label %13
13: ; preds = %5, %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.1, i64 0, i64 0))
ret void
}