Fixing pointer array-indexing *((const struct Segment*) letter_c + (byte) main::i)
Fixing pointer array-indexing *((const signed word*) SCREEN + (byte) main::j)
Fixing pointer array-indexing *((const signed word*) SCREEN + (byte) main::j)
Created struct value member variable (signed word) main::to_x
Created struct value member variable (signed word) main::to_y
Converted struct value to member variables (struct SplineVector16) main::to
Unwinding value copy (struct SplineVector16) main::to ← *((const struct Segment*) letter_c + (byte~) main::$1).to
Adding value simple copy (signed word) main::to_x ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_X + (byte~) main::$1)
Adding value simple copy (signed word) main::to_y ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y + (byte~) main::$1)
Replacing struct member reference (struct SplineVector16) main::to.x with member unwinding reference (signed word) main::to_x
Replacing struct member reference (struct SplineVector16) main::to.y with member unwinding reference (signed word) main::to_y
Culled Empty Block (label) main::@2

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

(void()) main()
main: scope:[main]  from @1
  (byte) main::j#0 ← (byte) 0
  (byte) main::i#0 ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@1
  (byte) main::j#3 ← phi( main/(byte) main::j#0 main::@1/(byte) main::j#2 )
  (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
  (byte~) main::$1 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_SEGMENT
  (signed word) main::to_x#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_X + (byte~) main::$1)
  (signed word) main::to_y#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y + (byte~) main::$1)
  (byte~) main::$2 ← (byte) main::j#3 * (const byte) SIZEOF_SIGNED_WORD
  *((const signed word*) SCREEN + (byte~) main::$2) ← (signed word) main::to_x#0
  (byte) main::j#1 ← ++ (byte) main::j#3
  (byte~) main::$3 ← (byte) main::j#1 * (const byte) SIZEOF_SIGNED_WORD
  *((const signed word*) SCREEN + (byte~) main::$3) ← (signed word) main::to_y#0
  (byte) main::j#2 ← ++ (byte) main::j#1
  (byte) main::i#1 ← (byte) main::i#2 + rangenext(0,2)
  (bool~) main::$0 ← (byte) main::i#1 != rangelast(0,2)
  if((bool~) main::$0) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@1
  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) MOVE_TO = (byte) 0
(const byte) OFFSET_STRUCT_SEGMENT_TO = (byte) 1
(const byte) OFFSET_STRUCT_SPLINEVECTOR16_X = (byte) 0
(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y = (byte) 2
(const signed word*) SCREEN = (signed word*)(number) $400
(const byte) SIZEOF_SIGNED_WORD = (byte) 2
(const byte) SIZEOF_STRUCT_SEGMENT = (byte) 9
(const byte) SPLINE_TO = (byte) 1
(const byte) Segment::SegmentType::LINE_TO = (byte) 2
(const byte) Segment::SegmentType::MOVE_TO = (byte) 0
(const byte) Segment::SegmentType::SPLINE_TO = (byte) 1
(struct SplineVector16) Segment::to
(byte) Segment::type
(struct SplineVector16) Segment::via
(signed word) SplineVector16::x
(signed word) SplineVector16::y
(const struct Segment*) letter_c[]  = { { type: (const byte) MOVE_TO, to: { x: (signed word)(byte) 'a', y: (signed word)(byte) 'b' }, via: { x: (signed word) 0, y: (signed word) 0 } }, { type: (const byte) SPLINE_TO, to: { x: (signed word)(byte) 'c', y: (signed word)(byte) 'd' }, via: { x: (signed word) $67, y: (signed word) $a9 } }, { type: (const byte) SPLINE_TO, to: { x: (signed word)(byte) 'e', y: (signed word)(byte) 'f' }, via: { x: (signed word) $4b, y: (signed word) $c3 } } }
(void()) main()
(bool~) main::$0
(byte~) main::$1
(byte~) main::$2
(byte~) main::$3
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::j
(byte) main::j#0
(byte) main::j#1
(byte) main::j#2
(byte) main::j#3
(signed word) main::to_x
(signed word) main::to_x#0
(signed word) main::to_y
(signed word) main::to_y#0

Simplifying constant pointer cast (signed word*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) main::$0 [14] if((byte) main::i#1!=rangelast(0,2)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) main::j#0 = 0
Constant (const byte) main::i#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,2)) goto main::@1 to (number) 3
Simplifying expression containing zero (signed word*)(struct SplineVector16*)letter_c+OFFSET_STRUCT_SEGMENT_TO in [4] (signed word) main::to_x#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_X + (byte~) main::$1)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_SPLINEVECTOR16_X
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) 3 in if((byte) main::i#1!=(number) 3) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting multiplication to use shift and addition[1] (byte~) main::$1 ← (byte) main::i#2 * (const byte) SIZEOF_STRUCT_SEGMENT
Rewriting multiplication to use shift [4] (byte~) main::$2 ← (byte) main::j#3 * (const byte) SIZEOF_SIGNED_WORD
Rewriting multiplication to use shift [7] (byte~) main::$3 ← (byte) main::j#1 * (const byte) SIZEOF_SIGNED_WORD
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const byte) main::j#0
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte) 0
Constant inlined main::j#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Alias (byte~) main::$1 = (byte~) main::$5 
Successful SSA optimization Pass2AliasElimination
Eliminating unused constant (const byte) SIZEOF_STRUCT_SEGMENT
Eliminating unused constant (const byte) SIZEOF_SIGNED_WORD
Successful SSA optimization PassNEliminateUnusedVars
Added new block during phi lifting main::@3(between main::@1 and main::@1)
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
CALL GRAPH
Calls in [] to main:2 

Created 2 initial phi equivalence classes
Coalesced [20] main::i#3 ← main::i#1
Coalesced [21] main::j#4 ← main::j#2
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@3
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::j#3 ← phi( main/(byte) 0 main::@1/(byte) main::j#2 )
  [5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
  [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 3
  [7] (byte~) main::$1 ← (byte~) main::$4 + (byte) main::i#2
  [8] (signed word) main::to_x#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1)
  [9] (signed word) main::to_y#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y + (byte~) main::$1)
  [10] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1
  [11] *((const signed word*) SCREEN + (byte~) main::$2) ← (signed word) main::to_x#0
  [12] (byte) main::j#1 ← ++ (byte) main::j#3
  [13] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1
  [14] *((const signed word*) SCREEN + (byte~) main::$3) ← (signed word) main::to_y#0
  [15] (byte) main::j#2 ← ++ (byte) main::j#1
  [16] (byte) main::i#1 ← ++ (byte) main::i#2
  [17] if((byte) main::i#1!=(byte) 3) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@1
  [18] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(struct SplineVector16) Segment::to
(byte) Segment::type
(struct SplineVector16) Segment::via
(signed word) SplineVector16::x
(signed word) SplineVector16::y
(void()) main()
(byte~) main::$1 16.5
(byte~) main::$2 22.0
(byte~) main::$3 22.0
(byte~) main::$4 22.0
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 4.0
(byte) main::j
(byte) main::j#1 11.0
(byte) main::j#2 7.333333333333333
(byte) main::j#3 4.714285714285714
(signed word) main::to_x
(signed word) main::to_x#0 7.333333333333333
(signed word) main::to_y
(signed word) main::to_y#0 4.4

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#3 main::j#2 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable main::$1 to live range equivalence class [ main::$1 ]
Added variable main::to_x#0 to live range equivalence class [ main::to_x#0 ]
Added variable main::to_y#0 to live range equivalence class [ main::to_y#0 ]
Added variable main::$2 to live range equivalence class [ main::$2 ]
Added variable main::j#1 to live range equivalence class [ main::j#1 ]
Added variable main::$3 to live range equivalence class [ main::$3 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#3 main::j#2 ]
[ main::$4 ]
[ main::$1 ]
[ main::to_x#0 ]
[ main::to_y#0 ]
[ main::$2 ]
[ main::j#1 ]
[ main::$3 ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
Allocated zp[1]:3 [ main::j#3 main::j#2 ]
Allocated zp[1]:4 [ main::$4 ]
Allocated zp[1]:5 [ main::$1 ]
Allocated zp[2]:6 [ main::to_x#0 ]
Allocated zp[2]:8 [ main::to_y#0 ]
Allocated zp[1]:10 [ main::$2 ]
Allocated zp[1]:11 [ main::j#1 ]
Allocated zp[1]:12 [ main::$3 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Complex C-struct - copying a sub-struct with 2-byte members from C-standard layout to Unwound layout
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const MOVE_TO = 0
  .const SPLINE_TO = 1
  .label SCREEN = $400
  .const OFFSET_STRUCT_SEGMENT_TO = 1
  .const OFFSET_STRUCT_SPLINEVECTOR16_Y = 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 __1 = 5
    .label __2 = $a
    .label __3 = $c
    .label to_x = 6
    .label to_y = 8
    .label j = $b
    .label j_1 = 3
    .label i = 2
    .label __4 = 4
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::j#3 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z j_1
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- 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::j#3 = (byte) main::j#2 [phi:main::@1->main::@1#0] -- register_copy 
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#1] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 3 -- vbuz1=vbuz2_rol_3 
    lda.z i
    asl
    asl
    asl
    sta.z __4
    // [7] (byte~) main::$1 ← (byte~) main::$4 + (byte) main::i#2 -- vbuz1=vbuz2_plus_vbuz3 
    lda.z __4
    clc
    adc.z i
    sta.z __1
    // [8] (signed word) main::to_x#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1) -- vwsz1=pwsc1_derefidx_vbuz2 
    ldy.z __1
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO,y
    sta.z to_x
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+1,y
    sta.z to_x+1
    // [9] (signed word) main::to_y#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y + (byte~) main::$1) -- vwsz1=pwsc1_derefidx_vbuz2 
    ldy.z __1
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+OFFSET_STRUCT_SPLINEVECTOR16_Y,y
    sta.z to_y
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+OFFSET_STRUCT_SPLINEVECTOR16_Y+1,y
    sta.z to_y+1
    // [10] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z j_1
    asl
    sta.z __2
    // [11] *((const signed word*) SCREEN + (byte~) main::$2) ← (signed word) main::to_x#0 -- pwsc1_derefidx_vbuz1=vwsz2 
    ldy.z __2
    lda.z to_x
    sta SCREEN,y
    lda.z to_x+1
    sta SCREEN+1,y
    // [12] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuz1=_inc_vbuz2 
    ldy.z j_1
    iny
    sty.z j
    // [13] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z j
    asl
    sta.z __3
    // [14] *((const signed word*) SCREEN + (byte~) main::$3) ← (signed word) main::to_y#0 -- pwsc1_derefidx_vbuz1=vwsz2 
    ldy.z __3
    lda.z to_y
    sta SCREEN,y
    lda.z to_y+1
    sta SCREEN+1,y
    // [15] (byte) main::j#2 ← ++ (byte) main::j#1 -- vbuz1=_inc_vbuz2 
    ldy.z j
    iny
    sty.z j_1
    // [16] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [17] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #3
    cmp.z i
    bne __b1_from___b1
    jmp __breturn
    // main::@return
  __breturn:
    // [18] return 
    rts
}
  // File Data
  // True type letter c
  letter_c: .byte MOVE_TO
  .word 'a', 'b', 0, 0
  .byte SPLINE_TO
  .word 'c', 'd', $67, $a9
  .byte SPLINE_TO
  .word 'e', 'f', $4b, $c3

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 3 [ main::i#2 main::j#3 main::$4 ] ( main:2 [ main::i#2 main::j#3 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 ]
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::j#3 main::j#2 ]
Statement [7] (byte~) main::$1 ← (byte~) main::$4 + (byte) main::i#2 [ main::i#2 main::j#3 main::$1 ] ( main:2 [ main::i#2 main::j#3 main::$1 ] ) always clobbers reg byte a 
Statement [8] (signed word) main::to_x#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1) [ main::i#2 main::j#3 main::$1 main::to_x#0 ] ( main:2 [ main::i#2 main::j#3 main::$1 main::to_x#0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:5 [ main::$1 ]
Statement [9] (signed word) main::to_y#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y + (byte~) main::$1) [ main::i#2 main::j#3 main::to_x#0 main::to_y#0 ] ( main:2 [ main::i#2 main::j#3 main::to_x#0 main::to_y#0 ] ) always clobbers reg byte a 
Statement [10] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 [ main::i#2 main::j#3 main::to_x#0 main::to_y#0 main::$2 ] ( main:2 [ main::i#2 main::j#3 main::to_x#0 main::to_y#0 main::$2 ] ) always clobbers reg byte a 
Statement [11] *((const signed word*) SCREEN + (byte~) main::$2) ← (signed word) main::to_x#0 [ main::i#2 main::j#3 main::to_y#0 ] ( main:2 [ main::i#2 main::j#3 main::to_y#0 ] ) always clobbers reg byte a 
Statement [13] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 [ main::i#2 main::to_y#0 main::j#1 main::$3 ] ( main:2 [ main::i#2 main::to_y#0 main::j#1 main::$3 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:11 [ main::j#1 ]
Statement [14] *((const signed word*) SCREEN + (byte~) main::$3) ← (signed word) main::to_y#0 [ main::i#2 main::j#1 ] ( main:2 [ main::i#2 main::j#1 ] ) always clobbers reg byte a 
Statement [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 3 [ main::i#2 main::j#3 main::$4 ] ( main:2 [ main::i#2 main::j#3 main::$4 ] ) always clobbers reg byte a 
Statement [7] (byte~) main::$1 ← (byte~) main::$4 + (byte) main::i#2 [ main::i#2 main::j#3 main::$1 ] ( main:2 [ main::i#2 main::j#3 main::$1 ] ) always clobbers reg byte a 
Statement [8] (signed word) main::to_x#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1) [ main::i#2 main::j#3 main::$1 main::to_x#0 ] ( main:2 [ main::i#2 main::j#3 main::$1 main::to_x#0 ] ) always clobbers reg byte a 
Statement [9] (signed word) main::to_y#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y + (byte~) main::$1) [ main::i#2 main::j#3 main::to_x#0 main::to_y#0 ] ( main:2 [ main::i#2 main::j#3 main::to_x#0 main::to_y#0 ] ) always clobbers reg byte a 
Statement [10] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 [ main::i#2 main::j#3 main::to_x#0 main::to_y#0 main::$2 ] ( main:2 [ main::i#2 main::j#3 main::to_x#0 main::to_y#0 main::$2 ] ) always clobbers reg byte a 
Statement [11] *((const signed word*) SCREEN + (byte~) main::$2) ← (signed word) main::to_x#0 [ main::i#2 main::j#3 main::to_y#0 ] ( main:2 [ main::i#2 main::j#3 main::to_y#0 ] ) always clobbers reg byte a 
Statement [13] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 [ main::i#2 main::to_y#0 main::j#1 main::$3 ] ( main:2 [ main::i#2 main::to_y#0 main::j#1 main::$3 ] ) always clobbers reg byte a 
Statement [14] *((const signed word*) SCREEN + (byte~) main::$3) ← (signed word) main::to_y#0 [ main::i#2 main::j#1 ] ( main:2 [ main::i#2 main::j#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::j#3 main::j#2 ] : zp[1]:3 , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ main::$4 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:5 [ main::$1 ] : zp[1]:5 , reg byte x , reg byte y , 
Potential registers zp[2]:6 [ main::to_x#0 ] : zp[2]:6 , 
Potential registers zp[2]:8 [ main::to_y#0 ] : zp[2]:8 , 
Potential registers zp[1]:10 [ main::$2 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:11 [ main::j#1 ] : zp[1]:11 , reg byte x , reg byte y , 
Potential registers zp[1]:12 [ main::$3 ] : zp[1]:12 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 22: zp[1]:4 [ main::$4 ] 22: zp[1]:10 [ main::$2 ] 22: zp[1]:12 [ main::$3 ] 20.5: zp[1]:2 [ main::i#2 main::i#1 ] 16.5: zp[1]:5 [ main::$1 ] 12.05: zp[1]:3 [ main::j#3 main::j#2 ] 11: zp[1]:11 [ main::j#1 ] 7.33: zp[2]:6 [ main::to_x#0 ] 4.4: zp[2]:8 [ main::to_y#0 ] 
Uplift Scope [SplineVector16] 
Uplift Scope [Segment] 
Uplift Scope [Segment::SegmentType] 
Uplift Scope [] 

Uplifting [main] best 1413 combination reg byte a [ main::$4 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] reg byte x [ main::i#2 main::i#1 ] zp[1]:5 [ main::$1 ] zp[1]:3 [ main::j#3 main::j#2 ] zp[1]:11 [ main::j#1 ] zp[2]:6 [ main::to_x#0 ] zp[2]:8 [ main::to_y#0 ] 
Limited combination testing to 100 combinations of 5184 possible.
Uplifting [SplineVector16] best 1413 combination 
Uplifting [Segment] best 1413 combination 
Uplifting [Segment::SegmentType] best 1413 combination 
Uplifting [] best 1413 combination 
Attempting to uplift remaining variables inzp[1]:5 [ main::$1 ]
Uplifting [main] best 1343 combination reg byte y [ main::$1 ] 
Attempting to uplift remaining variables inzp[1]:3 [ main::j#3 main::j#2 ]
Uplifting [main] best 1343 combination zp[1]:3 [ main::j#3 main::j#2 ] 
Attempting to uplift remaining variables inzp[1]:11 [ main::j#1 ]
Uplifting [main] best 1343 combination zp[1]:11 [ main::j#1 ] 
Coalescing zero page register [ zp[1]:3 [ main::j#3 main::j#2 ] ] with [ zp[1]:11 [ main::j#1 ] ] - score: 2
Allocated (was zp[1]:3) zp[1]:2 [ main::j#3 main::j#2 main::j#1 ]
Allocated (was zp[2]:6) zp[2]:3 [ main::to_x#0 ]
Allocated (was zp[2]:8) zp[2]:5 [ main::to_y#0 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Complex C-struct - copying a sub-struct with 2-byte members from C-standard layout to Unwound layout
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const MOVE_TO = 0
  .const SPLINE_TO = 1
  .label SCREEN = $400
  .const OFFSET_STRUCT_SEGMENT_TO = 1
  .const OFFSET_STRUCT_SPLINEVECTOR16_Y = 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 to_x = 3
    .label to_y = 5
    .label j = 2
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::j#3 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z j
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- 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::j#3 = (byte) main::j#2 [phi:main::@1->main::@1#0] -- register_copy 
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#1] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 3 -- vbuaa=vbuxx_rol_3 
    txa
    asl
    asl
    asl
    // [7] (byte~) main::$1 ← (byte~) main::$4 + (byte) main::i#2 -- vbuyy=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    tay
    // [8] (signed word) main::to_x#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1) -- vwsz1=pwsc1_derefidx_vbuyy 
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO,y
    sta.z to_x
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+1,y
    sta.z to_x+1
    // [9] (signed word) main::to_y#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y + (byte~) main::$1) -- vwsz1=pwsc1_derefidx_vbuyy 
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+OFFSET_STRUCT_SPLINEVECTOR16_Y,y
    sta.z to_y
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+OFFSET_STRUCT_SPLINEVECTOR16_Y+1,y
    sta.z to_y+1
    // [10] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 -- vbuaa=vbuz1_rol_1 
    lda.z j
    asl
    // [11] *((const signed word*) SCREEN + (byte~) main::$2) ← (signed word) main::to_x#0 -- pwsc1_derefidx_vbuaa=vwsz1 
    tay
    lda.z to_x
    sta SCREEN,y
    lda.z to_x+1
    sta SCREEN+1,y
    // [12] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuz1=_inc_vbuz1 
    inc.z j
    // [13] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 -- vbuaa=vbuz1_rol_1 
    lda.z j
    asl
    // [14] *((const signed word*) SCREEN + (byte~) main::$3) ← (signed word) main::to_y#0 -- pwsc1_derefidx_vbuaa=vwsz1 
    tay
    lda.z to_y
    sta SCREEN,y
    lda.z to_y+1
    sta SCREEN+1,y
    // [15] (byte) main::j#2 ← ++ (byte) main::j#1 -- vbuz1=_inc_vbuz1 
    inc.z j
    // [16] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [17] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #3
    bne __b1_from___b1
    jmp __breturn
    // main::@return
  __breturn:
    // [18] return 
    rts
}
  // File Data
  // True type letter c
  letter_c: .byte MOVE_TO
  .word 'a', 'b', 0, 0
  .byte SPLINE_TO
  .word 'c', 'd', $67, $a9
  .byte SPLINE_TO
  .word 'e', 'f', $4b, $c3

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing instruction ldx #0 with TAX
Replacing label __bbegin with __b1
Replacing label __b1_from___b1 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b1_from_main:
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
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte) MOVE_TO = (byte) 0
(const byte) OFFSET_STRUCT_SEGMENT_TO = (byte) 1
(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y = (byte) 2
(const signed word*) SCREEN = (signed word*) 1024
(const byte) SPLINE_TO = (byte) 1
(const byte) Segment::SegmentType::LINE_TO = (byte) 2
(const byte) Segment::SegmentType::MOVE_TO = (byte) 0
(const byte) Segment::SegmentType::SPLINE_TO = (byte) 1
(struct SplineVector16) Segment::to
(byte) Segment::type
(struct SplineVector16) Segment::via
(signed word) SplineVector16::x
(signed word) SplineVector16::y
(const struct Segment*) letter_c[]  = { { type: (const byte) MOVE_TO, to: { x: (signed word)(byte) 'a', y: (signed word)(byte) 'b' }, via: { x: (signed word) 0, y: (signed word) 0 } }, { type: (const byte) SPLINE_TO, to: { x: (signed word)(byte) 'c', y: (signed word)(byte) 'd' }, via: { x: (signed word) $67, y: (signed word) $a9 } }, { type: (const byte) SPLINE_TO, to: { x: (signed word)(byte) 'e', y: (signed word)(byte) 'f' }, via: { x: (signed word) $4b, y: (signed word) $c3 } } }
(void()) main()
(byte~) main::$1 reg byte y 16.5
(byte~) main::$2 reg byte a 22.0
(byte~) main::$3 reg byte a 22.0
(byte~) main::$4 reg byte a 22.0
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 4.0
(byte) main::j
(byte) main::j#1 j zp[1]:2 11.0
(byte) main::j#2 j zp[1]:2 7.333333333333333
(byte) main::j#3 j zp[1]:2 4.714285714285714
(signed word) main::to_x
(signed word) main::to_x#0 to_x zp[2]:3 7.333333333333333
(signed word) main::to_y
(signed word) main::to_y#0 to_y zp[2]:5 4.4

reg byte x [ main::i#2 main::i#1 ]
zp[1]:2 [ main::j#3 main::j#2 main::j#1 ]
reg byte a [ main::$4 ]
reg byte y [ main::$1 ]
zp[2]:3 [ main::to_x#0 ]
zp[2]:5 [ main::to_y#0 ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]


FINAL ASSEMBLER
Score: 1181

  // File Comments
// Complex C-struct - copying a sub-struct with 2-byte members from C-standard layout to Unwound layout
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .const MOVE_TO = 0
  .const SPLINE_TO = 1
  .label SCREEN = $400
  .const OFFSET_STRUCT_SEGMENT_TO = 1
  .const OFFSET_STRUCT_SPLINEVECTOR16_Y = 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 to_x = 3
    .label to_y = 5
    .label j = 2
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (byte) main::j#3 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z j
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    tax
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
    // [5] phi (byte) main::j#3 = (byte) main::j#2 [phi:main::@1->main::@1#0] -- register_copy 
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#1] -- register_copy 
    // main::@1
  __b1:
    // to = letter_c[i].to
    // [6] (byte~) main::$4 ← (byte) main::i#2 << (byte) 3 -- vbuaa=vbuxx_rol_3 
    txa
    asl
    asl
    asl
    // [7] (byte~) main::$1 ← (byte~) main::$4 + (byte) main::i#2 -- vbuyy=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    tay
    // [8] (signed word) main::to_x#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1) -- vwsz1=pwsc1_derefidx_vbuyy 
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO,y
    sta.z to_x
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+1,y
    sta.z to_x+1
    // [9] (signed word) main::to_y#0 ← *((signed word*)(struct SplineVector16*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO+(const byte) OFFSET_STRUCT_SPLINEVECTOR16_Y + (byte~) main::$1) -- vwsz1=pwsc1_derefidx_vbuyy 
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+OFFSET_STRUCT_SPLINEVECTOR16_Y,y
    sta.z to_y
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO+OFFSET_STRUCT_SPLINEVECTOR16_Y+1,y
    sta.z to_y+1
    // SCREEN[j++] = to.x
    // [10] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 -- vbuaa=vbuz1_rol_1 
    lda.z j
    asl
    // [11] *((const signed word*) SCREEN + (byte~) main::$2) ← (signed word) main::to_x#0 -- pwsc1_derefidx_vbuaa=vwsz1 
    tay
    lda.z to_x
    sta SCREEN,y
    lda.z to_x+1
    sta SCREEN+1,y
    // SCREEN[j++] = to.x;
    // [12] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuz1=_inc_vbuz1 
    inc.z j
    // SCREEN[j++] = to.y
    // [13] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 -- vbuaa=vbuz1_rol_1 
    lda.z j
    asl
    // [14] *((const signed word*) SCREEN + (byte~) main::$3) ← (signed word) main::to_y#0 -- pwsc1_derefidx_vbuaa=vwsz1 
    tay
    lda.z to_y
    sta SCREEN,y
    lda.z to_y+1
    sta SCREEN+1,y
    // SCREEN[j++] = to.y;
    // [15] (byte) main::j#2 ← ++ (byte) main::j#1 -- vbuz1=_inc_vbuz1 
    inc.z j
    // for( byte i: 0..2)
    // [16] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [17] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #3
    bne __b1
    // main::@return
    // }
    // [18] return 
    rts
}
  // File Data
  // True type letter c
  letter_c: .byte MOVE_TO
  .word 'a', 'b', 0, 0
  .byte SPLINE_TO
  .word 'c', 'd', $67, $a9
  .byte SPLINE_TO
  .word 'e', 'f', $4b, $c3

