Fixing pointer array-indexing *((const struct Point*) points + (byte) main::i)
Fixing pointer array-indexing *((const struct Point*) points + (byte) main::i)
Fixing pointer array-indexing *((const struct Point*) points + (byte) main::i1)
Fixing pointer array-indexing *((const struct Point*) points + (byte) main::i1)
Replacing struct member reference *((const struct Point*) points + (byte~) main::$3).x with member unwinding reference *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$3)
Replacing struct member reference *((const struct Point*) points + (byte~) main::$4).y with member unwinding reference *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4)
Replacing struct member reference *((const struct Point*) points + (byte~) main::$5).x with member unwinding reference *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$5)
Replacing struct member reference *((const struct Point*) points + (byte~) main::$6).y with member unwinding reference *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6)
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::$3 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
  *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$3) ← (byte) main::i#2
  (number~) main::$0 ← (byte) main::i#2 + (number) 1
  (byte~) main::$4 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
  *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) ← (number~) main::$0
  (byte) main::i#1 ← (byte) main::i#2 + rangenext(0,4)
  (bool~) main::$1 ← (byte) main::i#1 != rangelast(0,4)
  if((bool~) main::$1) 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::$5 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
  *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$5)
  (byte~) main::$6 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
  *((const byte*) main::SCREEN+(number) $28 + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6)
  (byte) main::i1#1 ← (byte) main::i1#2 + rangenext(0,4)
  (bool~) main::$2 ← (byte) main::i1#1 != rangelast(0,4)
  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()
(number~) main::$0
(bool~) main::$1
(bool~) main::$2
(byte~) main::$3
(byte~) main::$4
(byte~) main::$5
(byte~) main::$6
(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
(const struct Point*) points[(number) 4]  = { fill( 4, 0) }

Adding number conversion cast (unumber) 1 in (number~) main::$0 ← (byte) main::i#2 + (number) 1
Adding number conversion cast (unumber) main::$0 in (number~) main::$0 ← (byte) main::i#2 + (unumber)(number) 1
Adding number conversion cast (unumber) $28 in *((const byte*) main::SCREEN+(number) $28 + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6)
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 1
Simplifying constant integer cast $28
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::$0 ← (byte) main::i#2 + (byte) 1
Identified duplicate assignment right side [5] (byte~) main::$4 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
Identified duplicate assignment right side [14] (byte~) main::$6 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2DuplicateRValueIdentification
Simple Condition (bool~) main::$1 [9] if((byte) main::i#1!=rangelast(0,4)) goto main::@1
Simple Condition (bool~) main::$2 [18] if((byte) main::i1#1!=rangelast(0,4)) 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 [7] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [9] if(main::i#1!=rangelast(0,4)) goto main::@1 to (number) 5
Resolved ranged next value [16] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [18] if(main::i1#1!=rangelast(0,4)) goto main::@3 to (number) 5
Simplifying expression containing zero (byte*)points in [3] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$3) ← (byte) main::i#2
Simplifying expression containing zero (byte*)points in [13] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$5)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) 5 in if((byte) main::i#1!=(number) 5) goto main::@1
Adding number conversion cast (unumber) 5 in if((byte) main::i1#1!=(number) 5) goto main::@3
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 5
Simplifying constant integer cast 5
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 5
Finalized unsigned number type (byte) 5
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte~) main::$4 = (byte~) main::$3 
Alias (byte~) main::$6 = (byte~) main::$5 
Successful SSA optimization Pass2AliasElimination
Rewriting multiplication to use shift [1] (byte~) main::$4 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
Rewriting multiplication to use shift [8] (byte~) main::$6 ← (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 [21] main::i1#3 ← main::i1#1
Coalesced [22] 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::$4 ← (byte) main::i#2 << (byte) 1
  [7] *((byte*)(const struct Point*) points + (byte~) main::$4) ← (byte) main::i#2
  [8] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1
  [9] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) ← (byte~) main::$0
  [10] (byte) main::i#1 ← ++ (byte) main::i#2
  [11] if((byte) main::i#1!=(byte) 5) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [12] (byte) main::i1#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::i1#1 )
  [13] (byte~) main::$6 ← (byte) main::i1#2 << (byte) 1
  [14] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$6)
  [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6)
  [16] (byte) main::i1#1 ← ++ (byte) main::i1#2
  [17] if((byte) main::i1#1!=(byte) 5) goto main::@2
  to:main::@return
main::@return: scope:[main]  from main::@2
  [18] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(void()) main()
(byte~) main::$0 22.0
(byte~) main::$4 11.0
(byte~) main::$6 16.5
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 11.0
(byte) main::i1
(byte) main::i1#1 16.5
(byte) main::i1#2 13.75

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::i1#2 main::i1#1 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable main::$6 to live range equivalence class [ main::$6 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::i1#2 main::i1#1 ]
[ main::$4 ]
[ main::$0 ]
[ main::$6 ]
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::$4 ]
Allocated zp[1]:5 [ main::$0 ]
Allocated zp[1]:6 [ main::$6 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Minimal struct - array of struct
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .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 = 5
    .label __4 = 4
    .label __6 = 6
    .label i = 2
    .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::$4 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z i
    asl
    sta.z __4
    // [7] *((byte*)(const struct Point*) points + (byte~) main::$4) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda.z i
    ldy.z __4
    sta points,y
    // [8] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 -- vbuz1=vbuz2_plus_1 
    ldy.z i
    iny
    sty.z __0
    // [9] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda.z __0
    ldy.z __4
    sta points+OFFSET_STRUCT_POINT_Y,y
    // [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [11] if((byte) main::i#1!=(byte) 5) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #5
    cmp.z i
    bne __b1_from___b1
    // [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [12] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i1
    jmp __b2
    // [12] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  __b2_from___b2:
    // [12] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [13] (byte~) main::$6 ← (byte) main::i1#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z i1
    asl
    sta.z __6
    // [14] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$6) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2 
    ldy.z __6
    lda points,y
    ldy.z i1
    sta SCREEN,y
    // [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2 
    ldy.z __6
    lda points+OFFSET_STRUCT_POINT_Y,y
    ldy.z i1
    sta SCREEN+$28,y
    // [16] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1 
    inc.z i1
    // [17] if((byte) main::i1#1!=(byte) 5) goto main::@2 -- vbuz1_neq_vbuc1_then_la1 
    lda #5
    cmp.z i1
    bne __b2_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [18] return 
    rts
}
  // File Data
  points: .fill 2*4, 0

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$4 ] ( main:2 [ main::i#2 main::$4 ] ) 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] *((byte*)(const struct Point*) points + (byte~) main::$4) ← (byte) main::i#2 [ main::i#2 main::$4 ] ( main:2 [ main::i#2 main::$4 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::$4 ]
Statement [13] (byte~) main::$6 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$6 ] ( main:2 [ main::i1#2 main::$6 ] ) 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 [14] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$6) [ main::i1#2 main::$6 ] ( main:2 [ main::i1#2 main::$6 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:6 [ main::$6 ]
Statement [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a 
Statement [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$4 ] ( main:2 [ main::i#2 main::$4 ] ) always clobbers reg byte a 
Statement [7] *((byte*)(const struct Point*) points + (byte~) main::$4) ← (byte) main::i#2 [ main::i#2 main::$4 ] ( main:2 [ main::i#2 main::$4 ] ) always clobbers reg byte a 
Statement [13] (byte~) main::$6 ← (byte) main::i1#2 << (byte) 1 [ main::i1#2 main::$6 ] ( main:2 [ main::i1#2 main::$6 ] ) always clobbers reg byte a 
Statement [14] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$6) [ main::i1#2 main::$6 ] ( main:2 [ main::i1#2 main::$6 ] ) always clobbers reg byte a 
Statement [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) [ main::i1#2 ] ( main:2 [ main::i1#2 ] ) always clobbers reg byte a 
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ main::$4 ] : zp[1]:4 , reg byte x , reg byte y , 
Potential registers zp[1]:5 [ main::$0 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ main::$6 ] : zp[1]:6 , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 30.25: zp[1]:3 [ main::i1#2 main::i1#1 ] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:5 [ main::$0 ] 16.5: zp[1]:6 [ main::$6 ] 11: zp[1]:4 [ main::$4 ] 
Uplift Scope [Point] 
Uplift Scope [] 

Uplifting [main] best 918 combination reg byte y [ main::i1#2 main::i1#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte y [ main::$0 ] reg byte x [ main::$6 ] zp[1]:4 [ main::$4 ] 
Limited combination testing to 100 combinations of 324 possible.
Uplifting [Point] best 918 combination 
Uplifting [] best 918 combination 
Attempting to uplift remaining variables inzp[1]:4 [ main::$4 ]
Uplifting [main] best 918 combination zp[1]:4 [ main::$4 ] 
Allocated (was zp[1]:4) zp[1]:2 [ main::$4 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct - array of struct
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .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 __4 = 2
    // [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::$4 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuxx_rol_1 
    txa
    asl
    sta.z __4
    // [7] *((byte*)(const struct Point*) points + (byte~) main::$4) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuxx 
    ldy.z __4
    txa
    sta points,y
    // [8] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 -- vbuyy=vbuxx_plus_1 
    txa
    tay
    iny
    // [9] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuyy 
    tya
    ldy.z __4
    sta points+OFFSET_STRUCT_POINT_Y,y
    // [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [11] if((byte) main::i#1!=(byte) 5) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #5
    bne __b1_from___b1
    // [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [12] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuyy=vbuc1 
    ldy #0
    jmp __b2
    // [12] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  __b2_from___b2:
    // [12] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [13] (byte~) main::$6 ← (byte) main::i1#2 << (byte) 1 -- vbuxx=vbuyy_rol_1 
    tya
    asl
    tax
    // [14] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$6) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx 
    lda points,x
    sta SCREEN,y
    // [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx 
    lda points+OFFSET_STRUCT_POINT_Y,x
    sta SCREEN+$28,y
    // [16] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuyy=_inc_vbuyy 
    iny
    // [17] if((byte) main::i1#1!=(byte) 5) goto main::@2 -- vbuyy_neq_vbuc1_then_la1 
    cpy #5
    bne __b2_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [18] 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 instruction ldy.z __4 with TAY
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) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(void()) main()
(byte~) main::$0 reg byte y 22.0
(byte~) main::$4 zp[1]:2 11.0
(byte~) main::$6 reg byte x 16.5
(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 11.0
(byte) main::i1
(byte) main::i1#1 reg byte y 16.5
(byte) main::i1#2 reg byte y 13.75
(const struct Point*) points[(number) 4]  = { fill( 4, 0) }

reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::i1#2 main::i1#1 ]
zp[1]:2 [ main::$4 ]
reg byte y [ main::$0 ]
reg byte x [ main::$6 ]


FINAL ASSEMBLER
Score: 746

  // File Comments
// Minimal struct - array of struct
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .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 __4 = 2
    // [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].x = i
    // [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuxx_rol_1 
    txa
    asl
    sta.z __4
    // [7] *((byte*)(const struct Point*) points + (byte~) main::$4) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuxx 
    tay
    txa
    sta points,y
    // i+1
    // [8] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 -- vbuyy=vbuxx_plus_1 
    txa
    tay
    iny
    // points[i].y = i+1
    // [9] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$4) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuyy 
    tya
    ldy.z __4
    sta points+OFFSET_STRUCT_POINT_Y,y
    // for( byte i: 0..4)
    // [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [11] if((byte) main::i#1!=(byte) 5) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #5
    bne __b1
    // [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // [12] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuyy=vbuc1 
    ldy #0
    // [12] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
    // [12] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    // main::@2
  __b2:
    // SCREEN[i] = points[i].x
    // [13] (byte~) main::$6 ← (byte) main::i1#2 << (byte) 1 -- vbuxx=vbuyy_rol_1 
    tya
    asl
    tax
    // [14] *((const byte*) main::SCREEN + (byte) main::i1#2) ← *((byte*)(const struct Point*) points + (byte~) main::$6) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx 
    lda points,x
    sta SCREEN,y
    // (SCREEN+40)[i] = points[i].y
    // [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i1#2) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx 
    lda points+OFFSET_STRUCT_POINT_Y,x
    sta SCREEN+$28,y
    // for( byte i: 0..4)
    // [16] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuyy=_inc_vbuyy 
    iny
    // [17] if((byte) main::i1#1!=(byte) 5) goto main::@2 -- vbuyy_neq_vbuc1_then_la1 
    cpy #5
    bne __b2
    // main::@return
    // }
    // [18] return 
    rts
}
  // File Data
  points: .fill 2*4, 0

