Fixing pointer addition (struct Point*~) main::$0 ← (const struct Point*) points + (byte) main::i
Fixing pointer addition (struct Point*~) main::$7 ← (const struct Point*) points + (byte) main::i1
Culled Empty Block (label) main::@4

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

(void()) main()
main: scope:[main]  from @1
  (byte) main::i#0 ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@1
  (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
  (byte~) main::$13 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
  (struct Point*~) main::$0 ← (const struct Point*) points + (byte~) main::$13
  (struct Point*) main::point_i#0 ← (struct Point*~) main::$0
  (byte*~) main::$1 ← ((byte*)) (struct Point*) main::point_i#0
  (byte*~) main::$2 ← (byte*~) main::$1 + (const byte) OFFS_X
  *((byte*~) main::$2) ← (byte) main::i#2
  (byte*~) main::$3 ← ((byte*)) (struct Point*) main::point_i#0
  (byte*~) main::$4 ← (byte*~) main::$3 + (const byte) OFFS_Y
  (number~) main::$5 ← (byte) main::i#2 + (number) 4
  *((byte*~) main::$4) ← (number~) main::$5
  (byte) main::i#1 ← (byte) main::i#2 + rangenext(0,3)
  (bool~) main::$6 ← (byte) main::i#1 != rangelast(0,3)
  if((bool~) main::$6) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte) main::i1#0 ← (byte) 0
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@3
  (byte) main::i1#2 ← phi( main::@2/(byte) main::i1#0 main::@3/(byte) main::i1#1 )
  (byte~) main::$14 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
  (struct Point*~) main::$7 ← (const struct Point*) points + (byte~) main::$14
  (struct Point*) main::point_i1#0 ← (struct Point*~) main::$7
  (byte*~) main::$8 ← ((byte*)) (struct Point*) main::point_i1#0
  (byte*~) main::$9 ← (byte*~) main::$8 + (const byte) OFFS_X
  *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*~) main::$9)
  (byte*~) main::$10 ← ((byte*)) (struct Point*) main::point_i1#0
  (byte*~) main::$11 ← (byte*~) main::$10 + (const byte) OFFS_Y
  *((const byte*) main::SCREEN+(number) $28 + (byte) main::i1#2) ← *((byte*~) main::$11)
  (byte) main::i1#1 ← (byte) main::i1#2 + rangenext(0,3)
  (bool~) main::$12 ← (byte) main::i1#1 != rangelast(0,3)
  if((bool~) main::$12) 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) OFFS_X = (byte) 0
(const byte) OFFS_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(struct Point*~) main::$0
(byte*~) main::$1
(byte*~) main::$10
(byte*~) main::$11
(bool~) main::$12
(byte~) main::$13
(byte~) main::$14
(byte*~) main::$2
(byte*~) main::$3
(byte*~) main::$4
(number~) main::$5
(bool~) main::$6
(struct Point*~) main::$7
(byte*~) main::$8
(byte*~) main::$9
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i1
(byte) main::i1#0
(byte) main::i1#1
(byte) main::i1#2
(struct Point*) main::point_i
(struct Point*) main::point_i#0
(struct Point*) main::point_i1
(struct Point*) main::point_i1#0
(const struct Point*) points[(number) 4]  = { fill( 4, 0) }

Adding number conversion cast (unumber) 4 in (number~) main::$5 ← (byte) main::i#2 + (number) 4
Adding number conversion cast (unumber) main::$5 in (number~) main::$5 ← (byte) main::i#2 + (unumber)(number) 4
Adding number conversion cast (unumber) $28 in *((const byte*) main::SCREEN+(number) $28 + (byte) main::i1#2) ← *((byte*~) main::$11)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*~) main::$1 ← (byte*)(struct Point*) main::point_i#0
Inlining cast (byte*~) main::$3 ← (byte*)(struct Point*) main::point_i#0
Inlining cast (byte*~) main::$8 ← (byte*)(struct Point*) main::point_i1#0
Inlining cast (byte*~) main::$10 ← (byte*)(struct Point*) main::point_i1#0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 4
Simplifying constant integer cast $28
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 4
Finalized unsigned number type (byte) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::$5 ← (byte) main::i#2 + (byte) 4
Alias (struct Point*) main::point_i#0 = (struct Point*~) main::$0 
Alias (struct Point*) main::point_i1#0 = (struct Point*~) main::$7 
Successful SSA optimization Pass2AliasElimination
Simple Condition (bool~) main::$6 [14] if((byte) main::i#1!=rangelast(0,3)) goto main::@1
Simple Condition (bool~) main::$12 [28] if((byte) main::i1#1!=rangelast(0,3)) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) main::i#0 = 0
Constant (const byte) main::i1#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [12] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [14] if(main::i#1!=rangelast(0,3)) goto main::@1 to (number) 4
Resolved ranged next value [26] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [28] if(main::i1#1!=rangelast(0,3)) goto main::@3 to (number) 4
Converting *(pointer+n) to pointer[n] [7] *((byte*~) main::$2) ← (byte) main::i#2  -- *(main::$1 + OFFS_X)
Converting *(pointer+n) to pointer[n] [11] *((byte*~) main::$4) ← (byte~) main::$5  -- *(main::$3 + OFFS_Y)
Converting *(pointer+n) to pointer[n] [22] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*~) main::$9)  -- *(main::$8 + OFFS_X)
Converting *(pointer+n) to pointer[n] [25] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*~) main::$11)  -- *(main::$10 + OFFS_Y)
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero main::$1 in [6] (byte*~) main::$2 ← (byte*~) main::$1 + (const byte) OFFS_X
Simplifying expression containing zero main::$1 in [7] *((byte*~) main::$1 + (const byte) OFFS_X) ← (byte) main::i#2
Simplifying expression containing zero main::$8 in [21] (byte*~) main::$9 ← (byte*~) main::$8 + (const byte) OFFS_X
Simplifying expression containing zero main::$8 in [22] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*~) main::$8 + (const byte) OFFS_X)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (byte*~) main::$2 and assignment [4] (byte*~) main::$2 ← (byte*~) main::$1
Eliminating unused variable (byte*~) main::$4 and assignment [7] (byte*~) main::$4 ← (byte*~) main::$3 + (const byte) OFFS_Y
Eliminating unused variable (byte*~) main::$9 and assignment [16] (byte*~) main::$9 ← (byte*~) main::$8
Eliminating unused variable (byte*~) main::$11 and assignment [19] (byte*~) main::$11 ← (byte*~) main::$10 + (const byte) OFFS_Y
Eliminating unused constant (const byte) OFFS_X
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) 4 in if((byte) main::i#1!=(number) 4) goto main::@1
Adding number conversion cast (unumber) 4 in if((byte) main::i1#1!=(number) 4) goto main::@3
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 4
Simplifying constant integer cast 4
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 4
Finalized unsigned number type (byte) 4
Successful SSA optimization PassNFinalizeNumberTypeConversions
Converting *(pointer+n) to pointer[n] [4] *((byte*~) main::$1) ← (byte) main::i#2  -- *((byte*)points + main::$13)
Converting *(pointer+n) to pointer[n] [14] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*~) main::$8)  -- *((byte*)points + main::$14)
Successful SSA optimization Pass2InlineDerefIdx
Eliminating unused variable (byte*~) main::$1 and assignment [3] (byte*~) main::$1 ← (byte*)(struct Point*) main::point_i#0
Eliminating unused variable (byte*~) main::$8 and assignment [13] (byte*~) main::$8 ← (byte*)(struct Point*) main::point_i1#0
Successful SSA optimization PassNEliminateUnusedVars
Constant value identified (byte*)points in [3] *((byte*)(const struct Point*) points + (byte~) main::$13) ← (byte) main::i#2
Constant value identified (byte*)points in [12] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$14)
Successful SSA optimization Pass2ConstantValues
Inlining Noop Cast [4] (byte*~) main::$3 ← (byte*)(struct Point*) main::point_i#0 keeping main::point_i#0
Inlining Noop Cast [13] (byte*~) main::$10 ← (byte*)(struct Point*) main::point_i1#0 keeping main::point_i1#0
Successful SSA optimization Pass2NopCastInlining
Rewriting multiplication to use shift [1] (byte~) main::$13 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
Rewriting multiplication to use shift [10] (byte~) main::$14 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::i1#0
Constant inlined main::i#0 = (byte) 0
Constant inlined main::i1#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Eliminating unused constant (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization PassNEliminateUnusedVars
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 [23] main::i1#3 ← main::i1#1
Coalesced [24] 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] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
  [6] (byte~) main::$13 ← (byte) main::i#2 << (byte) 1
  [7] (struct Point*) main::point_i#0 ← (const struct Point*) points + (byte~) main::$13
  [8] *((byte*)(const struct Point*) points + (byte~) main::$13) ← (byte) main::i#2
  [9] (byte~) main::$5 ← (byte) main::i#2 + (byte) 4
  [10] *((byte*)(struct Point*) main::point_i#0 + (const byte) OFFS_Y) ← (byte~) main::$5
  [11] (byte) main::i#1 ← ++ (byte) main::i#2
  [12] if((byte) main::i#1!=(byte) 4) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [13] (byte) main::i1#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::i1#1 )
  [14] (byte~) main::$14 ← (byte) main::i1#2 << (byte) 1
  [15] (struct Point*) main::point_i1#0 ← (const struct Point*) points + (byte~) main::$14
  [16] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$14)
  [17] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(struct Point*) main::point_i1#0 + (const byte) OFFS_Y)
  [18] (byte) main::i1#1 ← ++ (byte) main::i1#2
  [19] if((byte) main::i1#1!=(byte) 4) goto main::@2
  to:main::@return
main::@return: scope:[main]  from main::@2
  [20] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(void()) main()
(byte~) main::$13 16.5
(byte~) main::$14 16.5
(byte~) main::$5 22.0
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 9.166666666666666
(byte) main::i1
(byte) main::i1#1 16.5
(byte) main::i1#2 11.0
(struct Point*) main::point_i
(struct Point*) main::point_i#0 3.6666666666666665
(struct Point*) main::point_i1
(struct Point*) main::point_i1#0 5.5

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

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Minimal struct - array of struct - far pointer math indexing
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const OFFS_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 __5 = 7
    .label __13 = 4
    .label __14 = 8
    .label point_i = 5
    .label i = 2
    .label point_i1 = 9
    .label i1 = 3
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    jmp __b1
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  __b1_from___b1:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte~) main::$13 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z i
    asl
    sta.z __13
    // [7] (struct Point*) main::point_i#0 ← (const struct Point*) points + (byte~) main::$13 -- pssz1=pssc1_plus_vbuz2 
    lda.z __13
    clc
    adc #<points
    sta.z point_i
    lda #>points
    adc #0
    sta.z point_i+1
    // [8] *((byte*)(const struct Point*) points + (byte~) main::$13) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda.z i
    ldy.z __13
    sta points,y
    // [9] (byte~) main::$5 ← (byte) main::i#2 + (byte) 4 -- vbuz1=vbuz2_plus_vbuc1 
    lax.z i
    axs #-[4]
    stx.z __5
    // [10] *((byte*)(struct Point*) main::point_i#0 + (const byte) OFFS_Y) ← (byte~) main::$5 -- pbuz1_derefidx_vbuc1=vbuz2 
    // points[i].x = i;
    lda.z __5
    ldy #OFFS_Y
    sta (point_i),y
    // [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [12] if((byte) main::i#1!=(byte) 4) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #4
    cmp.z i
    bne __b1_from___b1
    // [13] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [13] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i1
    jmp __b2
    // [13] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  __b2_from___b2:
    // [13] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [14] (byte~) main::$14 ← (byte) main::i1#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z i1
    asl
    sta.z __14
    // [15] (struct Point*) main::point_i1#0 ← (const struct Point*) points + (byte~) main::$14 -- pssz1=pssc1_plus_vbuz2 
    lda.z __14
    clc
    adc #<points
    sta.z point_i1
    lda #>points
    adc #0
    sta.z point_i1+1
    // [16] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$14) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2 
    ldy.z __14
    lda points,y
    ldy.z i1
    sta SCREEN,y
    // [17] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(struct Point*) main::point_i1#0 + (const byte) OFFS_Y) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2 
    // SCREEN[i] = points[i].x;
    ldx.z i1
    ldy #OFFS_Y
    lda (point_i1),y
    sta SCREEN+$28,x
    // [18] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1 
    inc.z i1
    // [19] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuz1_neq_vbuc1_then_la1 
    lda #4
    cmp.z i1
    bne __b2_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [20] return 
    rts
}
  // File Data
  points: .fill 2*4, 0

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte~) main::$13 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$13 ] ( main:2 [ main::i#2 main::$13 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [7] (struct Point*) main::point_i#0 ← (const struct Point*) points + (byte~) main::$13 [ main::i#2 main::$13 main::point_i#0 ] ( main:2 [ main::i#2 main::$13 main::point_i#0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::$13 ]
Statement [8] *((byte*)(const struct Point*) points + (byte~) main::$13) ← (byte) main::i#2 [ main::i#2 main::point_i#0 ] ( main:2 [ main::i#2 main::point_i#0 ] ) always clobbers reg byte a 
Statement [9] (byte~) main::$5 ← (byte) main::i#2 + (byte) 4 [ main::i#2 main::point_i#0 main::$5 ] ( main:2 [ main::i#2 main::point_i#0 main::$5 ] ) always clobbers reg byte a 
Statement [10] *((byte*)(struct Point*) main::point_i#0 + (const byte) OFFS_Y) ← (byte~) main::$5 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [14] (byte~) main::$14 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$14 ] ( main:2 [ main::i1#2 main::$14 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Statement [15] (struct Point*) main::point_i1#0 ← (const struct Point*) points + (byte~) main::$14 [ main::i1#2 main::$14 main::point_i1#0 ] ( main:2 [ main::i1#2 main::$14 main::point_i1#0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:8 [ main::$14 ]
Statement [16] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$14) [ main::i1#2 main::point_i1#0 ] ( main:2 [ main::i1#2 main::point_i1#0 ] ) always clobbers reg byte a 
Statement [17] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(struct Point*) main::point_i1#0 + (const byte) OFFS_Y) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Statement [6] (byte~) main::$13 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$13 ] ( main:2 [ main::i#2 main::$13 ] ) always clobbers reg byte a 
Statement [7] (struct Point*) main::point_i#0 ← (const struct Point*) points + (byte~) main::$13 [ main::i#2 main::$13 main::point_i#0 ] ( main:2 [ main::i#2 main::$13 main::point_i#0 ] ) always clobbers reg byte a 
Statement [8] *((byte*)(const struct Point*) points + (byte~) main::$13) ← (byte) main::i#2 [ main::i#2 main::point_i#0 ] ( main:2 [ main::i#2 main::point_i#0 ] ) always clobbers reg byte a 
Statement [9] (byte~) main::$5 ← (byte) main::i#2 + (byte) 4 [ main::i#2 main::point_i#0 main::$5 ] ( main:2 [ main::i#2 main::point_i#0 main::$5 ] ) always clobbers reg byte a 
Statement [10] *((byte*)(struct Point*) main::point_i#0 + (const byte) OFFS_Y) ← (byte~) main::$5 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y 
Statement [14] (byte~) main::$14 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$14 ] ( main:2 [ main::i1#2 main::$14 ] ) always clobbers reg byte a 
Statement [15] (struct Point*) main::point_i1#0 ← (const struct Point*) points + (byte~) main::$14 [ main::i1#2 main::$14 main::point_i1#0 ] ( main:2 [ main::i1#2 main::$14 main::point_i1#0 ] ) always clobbers reg byte a 
Statement [16] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$14) [ main::i1#2 main::point_i1#0 ] ( main:2 [ main::i1#2 main::point_i1#0 ] ) always clobbers reg byte a 
Statement [17] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(struct Point*) main::point_i1#0 + (const byte) OFFS_Y) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a reg byte y 
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , 
Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 , reg byte x , 
Potential registers zp[1]:4 [ main::$13 ] : zp[1]:4 , reg byte x , reg byte y , 
Potential registers zp[2]:5 [ main::point_i#0 ] : zp[2]:5 , 
Potential registers zp[1]:7 [ main::$5 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:8 [ main::$14 ] : zp[1]:8 , reg byte x , reg byte y , 
Potential registers zp[2]:9 [ main::point_i1#0 ] : zp[2]:9 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 27.5: zp[1]:3 [ main::i1#2 main::i1#1 ] 25.67: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:7 [ main::$5 ] 16.5: zp[1]:4 [ main::$13 ] 16.5: zp[1]:8 [ main::$14 ] 5.5: zp[2]:9 [ main::point_i1#0 ] 3.67: zp[2]:5 [ main::point_i#0 ] 
Uplift Scope [Point] 
Uplift Scope [] 

Uplifting [main] best 1258 combination reg byte x [ main::i1#2 main::i1#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$5 ] reg byte y [ main::$13 ] zp[1]:8 [ main::$14 ] zp[2]:9 [ main::point_i1#0 ] zp[2]:5 [ main::point_i#0 ] 
Limited combination testing to 100 combinations of 144 possible.
Uplifting [Point] best 1258 combination 
Uplifting [] best 1258 combination 
Attempting to uplift remaining variables inzp[1]:8 [ main::$14 ]
Uplifting [main] best 1208 combination reg byte y [ main::$14 ] 
Allocated (was zp[2]:5) zp[2]:2 [ main::point_i#0 ]
Allocated (was zp[2]:9) zp[2]:4 [ main::point_i1#0 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct - array of struct - far pointer math indexing
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const OFFS_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 point_i = 2
    .label point_i1 = 4
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  __b1_from___b1:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte~) main::$13 ← (byte) main::i#2 << (byte) 1 -- vbuyy=vbuxx_rol_1 
    txa
    asl
    tay
    // [7] (struct Point*) main::point_i#0 ← (const struct Point*) points + (byte~) main::$13 -- pssz1=pssc1_plus_vbuyy 
    tya
    clc
    adc #<points
    sta.z point_i
    lda #>points
    adc #0
    sta.z point_i+1
    // [8] *((byte*)(const struct Point*) points + (byte~) main::$13) ← (byte) main::i#2 -- pbuc1_derefidx_vbuyy=vbuxx 
    txa
    sta points,y
    // [9] (byte~) main::$5 ← (byte) main::i#2 + (byte) 4 -- vbuaa=vbuxx_plus_vbuc1 
    txa
    clc
    adc #4
    // [10] *((byte*)(struct Point*) main::point_i#0 + (const byte) OFFS_Y) ← (byte~) main::$5 -- pbuz1_derefidx_vbuc1=vbuaa 
    // points[i].x = i;
    ldy #OFFS_Y
    sta (point_i),y
    // [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [12] if((byte) main::i#1!=(byte) 4) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #4
    bne __b1_from___b1
    // [13] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [13] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b2
    // [13] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  __b2_from___b2:
    // [13] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [14] (byte~) main::$14 ← (byte) main::i1#2 << (byte) 1 -- vbuyy=vbuxx_rol_1 
    txa
    asl
    tay
    // [15] (struct Point*) main::point_i1#0 ← (const struct Point*) points + (byte~) main::$14 -- pssz1=pssc1_plus_vbuyy 
    tya
    clc
    adc #<points
    sta.z point_i1
    lda #>points
    adc #0
    sta.z point_i1+1
    // [16] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$14) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy 
    lda points,y
    sta SCREEN,x
    // [17] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(struct Point*) main::point_i1#0 + (const byte) OFFS_Y) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2 
    // SCREEN[i] = points[i].x;
    ldy #OFFS_Y
    lda (point_i1),y
    sta SCREEN+$28,x
    // [18] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuxx=_inc_vbuxx 
    inx
    // [19] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #4
    bne __b2_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [20] return 
    rts
}
  // File Data
  points: .fill 2*4, 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
Replacing label __bbegin with __b1
Replacing label __b1_from___b1 with __b1
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) OFFS_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(void()) main()
(byte~) main::$13 reg byte y 16.5
(byte~) main::$14 reg byte y 16.5
(byte~) main::$5 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 9.166666666666666
(byte) main::i1
(byte) main::i1#1 reg byte x 16.5
(byte) main::i1#2 reg byte x 11.0
(struct Point*) main::point_i
(struct Point*) main::point_i#0 point_i zp[2]:2 3.6666666666666665
(struct Point*) main::point_i1
(struct Point*) main::point_i1#0 point_i1 zp[2]:4 5.5
(const struct Point*) points[(number) 4]  = { fill( 4, 0) }

reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::i1#2 main::i1#1 ]
reg byte y [ main::$13 ]
zp[2]:2 [ main::point_i#0 ]
reg byte a [ main::$5 ]
reg byte y [ main::$14 ]
zp[2]:4 [ main::point_i1#0 ]


FINAL ASSEMBLER
Score: 1046

  // File Comments
// Minimal struct - array of struct - far pointer math indexing
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .const OFFS_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 point_i = 2
    .label point_i1 = 4
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // points+i
    // [6] (byte~) main::$13 ← (byte) main::i#2 << (byte) 1 -- vbuyy=vbuxx_rol_1 
    txa
    asl
    tay
    // point_i = points+i
    // [7] (struct Point*) main::point_i#0 ← (const struct Point*) points + (byte~) main::$13 -- pssz1=pssc1_plus_vbuyy 
    tya
    clc
    adc #<points
    sta.z point_i
    lda #>points
    adc #0
    sta.z point_i+1
    // *((byte*)point_i+OFFS_X) = i
    // [8] *((byte*)(const struct Point*) points + (byte~) main::$13) ← (byte) main::i#2 -- pbuc1_derefidx_vbuyy=vbuxx 
    txa
    sta points,y
    // i+4
    // [9] (byte~) main::$5 ← (byte) main::i#2 + (byte) 4 -- vbuaa=vbuxx_plus_vbuc1 
    txa
    clc
    adc #4
    // *((byte*)point_i+OFFS_Y)  = i+4
    // [10] *((byte*)(struct Point*) main::point_i#0 + (const byte) OFFS_Y) ← (byte~) main::$5 -- pbuz1_derefidx_vbuc1=vbuaa 
    // points[i].x = i;
    ldy #OFFS_Y
    sta (point_i),y
    // for( byte i: 0..3)
    // [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [12] if((byte) main::i#1!=(byte) 4) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #4
    bne __b1
    // [13] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // [13] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    // [13] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
    // [13] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    // main::@2
  __b2:
    // points+i
    // [14] (byte~) main::$14 ← (byte) main::i1#2 << (byte) 1 -- vbuyy=vbuxx_rol_1 
    txa
    asl
    tay
    // point_i = points+i
    // [15] (struct Point*) main::point_i1#0 ← (const struct Point*) points + (byte~) main::$14 -- pssz1=pssc1_plus_vbuyy 
    tya
    clc
    adc #<points
    sta.z point_i1
    lda #>points
    adc #0
    sta.z point_i1+1
    // SCREEN[i] = *((byte*)point_i+OFFS_X)
    // [16] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$14) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy 
    lda points,y
    sta SCREEN,x
    // (SCREEN+40)[i] = *((byte*)point_i+OFFS_Y)
    // [17] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(struct Point*) main::point_i1#0 + (const byte) OFFS_Y) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2 
    // SCREEN[i] = points[i].x;
    ldy #OFFS_Y
    lda (point_i1),y
    sta SCREEN+$28,x
    // for( byte i: 0..3)
    // [18] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuxx=_inc_vbuxx 
    inx
    // [19] if((byte) main::i1#1!=(byte) 4) goto main::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #4
    bne __b2
    // main::@return
    // }
    // [20] return 
    rts
}
  // File Data
  points: .fill 2*4, 0

