#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 */
typedef int uint8_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/, int, int, int);
int main(void) {
  static const uint16_t table85[16] = {
      0xffff, 0xaaaa, 0xcccc, 0x9999, 0xf0f0, 0xa5a5, 0xc4c4, 0x9696,
      0xff00, 0xaa55, 0xcc33, 0x9966, 0xf00f, 0xa55a, 0xc33c, 0x9669};
  int page, nyb_h, nyb_l, offset = 0;
  for (page = 0; page < 4; page++)
    for (nyb_h = 0; nyb_h < 16; nyb_h++)
      for (nyb_l = 0; nyb_l < 16; nyb_l++) {
        uint32_t code = (table85[nyb_h] << 16) | table85[nyb_l];
        uint8_t byte = 0x000000ff & (code >> (8 * page));
        printf("\tmovlw\t0x%02x\t;offset 0x%03x (page %d, %x followed by %x)\n",
               byte, offset++, page, nyb_h, nyb_l);
      }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11f7 <main+0xd7>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    11e4 <main+0xc4>
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    11d1 <main+0xb1>
movslq -0xc(%rbp),%rcx
lea    0xe8c(%rip),%rax
mov    (%rax,%rcx,4),%eax
shl    $0x10,%eax
movslq -0x10(%rbp),%rdx
lea    0xe7b(%rip),%rcx
or     (%rcx,%rdx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115f <main+0x3f>
jmp    11d6 <main+0xb6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114e <main+0x2e>
jmp    11e9 <main+0xc9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r15d,%r15d
lea    0xecb(%rip),%r13
lea    0xf04(%rip),%r14
xor    %eax,%eax
xchg   %ax,%ax
mov    %eax,%r12d
mov    %r13,%rbp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%edx
movzbl 0x0(%rbp),%esi
mov    %r14,%rdi
xor    %ecx,%ecx
mov    %r15d,%r8d
mov    %ebx,%r9d
call   1030 <printf@plt>
add    $0x1,%rbx
add    $0x4,%rbp
cmp    $0x10,%rbx
jne    1150 <main+0x30>
add    $0x1,%r15
lea    (%r12,%rbx,1),%eax
cmp    $0x10,%r15
jne    1140 <main+0x20>
add    %ebx,%r12d
xor    %r15d,%r15d
lea    0xeaf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12d,%r13d
lea    0xe56(%rip),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    (%rbx,%r13,1),%edx
movzbl 0x1(%rbp),%esi
mov    %r14,%rdi
mov    $0x1,%ecx
mov    %r15d,%r8d
mov    %ebx,%r9d
call   1030 <printf@plt>
add    $0x1,%rbx
add    $0x4,%rbp
cmp    $0x10,%rbx
jne    11b0 <main+0x90>
add    $0x1,%r15
lea    (%rbx,%r13,1),%r12d
cmp    $0x10,%r15
jne    11a0 <main+0x80>
add    %ebx,%r13d
xor    %r15d,%r15d
nopl   (%rax)
lea    0xe09(%rip),%rbp
mov    0x0(%rbp,%r15,4),%r14d
shl    $0x10,%r14d
mov    %r13d,%r12d
xor    %ebx,%ebx
lea    0xe34(%rip),%r13
nopl   0x0(%rax)
lea    (%r12,%rbx,1),%edx
mov    0x0(%rbp),%eax
or     %r14d,%eax
shr    $0x10,%eax
movzbl %al,%esi
mov    %r13,%rdi
mov    $0x2,%ecx
mov    %r15d,%r8d
mov    %ebx,%r9d
call   1030 <printf@plt>
add    $0x1,%rbx
add    $0x4,%rbp
cmp    $0x10,%rbx
jne    1210 <main+0xf0>
add    $0x1,%r15
lea    (%r12,%rbx,1),%r13d
cmp    $0x10,%r15
jne    11f0 <main+0xd0>
add    %ebx,%r12d
xor    %r15d,%r15d
lea    0xde4(%rip),%r14
nopl   0x0(%rax)
lea    0xd99(%rip),%r13
mov    0x0(%r13,%r15,4),%ebp
shl    $0x10,%ebp
mov    %r12d,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r12,%rbx,1),%edx
mov    0x0(%r13),%esi
or     %ebp,%esi
shr    $0x18,%esi
mov    %r14,%rdi
mov    $0x3,%ecx
mov    %r15d,%r8d
mov    %ebx,%r9d
call   1030 <printf@plt>
add    $0x1,%rbx
add    $0x4,%r13
cmp    $0x10,%rbx
jne    1280 <main+0x160>
add    $0x1,%r15
add    %ebx,%r12d
cmp    $0x10,%r15
jne    1260 <main+0x140>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@main.table85 = internal constant [16 x i32] [i32 65535, i32 43690, i32 52428, i32 39321, i32 61680, i32 42405, i32 50372, i32 38550, i32 65280, i32 43605, i32 52275, i32 39270, i32 61455, i32 42330, i32 49980, i32 38505]
@.str = [59 x i8] c"\09movlw\090x%02x\09;offset 0x%03x (page %d, %x followed by %x)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %2
br label %8
8: ; preds = %50, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %53
11: ; preds = %8
store i32 0, i32* %3
br label %12
12: ; preds = %46, %11
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 16
br i1 %14, label %15, label %49
15: ; preds = %12
store i32 0, i32* %4
br label %16
16: ; preds = %42, %15
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 16
br i1 %18, label %19, label %45
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [16 x i32], [16 x i32]* @main.table85, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = shl i32 %23, 16
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [16 x i32], [16 x i32]* @main.table85, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = or i32 %24, %28
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = load i32, i32* %2
%32 = mul nsw i32 8, %31
%33 = ashr i32 %30, %32
%34 = and i32 255, %33
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %36, i32 %38, i32 %39, i32 %40)
br label %42
42: ; preds = %19
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %16
45: ; preds = %16
br label %46
46: ; preds = %45
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %12
49: ; preds = %12
br label %50
50: ; preds = %49
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %8
53: ; preds = %8
%54 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@main.table85 = internal unnamed_addr constant [16 x i32] [i32 65535, i32 43690, i32 52428, i32 39321, i32 61680, i32 42405, i32 50372, i32 38550, i32 65280, i32 43605, i32 52275, i32 39270, i32 61455, i32 42330, i32 49980, i32 38505]
@.str = [59 x i8] c"\09movlw\090x%02x\09;offset 0x%03x (page %d, %x followed by %x)\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %16
%2 = phi i64 [ 0, %0 ], [ %17, %16 ]
%3 = phi i32 [ 0, %0 ], [ %11, %16 ]
%4 = trunc i64 %2 to i32
br label %5
5: ; preds = %1, %5
%6 = phi i64 [ 0, %1 ], [ %14, %5 ]
%7 = phi i32 [ %3, %1 ], [ %11, %5 ]
%8 = getelementptr inbounds [16 x i32], [16 x i32]* @main.table85, i64 0, i64 %6
%9 = load i32, i32* %8
%10 = and i32 %9, 255
%11 = add nsw i32 %7, 1
%12 = trunc i64 %6 to i32
%13 = tail call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %7, i32 0, i32 %4, i32 %12)
%14 = add nuw nsw i64 %6, 1
%15 = icmp eq i64 %14, 16
br i1 %15, label %16, label %5
16: ; preds = %5
%17 = add nuw nsw i64 %2, 1
%18 = icmp eq i64 %17, 16
br i1 %18, label %19, label %1
19: ; preds = %16, %35
%20 = phi i64 [ %36, %35 ], [ 0, %16 ]
%21 = phi i32 [ %30, %35 ], [ %11, %16 ]
%22 = trunc i64 %20 to i32
br label %23
23: ; preds = %23, %19
%24 = phi i64 [ 0, %19 ], [ %33, %23 ]
%25 = phi i32 [ %21, %19 ], [ %30, %23 ]
%26 = getelementptr inbounds [16 x i32], [16 x i32]* @main.table85, i64 0, i64 %24
%27 = load i32, i32* %26
%28 = lshr i32 %27, 8
%29 = and i32 %28, 255
%30 = add nsw i32 %25, 1
%31 = trunc i64 %24 to i32
%32 = tail call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %25, i32 1, i32 %22, i32 %31)
%33 = add nuw nsw i64 %24, 1
%34 = icmp eq i64 %33, 16
br i1 %34, label %35, label %23
35: ; preds = %23
%36 = add nuw nsw i64 %20, 1
%37 = icmp eq i64 %36, 16
br i1 %37, label %38, label %19
38: ; preds = %35, %58
%39 = phi i64 [ %59, %58 ], [ 0, %35 ]
%40 = phi i32 [ %53, %58 ], [ %30, %35 ]
%41 = getelementptr inbounds [16 x i32], [16 x i32]* @main.table85, i64 0, i64 %39
%42 = load i32, i32* %41
%43 = shl i32 %42, 16
%44 = trunc i64 %39 to i32
br label %45
45: ; preds = %45, %38
%46 = phi i64 [ 0, %38 ], [ %56, %45 ]
%47 = phi i32 [ %40, %38 ], [ %53, %45 ]
%48 = getelementptr inbounds [16 x i32], [16 x i32]* @main.table85, i64 0, i64 %46
%49 = load i32, i32* %48
%50 = or i32 %43, %49
%51 = lshr i32 %50, 16
%52 = and i32 %51, 255
%53 = add nsw i32 %47, 1
%54 = trunc i64 %46 to i32
%55 = tail call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %52, i32 %47, i32 2, i32 %44, i32 %54)
%56 = add nuw nsw i64 %46, 1
%57 = icmp eq i64 %56, 16
br i1 %57, label %58, label %45
58: ; preds = %45
%59 = add nuw nsw i64 %39, 1
%60 = icmp eq i64 %59, 16
br i1 %60, label %61, label %38
61: ; preds = %58, %80
%62 = phi i64 [ %81, %80 ], [ 0, %58 ]
%63 = phi i32 [ %75, %80 ], [ %53, %58 ]
%64 = getelementptr inbounds [16 x i32], [16 x i32]* @main.table85, i64 0, i64 %62
%65 = load i32, i32* %64
%66 = shl i32 %65, 16
%67 = trunc i64 %62 to i32
br label %68
68: ; preds = %68, %61
%69 = phi i64 [ 0, %61 ], [ %78, %68 ]
%70 = phi i32 [ %63, %61 ], [ %75, %68 ]
%71 = getelementptr inbounds [16 x i32], [16 x i32]* @main.table85, i64 0, i64 %69
%72 = load i32, i32* %71
%73 = or i32 %66, %72
%74 = lshr i32 %73, 24
%75 = add nsw i32 %70, 1
%76 = trunc i64 %69 to i32
%77 = tail call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %74, i32 %70, i32 3, i32 %67, i32 %76)
%78 = add nuw nsw i64 %69, 1
%79 = icmp eq i64 %78, 16
br i1 %79, label %80, label %68
80: ; preds = %68
%81 = add nuw nsw i64 %62, 1
%82 = icmp eq i64 %81, 16
br i1 %82, label %83, label %61
83: ; preds = %80
%84 = tail call i32 @exit(i32 0)
unreachable
}