Fixing pointer array-indexing *((const struct Point*) points + (word) main::i)
Fixing pointer array-indexing *((const struct Point*) points + (word) main::i1)
Fixing pointer array-indexing *((const struct Point*) main::SCREEN + (word) main::i1)
Constantified RValue *((const struct Point*) points + (word~) main::$3) ← (struct Point){ (byte) 2, (byte~) main::$0 }
Unwinding value copy *((const struct Point*) points + (word~) main::$3) ← (struct Point){ (byte) 2, (byte~) main::$0 }
Adding value simple copy *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (word~) main::$3) ← (byte) 2
Adding value simple copy *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3) ← (byte~) main::$0
Adding value bulk copy *((const struct Point*) main::SCREEN + (word~) main::$4) ← memcpy(*((const struct Point*) points + (word~) main::$4), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Culled Empty Block (label) main::@4

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@1

(void()) main()
main: scope:[main]  from @1
  (word) main::i#0 ← (word) 0
  to:main::@1
main::@1: scope:[main]  from main main::@1
  (word) main::i#2 ← phi( main/(word) main::i#0 main::@1/(word) main::i#1 )
  (byte~) main::$0 ← ((byte)) (word) main::i#2
  (word~) main::$3 ← (word) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
  *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (word~) main::$3) ← (byte) 2
  *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3) ← (byte~) main::$0
  (word) main::i#1 ← (word) main::i#2 + rangenext(0,$1f3)
  (bool~) main::$1 ← (word) main::i#1 != rangelast(0,$1f3)
  if((bool~) main::$1) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1
  (word) main::i1#0 ← (word) 0
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@3
  (word) main::i1#2 ← phi( main::@2/(word) main::i1#0 main::@3/(word) main::i1#1 )
  (word~) main::$4 ← (word) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
  *((const struct Point*) main::SCREEN + (word~) main::$4) ← memcpy(*((const struct Point*) points + (word~) main::$4), struct Point, (const byte) SIZEOF_STRUCT_POINT)
  (word) main::i1#1 ← (word) main::i1#2 + rangenext(0,$1f3)
  (bool~) main::$2 ← (word) main::i1#1 != rangelast(0,$1f3)
  if((bool~) main::$2) goto main::@3
  to:main::@return
main::@return: scope:[main]  from main::@3
  return 
  to:@return
@1: scope:[]  from @begin
  call main 
  to:@2
@2: scope:[]  from @1
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_X = (byte) 0
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(byte~) main::$0
(bool~) main::$1
(bool~) main::$2
(word~) main::$3
(word~) main::$4
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(const struct Point*) main::SCREEN = (struct Point*)(number) $400
(word) main::i
(word) main::i#0
(word) main::i#1
(word) main::i#2
(word) main::i1
(word) main::i1#0
(word) main::i1#1
(word) main::i1#2
(const struct Point*) points[(number) $1f4]  = { fill( $1f4, 0) }

Inlining cast (byte~) main::$0 ← (byte)(word) main::i#2
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (struct Point*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) main::$1 [8] if((word) main::i#1!=rangelast(0,$1f3)) goto main::@1
Simple Condition (bool~) main::$2 [15] if((word) main::i1#1!=rangelast(0,$1f3)) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const word) main::i#0 = 0
Constant (const word) main::i1#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [6] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [8] if(main::i#1!=rangelast(0,$1f3)) goto main::@1 to (number) $1f4
Resolved ranged next value [13] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [15] if(main::i1#1!=rangelast(0,$1f3)) goto main::@3 to (number) $1f4
De-inlining pointer[w] to *(pointer+w)   [4] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (word~) main::$3) ← (byte) 2
De-inlining pointer[w] to *(pointer+w)   [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3) ← (byte~) main::$0
De-inlining pointer[w] to *(pointer+w)   [12] *((const struct Point*) main::SCREEN + (word~) main::$4) ← memcpy(*((const struct Point*) points + (word~) main::$4), struct Point, (const byte) SIZEOF_STRUCT_POINT)
De-inlining pointer[w] to *(pointer+w)   [12] *((const struct Point*) main::SCREEN + (word~) main::$4) ← memcpy(*((struct Point*~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Successful SSA optimization Pass2DeInlineWordDerefIdx
Simplifying expression containing zero (byte*)points in (byte*~) main::$5 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (word~) main::$3
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) $1f4 in if((word) main::i#1!=(number) $1f4) goto main::@1
Adding number conversion cast (unumber) $1f4 in if((word) main::i1#1!=(number) $1f4) goto main::@3
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $1f4
Simplifying constant integer cast $1f4
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (word) $1f4
Finalized unsigned number type (word) $1f4
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting multiplication to use shift [2] (word~) main::$3 ← (word) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
Rewriting multiplication to use shift [10] (word~) main::$4 ← (word) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const word) main::i#0
Inlining constant with var siblings (const word) main::i1#0
Constant inlined main::i#0 = (word) 0
Constant inlined main::i1#0 = (word) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@5(between main::@1 and main::@1)
Added new block during phi lifting main::@6(between main::@3 and main::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@2
CALL GRAPH
Calls in [] to main:2 

Created 2 initial phi equivalence classes
Coalesced [24] main::i1#3 ← main::i1#1
Coalesced [25] main::i#3 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@2
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@5
Renumbering block main::@3 to main::@2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @1
  [3] phi()

(void()) main()
main: scope:[main]  from @1
  [4] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@1
  [5] (word) main::i#2 ← phi( main/(word) 0 main::@1/(word) main::i#1 )
  [6] (byte~) main::$0 ← (byte)(word) main::i#2
  [7] (word~) main::$3 ← (word) main::i#2 << (byte) 1
  [8] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (word~) main::$3
  [9] *((byte*~) main::$5) ← (byte) 2
  [10] (byte*~) main::$6 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3
  [11] *((byte*~) main::$6) ← (byte~) main::$0
  [12] (word) main::i#1 ← ++ (word) main::i#2
  [13] if((word) main::i#1!=(word) $1f4) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [14] (word) main::i1#2 ← phi( main::@1/(word) 0 main::@2/(word) main::i1#1 )
  [15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1
  [16] (struct Point*~) main::$7 ← (const struct Point*) points + (word~) main::$4
  [17] (struct Point*~) main::$8 ← (const struct Point*) main::SCREEN + (word~) main::$4
  [18] *((struct Point*~) main::$8) ← memcpy(*((struct Point*~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT)
  [19] (word) main::i1#1 ← ++ (word) main::i1#2
  [20] if((word) main::i1#1!=(word) $1f4) goto main::@2
  to:main::@return
main::@return: scope:[main]  from main::@2
  [21] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(void()) main()
(byte~) main::$0 4.4
(word~) main::$3 11.0
(word~) main::$4 16.5
(byte*~) main::$5 22.0
(byte*~) main::$6 22.0
(struct Point*~) main::$7 5.5
(struct Point*~) main::$8 22.0
(word) main::i
(word) main::i#1 16.5
(word) main::i#2 4.714285714285714
(word) main::i1
(word) main::i1#1 16.5
(word) main::i1#2 6.6000000000000005

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::i1#2 main::i1#1 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable main::$3 to live range equivalence class [ main::$3 ]
Added variable main::$5 to live range equivalence class [ main::$5 ]
Added variable main::$6 to live range equivalence class [ main::$6 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable main::$7 to live range equivalence class [ main::$7 ]
Added variable main::$8 to live range equivalence class [ main::$8 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::i1#2 main::i1#1 ]
[ main::$0 ]
[ main::$3 ]
[ main::$5 ]
[ main::$6 ]
[ main::$4 ]
[ main::$7 ]
[ main::$8 ]
Allocated zp[2]:2 [ main::i#2 main::i#1 ]
Allocated zp[2]:4 [ main::i1#2 main::i1#1 ]
Allocated zp[1]:6 [ main::$0 ]
Allocated zp[2]:7 [ main::$3 ]
Allocated zp[2]:9 [ main::$5 ]
Allocated zp[2]:11 [ main::$6 ]
Allocated zp[2]:13 [ main::$4 ]
Allocated zp[2]:15 [ main::$7 ]
Allocated zp[2]:17 [ main::$8 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Minimal struct -  array with 256+ structs
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_STRUCT_POINT = 2
  .const OFFSET_STRUCT_POINT_Y = 1
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from___b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label SCREEN = $400
    .label __0 = 6
    .label __3 = 7
    .label __4 = $d
    .label i = 2
    .label i1 = 4
    .label __5 = 9
    .label __6 = $b
    .label __7 = $f
    .label __8 = $11
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (word) main::i#2 = (word) 0 [phi:main->main::@1#0] -- vwuz1=vwuc1 
    lda #<0
    sta.z i
    lda #>0
    sta.z i+1
    jmp __b1
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  __b1_from___b1:
    // [5] phi (word) main::i#2 = (word) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte~) main::$0 ← (byte)(word) main::i#2 -- vbuz1=_byte_vwuz2 
    lda.z i
    sta.z __0
    // [7] (word~) main::$3 ← (word) main::i#2 << (byte) 1 -- vwuz1=vwuz2_rol_1 
    lda.z i
    asl
    sta.z __3
    lda.z i+1
    rol
    sta.z __3+1
    // [8] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __3
    clc
    adc #<points
    sta.z __5
    lda.z __3+1
    adc #>points
    sta.z __5+1
    // [9] *((byte*~) main::$5) ← (byte) 2 -- _deref_pbuz1=vbuc1 
    lda #2
    ldy #0
    sta (__5),y
    // [10] (byte*~) main::$6 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __3
    clc
    adc #<points+OFFSET_STRUCT_POINT_Y
    sta.z __6
    lda.z __3+1
    adc #>points+OFFSET_STRUCT_POINT_Y
    sta.z __6+1
    // [11] *((byte*~) main::$6) ← (byte~) main::$0 -- _deref_pbuz1=vbuz2 
    lda.z __0
    ldy #0
    sta (__6),y
    // [12] (word) main::i#1 ← ++ (word) main::i#2 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // [13] if((word) main::i#1!=(word) $1f4) goto main::@1 -- vwuz1_neq_vwuc1_then_la1 
    lda.z i+1
    cmp #>$1f4
    bne __b1_from___b1
    lda.z i
    cmp #<$1f4
    bne __b1_from___b1
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [14] phi (word) main::i1#2 = (word) 0 [phi:main::@1->main::@2#0] -- vwuz1=vwuc1 
    lda #<0
    sta.z i1
    lda #>0
    sta.z i1+1
    jmp __b2
    // [14] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  __b2_from___b2:
    // [14] phi (word) main::i1#2 = (word) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1 -- vwuz1=vwuz2_rol_1 
    lda.z i1
    asl
    sta.z __4
    lda.z i1+1
    rol
    sta.z __4+1
    // [16] (struct Point*~) main::$7 ← (const struct Point*) points + (word~) main::$4 -- pssz1=pssc1_plus_vwuz2 
    lda.z __4
    clc
    adc #<points
    sta.z __7
    lda.z __4+1
    adc #>points
    sta.z __7+1
    // [17] (struct Point*~) main::$8 ← (const struct Point*) main::SCREEN + (word~) main::$4 -- pssz1=pssc1_plus_vwuz2 
    lda.z __4
    clc
    adc #<SCREEN
    sta.z __8
    lda.z __4+1
    adc #>SCREEN
    sta.z __8+1
    // [18] *((struct Point*~) main::$8) ← memcpy(*((struct Point*~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssz1=_deref_pssz2_memcpy_vbuc1 
    ldy #0
  !:
    lda (__7),y
    sta (__8),y
    iny
    cpy #SIZEOF_STRUCT_POINT
    bne !-
    // [19] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1 
    inc.z i1
    bne !+
    inc.z i1+1
  !:
    // [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1 
    lda.z i1+1
    cmp #>$1f4
    bne __b2_from___b2
    lda.z i1
    cmp #<$1f4
    bne __b2_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [21] return 
    rts
}
  // File Data
  points: .fill 2*$1f4, 0

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte~) main::$0 ← (byte)(word) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) always clobbers reg byte a 
Statement [7] (word~) main::$3 ← (word) main::i#2 << (byte) 1 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:6 [ main::$0 ]
Statement [8] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (word~) main::$3 [ main::i#2 main::$0 main::$3 main::$5 ] ( main:2 [ main::i#2 main::$0 main::$3 main::$5 ] ) always clobbers reg byte a 
Statement [9] *((byte*~) main::$5) ← (byte) 2 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:6 [ main::$0 ]
Statement [10] (byte*~) main::$6 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 [ main::i#2 main::$0 main::$6 ] ( main:2 [ main::i#2 main::$0 main::$6 ] ) always clobbers reg byte a 
Statement [11] *((byte*~) main::$6) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y 
Statement [13] if((word) main::i#1!=(word) $1f4) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a 
Statement [15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1 [ main::i1#2 main::$4 ] ( main:2 [ main::i1#2 main::$4 ] ) always clobbers reg byte a 
Statement [16] (struct Point*~) main::$7 ← (const struct Point*) points + (word~) main::$4 [ main::i1#2 main::$4 main::$7 ] ( main:2 [ main::i1#2 main::$4 main::$7 ] ) always clobbers reg byte a 
Statement [17] (struct Point*~) main::$8 ← (const struct Point*) main::SCREEN + (word~) main::$4 [ main::i1#2 main::$7 main::$8 ] ( main:2 [ main::i1#2 main::$7 main::$8 ] ) always clobbers reg byte a 
Statement [18] *((struct Point*~) main::$8) ← memcpy(*((struct Point*~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte y 
Statement [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a 
Statement [6] (byte~) main::$0 ← (byte)(word) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) always clobbers reg byte a 
Statement [7] (word~) main::$3 ← (word) main::i#2 << (byte) 1 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a 
Statement [8] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (word~) main::$3 [ main::i#2 main::$0 main::$3 main::$5 ] ( main:2 [ main::i#2 main::$0 main::$3 main::$5 ] ) always clobbers reg byte a 
Statement [9] *((byte*~) main::$5) ← (byte) 2 [ main::i#2 main::$0 main::$3 ] ( main:2 [ main::i#2 main::$0 main::$3 ] ) always clobbers reg byte a reg byte y 
Statement [10] (byte*~) main::$6 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 [ main::i#2 main::$0 main::$6 ] ( main:2 [ main::i#2 main::$0 main::$6 ] ) always clobbers reg byte a 
Statement [11] *((byte*~) main::$6) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y 
Statement [13] if((word) main::i#1!=(word) $1f4) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a 
Statement [15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1 [ main::i1#2 main::$4 ] ( main:2 [ main::i1#2 main::$4 ] ) always clobbers reg byte a 
Statement [16] (struct Point*~) main::$7 ← (const struct Point*) points + (word~) main::$4 [ main::i1#2 main::$4 main::$7 ] ( main:2 [ main::i1#2 main::$4 main::$7 ] ) always clobbers reg byte a 
Statement [17] (struct Point*~) main::$8 ← (const struct Point*) main::SCREEN + (word~) main::$4 [ main::i1#2 main::$7 main::$8 ] ( main:2 [ main::i1#2 main::$7 main::$8 ] ) always clobbers reg byte a 
Statement [18] *((struct Point*~) main::$8) ← memcpy(*((struct Point*~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte y 
Statement [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 [ main::i1#1 ] ( main:2 [ main::i1#1 ] ) always clobbers reg byte a 
Potential registers zp[2]:2 [ main::i#2 main::i#1 ] : zp[2]:2 , 
Potential registers zp[2]:4 [ main::i1#2 main::i1#1 ] : zp[2]:4 , 
Potential registers zp[1]:6 [ main::$0 ] : zp[1]:6 , reg byte x , 
Potential registers zp[2]:7 [ main::$3 ] : zp[2]:7 , 
Potential registers zp[2]:9 [ main::$5 ] : zp[2]:9 , 
Potential registers zp[2]:11 [ main::$6 ] : zp[2]:11 , 
Potential registers zp[2]:13 [ main::$4 ] : zp[2]:13 , 
Potential registers zp[2]:15 [ main::$7 ] : zp[2]:15 , 
Potential registers zp[2]:17 [ main::$8 ] : zp[2]:17 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 23.1: zp[2]:4 [ main::i1#2 main::i1#1 ] 22: zp[2]:9 [ main::$5 ] 22: zp[2]:11 [ main::$6 ] 22: zp[2]:17 [ main::$8 ] 21.21: zp[2]:2 [ main::i#2 main::i#1 ] 16.5: zp[2]:13 [ main::$4 ] 11: zp[2]:7 [ main::$3 ] 5.5: zp[2]:15 [ main::$7 ] 4.4: zp[1]:6 [ main::$0 ] 
Uplift Scope [Point] 
Uplift Scope [] 

Uplifting [main] best 2408 combination zp[2]:4 [ main::i1#2 main::i1#1 ] zp[2]:9 [ main::$5 ] zp[2]:11 [ main::$6 ] zp[2]:17 [ main::$8 ] zp[2]:2 [ main::i#2 main::i#1 ] zp[2]:13 [ main::$4 ] zp[2]:7 [ main::$3 ] zp[2]:15 [ main::$7 ] reg byte x [ main::$0 ] 
Uplifting [Point] best 2408 combination 
Uplifting [] best 2408 combination 
Coalescing zero page register [ zp[2]:7 [ main::$3 ] ] with [ zp[2]:11 [ main::$6 ] ] - score: 1
Coalescing zero page register [ zp[2]:13 [ main::$4 ] ] with [ zp[2]:17 [ main::$8 ] ] - score: 1
Allocated (was zp[2]:7) zp[2]:6 [ main::$3 main::$6 ]
Allocated (was zp[2]:9) zp[2]:8 [ main::$5 ]
Allocated (was zp[2]:13) zp[2]:10 [ main::$4 main::$8 ]
Allocated (was zp[2]:15) zp[2]:12 [ main::$7 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct -  array with 256+ structs
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_STRUCT_POINT = 2
  .const OFFSET_STRUCT_POINT_Y = 1
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from___b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label SCREEN = $400
    .label __3 = 6
    .label __4 = $a
    .label i = 2
    .label i1 = 4
    .label __5 = 8
    .label __6 = 6
    .label __7 = $c
    .label __8 = $a
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (word) main::i#2 = (word) 0 [phi:main->main::@1#0] -- vwuz1=vwuc1 
    lda #<0
    sta.z i
    lda #>0
    sta.z i+1
    jmp __b1
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  __b1_from___b1:
    // [5] phi (word) main::i#2 = (word) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte~) main::$0 ← (byte)(word) main::i#2 -- vbuxx=_byte_vwuz1 
    lda.z i
    tax
    // [7] (word~) main::$3 ← (word) main::i#2 << (byte) 1 -- vwuz1=vwuz2_rol_1 
    lda.z i
    asl
    sta.z __3
    lda.z i+1
    rol
    sta.z __3+1
    // [8] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __3
    clc
    adc #<points
    sta.z __5
    lda.z __3+1
    adc #>points
    sta.z __5+1
    // [9] *((byte*~) main::$5) ← (byte) 2 -- _deref_pbuz1=vbuc1 
    lda #2
    ldy #0
    sta (__5),y
    // [10] (byte*~) main::$6 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz1 
    clc
    lda.z __6
    adc #<points+OFFSET_STRUCT_POINT_Y
    sta.z __6
    lda.z __6+1
    adc #>points+OFFSET_STRUCT_POINT_Y
    sta.z __6+1
    // [11] *((byte*~) main::$6) ← (byte~) main::$0 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (__6),y
    // [12] (word) main::i#1 ← ++ (word) main::i#2 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // [13] if((word) main::i#1!=(word) $1f4) goto main::@1 -- vwuz1_neq_vwuc1_then_la1 
    lda.z i+1
    cmp #>$1f4
    bne __b1_from___b1
    lda.z i
    cmp #<$1f4
    bne __b1_from___b1
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [14] phi (word) main::i1#2 = (word) 0 [phi:main::@1->main::@2#0] -- vwuz1=vwuc1 
    lda #<0
    sta.z i1
    lda #>0
    sta.z i1+1
    jmp __b2
    // [14] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  __b2_from___b2:
    // [14] phi (word) main::i1#2 = (word) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1 -- vwuz1=vwuz2_rol_1 
    lda.z i1
    asl
    sta.z __4
    lda.z i1+1
    rol
    sta.z __4+1
    // [16] (struct Point*~) main::$7 ← (const struct Point*) points + (word~) main::$4 -- pssz1=pssc1_plus_vwuz2 
    lda.z __4
    clc
    adc #<points
    sta.z __7
    lda.z __4+1
    adc #>points
    sta.z __7+1
    // [17] (struct Point*~) main::$8 ← (const struct Point*) main::SCREEN + (word~) main::$4 -- pssz1=pssc1_plus_vwuz1 
    clc
    lda.z __8
    adc #<SCREEN
    sta.z __8
    lda.z __8+1
    adc #>SCREEN
    sta.z __8+1
    // [18] *((struct Point*~) main::$8) ← memcpy(*((struct Point*~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssz1=_deref_pssz2_memcpy_vbuc1 
    ldy #0
  !:
    lda (__7),y
    sta (__8),y
    iny
    cpy #SIZEOF_STRUCT_POINT
    bne !-
    // [19] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1 
    inc.z i1
    bne !+
    inc.z i1+1
  !:
    // [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1 
    lda.z i1+1
    cmp #>$1f4
    bne __b2_from___b2
    lda.z i1
    cmp #<$1f4
    bne __b2_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [21] return 
    rts
}
  // File Data
  points: .fill 2*$1f4, 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #>0
Removing instruction lda.z i
Removing instruction ldy #0
Removing instruction lda #>0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b1 with __b1
Replacing label __b1_from___b1 with __b1
Replacing label __b2_from___b2 with __b2
Replacing label __b2_from___b2 with __b2
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from___b1:
Removing instruction __b2_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b1_from_main:
Removing instruction __b2_from___b1:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp __b1
Removing instruction jmp __b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(byte~) main::$0 reg byte x 4.4
(word~) main::$3 zp[2]:6 11.0
(word~) main::$4 zp[2]:10 16.5
(byte*~) main::$5 zp[2]:8 22.0
(byte*~) main::$6 zp[2]:6 22.0
(struct Point*~) main::$7 zp[2]:12 5.5
(struct Point*~) main::$8 zp[2]:10 22.0
(label) main::@1
(label) main::@2
(label) main::@return
(const struct Point*) main::SCREEN = (struct Point*) 1024
(word) main::i
(word) main::i#1 i zp[2]:2 16.5
(word) main::i#2 i zp[2]:2 4.714285714285714
(word) main::i1
(word) main::i1#1 i1 zp[2]:4 16.5
(word) main::i1#2 i1 zp[2]:4 6.6000000000000005
(const struct Point*) points[(number) $1f4]  = { fill( $1f4, 0) }

zp[2]:2 [ main::i#2 main::i#1 ]
zp[2]:4 [ main::i1#2 main::i1#1 ]
reg byte x [ main::$0 ]
zp[2]:6 [ main::$3 main::$6 ]
zp[2]:8 [ main::$5 ]
zp[2]:10 [ main::$4 main::$8 ]
zp[2]:12 [ main::$7 ]


FINAL ASSEMBLER
Score: 2156

  // File Comments
// Minimal struct -  array with 256+ structs
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_STRUCT_POINT = 2
  .const OFFSET_STRUCT_POINT_Y = 1
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label SCREEN = $400
    .label __3 = 6
    .label __4 = $a
    .label i = 2
    .label i1 = 4
    .label __5 = 8
    .label __6 = 6
    .label __7 = $c
    .label __8 = $a
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (word) main::i#2 = (word) 0 [phi:main->main::@1#0] -- vwuz1=vwuc1 
    lda #<0
    sta.z i
    sta.z i+1
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
    // [5] phi (word) main::i#2 = (word) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // (byte)i
    // [6] (byte~) main::$0 ← (byte)(word) main::i#2 -- vbuxx=_byte_vwuz1 
    lda.z i
    tax
    // points[i] = { 2, (byte)i }
    // [7] (word~) main::$3 ← (word) main::i#2 << (byte) 1 -- vwuz1=vwuz2_rol_1 
    asl
    sta.z __3
    lda.z i+1
    rol
    sta.z __3+1
    // [8] (byte*~) main::$5 ← (byte*)(const struct Point*) points + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __3
    clc
    adc #<points
    sta.z __5
    lda.z __3+1
    adc #>points
    sta.z __5+1
    // [9] *((byte*~) main::$5) ← (byte) 2 -- _deref_pbuz1=vbuc1 
    lda #2
    ldy #0
    sta (__5),y
    // [10] (byte*~) main::$6 ← (byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (word~) main::$3 -- pbuz1=pbuc1_plus_vwuz1 
    clc
    lda.z __6
    adc #<points+OFFSET_STRUCT_POINT_Y
    sta.z __6
    lda.z __6+1
    adc #>points+OFFSET_STRUCT_POINT_Y
    sta.z __6+1
    // [11] *((byte*~) main::$6) ← (byte~) main::$0 -- _deref_pbuz1=vbuxx 
    txa
    sta (__6),y
    // for( word i: 0..499)
    // [12] (word) main::i#1 ← ++ (word) main::i#2 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // [13] if((word) main::i#1!=(word) $1f4) goto main::@1 -- vwuz1_neq_vwuc1_then_la1 
    lda.z i+1
    cmp #>$1f4
    bne __b1
    lda.z i
    cmp #<$1f4
    bne __b1
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // [14] phi (word) main::i1#2 = (word) 0 [phi:main::@1->main::@2#0] -- vwuz1=vwuc1 
    lda #<0
    sta.z i1
    sta.z i1+1
    // [14] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
    // [14] phi (word) main::i1#2 = (word) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    // main::@2
  __b2:
    // SCREEN[i] = points[i]
    // [15] (word~) main::$4 ← (word) main::i1#2 << (byte) 1 -- vwuz1=vwuz2_rol_1 
    lda.z i1
    asl
    sta.z __4
    lda.z i1+1
    rol
    sta.z __4+1
    // [16] (struct Point*~) main::$7 ← (const struct Point*) points + (word~) main::$4 -- pssz1=pssc1_plus_vwuz2 
    lda.z __4
    clc
    adc #<points
    sta.z __7
    lda.z __4+1
    adc #>points
    sta.z __7+1
    // [17] (struct Point*~) main::$8 ← (const struct Point*) main::SCREEN + (word~) main::$4 -- pssz1=pssc1_plus_vwuz1 
    clc
    lda.z __8
    adc #<SCREEN
    sta.z __8
    lda.z __8+1
    adc #>SCREEN
    sta.z __8+1
    // [18] *((struct Point*~) main::$8) ← memcpy(*((struct Point*~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssz1=_deref_pssz2_memcpy_vbuc1 
    ldy #0
  !:
    lda (__7),y
    sta (__8),y
    iny
    cpy #SIZEOF_STRUCT_POINT
    bne !-
    // for( word i: 0..499)
    // [19] (word) main::i1#1 ← ++ (word) main::i1#2 -- vwuz1=_inc_vwuz1 
    inc.z i1
    bne !+
    inc.z i1+1
  !:
    // [20] if((word) main::i1#1!=(word) $1f4) goto main::@2 -- vwuz1_neq_vwuc1_then_la1 
    lda.z i1+1
    cmp #>$1f4
    bne __b2
    lda.z i1
    cmp #<$1f4
    bne __b2
    // main::@return
    // }
    // [21] return 
    rts
}
  // File Data
  points: .fill 2*$1f4, 0

