#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 dump_mode_page(unsigned char *page, int len) {
  int i, k;
  for (k = 0; k < len; k += 16) {
    printf("%x:", k / 16);
    for (i = 0; i < 16; i++) {
      printf(" %02x", page[k + i]);
      if (k + i >= len) {
        printf("\n");
        break;
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<dump_mode_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ce <dump_mode_page+0xbe>
mov    -0x14(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    11b2 <dump_mode_page+0xa2>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     119f <dump_mode_page+0x8f>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b2 <dump_mode_page+0xa2>
jmp    11a4 <dump_mode_page+0x94>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1154 <dump_mode_page+0x44>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <dump_mode_page+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_mode_page>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,0x4(%rsp)
test   %esi,%esi
jle    1389 <dump_mode_page+0x269>
mov    %rdi,%r12
mov    0x4(%rsp),%r13d
mov    $0xf,%r14d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
lea    -0xf(%r14),%r15
lea    0xea5(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl -0xf(%r12,%r14,1),%esi
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%r15
jge    1360 <dump_mode_page+0x240>
lea    -0xe(%r14),%rbx
movzbl -0xe(%r12,%r14,1),%esi
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0xd(%r14),%rbx
movzbl -0xd(%r12,%r14,1),%esi
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0xc(%r14),%rbx
movzbl -0xc(%r12,%r14,1),%esi
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0xb(%r14),%rbx
movzbl -0xb(%r12,%r14,1),%esi
lea    0xe0f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0xa(%r14),%rbx
movzbl -0xa(%r12,%r14,1),%esi
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x9(%r14),%rbx
movzbl -0x9(%r12,%r14,1),%esi
lea    0xdcd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x8(%r14),%rbx
movzbl -0x8(%r12,%r14,1),%esi
lea    0xdac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x7(%r14),%rbx
movzbl -0x7(%r12,%r14,1),%esi
lea    0xd8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x6(%r14),%rbx
movzbl -0x6(%r12,%r14,1),%esi
lea    0xd6a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x5(%r14),%rbx
movzbl -0x5(%r12,%r14,1),%esi
lea    0xd49(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x4(%r14),%rbx
movzbl -0x4(%r12,%r14,1),%esi
lea    0xd28(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x3(%r14),%rbx
movzbl -0x3(%r12,%r14,1),%esi
lea    0xd0b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x2(%r14),%rbx
movzbl -0x2(%r12,%r14,1),%esi
lea    0xcee(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
lea    -0x1(%r14),%rbx
movzbl -0x1(%r12,%r14,1),%esi
lea    0xcd1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%rbx
jge    1360 <dump_mode_page+0x240>
movzbl (%r12,%r14,1),%esi
lea    0xcb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13,%r14
jl     136a <dump_mode_page+0x24a>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%r14
add    $0x1,%ebp
lea    -0xf(%r14),%eax
cmp    0x4(%rsp),%eax
jl     1150 <dump_mode_page+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%x:\00"
@.str.1 = [6 x i8] c" %02x\00"
define void @dump_mode_page(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %128
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %123
%7 = phi i64 [ 0, %4 ], [ %125, %123 ]
%8 = lshr exact i64 %7, 4
%9 = trunc i64 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds i8, i8* %0, i64 %7
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = icmp slt i64 %7, %5
br i1 %15, label %16, label %121
16: ; preds = %6
%17 = or i64 %7, 1
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = icmp slt i64 %17, %5
br i1 %22, label %23, label %121
23: ; preds = %16
%24 = or i64 %7, 2
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = icmp slt i64 %24, %5
br i1 %29, label %30, label %121
30: ; preds = %23
%31 = or i64 %7, 3
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = icmp slt i64 %31, %5
br i1 %36, label %37, label %121
37: ; preds = %30
%38 = or i64 %7, 4
%39 = getelementptr inbounds i8, i8* %0, i64 %38
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = icmp slt i64 %38, %5
br i1 %43, label %44, label %121
44: ; preds = %37
%45 = or i64 %7, 5
%46 = getelementptr inbounds i8, i8* %0, i64 %45
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = icmp slt i64 %45, %5
br i1 %50, label %51, label %121
51: ; preds = %44
%52 = or i64 %7, 6
%53 = getelementptr inbounds i8, i8* %0, i64 %52
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%57 = icmp slt i64 %52, %5
br i1 %57, label %58, label %121
58: ; preds = %51
%59 = or i64 %7, 7
%60 = getelementptr inbounds i8, i8* %0, i64 %59
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%64 = icmp slt i64 %59, %5
br i1 %64, label %65, label %121
65: ; preds = %58
%66 = or i64 %7, 8
%67 = getelementptr inbounds i8, i8* %0, i64 %66
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %69)
%71 = icmp slt i64 %66, %5
br i1 %71, label %72, label %121
72: ; preds = %65
%73 = or i64 %7, 9
%74 = getelementptr inbounds i8, i8* %0, i64 %73
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %76)
%78 = icmp slt i64 %73, %5
br i1 %78, label %79, label %121
79: ; preds = %72
%80 = or i64 %7, 10
%81 = getelementptr inbounds i8, i8* %0, i64 %80
%82 = load i8, i8* %81
%83 = zext i8 %82 to i32
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %83)
%85 = icmp slt i64 %80, %5
br i1 %85, label %86, label %121
86: ; preds = %79
%87 = or i64 %7, 11
%88 = getelementptr inbounds i8, i8* %0, i64 %87
%89 = load i8, i8* %88
%90 = zext i8 %89 to i32
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %90)
%92 = icmp slt i64 %87, %5
br i1 %92, label %93, label %121
93: ; preds = %86
%94 = or i64 %7, 12
%95 = getelementptr inbounds i8, i8* %0, i64 %94
%96 = load i8, i8* %95
%97 = zext i8 %96 to i32
%98 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %97)
%99 = icmp slt i64 %94, %5
br i1 %99, label %100, label %121
100: ; preds = %93
%101 = or i64 %7, 13
%102 = getelementptr inbounds i8, i8* %0, i64 %101
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %104)
%106 = icmp slt i64 %101, %5
br i1 %106, label %107, label %121
107: ; preds = %100
%108 = or i64 %7, 14
%109 = getelementptr inbounds i8, i8* %0, i64 %108
%110 = load i8, i8* %109
%111 = zext i8 %110 to i32
%112 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %111)
%113 = icmp slt i64 %108, %5
br i1 %113, label %114, label %121
114: ; preds = %107
%115 = or i64 %7, 15
%116 = getelementptr inbounds i8, i8* %0, i64 %115
%117 = load i8, i8* %116
%118 = zext i8 %117 to i32
%119 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %118)
%120 = icmp slt i64 %115, %5
br i1 %120, label %123, label %121
121: ; preds = %114, %107, %100, %93, %86, %79, %72, %65, %58, %51, %44, %37, %30, %23, %16, %6
%122 = tail call i32 @putchar(i32 10)
br label %123
123: ; preds = %114, %121
%124 = tail call i32 @putchar(i32 10)
%125 = add nuw i64 %7, 16
%126 = trunc i64 %125 to i32
%127 = icmp slt i32 %126, %1
br i1 %127, label %6, label %128
128: ; preds = %123, %2
ret void
}