Adding value bulk copy *(&(struct Vector) main::v) ← memcpy(*(&(const struct Vector) $0), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
Replacing struct member reference (struct Vector) main::v.p.x with member unwinding reference *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P+(const byte) OFFSET_STRUCT_POINT_X)
Replacing struct member reference (struct Vector) main::v.p.y with member unwinding reference *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P+(const byte) OFFSET_STRUCT_POINT_Y)
Replacing struct member reference (struct Vector) main::v.q.x with member unwinding reference *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_X)
Replacing struct member reference (struct Vector) main::v.q.y with member unwinding reference *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)

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

(void()) main()
main: scope:[main]  from @1
  *(&(struct Vector) main::v) ← memcpy(*(&(const struct Vector) $0), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
  (struct Vector) main::v ← struct-unwound {*(&(struct Vector) main::v)}
  *((const byte*) SCREEN + (number) 0) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P+(const byte) OFFSET_STRUCT_POINT_X)
  *((const byte*) SCREEN + (number) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P+(const byte) OFFSET_STRUCT_POINT_Y)
  *((const byte*) SCREEN + (number) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_X)
  *((const byte*) SCREEN + (number) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return
@1: scope:[]  from @begin
  call main 
  to:@2
@2: scope:[]  from @1
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(const struct Vector) $0 = { p: { x: (byte) 2, y: (byte) 3 }, q: { x: (byte) 4, y: (byte) 5 } }
(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_VECTOR_P = (byte) 0
(const byte) OFFSET_STRUCT_VECTOR_Q = (byte) 2
(byte) Point::x
(byte) Point::y
(const byte*) SCREEN = (byte*)(number) $400
(const byte) SIZEOF_STRUCT_VECTOR = (byte) 4
(struct Point) Vector::p
(struct Point) Vector::q
(void()) main()
(label) main::@return
(struct Vector) main::v loadstore

Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (number) 0) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P+(const byte) OFFSET_STRUCT_POINT_X)
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (number) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P+(const byte) OFFSET_STRUCT_POINT_Y)
Adding number conversion cast (unumber) 2 in *((const byte*) SCREEN + (number) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_X)
Adding number conversion cast (unumber) 3 in *((const byte*) SCREEN + (number) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Removing C-classic struct-unwound assignment [1] (struct Vector) main::v ← struct-unwound {*(&(struct Vector) main::v)}
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_P in [2] *((const byte*) SCREEN + (byte) 0) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P+(const byte) OFFSET_STRUCT_POINT_X)
Simplifying expression containing zero (struct Point*)&main::v in [2] *((const byte*) SCREEN + (byte) 0) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P)
Simplifying expression containing zero SCREEN in [2] *((const byte*) SCREEN + (byte) 0) ← *((byte*)(struct Point*)&(struct Vector) main::v)
Simplifying expression containing zero (struct Point*)&main::v in [3] *((const byte*) SCREEN + (byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_P+(const byte) OFFSET_STRUCT_POINT_Y)
Simplifying expression containing zero (byte*)(struct Point*)&main::v+OFFSET_STRUCT_VECTOR_Q in [4] *((const byte*) SCREEN + (byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_X)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_VECTOR_P
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Consolidated array index constant in *(SCREEN+1)
Consolidated array index constant in *(SCREEN+2)
Consolidated array index constant in *(SCREEN+3)
Successful SSA optimization Pass2ConstantAdditionElimination
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
CALL GRAPH
Calls in [] to main:2 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end

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] *(&(struct Vector) main::v) ← memcpy(*(&(const struct Vector) $0), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR)
  [5] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v)
  [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y)
  [7] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q)
  [8] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y)
  to:main::@return
main::@return: scope:[main]  from main
  [9] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(struct Point) Vector::p
(struct Point) Vector::q
(void()) main()
(struct Vector) main::v loadstore

Initial phi equivalence classes
Added variable main::v to live range equivalence class [ main::v ]
Complete equivalence classes
[ main::v ]
Allocated zp[4]:2 [ main::v ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Minimal struct with C-Standard behavior - struct containing struct with initializer
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_VECTOR = 4
  .const OFFSET_STRUCT_POINT_Y = 1
  .const OFFSET_STRUCT_VECTOR_Q = 2
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label v = 2
    // [4] *(&(struct Vector) main::v) ← memcpy(*(&(const struct Vector) $0), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_VECTOR
  !:
    lda __0-1,y
    sta v-1,y
    dey
    bne !-
    // [5] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2 
    lda.z v
    sta SCREEN
    // [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_POINT_Y
    sta SCREEN+1
    // [7] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_VECTOR_Q
    sta SCREEN+2
    // [8] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
    sta SCREEN+3
    jmp __breturn
    // main::@return
  __breturn:
    // [9] return 
    rts
}
  // File Data
  __0: .byte 2, 3, 4, 5

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *(&(struct Vector) main::v) ← memcpy(*(&(const struct Vector) $0), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a reg byte y 
Statement [5] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a 
Statement [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a 
Statement [7] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) [ main::v ] ( main:2 [ main::v ] ) always clobbers reg byte a 
Statement [8] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a 
Potential registers zp[4]:2 [ main::v ] : zp[4]:2 , 

REGISTER UPLIFT SCOPES
Uplift Scope [Point] 
Uplift Scope [Vector] 
Uplift Scope [main] 0: zp[4]:2 [ main::v ] 
Uplift Scope [] 

Uplifting [Point] best 68 combination 
Uplifting [Vector] best 68 combination 
Uplifting [main] best 68 combination zp[4]:2 [ main::v ] 
Uplifting [] best 68 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct with C-Standard behavior - struct containing struct with initializer
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_VECTOR = 4
  .const OFFSET_STRUCT_POINT_Y = 1
  .const OFFSET_STRUCT_VECTOR_Q = 2
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label v = 2
    // [4] *(&(struct Vector) main::v) ← memcpy(*(&(const struct Vector) $0), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_VECTOR
  !:
    lda __0-1,y
    sta v-1,y
    dey
    bne !-
    // [5] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2 
    lda.z v
    sta SCREEN
    // [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_POINT_Y
    sta SCREEN+1
    // [7] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_VECTOR_Q
    sta SCREEN+2
    // [8] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
    sta SCREEN+3
    jmp __breturn
    // main::@return
  __breturn:
    // [9] return 
    rts
}
  // File Data
  __0: .byte 2, 3, 4, 5

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(const struct Vector) $0 = { p: { x: (byte) 2, y: (byte) 3 }, q: { x: (byte) 4, y: (byte) 5 } }
(label) @1
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(const byte) OFFSET_STRUCT_VECTOR_Q = (byte) 2
(byte) Point::x
(byte) Point::y
(const byte*) SCREEN = (byte*) 1024
(const byte) SIZEOF_STRUCT_VECTOR = (byte) 4
(struct Point) Vector::p
(struct Point) Vector::q
(void()) main()
(label) main::@return
(struct Vector) main::v loadstore zp[4]:2

zp[4]:2 [ main::v ]


FINAL ASSEMBLER
Score: 53

  // File Comments
// Minimal struct with C-Standard behavior - struct containing struct with initializer
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_VECTOR = 4
  .const OFFSET_STRUCT_POINT_Y = 1
  .const OFFSET_STRUCT_VECTOR_Q = 2
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label v = 2
    // v = { {2, 3}, {4, 5} }
    // [4] *(&(struct Vector) main::v) ← memcpy(*(&(const struct Vector) $0), struct Vector, (const byte) SIZEOF_STRUCT_VECTOR) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_VECTOR
  !:
    lda __0-1,y
    sta v-1,y
    dey
    bne !-
    // SCREEN[0] = v.p.x
    // [5] *((const byte*) SCREEN) ← *((byte*)(struct Point*)&(struct Vector) main::v) -- _deref_pbuc1=_deref_pbuc2 
    lda.z v
    sta SCREEN
    // SCREEN[1] = v.p.y
    // [6] *((const byte*) SCREEN+(byte) 1) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_POINT_Y
    sta SCREEN+1
    // SCREEN[2] = v.q.x
    // [7] *((const byte*) SCREEN+(byte) 2) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_VECTOR_Q
    sta SCREEN+2
    // SCREEN[3] = v.q.y
    // [8] *((const byte*) SCREEN+(byte) 3) ← *((byte*)(struct Point*)&(struct Vector) main::v+(const byte) OFFSET_STRUCT_VECTOR_Q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda v+OFFSET_STRUCT_VECTOR_Q+OFFSET_STRUCT_POINT_Y
    sta SCREEN+3
    // main::@return
    // }
    // [9] return 
    rts
}
  // File Data
  __0: .byte 2, 3, 4, 5

