Fixing struct type size struct Entry to 3
Inlined call call __init
Eliminating unused variable with no statement main::$0
Eliminating unused variable with no statement main::$1

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  main::entry0#0 = ENTRIES
  main::$5 = 1 * SIZEOF_STRUCT_ENTRY
  main::entry1#0 = ENTRIES + main::$5
  main::$6 = 2 * SIZEOF_STRUCT_ENTRY
  main::entry2#0 = ENTRIES + main::$6
  main::$17 = (struct Entry **)main::entry0#0
  main::$7 = main::$17 + OFFSET_STRUCT_ENTRY_NEXT
  *main::$7 = main::entry2#0
  main::$18 = (char *)main::entry0#0
  main::$8 = main::$18 + OFFSET_STRUCT_ENTRY_VALUE
  *main::$8 = 1
  main::$19 = (struct Entry **)main::entry2#0
  main::$9 = main::$19 + OFFSET_STRUCT_ENTRY_NEXT
  *main::$9 = main::entry1#0
  main::$20 = (char *)main::entry2#0
  main::$10 = main::$20 + OFFSET_STRUCT_ENTRY_VALUE
  *main::$10 = 2
  main::$21 = (struct Entry **)main::entry1#0
  main::$11 = main::$21 + OFFSET_STRUCT_ENTRY_NEXT
  *main::$11 = (struct Entry *)0
  main::$22 = (char *)main::entry1#0
  main::$12 = main::$22 + OFFSET_STRUCT_ENTRY_VALUE
  *main::$12 = 3
  main::idx#0 = 0
  main::entry#0 = ENTRIES
  to:main::@1
main::@1: scope:[main]  from main main::@2
  main::idx#6 = phi( main/main::idx#0, main::@2/main::idx#4 )
  main::entry#2 = phi( main/main::entry#0, main::@2/main::entry#1 )
  main::$27 = (struct Entry *)0 != main::entry#2
  if(main::$27) goto main::@2
  to:main::@return
main::@2: scope:[main]  from main::@1
  main::idx#5 = phi( main::@1/main::idx#6 )
  main::entry#3 = phi( main::@1/main::entry#2 )
  main::$23 = (char *)main::entry#3
  main::$13 = main::$23 + OFFSET_STRUCT_ENTRY_VALUE
  main::$2 = '0' + *main::$13
  main::SCREEN[main::idx#5] = main::$2
  main::idx#1 = ++ main::idx#5
  main::$24 = (struct Entry **)main::entry#3
  main::$14 = main::$24 + OFFSET_STRUCT_ENTRY_NEXT
  main::$3 = byte0  *main::$14
  main::SCREEN[main::idx#1] = main::$3
  main::idx#2 = ++ main::idx#1
  main::$25 = (struct Entry **)main::entry#3
  main::$15 = main::$25 + OFFSET_STRUCT_ENTRY_NEXT
  main::$4 = byte1  *main::$15
  main::SCREEN[main::idx#2] = main::$4
  main::idx#3 = ++ main::idx#2
  main::SCREEN[main::idx#3] = ' '
  main::idx#4 = ++ main::idx#3
  main::$26 = (struct Entry **)main::entry#3
  main::$16 = main::$26 + OFFSET_STRUCT_ENTRY_NEXT
  main::entry#1 = *main::$16
  to:main::@1
main::@return: scope:[main]  from main::@1
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  return 
  to:@return

SYMBOL TABLE SSA
__constant struct Entry *ENTRIES = (struct Entry *)$1000
__constant char OFFSET_STRUCT_ENTRY_NEXT = 1
__constant char OFFSET_STRUCT_ENTRY_VALUE = 0
__constant char SIZEOF_STRUCT_ENTRY = 3
void __start()
void main()
char *main::$10
struct Entry **main::$11
char *main::$12
char *main::$13
struct Entry **main::$14
struct Entry **main::$15
struct Entry **main::$16
struct Entry **main::$17
char *main::$18
struct Entry **main::$19
char main::$2
char *main::$20
struct Entry **main::$21
char *main::$22
char *main::$23
struct Entry **main::$24
struct Entry **main::$25
struct Entry **main::$26
bool main::$27
char main::$3
char main::$4
number main::$5
number main::$6
struct Entry **main::$7
char *main::$8
struct Entry **main::$9
__constant char * const main::SCREEN = (char *)$400
struct Entry *main::entry
struct Entry *main::entry#0
struct Entry *main::entry#1
struct Entry *main::entry#2
struct Entry *main::entry#3
struct Entry *main::entry0
struct Entry *main::entry0#0
struct Entry *main::entry1
struct Entry *main::entry1#0
struct Entry *main::entry2
struct Entry *main::entry2#0
char main::idx
char main::idx#0
char main::idx#1
char main::idx#2
char main::idx#3
char main::idx#4
char main::idx#5
char main::idx#6

Adding number conversion cast (unumber) 1 in main::$5 = 1 * SIZEOF_STRUCT_ENTRY
Adding number conversion cast (unumber) main::$5 in main::$5 = (unumber)1 * SIZEOF_STRUCT_ENTRY
Adding number conversion cast (unumber) 2 in main::$6 = 2 * SIZEOF_STRUCT_ENTRY
Adding number conversion cast (unumber) main::$6 in main::$6 = (unumber)2 * SIZEOF_STRUCT_ENTRY
Adding number conversion cast (unumber) 1 in *main::$8 = 1
Adding number conversion cast (unumber) 2 in *main::$10 = 2
Adding number conversion cast (unumber) 3 in *main::$12 = 3
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *main::$8 = (unumber)1
Inlining cast *main::$10 = (unumber)2
Inlining cast *main::$12 = (unumber)3
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (struct Entry *) 4096
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant pointer cast (struct Entry *) 0
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to char in main::$5 = 1 * SIZEOF_STRUCT_ENTRY
Inferred type updated to char in main::$6 = 2 * SIZEOF_STRUCT_ENTRY
Alias main::entry#2 = main::entry#3 
Alias main::idx#5 = main::idx#6 
Successful SSA optimization Pass2AliasElimination
Simple Condition main::$27 [27] if((struct Entry *)0!=main::entry#2) goto main::@2
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [1] main::$5 = 1 * SIZEOF_STRUCT_ENTRY
Constant right-side identified [3] main::$6 = 2 * SIZEOF_STRUCT_ENTRY
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::entry0#0 = ENTRIES
Constant main::$5 = 1*SIZEOF_STRUCT_ENTRY
Constant main::$6 = 2*SIZEOF_STRUCT_ENTRY
Constant main::idx#0 = 0
Constant main::entry#0 = ENTRIES
Successful SSA optimization Pass2ConstantIdentification
Constant main::$17 = (struct Entry **)main::entry0#0
Constant main::$18 = (char *)main::entry0#0
Successful SSA optimization Pass2ConstantIdentification
Converting *(pointer+n) to pointer[n] [7] *main::$7 = main::entry2#0  -- main::$17[OFFSET_STRUCT_ENTRY_NEXT]
Converting *(pointer+n) to pointer[n] [10] *main::$8 = 1  -- main::$18[OFFSET_STRUCT_ENTRY_VALUE]
Converting *(pointer+n) to pointer[n] [13] *main::$9 = main::entry1#0  -- main::$19[OFFSET_STRUCT_ENTRY_NEXT]
Converting *(pointer+n) to pointer[n] [16] *main::$10 = 2  -- main::$20[OFFSET_STRUCT_ENTRY_VALUE]
Converting *(pointer+n) to pointer[n] [19] *main::$11 = (struct Entry *) 0  -- main::$21[OFFSET_STRUCT_ENTRY_NEXT]
Converting *(pointer+n) to pointer[n] [22] *main::$12 = 3  -- main::$22[OFFSET_STRUCT_ENTRY_VALUE]
Converting *(pointer+n) to pointer[n] [30] main::$2 = '0' + *main::$13  -- main::$23[OFFSET_STRUCT_ENTRY_VALUE]
Converting *(pointer+n) to pointer[n] [35] main::$3 = byte0  *main::$14  -- main::$24[OFFSET_STRUCT_ENTRY_NEXT]
Converting *(pointer+n) to pointer[n] [40] main::$4 = byte1  *main::$15  -- main::$25[OFFSET_STRUCT_ENTRY_NEXT]
Converting *(pointer+n) to pointer[n] [47] main::entry#1 = *main::$16  -- main::$26[OFFSET_STRUCT_ENTRY_NEXT]
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero main::$18 in [9] main::$8 = main::$18 + OFFSET_STRUCT_ENTRY_VALUE
Simplifying expression containing zero main::$18 in [10] main::$18[OFFSET_STRUCT_ENTRY_VALUE] = 1
Simplifying expression containing zero main::$20 in [15] main::$10 = main::$20 + OFFSET_STRUCT_ENTRY_VALUE
Simplifying expression containing zero main::$20 in [16] main::$20[OFFSET_STRUCT_ENTRY_VALUE] = 2
Simplifying expression containing zero main::$22 in [21] main::$12 = main::$22 + OFFSET_STRUCT_ENTRY_VALUE
Simplifying expression containing zero main::$22 in [22] main::$22[OFFSET_STRUCT_ENTRY_VALUE] = 3
Simplifying expression containing zero main::$23 in [29] main::$13 = main::$23 + OFFSET_STRUCT_ENTRY_VALUE
Simplifying expression containing zero main::$23 in [30] main::$2 = '0' + main::$23[OFFSET_STRUCT_ENTRY_VALUE]
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable main::$7 and assignment [2] main::$7 = main::$17 + OFFSET_STRUCT_ENTRY_NEXT
Eliminating unused variable main::$8 and assignment [4] main::$8 = main::$18
Eliminating unused variable main::$9 and assignment [7] main::$9 = main::$19 + OFFSET_STRUCT_ENTRY_NEXT
Eliminating unused variable main::$10 and assignment [10] main::$10 = main::$20
Eliminating unused variable main::$11 and assignment [13] main::$11 = main::$21 + OFFSET_STRUCT_ENTRY_NEXT
Eliminating unused variable main::$12 and assignment [16] main::$12 = main::$22
Eliminating unused variable main::$13 and assignment [21] main::$13 = main::$23
Eliminating unused variable main::$14 and assignment [26] main::$14 = main::$24 + OFFSET_STRUCT_ENTRY_NEXT
Eliminating unused variable main::$15 and assignment [31] main::$15 = main::$25 + OFFSET_STRUCT_ENTRY_NEXT
Eliminating unused variable main::$16 and assignment [38] main::$16 = main::$26 + OFFSET_STRUCT_ENTRY_NEXT
Eliminating unused constant OFFSET_STRUCT_ENTRY_VALUE
Successful SSA optimization PassNEliminateUnusedVars
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Constant right-side identified [0] main::entry1#0 = ENTRIES + main::$5
Constant right-side identified [1] main::entry2#0 = ENTRIES + main::$6
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::entry1#0 = ENTRIES+main::$5
Constant main::entry2#0 = ENTRIES+main::$6
Successful SSA optimization Pass2ConstantIdentification
Constant main::$19 = (struct Entry **)main::entry2#0
Constant main::$20 = (char *)main::entry2#0
Constant main::$21 = (struct Entry **)main::entry1#0
Constant main::$22 = (char *)main::entry1#0
Successful SSA optimization Pass2ConstantIdentification
Inlining Noop Cast [8] main::$23 = (char *)main::entry#2 keeping main::entry#2
Inlining Noop Cast [12] main::$24 = (struct Entry **)main::entry#2 keeping main::entry#2
Inlining Noop Cast [16] main::$25 = (struct Entry **)main::entry#2 keeping main::entry#2
Inlining Noop Cast [22] main::$26 = (struct Entry **)main::entry#2 keeping main::entry#2
Successful SSA optimization Pass2NopCastInlining
Inlining constant with var siblings main::idx#0
Inlining constant with var siblings main::entry#0
Constant inlined main::idx#0 = 0
Constant inlined main::$17 = (struct Entry **)ENTRIES
Constant inlined main::$18 = (char *)ENTRIES
Constant inlined main::$19 = (struct Entry **)main::entry2#0
Constant inlined main::$5 = 1*SIZEOF_STRUCT_ENTRY
Constant inlined main::$6 = 2*SIZEOF_STRUCT_ENTRY
Constant inlined main::entry0#0 = ENTRIES
Constant inlined main::entry#0 = ENTRIES
Constant inlined main::$20 = (char *)main::entry2#0
Constant inlined main::$21 = (struct Entry **)main::entry1#0
Constant inlined main::$22 = (char *)main::entry1#0
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((struct Entry **)ENTRIES+OFFSET_STRUCT_ENTRY_NEXT)
Consolidated array index constant in *((struct Entry **)main::entry2#0+OFFSET_STRUCT_ENTRY_NEXT)
Consolidated array index constant in *((struct Entry **)main::entry1#0+OFFSET_STRUCT_ENTRY_NEXT)
Successful SSA optimization Pass2ConstantAdditionElimination
CALL GRAPH

Created 2 initial phi equivalence classes
Coalesced [21] main::entry#4 = main::entry#1
Coalesced [22] main::idx#7 = main::idx#4
Coalesced down to 2 phi equivalence classes

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] *((struct Entry **)ENTRIES+OFFSET_STRUCT_ENTRY_NEXT) = main::entry2#0
  [1] *((char *)ENTRIES) = 1
  [2] *((struct Entry **)main::entry2#0+OFFSET_STRUCT_ENTRY_NEXT) = main::entry1#0
  [3] *((char *)main::entry2#0) = 2
  [4] *((struct Entry **)main::entry1#0+OFFSET_STRUCT_ENTRY_NEXT) = (struct Entry *) 0
  [5] *((char *)main::entry1#0) = 3
  to:main::@1
main::@1: scope:[main]  from main main::@2
  [6] main::idx#5 = phi( main/0, main::@2/main::idx#4 )
  [6] main::entry#2 = phi( main/ENTRIES, main::@2/main::entry#1 )
  [7] if((struct Entry *)0!=main::entry#2) goto main::@2
  to:main::@return
main::@return: scope:[main]  from main::@1
  [8] return 
  to:@return
main::@2: scope:[main]  from main::@1
  [9] main::$2 = '0' + *((char *)main::entry#2)
  [10] main::SCREEN[main::idx#5] = main::$2
  [11] main::idx#1 = ++ main::idx#5
  [12] main::$3 = byte0  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT]
  [13] main::SCREEN[main::idx#1] = main::$3
  [14] main::idx#2 = ++ main::idx#1
  [15] main::$4 = byte1  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT]
  [16] main::SCREEN[main::idx#2] = main::$4
  [17] main::idx#3 = ++ main::idx#2
  [18] main::SCREEN[main::idx#3] = ' '
  [19] main::idx#4 = ++ main::idx#3
  [20] main::entry#1 = ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT]
  to:main::@1


VARIABLE REGISTER WEIGHTS
void main()
char main::$2 // 22.0
char main::$3 // 22.0
char main::$4 // 22.0
struct Entry *main::entry
struct Entry *main::entry#1 // 22.0
struct Entry *main::entry#2 // 1.6923076923076923
struct Entry *main::entry0
struct Entry *main::entry1
struct Entry *main::entry2
char main::idx
char main::idx#1 // 11.0
char main::idx#2 // 11.0
char main::idx#3 // 16.5
char main::idx#4 // 11.0
char main::idx#5 // 8.25

Initial phi equivalence classes
[ main::entry#2 main::entry#1 ]
[ main::idx#5 main::idx#4 ]
Added variable main::$2 to live range equivalence class [ main::$2 ]
Added variable main::idx#1 to live range equivalence class [ main::idx#1 ]
Added variable main::$3 to live range equivalence class [ main::$3 ]
Added variable main::idx#2 to live range equivalence class [ main::idx#2 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable main::idx#3 to live range equivalence class [ main::idx#3 ]
Complete equivalence classes
[ main::entry#2 main::entry#1 ]
[ main::idx#5 main::idx#4 ]
[ main::$2 ]
[ main::idx#1 ]
[ main::$3 ]
[ main::idx#2 ]
[ main::$4 ]
[ main::idx#3 ]
Allocated zp[2]:2 [ main::entry#2 main::entry#1 ]
Allocated zp[1]:4 [ main::$2 ]
Allocated zp[1]:5 [ main::$3 ]
Allocated zp[1]:6 [ main::$4 ]
Allocated zp[1]:7 [ main::idx#5 main::idx#4 ]
Allocated zp[1]:8 [ main::idx#3 ]
Allocated zp[1]:9 [ main::idx#1 ]
Allocated zp[1]:10 [ main::idx#2 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *((struct Entry **)ENTRIES+OFFSET_STRUCT_ENTRY_NEXT) = main::entry2#0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *((char *)ENTRIES) = 1 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *((struct Entry **)main::entry2#0+OFFSET_STRUCT_ENTRY_NEXT) = main::entry1#0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *((char *)main::entry2#0) = 2 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *((struct Entry **)main::entry1#0+OFFSET_STRUCT_ENTRY_NEXT) = (struct Entry *) 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [5] *((char *)main::entry1#0) = 3 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] if((struct Entry *)0!=main::entry#2) goto main::@2 [ main::entry#2 main::idx#5 ] (  [ main::entry#2 main::idx#5 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:7 [ main::idx#5 main::idx#4 ]
Statement [9] main::$2 = '0' + *((char *)main::entry#2) [ main::entry#2 main::idx#5 main::$2 ] (  [ main::entry#2 main::idx#5 main::$2 ] { }  ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:7 [ main::idx#5 main::idx#4 ]
Statement [12] main::$3 = byte0  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] [ main::entry#2 main::idx#1 main::$3 ] (  [ main::entry#2 main::idx#1 main::$3 ] { }  ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp[1]:9 [ main::idx#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:9 [ main::idx#1 ]
Statement [15] main::$4 = byte1  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] [ main::entry#2 main::idx#2 main::$4 ] (  [ main::entry#2 main::idx#2 main::$4 ] { }  ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp[1]:10 [ main::idx#2 ]
Removing always clobbered register reg byte y as potential for zp[1]:10 [ main::idx#2 ]
Statement [18] main::SCREEN[main::idx#3] = ' ' [ main::entry#2 main::idx#3 ] (  [ main::entry#2 main::idx#3 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:8 [ main::idx#3 ]
Statement [20] main::entry#1 = ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] [ main::entry#1 main::idx#4 ] (  [ main::entry#1 main::idx#4 ] { }  ) always clobbers reg byte a reg byte y 
Statement [0] *((struct Entry **)ENTRIES+OFFSET_STRUCT_ENTRY_NEXT) = main::entry2#0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *((char *)ENTRIES) = 1 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *((struct Entry **)main::entry2#0+OFFSET_STRUCT_ENTRY_NEXT) = main::entry1#0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *((char *)main::entry2#0) = 2 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *((struct Entry **)main::entry1#0+OFFSET_STRUCT_ENTRY_NEXT) = (struct Entry *) 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [5] *((char *)main::entry1#0) = 3 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] if((struct Entry *)0!=main::entry#2) goto main::@2 [ main::entry#2 main::idx#5 ] (  [ main::entry#2 main::idx#5 ] { }  ) always clobbers reg byte a 
Statement [9] main::$2 = '0' + *((char *)main::entry#2) [ main::entry#2 main::idx#5 main::$2 ] (  [ main::entry#2 main::idx#5 main::$2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [12] main::$3 = byte0  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] [ main::entry#2 main::idx#1 main::$3 ] (  [ main::entry#2 main::idx#1 main::$3 ] { }  ) always clobbers reg byte a reg byte y 
Statement [15] main::$4 = byte1  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] [ main::entry#2 main::idx#2 main::$4 ] (  [ main::entry#2 main::idx#2 main::$4 ] { }  ) always clobbers reg byte a reg byte y 
Statement [18] main::SCREEN[main::idx#3] = ' ' [ main::entry#2 main::idx#3 ] (  [ main::entry#2 main::idx#3 ] { }  ) always clobbers reg byte a 
Statement [20] main::entry#1 = ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] [ main::entry#1 main::idx#4 ] (  [ main::entry#1 main::idx#4 ] { }  ) always clobbers reg byte a reg byte y 
Potential registers zp[2]:2 [ main::entry#2 main::entry#1 ] : zp[2]:2 , 
Potential registers zp[1]:7 [ main::idx#5 main::idx#4 ] : zp[1]:7 , reg byte x , 
Potential registers zp[1]:4 [ main::$2 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:9 [ main::idx#1 ] : zp[1]:9 , reg byte x , 
Potential registers zp[1]:5 [ main::$3 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:10 [ main::idx#2 ] : zp[1]:10 , reg byte x , 
Potential registers zp[1]:6 [ main::$4 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:8 [ main::idx#3 ] : zp[1]:8 , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 23.69: zp[2]:2 [ main::entry#2 main::entry#1 ] 22: zp[1]:4 [ main::$2 ] 22: zp[1]:5 [ main::$3 ] 22: zp[1]:6 [ main::$4 ] 19.25: zp[1]:7 [ main::idx#5 main::idx#4 ] 16.5: zp[1]:8 [ main::idx#3 ] 11: zp[1]:9 [ main::idx#1 ] 11: zp[1]:10 [ main::idx#2 ] 
Uplift Scope [Entry] 
Uplift Scope [] 

Uplifting [main] best 1535 combination zp[2]:2 [ main::entry#2 main::entry#1 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] reg byte a [ main::$4 ] reg byte x [ main::idx#5 main::idx#4 ] zp[1]:8 [ main::idx#3 ] zp[1]:9 [ main::idx#1 ] zp[1]:10 [ main::idx#2 ] 
Limited combination testing to 100 combinations of 1536 possible.
Uplifting [Entry] best 1535 combination 
Uplifting [] best 1535 combination 
Attempting to uplift remaining variables inzp[1]:8 [ main::idx#3 ]
Uplifting [main] best 1445 combination reg byte x [ main::idx#3 ] 
Attempting to uplift remaining variables inzp[1]:9 [ main::idx#1 ]
Uplifting [main] best 1355 combination reg byte x [ main::idx#1 ] 
Attempting to uplift remaining variables inzp[1]:10 [ main::idx#2 ]
Uplifting [main] best 1265 combination reg byte x [ main::idx#2 ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct - simple linked list implemented using pointers
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-ptr-5.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .const SIZEOF_STRUCT_ENTRY = 3
  .const OFFSET_STRUCT_ENTRY_NEXT = 1
  .label ENTRIES = $1000
.segment Code
  // main
main: {
    // Run through the linked list
    .label SCREEN = $400
    .label entry1 = ENTRIES+1*SIZEOF_STRUCT_ENTRY
    .label entry2 = ENTRIES+2*SIZEOF_STRUCT_ENTRY
    .label entry = 2
    // [0] *((struct Entry **)ENTRIES+OFFSET_STRUCT_ENTRY_NEXT) = main::entry2#0 -- _deref_qssc1=pssc2 
    lda #<entry2
    sta ENTRIES+OFFSET_STRUCT_ENTRY_NEXT
    lda #>entry2
    sta ENTRIES+OFFSET_STRUCT_ENTRY_NEXT+1
    // [1] *((char *)ENTRIES) = 1 -- _deref_pbuc1=vbuc2 
    lda #1
    sta ENTRIES
    // [2] *((struct Entry **)main::entry2#0+OFFSET_STRUCT_ENTRY_NEXT) = main::entry1#0 -- _deref_qssc1=pssc2 
    lda #<entry1
    sta entry2+OFFSET_STRUCT_ENTRY_NEXT
    lda #>entry1
    sta entry2+OFFSET_STRUCT_ENTRY_NEXT+1
    // [3] *((char *)main::entry2#0) = 2 -- _deref_pbuc1=vbuc2 
    lda #2
    sta entry2
    // [4] *((struct Entry **)main::entry1#0+OFFSET_STRUCT_ENTRY_NEXT) = (struct Entry *) 0 -- _deref_qssc1=pssc2 
    lda #<0
    sta entry1+OFFSET_STRUCT_ENTRY_NEXT
    lda #>0
    sta entry1+OFFSET_STRUCT_ENTRY_NEXT+1
    // [5] *((char *)main::entry1#0) = 3 -- _deref_pbuc1=vbuc2 
    lda #3
    sta entry1
    // [6] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [6] phi main::idx#5 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [6] phi main::entry#2 = ENTRIES [phi:main->main::@1#1] -- pssz1=pssc1 
    lda #<ENTRIES
    sta.z entry
    lda #>ENTRIES
    sta.z entry+1
    jmp __b1
    // main::@1
  __b1:
    // [7] if((struct Entry *)0!=main::entry#2) goto main::@2 -- pssc1_neq_pssz1_then_la1 
    lda.z entry+1
    cmp #>0
    bne __b2
    lda.z entry
    cmp #<0
    bne __b2
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
    // main::@2
  __b2:
    // [9] main::$2 = '0' + *((char *)main::entry#2) -- vbuaa=vbuc1_plus__deref_pbuz1 
    lda #'0'
    clc
    ldy #0
    adc (entry),y
    // [10] main::SCREEN[main::idx#5] = main::$2 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // [11] main::idx#1 = ++ main::idx#5 -- vbuxx=_inc_vbuxx 
    inx
    // [12] main::$3 = byte0  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] -- vbuaa=_byte0_qssz1_derefidx_vbuc1 
    ldy #OFFSET_STRUCT_ENTRY_NEXT
    lda (entry),y
    // [13] main::SCREEN[main::idx#1] = main::$3 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // [14] main::idx#2 = ++ main::idx#1 -- vbuxx=_inc_vbuxx 
    inx
    // [15] main::$4 = byte1  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] -- vbuaa=_byte1_qssz1_derefidx_vbuc1 
    ldy #OFFSET_STRUCT_ENTRY_NEXT+1
    lda (entry),y
    // [16] main::SCREEN[main::idx#2] = main::$4 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // [17] main::idx#3 = ++ main::idx#2 -- vbuxx=_inc_vbuxx 
    inx
    // [18] main::SCREEN[main::idx#3] = ' ' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #' '
    sta SCREEN,x
    // [19] main::idx#4 = ++ main::idx#3 -- vbuxx=_inc_vbuxx 
    inx
    // [20] main::entry#1 = ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] -- pssz1=qssz1_derefidx_vbuc1 
    ldy #OFFSET_STRUCT_ENTRY_NEXT
    lda (entry),y
    pha
    iny
    lda (entry),y
    sta.z entry+1
    pla
    sta.z entry
    // [6] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  __b1_from___b2:
    // [6] phi main::idx#5 = main::idx#4 [phi:main::@2->main::@1#0] -- register_copy 
    // [6] phi main::entry#2 = main::entry#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp __b1
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #>0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction __b1_from_main:
Removing instruction __breturn:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant struct Entry *ENTRIES = (struct Entry *) 4096
__constant char OFFSET_STRUCT_ENTRY_NEXT = 1
__constant char SIZEOF_STRUCT_ENTRY = 3
void main()
char main::$2 // reg byte a 22.0
char main::$3 // reg byte a 22.0
char main::$4 // reg byte a 22.0
__constant char * const main::SCREEN = (char *) 1024
struct Entry *main::entry
struct Entry *main::entry#1 // entry zp[2]:2 22.0
struct Entry *main::entry#2 // entry zp[2]:2 1.6923076923076923
struct Entry *main::entry0
struct Entry *main::entry1
__constant struct Entry *main::entry1#0 = ENTRIES+1*SIZEOF_STRUCT_ENTRY // entry1
struct Entry *main::entry2
__constant struct Entry *main::entry2#0 = ENTRIES+2*SIZEOF_STRUCT_ENTRY // entry2
char main::idx
char main::idx#1 // reg byte x 11.0
char main::idx#2 // reg byte x 11.0
char main::idx#3 // reg byte x 16.5
char main::idx#4 // reg byte x 11.0
char main::idx#5 // reg byte x 8.25

zp[2]:2 [ main::entry#2 main::entry#1 ]
reg byte x [ main::idx#5 main::idx#4 ]
reg byte a [ main::$2 ]
reg byte x [ main::idx#1 ]
reg byte a [ main::$3 ]
reg byte x [ main::idx#2 ]
reg byte a [ main::$4 ]
reg byte x [ main::idx#3 ]


FINAL ASSEMBLER
Score: 1203

  // File Comments
// Minimal struct - simple linked list implemented using pointers
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-ptr-5.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .const SIZEOF_STRUCT_ENTRY = 3
  .const OFFSET_STRUCT_ENTRY_NEXT = 1
  .label ENTRIES = $1000
.segment Code
  // main
main: {
    // Run through the linked list
    .label SCREEN = $400
    .label entry1 = ENTRIES+1*SIZEOF_STRUCT_ENTRY
    .label entry2 = ENTRIES+2*SIZEOF_STRUCT_ENTRY
    .label entry = 2
    // entry0->next = entry2
    // [0] *((struct Entry **)ENTRIES+OFFSET_STRUCT_ENTRY_NEXT) = main::entry2#0 -- _deref_qssc1=pssc2 
    lda #<entry2
    sta ENTRIES+OFFSET_STRUCT_ENTRY_NEXT
    lda #>entry2
    sta ENTRIES+OFFSET_STRUCT_ENTRY_NEXT+1
    // entry0->value = 1
    // [1] *((char *)ENTRIES) = 1 -- _deref_pbuc1=vbuc2 
    lda #1
    sta ENTRIES
    // entry2->next = entry1
    // [2] *((struct Entry **)main::entry2#0+OFFSET_STRUCT_ENTRY_NEXT) = main::entry1#0 -- _deref_qssc1=pssc2 
    lda #<entry1
    sta entry2+OFFSET_STRUCT_ENTRY_NEXT
    lda #>entry1
    sta entry2+OFFSET_STRUCT_ENTRY_NEXT+1
    // entry2->value = 2
    // [3] *((char *)main::entry2#0) = 2 -- _deref_pbuc1=vbuc2 
    lda #2
    sta entry2
    // entry1->next = (struct Entry*)0
    // [4] *((struct Entry **)main::entry1#0+OFFSET_STRUCT_ENTRY_NEXT) = (struct Entry *) 0 -- _deref_qssc1=pssc2 
    lda #<0
    sta entry1+OFFSET_STRUCT_ENTRY_NEXT
    sta entry1+OFFSET_STRUCT_ENTRY_NEXT+1
    // entry1->value = 3
    // [5] *((char *)main::entry1#0) = 3 -- _deref_pbuc1=vbuc2 
    lda #3
    sta entry1
    // [6] phi from main to main::@1 [phi:main->main::@1]
    // [6] phi main::idx#5 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [6] phi main::entry#2 = ENTRIES [phi:main->main::@1#1] -- pssz1=pssc1 
    lda #<ENTRIES
    sta.z entry
    lda #>ENTRIES
    sta.z entry+1
    // main::@1
  __b1:
    // while(entry)
    // [7] if((struct Entry *)0!=main::entry#2) goto main::@2 -- pssc1_neq_pssz1_then_la1 
    lda.z entry+1
    cmp #>0
    bne __b2
    lda.z entry
    cmp #<0
    bne __b2
    // main::@return
    // }
    // [8] return 
    rts
    // main::@2
  __b2:
    // '0'+entry->value
    // [9] main::$2 = '0' + *((char *)main::entry#2) -- vbuaa=vbuc1_plus__deref_pbuz1 
    lda #'0'
    clc
    ldy #0
    adc (entry),y
    // SCREEN[idx++] = '0'+entry->value
    // [10] main::SCREEN[main::idx#5] = main::$2 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // SCREEN[idx++] = '0'+entry->value;
    // [11] main::idx#1 = ++ main::idx#5 -- vbuxx=_inc_vbuxx 
    inx
    // BYTE0(entry->next)
    // [12] main::$3 = byte0  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] -- vbuaa=_byte0_qssz1_derefidx_vbuc1 
    ldy #OFFSET_STRUCT_ENTRY_NEXT
    lda (entry),y
    // SCREEN[idx++] = BYTE0(entry->next)
    // [13] main::SCREEN[main::idx#1] = main::$3 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // SCREEN[idx++] = BYTE0(entry->next);
    // [14] main::idx#2 = ++ main::idx#1 -- vbuxx=_inc_vbuxx 
    inx
    // BYTE1(entry->next)
    // [15] main::$4 = byte1  ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] -- vbuaa=_byte1_qssz1_derefidx_vbuc1 
    ldy #OFFSET_STRUCT_ENTRY_NEXT+1
    lda (entry),y
    // SCREEN[idx++] = BYTE1(entry->next)
    // [16] main::SCREEN[main::idx#2] = main::$4 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // SCREEN[idx++] = BYTE1(entry->next);
    // [17] main::idx#3 = ++ main::idx#2 -- vbuxx=_inc_vbuxx 
    inx
    // SCREEN[idx++] = ' '
    // [18] main::SCREEN[main::idx#3] = ' ' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #' '
    sta SCREEN,x
    // SCREEN[idx++] = ' ';
    // [19] main::idx#4 = ++ main::idx#3 -- vbuxx=_inc_vbuxx 
    inx
    // entry = entry->next
    // [20] main::entry#1 = ((struct Entry **)main::entry#2)[OFFSET_STRUCT_ENTRY_NEXT] -- pssz1=qssz1_derefidx_vbuc1 
    ldy #OFFSET_STRUCT_ENTRY_NEXT
    lda (entry),y
    pha
    iny
    lda (entry),y
    sta.z entry+1
    pla
    sta.z entry
    // [6] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
    // [6] phi main::idx#5 = main::idx#4 [phi:main::@2->main::@1#0] -- register_copy 
    // [6] phi main::entry#2 = main::entry#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp __b1
}
  // File Data

