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*) main::SCREEN + (byte) main::i1)
Constantified RValue *((const struct Point*) points + (byte~) main::$6) ← (struct Point){ (signed byte~) main::$0, (signed byte~) main::$2, (signed byte~) main::$3 }
Unwinding value copy *((const struct Point*) points + (byte~) main::$6) ← (struct Point){ (signed byte~) main::$0, (signed byte~) main::$2, (signed byte~) main::$3 }
Adding value simple copy *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$6) ← (signed byte~) main::$0
Adding value simple copy *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2
Adding value simple copy *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte~) main::$3
Adding value bulk copy *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), 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
  (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 )
  (signed byte~) main::$0 ← ((signed byte)) (byte) main::i#2
  (signed byte~) main::$1 ← ((signed byte)) (byte) main::i#2
  (signed byte~) main::$2 ← - (signed byte~) main::$1
  (signed byte~) main::$3 ← ((signed byte)) (byte) main::i#2
  (byte~) main::$6 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
  *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$6) ← (signed byte~) main::$0
  *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2
  *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte~) main::$3
  (byte) main::i#1 ← (byte) main::i#2 + rangenext(0,3)
  (bool~) main::$4 ← (byte) main::i#1 != rangelast(0,3)
  if((bool~) main::$4) 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::$7 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
  *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT)
  (byte) main::i1#1 ← (byte) main::i1#2 + rangenext(0,3)
  (bool~) main::$5 ← (byte) main::i1#1 != rangelast(0,3)
  if((bool~) main::$5) 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
(const byte) OFFSET_STRUCT_POINT_Z = (byte) 2
(signed byte) Point::x
(signed byte) Point::y
(signed byte) Point::z
(const byte) SIZEOF_STRUCT_POINT = (byte) 3
(void()) main()
(signed byte~) main::$0
(signed byte~) main::$1
(signed byte~) main::$2
(signed byte~) main::$3
(bool~) main::$4
(bool~) main::$5
(byte~) main::$6
(byte~) main::$7
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(const struct Point*) main::SCREEN = (struct Point*)(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) }

Inlining cast (signed byte~) main::$0 ← (signed byte)(byte) main::i#2
Inlining cast (signed byte~) main::$1 ← (signed byte)(byte) main::i#2
Inlining cast (signed byte~) main::$3 ← (signed byte)(byte) main::i#2
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (struct Point*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) main::$4 [12] if((byte) main::i#1!=rangelast(0,3)) goto main::@1
Simple Condition (bool~) main::$5 [19] 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 [10] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [12] if(main::i#1!=rangelast(0,3)) goto main::@1 to (number) 4
Resolved ranged next value [17] main::i1#1 ← ++ main::i1#2 to ++
Resolved ranged comparison value [19] if(main::i1#1!=rangelast(0,3)) goto main::@3 to (number) 4
Simplifying expression containing zero (signed byte*)points in [7] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (byte~) main::$6) ← (signed byte~) main::$0
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_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
Inlining Noop Cast [1] (signed byte~) main::$0 ← (signed byte)(byte) main::i#2 keeping main::i#2
Inlining Noop Cast [2] (signed byte~) main::$1 ← (signed byte)(byte) main::i#2 keeping main::i#2
Inlining Noop Cast [4] (signed byte~) main::$3 ← (signed byte)(byte) main::i#2 keeping main::i#2
Successful SSA optimization Pass2NopCastInlining
Rewriting multiplication to use shift and addition[5] (byte~) main::$6 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_POINT
Rewriting multiplication to use shift and addition[12] (byte~) main::$7 ← (byte) main::i1#2 * (const byte) SIZEOF_STRUCT_POINT
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
Alias (byte~) main::$6 = (byte~) main::$9 
Alias (byte~) main::$7 = (byte~) main::$11 
Successful SSA optimization Pass2AliasElimination
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] (signed byte~) main::$2 ← - (signed byte)(byte) main::i#2
  [7] (byte~) main::$8 ← (byte) main::i#2 << (byte) 1
  [8] (byte~) main::$6 ← (byte~) main::$8 + (byte) main::i#2
  [9] *((signed byte*)(const struct Point*) points + (byte~) main::$6) ← (signed byte)(byte) main::i#2
  [10] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2
  [11] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte)(byte) main::i#2
  [12] (byte) main::i#1 ← ++ (byte) main::i#2
  [13] if((byte) main::i#1!=(byte) 4) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [14] (byte) main::i1#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::i1#1 )
  [15] (byte~) main::$10 ← (byte) main::i1#2 << (byte) 1
  [16] (byte~) main::$7 ← (byte~) main::$10 + (byte) main::i1#2
  [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT)
  [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
(signed byte) Point::x
(signed byte) Point::y
(signed byte) Point::z
(void()) main()
(byte~) main::$10 22.0
(signed byte~) main::$2 5.5
(byte~) main::$6 14.666666666666666
(byte~) main::$7 22.0
(byte~) main::$8 22.0
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 6.285714285714286
(byte) main::i1
(byte) main::i1#1 16.5
(byte) main::i1#2 11.0

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

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Minimal struct -  array of 3-byte structs (required *3)
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_STRUCT_POINT = 3
  .const OFFSET_STRUCT_POINT_Y = 1
  .const OFFSET_STRUCT_POINT_Z = 2
  // @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 __2 = 4
    .label __6 = 6
    .label __7 = 8
    .label i = 2
    .label i1 = 3
    .label __8 = 5
    .label __10 = 7
    // [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] (signed byte~) main::$2 ← - (signed byte)(byte) main::i#2 -- vbsz1=_neg_vbsz2 
    lda.z i
    eor #$ff
    clc
    adc #1
    sta.z __2
    // [7] (byte~) main::$8 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z i
    asl
    sta.z __8
    // [8] (byte~) main::$6 ← (byte~) main::$8 + (byte) main::i#2 -- vbuz1=vbuz2_plus_vbuz3 
    lda.z __8
    clc
    adc.z i
    sta.z __6
    // [9] *((signed byte*)(const struct Point*) points + (byte~) main::$6) ← (signed byte)(byte) main::i#2 -- pbsc1_derefidx_vbuz1=vbsz2 
    lda.z i
    ldy.z __6
    sta points,y
    // [10] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2 -- pbsc1_derefidx_vbuz1=vbsz2 
    lda.z __2
    ldy.z __6
    sta points+OFFSET_STRUCT_POINT_Y,y
    // [11] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte)(byte) main::i#2 -- pbsc1_derefidx_vbuz1=vbsz2 
    lda.z i
    ldy.z __6
    sta points+OFFSET_STRUCT_POINT_Z,y
    // [12] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [13] if((byte) main::i#1!=(byte) 4) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #4
    cmp.z i
    bne __b1_from___b1
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i1
    jmp __b2
    // [14] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  __b2_from___b2:
    // [14] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [15] (byte~) main::$10 ← (byte) main::i1#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z i1
    asl
    sta.z __10
    // [16] (byte~) main::$7 ← (byte~) main::$10 + (byte) main::i1#2 -- vbuz1=vbuz2_plus_vbuz3 
    lda.z __10
    clc
    adc.z i1
    sta.z __7
    // [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuz1=pssc2_derefidx_vbuz1_memcpy_vbuc3 
    ldx #SIZEOF_STRUCT_POINT
    ldy.z __7
  !:
    lda points,y
    sta SCREEN,y
    iny
    dex
    bne !-
    // [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 3*4, 0

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

REGISTER UPLIFT SCOPES
Uplift Scope [main] 27.5: zp[1]:3 [ main::i1#2 main::i1#1 ] 22.79: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:5 [ main::$8 ] 22: zp[1]:7 [ main::$10 ] 22: zp[1]:8 [ main::$7 ] 14.67: zp[1]:6 [ main::$6 ] 5.5: zp[1]:4 [ main::$2 ] 
Uplift Scope [Point] 
Uplift Scope [] 

Uplifting [main] best 1298 combination zp[1]:3 [ main::i1#2 main::i1#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$8 ] reg byte a [ main::$10 ] reg byte a [ main::$7 ] zp[1]:6 [ main::$6 ] zp[1]:4 [ main::$2 ] 
Limited combination testing to 100 combinations of 1728 possible.
Uplifting [Point] best 1298 combination 
Uplifting [] best 1298 combination 
Attempting to uplift remaining variables inzp[1]:3 [ main::i1#2 main::i1#1 ]
Uplifting [main] best 1298 combination zp[1]:3 [ main::i1#2 main::i1#1 ] 
Attempting to uplift remaining variables inzp[1]:6 [ main::$6 ]
Uplifting [main] best 1198 combination reg byte y [ main::$6 ] 
Attempting to uplift remaining variables inzp[1]:4 [ main::$2 ]
Uplifting [main] best 1198 combination zp[1]:4 [ main::$2 ] 
Allocated (was zp[1]:3) zp[1]:2 [ main::i1#2 main::i1#1 ]
Allocated (was zp[1]:4) zp[1]:3 [ main::$2 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct -  array of 3-byte structs (required *3)
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_STRUCT_POINT = 3
  .const OFFSET_STRUCT_POINT_Y = 1
  .const OFFSET_STRUCT_POINT_Z = 2
  // @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 __2 = 3
    .label i1 = 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] (signed byte~) main::$2 ← - (signed byte)(byte) main::i#2 -- vbsz1=_neg_vbsxx 
    txa
    eor #$ff
    clc
    adc #1
    sta.z __2
    // [7] (byte~) main::$8 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [8] (byte~) main::$6 ← (byte~) main::$8 + (byte) main::i#2 -- vbuyy=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    tay
    // [9] *((signed byte*)(const struct Point*) points + (byte~) main::$6) ← (signed byte)(byte) main::i#2 -- pbsc1_derefidx_vbuyy=vbsxx 
    txa
    sta points,y
    // [10] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2 -- pbsc1_derefidx_vbuyy=vbsz1 
    lda.z __2
    sta points+OFFSET_STRUCT_POINT_Y,y
    // [11] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte)(byte) main::i#2 -- pbsc1_derefidx_vbuyy=vbsxx 
    txa
    sta points+OFFSET_STRUCT_POINT_Z,y
    // [12] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [13] if((byte) main::i#1!=(byte) 4) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #4
    bne __b1_from___b1
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i1
    jmp __b2
    // [14] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  __b2_from___b2:
    // [14] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [15] (byte~) main::$10 ← (byte) main::i1#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 
    lda.z i1
    asl
    // [16] (byte~) main::$7 ← (byte~) main::$10 + (byte) main::i1#2 -- vbuaa=vbuaa_plus_vbuz1 
    clc
    adc.z i1
    // [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuaa=pssc2_derefidx_vbuaa_memcpy_vbuc3 
    ldx #SIZEOF_STRUCT_POINT
    tay
  !:
    lda points,y
    sta SCREEN,y
    iny
    dex
    bne !-
    // [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 3*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) OFFSET_STRUCT_POINT_Y = (byte) 1
(const byte) OFFSET_STRUCT_POINT_Z = (byte) 2
(signed byte) Point::x
(signed byte) Point::y
(signed byte) Point::z
(const byte) SIZEOF_STRUCT_POINT = (byte) 3
(void()) main()
(byte~) main::$10 reg byte a 22.0
(signed byte~) main::$2 zp[1]:3 5.5
(byte~) main::$6 reg byte y 14.666666666666666
(byte~) main::$7 reg byte a 22.0
(byte~) main::$8 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
(const struct Point*) main::SCREEN = (struct Point*) 1024
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 6.285714285714286
(byte) main::i1
(byte) main::i1#1 i1 zp[1]:2 16.5
(byte) main::i1#2 i1 zp[1]:2 11.0
(const struct Point*) points[(number) 4]  = { fill( 4, 0) }

reg byte x [ main::i#2 main::i#1 ]
zp[1]:2 [ main::i1#2 main::i1#1 ]
zp[1]:3 [ main::$2 ]
reg byte a [ main::$8 ]
reg byte y [ main::$6 ]
reg byte a [ main::$10 ]
reg byte a [ main::$7 ]


FINAL ASSEMBLER
Score: 1036

  // File Comments
// Minimal struct -  array of 3-byte structs (required *3)
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_STRUCT_POINT = 3
  .const OFFSET_STRUCT_POINT_Y = 1
  .const OFFSET_STRUCT_POINT_Z = 2
  // @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 __2 = 3
    .label i1 = 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:
    // -(signed byte)i
    // [6] (signed byte~) main::$2 ← - (signed byte)(byte) main::i#2 -- vbsz1=_neg_vbsxx 
    txa
    eor #$ff
    clc
    adc #1
    sta.z __2
    // points[i] = { (signed byte)i, -(signed byte)i, (signed byte)i }
    // [7] (byte~) main::$8 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [8] (byte~) main::$6 ← (byte~) main::$8 + (byte) main::i#2 -- vbuyy=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    tay
    // [9] *((signed byte*)(const struct Point*) points + (byte~) main::$6) ← (signed byte)(byte) main::i#2 -- pbsc1_derefidx_vbuyy=vbsxx 
    txa
    sta points,y
    // [10] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (byte~) main::$6) ← (signed byte~) main::$2 -- pbsc1_derefidx_vbuyy=vbsz1 
    lda.z __2
    sta points+OFFSET_STRUCT_POINT_Y,y
    // [11] *((signed byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Z + (byte~) main::$6) ← (signed byte)(byte) main::i#2 -- pbsc1_derefidx_vbuyy=vbsxx 
    txa
    sta points+OFFSET_STRUCT_POINT_Z,y
    // for( byte i: 0..3)
    // [12] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [13] if((byte) main::i#1!=(byte) 4) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #4
    bne __b1
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i1
    // [14] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
    // [14] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@2->main::@2#0] -- register_copy 
    // main::@2
  __b2:
    // SCREEN[i] = points[i]
    // [15] (byte~) main::$10 ← (byte) main::i1#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 
    lda.z i1
    asl
    // [16] (byte~) main::$7 ← (byte~) main::$10 + (byte) main::i1#2 -- vbuaa=vbuaa_plus_vbuz1 
    clc
    adc.z i1
    // [17] *((const struct Point*) main::SCREEN + (byte~) main::$7) ← memcpy(*((const struct Point*) points + (byte~) main::$7), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- pssc1_derefidx_vbuaa=pssc2_derefidx_vbuaa_memcpy_vbuc3 
    ldx #SIZEOF_STRUCT_POINT
    tay
  !:
    lda points,y
    sta SCREEN,y
    iny
    dex
    bne !-
    // for( byte i: 0..3)
    // [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
    // main::@return
    // }
    // [20] return 
    rts
}
  // File Data
  points: .fill 3*4, 0

