#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(char);
int /*<<< orphan*/ printf(char *, ...);
void dump_line(char *data, int offset, int limit) {
  int i;
  printf("%03x:", offset);
  for (i = 0; i < limit; i++) {
    printf(" %02x", (unsigned char)data[offset + i]);
  }
  for (i = 0; i + limit < 16; i++) {
    printf("   ");
  }
  printf(" ");
  for (i = 0; i < limit; i++) {
    printf("%c", isprint(data[offset + i]) ? data[offset + i] : '.');
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1183 <dump_line+0x63>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114a <dump_line+0x2a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x10,%eax
jge    11b5 <dump_line+0x95>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118a <dump_line+0x6a>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    123b <dump_line+0x11b>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     120f <dump_line+0xef>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
jmp    121c <dump_line+0xfc>
mov    $0x2e,%eax
mov    %eax,-0x18(%rbp)
jmp    121c <dump_line+0xfc>
mov    -0x18(%rbp),%esi
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ca <dump_line+0xaa>
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r12
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq %ebx,%r13
mov    %r14d,%ebp
test   %r14d,%r14d
jle    1192 <dump_line+0x62>
mov    %r13,(%rsp)
lea    (%r12,%r13,1),%rbx
lea    0xe9b(%rip),%r15
xor    %r13d,%r13d
xchg   %ax,%ax
movzbl (%rbx,%r13,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
jne    1170 <dump_line+0x40>
cmp    $0xf,%r14d
mov    (%rsp),%r13
jg     11ae <dump_line+0x7e>
lea    -0x10(%r14),%ebx
lea    0xe6f(%rip),%r15
nopl   (%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
inc    %ebx
jne    11a0 <dump_line+0x70>
mov    $0x20,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    11f9 <dump_line+0xc9>
add    %r13,%r12
xor    %ebx,%ebx
jmp    11e3 <dump_line+0xb3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%r12,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     11f9 <dump_line+0xc9>
movsbl (%r12,%rbx,1),%edi
call   1050 <isprint@plt>
test   %rax,%rax
jne    11d0 <dump_line+0xa0>
mov    $0x2e,%edi
jmp    11d5 <dump_line+0xa5>
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 = [6 x i8] c"%03x:\00"
@.str.1 = [6 x i8] c" %02x\00"
@.str.2 = [4 x i8] c" \00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @dump_line(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 0, i32* %7
br label %10
10: ; preds = %24, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = load i32, i32* %7
%18 = add nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %15, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %14
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %10
27: ; preds = %10
store i32 0, i32* %7
br label %28
28: ; preds = %35, %27
%29 = load i32, i32* %7
%30 = load i32, i32* %6
%31 = add nsw i32 %29, %30
%32 = icmp slt i32 %31, 16
br i1 %32, label %33, label %38
33: ; preds = %28
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %28
38: ; preds = %28
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %7
br label %40
40: ; preds = %67, %38
%41 = load i32, i32* %7
%42 = load i32, i32* %6
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %70
44: ; preds = %40
%45 = load i8*, i8** %4
%46 = load i32, i32* %5
%47 = load i32, i32* %7
%48 = add nsw i32 %46, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %45, i64 %49
%51 = load i8, i8* %50
%52 = call i64 @isprint(i8 signext %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %63
54: ; preds = %44
%55 = load i8*, i8** %4
%56 = load i32, i32* %5
%57 = load i32, i32* %7
%58 = add nsw i32 %56, %57
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %55, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
br label %64
63: ; preds = %44
br label %64
64: ; preds = %63, %54
%65 = phi i32 [ %62, %54 ], [ 46, %63 ]
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %64
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
store i32 %69, i32* %7
br label %40
70: ; preds = %40
%71 = 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 = [6 x i8] c"%03x:\00"
@.str.1 = [6 x i8] c" %02x\00"
@.str.2 = [4 x i8] c" \00"
define void @dump_line(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = sext i32 %1 to i64
%8 = zext i32 %2 to i64
br label %13
9: ; preds = %13
%10 = icmp slt i32 %2, 16
br i1 %10, label %11, label %27
11: ; preds = %3, %9
%12 = sub i32 16, %2
br label %22
13: ; preds = %6, %13
%14 = phi i64 [ 0, %6 ], [ %20, %13 ]
%15 = add nsw i64 %14, %7
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = add nuw nsw i64 %14, 1
%21 = icmp eq i64 %20, %8
br i1 %21, label %9, label %13
22: ; preds = %11, %22
%23 = phi i32 [ %25, %22 ], [ 0, %11 ]
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%25 = add nuw i32 %23, 1
%26 = icmp eq i32 %25, %12
br i1 %26, label %27, label %22
27: ; preds = %22, %9
%28 = tail call i32 @putchar(i32 32)
br i1 %5, label %29, label %47
29: ; preds = %27
%30 = sext i32 %1 to i64
%31 = zext i32 %2 to i64
br label %32
32: ; preds = %29, %42
%33 = phi i64 [ 0, %29 ], [ %45, %42 ]
%34 = add nsw i64 %33, %30
%35 = getelementptr inbounds i8, i8* %0, i64 %34
%36 = load i8, i8* %35
%37 = tail call i64 @isprint(i8 signext %36)
%38 = icmp eq i64 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %32
%40 = load i8, i8* %35
%41 = sext i8 %40 to i32
br label %42
42: ; preds = %32, %39
%43 = phi i32 [ %41, %39 ], [ 46, %32 ]
%44 = tail call i32 @putchar(i32 %43)
%45 = add nuw nsw i64 %33, 1
%46 = icmp eq i64 %45, %31
br i1 %46, label %47, label %32
47: ; preds = %42, %27
%48 = tail call i32 @putchar(i32 10)
ret void
}