Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  main::$6 = (char *)points
  main::$0 = main::$6 + OFFSET_STRUCT_POINT_X
  main::$7 = (char *)points
  main::$1 = main::$7 + OFFSET_STRUCT_POINT_X
  *main::$1 = *main::$0 + 5
  main::$8 = (char *)points
  main::$2 = main::$8 + OFFSET_STRUCT_POINT_Y
  main::$9 = (char *)points
  main::$3 = main::$9 + OFFSET_STRUCT_POINT_Y
  *main::$3 = *main::$2 + 5
  main::$10 = (char *)points
  main::$4 = main::$10 + OFFSET_STRUCT_POINT_X
  main::SCREEN[0] = *main::$4
  main::$11 = (char *)points
  main::$5 = main::$11 + OFFSET_STRUCT_POINT_Y
  main::SCREEN[1] = *main::$5
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  return 
  to:@return

SYMBOL TABLE SSA
__constant char OFFSET_STRUCT_POINT_X = 0
__constant char OFFSET_STRUCT_POINT_Y = 1
void __start()
void main()
char *main::$0
char *main::$1
char *main::$10
char *main::$11
char *main::$2
char *main::$3
char *main::$4
char *main::$5
char *main::$6
char *main::$7
char *main::$8
char *main::$9
__constant char * const main::SCREEN = (char *)$400
__constant struct Point *points = (struct Point *)$1000

Adding number conversion cast (unumber) 5 in *main::$1 = *main::$0 + 5
Adding number conversion cast (unumber) 5 in *main::$3 = *main::$2 + 5
Adding number conversion cast (unumber) 0 in main::SCREEN[0] = *main::$4
Adding number conversion cast (unumber) 1 in main::SCREEN[1] = *main::$5
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (struct Point *) 4096
Simplifying constant integer cast 5
Simplifying constant integer cast 5
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 5
Finalized unsigned number type (char) 5
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant right-side identified [0] main::$6 = (char *)points
Constant right-side identified [2] main::$7 = (char *)points
Constant right-side identified [5] main::$8 = (char *)points
Constant right-side identified [7] main::$9 = (char *)points
Constant right-side identified [10] main::$10 = (char *)points
Constant right-side identified [13] main::$11 = (char *)points
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::$6 = (char *)points
Constant main::$7 = (char *)points
Constant main::$8 = (char *)points
Constant main::$9 = (char *)points
Constant main::$10 = (char *)points
Constant main::$11 = (char *)points
Successful SSA optimization Pass2ConstantIdentification
Converting *(pointer+n) to pointer[n] [4] *main::$1 = *main::$0 + 5  -- main::$6[OFFSET_STRUCT_POINT_X]
Converting *(pointer+n) to pointer[n] [4] *main::$1 = main::$6[OFFSET_STRUCT_POINT_X] + 5  -- main::$7[OFFSET_STRUCT_POINT_X]
Converting *(pointer+n) to pointer[n] [9] *main::$3 = *main::$2 + 5  -- main::$8[OFFSET_STRUCT_POINT_Y]
Converting *(pointer+n) to pointer[n] [9] *main::$3 = main::$8[OFFSET_STRUCT_POINT_Y] + 5  -- main::$9[OFFSET_STRUCT_POINT_Y]
Converting *(pointer+n) to pointer[n] [12] main::SCREEN[0] = *main::$4  -- main::$10[OFFSET_STRUCT_POINT_X]
Converting *(pointer+n) to pointer[n] [15] main::SCREEN[1] = *main::$5  -- main::$11[OFFSET_STRUCT_POINT_Y]
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero main::$6 in [1] main::$0 = main::$6 + OFFSET_STRUCT_POINT_X
Simplifying expression containing zero main::$7 in [3] main::$1 = main::$7 + OFFSET_STRUCT_POINT_X
Simplifying expression containing zero main::$6 in [4] main::$7[OFFSET_STRUCT_POINT_X] = main::$6[OFFSET_STRUCT_POINT_X] + 5
Simplifying expression containing zero main::$7 in [4] main::$7[OFFSET_STRUCT_POINT_X] = *main::$6 + 5
Simplifying expression containing zero main::$10 in [11] main::$4 = main::$10 + OFFSET_STRUCT_POINT_X
Simplifying expression containing zero main::$10 in [12] main::SCREEN[0] = main::$10[OFFSET_STRUCT_POINT_X]
Simplifying expression containing zero main::SCREEN in [12] main::SCREEN[0] = *main::$10
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable main::$0 and assignment [0] main::$0 = main::$6
Eliminating unused variable main::$1 and assignment [1] main::$1 = main::$7
Eliminating unused variable main::$2 and assignment [3] main::$2 = main::$8 + OFFSET_STRUCT_POINT_Y
Eliminating unused variable main::$3 and assignment [4] main::$3 = main::$9 + OFFSET_STRUCT_POINT_Y
Eliminating unused variable main::$4 and assignment [6] main::$4 = main::$10
Eliminating unused variable main::$5 and assignment [8] main::$5 = main::$11 + OFFSET_STRUCT_POINT_Y
Eliminating unused constant OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Constant inlined main::$6 = (char *)points
Constant inlined main::$9 = (char *)points
Constant inlined main::$7 = (char *)points
Constant inlined main::$10 = (char *)points
Constant inlined main::$8 = (char *)points
Constant inlined main::$11 = (char *)points
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((char *)points+OFFSET_STRUCT_POINT_Y)
Consolidated array index constant in *((char *)points+OFFSET_STRUCT_POINT_Y)
Consolidated array index constant in *((char *)points+OFFSET_STRUCT_POINT_Y)
Consolidated array index constant in *(main::SCREEN+1)
Successful SSA optimization Pass2ConstantAdditionElimination
CALL GRAPH

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] *((char *)points) = *((char *)points) + 5
  [1] *((char *)points+OFFSET_STRUCT_POINT_Y) = *((char *)points+OFFSET_STRUCT_POINT_Y) + 5
  [2] *main::SCREEN = *((char *)points)
  [3] *(main::SCREEN+1) = *((char *)points+OFFSET_STRUCT_POINT_Y)
  to:main::@return
main::@return: scope:[main]  from main
  [4] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *((char *)points) = *((char *)points) + 5 [ ] (  [ ] { }  ) always clobbers reg byte a reg byte x 
Statement [1] *((char *)points+OFFSET_STRUCT_POINT_Y) = *((char *)points+OFFSET_STRUCT_POINT_Y) + 5 [ ] (  [ ] { }  ) always clobbers reg byte a reg byte x 
Statement [2] *main::SCREEN = *((char *)points) [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *(main::SCREEN+1) = *((char *)points+OFFSET_STRUCT_POINT_Y) [ ] (  [ ] { }  ) always clobbers reg byte a 

REGISTER UPLIFT SCOPES
Uplift Scope [Point] 
Uplift Scope [main] 
Uplift Scope [] 

Uplifting [Point] best 45 combination 
Uplifting [main] best 45 combination 
Uplifting [] best 45 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct - modifying pointer to struct in memory using arrow operator
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-ptr-13.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .const OFFSET_STRUCT_POINT_Y = 1
  .label points = $1000
.segment Code
  // main
main: {
    .label SCREEN = $400
    // [0] *((char *)points) = *((char *)points) + 5 -- _deref_pbuc1=_deref_pbuc1_plus_vbuc2 
    lax points
    axs #-[5]
    stx points
    // [1] *((char *)points+OFFSET_STRUCT_POINT_Y) = *((char *)points+OFFSET_STRUCT_POINT_Y) + 5 -- _deref_pbuc1=_deref_pbuc1_plus_vbuc2 
    lax points+OFFSET_STRUCT_POINT_Y
    axs #-[5]
    stx points+OFFSET_STRUCT_POINT_Y
    // [2] *main::SCREEN = *((char *)points) -- _deref_pbuc1=_deref_pbuc2 
    lda points
    sta SCREEN
    // [3] *(main::SCREEN+1) = *((char *)points+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda points+OFFSET_STRUCT_POINT_Y
    sta SCREEN+1
    jmp __breturn
    // main::@return
  __breturn:
    // [4] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing instruction lda points+OFFSET_STRUCT_POINT_Y with TXA
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant char OFFSET_STRUCT_POINT_Y = 1
void main()
__constant char * const main::SCREEN = (char *) 1024
__constant struct Point *points = (struct Point *) 4096



FINAL ASSEMBLER
Score: 40

  // File Comments
// Minimal struct - modifying pointer to struct in memory using arrow operator
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-ptr-13.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .const OFFSET_STRUCT_POINT_Y = 1
  .label points = $1000
.segment Code
  // main
main: {
    .label SCREEN = $400
    // points->x += 5
    // [0] *((char *)points) = *((char *)points) + 5 -- _deref_pbuc1=_deref_pbuc1_plus_vbuc2 
    lax points
    axs #-[5]
    stx points
    // points->y += 5
    // [1] *((char *)points+OFFSET_STRUCT_POINT_Y) = *((char *)points+OFFSET_STRUCT_POINT_Y) + 5 -- _deref_pbuc1=_deref_pbuc1_plus_vbuc2 
    lax points+OFFSET_STRUCT_POINT_Y
    axs #-[5]
    stx points+OFFSET_STRUCT_POINT_Y
    // SCREEN[0] = points->x
    // [2] *main::SCREEN = *((char *)points) -- _deref_pbuc1=_deref_pbuc2 
    lda points
    sta SCREEN
    // SCREEN[1] = points->y
    // [3] *(main::SCREEN+1) = *((char *)points+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    txa
    sta SCREEN+1
    // main::@return
    // }
    // [4] return 
    rts
}
  // File Data

