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)
Adding value bulk copy *(&(struct Vector) main::to) ← memcpy(*((struct Vector*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
Replacing struct member reference (struct Vector) main::to.x with member unwinding reference *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_X)
Replacing struct member reference (struct Vector) main::to.y with member unwinding reference *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_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
  *(&(struct Vector) main::to) ← memcpy(*((struct Vector*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
  (struct Vector) main::to ← struct-unwound {*(&(struct Vector) main::to)}
  (byte~) main::$2 ← (byte) main::j#3 * (const byte) SIZEOF_SIGNED_WORD
  *((const signed word*) SCREEN + (byte~) main::$2) ← *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_X)
  (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*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_Y)
  (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_VECTOR_X = (byte) 0
(const byte) OFFSET_STRUCT_VECTOR_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) SIZEOF_STRUCT_VECTOR = (byte) 4
(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 Vector) Segment::to
(byte) Segment::type
(struct Vector) Segment::via
(signed word) Vector::x
(signed word) Vector::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
(struct Vector) main::to loadstore

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
Removing C-classic struct-unwound assignment [5] (struct Vector) main::to ← struct-unwound {*(&(struct Vector) main::to)}
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*)&main::to in [7] *((const signed word*) SCREEN + (byte~) main::$2) ← *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_X)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_VECTOR_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 [3] (byte~) main::$2 ← (byte) main::j#3 * (const byte) SIZEOF_SIGNED_WORD
Rewriting multiplication to use shift [6] (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 [19] main::i#3 ← main::i#1
Coalesced [20] 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] *(&(struct Vector) main::to) ← memcpy(*((struct Vector*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
  [9] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1
  [10] *((const signed word*) SCREEN + (byte~) main::$2) ← *((signed word*)&(struct Vector) main::to)
  [11] (byte) main::j#1 ← ++ (byte) main::j#3
  [12] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1
  [13] *((const signed word*) SCREEN + (byte~) main::$3) ← *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_Y)
  [14] (byte) main::j#2 ← ++ (byte) main::j#1
  [15] (byte) main::i#1 ← ++ (byte) main::i#2
  [16] if((byte) main::i#1!=(byte) 3) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@1
  [17] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(struct Vector) Segment::to
(byte) Segment::type
(struct Vector) Segment::via
(signed word) Vector::x
(signed word) Vector::y
(void()) main()
(byte~) main::$1 11.0
(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.4
(byte) main::j
(byte) main::j#1 11.0
(byte) main::j#2 7.333333333333333
(byte) main::j#3 5.5
(struct Vector) main::to loadstore

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::$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 ]
Added variable main::to to live range equivalence class [ main::to ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#3 main::j#2 ]
[ main::$4 ]
[ main::$1 ]
[ main::$2 ]
[ main::j#1 ]
[ main::$3 ]
[ main::to ]
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[1]:6 [ main::$2 ]
Allocated zp[1]:7 [ main::j#1 ]
Allocated zp[1]:8 [ main::$3 ]
Allocated zp[4]:9 [ main::to ]

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 C-standard layout (expecting a memcpy)
  // 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 SIZEOF_STRUCT_VECTOR = 4
  .const OFFSET_STRUCT_VECTOR_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 = 9
    .label __1 = 5
    .label __2 = 6
    .label __3 = 8
    .label j = 7
    .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] *(&(struct Vector) main::to) ← memcpy(*((struct Vector*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) -- _deref_pssc1=pssc2_derefidx_vbuz1_memcpy_vbuc3 
    ldx.z __1
    ldy #0
  !:
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO,x
    sta to,y
    inx
    iny
    cpy #SIZEOF_STRUCT_VECTOR
    bne !-
    // [9] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z j_1
    asl
    sta.z __2
    // [10] *((const signed word*) SCREEN + (byte~) main::$2) ← *((signed word*)&(struct Vector) main::to) -- pwsc1_derefidx_vbuz1=_deref_pwsc2 
    ldy.z __2
    lda.z to
    sta SCREEN,y
    lda.z to+1
    sta SCREEN+1,y
    // [11] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuz1=_inc_vbuz2 
    ldy.z j_1
    iny
    sty.z j
    // [12] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z j
    asl
    sta.z __3
    // [13] *((const signed word*) SCREEN + (byte~) main::$3) ← *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_Y) -- pwsc1_derefidx_vbuz1=_deref_pwsc2 
    ldy.z __3
    lda to+OFFSET_STRUCT_VECTOR_Y
    sta SCREEN,y
    lda to+OFFSET_STRUCT_VECTOR_Y+1
    sta SCREEN+1,y
    // [14] (byte) main::j#2 ← ++ (byte) main::j#1 -- vbuz1=_inc_vbuz2 
    ldy.z j
    iny
    sty.z j_1
    // [15] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [16] 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:
    // [17] 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::to ] ( main:2 [ main::i#2 main::j#3 main::$4 main::to ] ) 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::to ] ( main:2 [ main::i#2 main::j#3 main::$1 main::to ] ) always clobbers reg byte a 
Statement [8] *(&(struct Vector) main::to) ← memcpy(*((struct Vector*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) [ main::i#2 main::j#3 main::to ] ( main:2 [ main::i#2 main::j#3 main::to ] ) always clobbers reg byte a reg byte x reg byte y 
Removing always clobbered register reg byte x as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte x as potential for zp[1]:3 [ main::j#3 main::j#2 ]
Removing always clobbered register reg byte y as potential for zp[1]:3 [ main::j#3 main::j#2 ]
Statement [9] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 [ main::i#2 main::j#3 main::to main::$2 ] ( main:2 [ main::i#2 main::j#3 main::to main::$2 ] ) always clobbers reg byte a 
Statement [10] *((const signed word*) SCREEN + (byte~) main::$2) ← *((signed word*)&(struct Vector) main::to) [ main::i#2 main::j#3 main::to ] ( main:2 [ main::i#2 main::j#3 main::to ] ) always clobbers reg byte a 
Statement [12] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 [ main::i#2 main::to main::j#1 main::$3 ] ( main:2 [ main::i#2 main::to main::j#1 main::$3 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:7 [ main::j#1 ]
Statement [13] *((const signed word*) SCREEN + (byte~) main::$3) ← *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_Y) [ main::i#2 main::to main::j#1 ] ( main:2 [ main::i#2 main::to main::j#1 ] ) always clobbers reg byte a 
Statement [16] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 main::j#2 main::to ] ( main:2 [ main::i#1 main::j#2 main::to ] ) 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::to ] ( main:2 [ main::i#2 main::j#3 main::$4 main::to ] ) 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::to ] ( main:2 [ main::i#2 main::j#3 main::$1 main::to ] ) always clobbers reg byte a 
Statement [8] *(&(struct Vector) main::to) ← memcpy(*((struct Vector*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) [ main::i#2 main::j#3 main::to ] ( main:2 [ main::i#2 main::j#3 main::to ] ) always clobbers reg byte a reg byte x reg byte y 
Statement [9] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 [ main::i#2 main::j#3 main::to main::$2 ] ( main:2 [ main::i#2 main::j#3 main::to main::$2 ] ) always clobbers reg byte a 
Statement [10] *((const signed word*) SCREEN + (byte~) main::$2) ← *((signed word*)&(struct Vector) main::to) [ main::i#2 main::j#3 main::to ] ( main:2 [ main::i#2 main::j#3 main::to ] ) always clobbers reg byte a 
Statement [12] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 [ main::i#2 main::to main::j#1 main::$3 ] ( main:2 [ main::i#2 main::to main::j#1 main::$3 ] ) always clobbers reg byte a 
Statement [13] *((const signed word*) SCREEN + (byte~) main::$3) ← *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_Y) [ main::i#2 main::to main::j#1 ] ( main:2 [ main::i#2 main::to main::j#1 ] ) always clobbers reg byte a 
Statement [16] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 main::j#2 main::to ] ( main:2 [ main::i#1 main::j#2 main::to ] ) always clobbers reg byte a 
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , 
Potential registers zp[1]:3 [ main::j#3 main::j#2 ] : zp[1]:3 , 
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 a , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ main::$2 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:7 [ main::j#1 ] : zp[1]:7 , reg byte x , reg byte y , 
Potential registers zp[1]:8 [ main::$3 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[4]:9 [ main::to ] : zp[4]:9 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 22: zp[1]:4 [ main::$4 ] 22: zp[1]:6 [ main::$2 ] 22: zp[1]:8 [ main::$3 ] 20.9: zp[1]:2 [ main::i#2 main::i#1 ] 12.83: zp[1]:3 [ main::j#3 main::j#2 ] 11: zp[1]:5 [ main::$1 ] 11: zp[1]:7 [ main::j#1 ] 0: zp[4]:9 [ main::to ] 
Uplift Scope [Vector] 
Uplift Scope [Segment] 
Uplift Scope [Segment::SegmentType] 
Uplift Scope [] 

Uplifting [main] best 1333 combination reg byte a [ main::$4 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] zp[1]:2 [ main::i#2 main::i#1 ] zp[1]:3 [ main::j#3 main::j#2 ] reg byte a [ main::$1 ] zp[1]:7 [ main::j#1 ] zp[4]:9 [ main::to ] 
Limited combination testing to 100 combinations of 768 possible.
Uplifting [Vector] best 1333 combination 
Uplifting [Segment] best 1333 combination 
Uplifting [Segment::SegmentType] best 1333 combination 
Uplifting [] best 1333 combination 
Attempting to uplift remaining variables inzp[1]:2 [ main::i#2 main::i#1 ]
Uplifting [main] best 1333 combination zp[1]:2 [ main::i#2 main::i#1 ] 
Attempting to uplift remaining variables inzp[1]:3 [ main::j#3 main::j#2 ]
Uplifting [main] best 1333 combination zp[1]:3 [ main::j#3 main::j#2 ] 
Attempting to uplift remaining variables inzp[1]:7 [ main::j#1 ]
Uplifting [main] best 1263 combination reg byte x [ main::j#1 ] 
Allocated (was zp[4]:9) zp[4]:4 [ main::to ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Complex C-struct - copying a sub-struct with 2-byte members from C-standard layout to C-standard layout (expecting a memcpy)
  // 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 SIZEOF_STRUCT_VECTOR = 4
  .const OFFSET_STRUCT_VECTOR_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 = 4
    .label j = 3
    .label i = 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] -- 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 -- vbuaa=vbuz1_rol_3 
    lda.z i
    asl
    asl
    asl
    // [7] (byte~) main::$1 ← (byte~) main::$4 + (byte) main::i#2 -- vbuaa=vbuaa_plus_vbuz1 
    clc
    adc.z i
    // [8] *(&(struct Vector) main::to) ← memcpy(*((struct Vector*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) -- _deref_pssc1=pssc2_derefidx_vbuaa_memcpy_vbuc3 
    tax
    ldy #0
  !:
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO,x
    sta to,y
    inx
    iny
    cpy #SIZEOF_STRUCT_VECTOR
    bne !-
    // [9] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 -- vbuaa=vbuz1_rol_1 
    lda.z j
    asl
    // [10] *((const signed word*) SCREEN + (byte~) main::$2) ← *((signed word*)&(struct Vector) main::to) -- pwsc1_derefidx_vbuaa=_deref_pwsc2 
    tay
    lda.z to
    sta SCREEN,y
    lda.z to+1
    sta SCREEN+1,y
    // [11] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuxx=_inc_vbuz1 
    ldx.z j
    inx
    // [12] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [13] *((const signed word*) SCREEN + (byte~) main::$3) ← *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_Y) -- pwsc1_derefidx_vbuaa=_deref_pwsc2 
    tay
    lda to+OFFSET_STRUCT_VECTOR_Y
    sta SCREEN,y
    lda to+OFFSET_STRUCT_VECTOR_Y+1
    sta SCREEN+1,y
    // [14] (byte) main::j#2 ← ++ (byte) main::j#1 -- vbuz1=_inc_vbuxx 
    inx
    stx.z j
    // [15] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [16] 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:
    // [17] 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
Removing instruction lda #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
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_VECTOR_Y = (byte) 2
(const signed word*) SCREEN = (signed word*) 1024
(const byte) SIZEOF_STRUCT_VECTOR = (byte) 4
(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 Vector) Segment::to
(byte) Segment::type
(struct Vector) Segment::via
(signed word) Vector::x
(signed word) Vector::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 a 11.0
(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 i zp[1]:2 16.5
(byte) main::i#2 i zp[1]:2 4.4
(byte) main::j
(byte) main::j#1 reg byte x 11.0
(byte) main::j#2 j zp[1]:3 7.333333333333333
(byte) main::j#3 j zp[1]:3 5.5
(struct Vector) main::to loadstore zp[4]:4

zp[1]:2 [ main::i#2 main::i#1 ]
zp[1]:3 [ main::j#3 main::j#2 ]
reg byte a [ main::$4 ]
reg byte a [ main::$1 ]
reg byte a [ main::$2 ]
reg byte x [ main::j#1 ]
reg byte a [ main::$3 ]
zp[4]:4 [ main::to ]


FINAL ASSEMBLER
Score: 1141

  // File Comments
// Complex C-struct - copying a sub-struct with 2-byte members from C-standard layout to C-standard layout (expecting a memcpy)
  // 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 SIZEOF_STRUCT_VECTOR = 4
  .const OFFSET_STRUCT_VECTOR_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 = 4
    .label j = 3
    .label i = 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] -- vbuz1=vbuc1 
    sta.z i
    // [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=vbuz1_rol_3 
    lda.z i
    asl
    asl
    asl
    // [7] (byte~) main::$1 ← (byte~) main::$4 + (byte) main::i#2 -- vbuaa=vbuaa_plus_vbuz1 
    clc
    adc.z i
    // [8] *(&(struct Vector) main::to) ← memcpy(*((struct Vector*)(const struct Segment*) letter_c+(const byte) OFFSET_STRUCT_SEGMENT_TO + (byte~) main::$1), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) -- _deref_pssc1=pssc2_derefidx_vbuaa_memcpy_vbuc3 
    tax
    ldy #0
  !:
    lda letter_c+OFFSET_STRUCT_SEGMENT_TO,x
    sta to,y
    inx
    iny
    cpy #SIZEOF_STRUCT_VECTOR
    bne !-
    // SCREEN[j++] = to.x
    // [9] (byte~) main::$2 ← (byte) main::j#3 << (byte) 1 -- vbuaa=vbuz1_rol_1 
    lda.z j
    asl
    // [10] *((const signed word*) SCREEN + (byte~) main::$2) ← *((signed word*)&(struct Vector) main::to) -- pwsc1_derefidx_vbuaa=_deref_pwsc2 
    tay
    lda.z to
    sta SCREEN,y
    lda.z to+1
    sta SCREEN+1,y
    // SCREEN[j++] = to.x;
    // [11] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuxx=_inc_vbuz1 
    ldx.z j
    inx
    // SCREEN[j++] = to.y
    // [12] (byte~) main::$3 ← (byte) main::j#1 << (byte) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [13] *((const signed word*) SCREEN + (byte~) main::$3) ← *((signed word*)&(struct Vector) main::to+(const byte) OFFSET_STRUCT_VECTOR_Y) -- pwsc1_derefidx_vbuaa=_deref_pwsc2 
    tay
    lda to+OFFSET_STRUCT_VECTOR_Y
    sta SCREEN,y
    lda to+OFFSET_STRUCT_VECTOR_Y+1
    sta SCREEN+1,y
    // SCREEN[j++] = to.y;
    // [14] (byte) main::j#2 ← ++ (byte) main::j#1 -- vbuz1=_inc_vbuxx 
    inx
    stx.z j
    // for( byte i: 0..2)
    // [15] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [16] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #3
    cmp.z i
    bne __b1
    // main::@return
    // }
    // [17] 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

