Inlined call call __init

CONTROL FLOW GRAPH SSA

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

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  points#2 = (struct Point *)$1000
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  points#9 = phi( __start::__init1/points#2 )
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  points#7 = phi( __start::@1/points#1 )
  points#3 = points#7
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  points#8 = phi( __start::@2/points#3 )
  points#4 = points#8
  return 
  to:@return

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

Adding number conversion cast (unumber) 0 in main::SCREEN[0] = *main::$0
Adding number conversion cast (unumber) 1 in main::SCREEN[1] = *main::$1
Adding number conversion cast (unumber) 2 in main::SCREEN[2] = *main::$2
Adding number conversion cast (unumber) 3 in main::SCREEN[3] = *main::$3
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Simplifying constant pointer cast (struct Point *) 4096
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias points#0 = points#6 points#1 
Alias points#2 = points#9 
Alias points#3 = points#7 points#8 points#4 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values points#5 points#2
Identical Phi Values points#3 points#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant points#2 = (struct Point *) 4096
Successful SSA optimization Pass2ConstantIdentification
Constant main::$4 = (char *)points#2
Constant main::$5 = (char *)points#2
Successful SSA optimization Pass2ConstantIdentification
Converting *(pointer+n) to pointer[n] [3] main::SCREEN[0] = *main::$0  -- main::$4[OFFSET_STRUCT_POINT_X]
Converting *(pointer+n) to pointer[n] [6] main::SCREEN[1] = *main::$1  -- main::$5[OFFSET_STRUCT_POINT_Y]
Converting *(pointer+n) to pointer[n] [10] main::SCREEN[2] = *main::$2  -- main::$6[OFFSET_STRUCT_POINT_X]
Converting *(pointer+n) to pointer[n] [13] main::SCREEN[3] = *main::$3  -- main::$7[OFFSET_STRUCT_POINT_Y]
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero main::$4 in [2] main::$0 = main::$4 + OFFSET_STRUCT_POINT_X
Simplifying expression containing zero main::$4 in [3] main::SCREEN[0] = main::$4[OFFSET_STRUCT_POINT_X]
Simplifying expression containing zero main::SCREEN in [3] main::SCREEN[0] = *main::$4
Simplifying expression containing zero main::$6 in [9] main::$2 = main::$6 + OFFSET_STRUCT_POINT_X
Simplifying expression containing zero main::$6 in [10] main::SCREEN[2] = main::$6[OFFSET_STRUCT_POINT_X]
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable main::$0 and assignment [0] main::$0 = main::$4
Eliminating unused variable main::$1 and assignment [2] main::$1 = main::$5 + OFFSET_STRUCT_POINT_Y
Eliminating unused variable main::$2 and assignment [6] main::$2 = main::$6
Eliminating unused variable main::$3 and assignment [9] main::$3 = main::$7 + 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 right-side identified [2] points#0 = points#2 + SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant points#0 = points#2+SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2ConstantIdentification
Constant main::$6 = (char *)points#0
Constant main::$7 = (char *)points#0
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings points#2
Inlining constant with different constant siblings points#0
Constant inlined main::$5 = (char *)(struct Point *) 4096
Constant inlined points#0 = (struct Point *) 4096+SIZEOF_STRUCT_POINT
Constant inlined main::$6 = (char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT
Constant inlined points#2 = (struct Point *) 4096
Constant inlined main::$4 = (char *)(struct Point *) 4096
Constant inlined main::$7 = (char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((char *)(struct Point *) 4096+OFFSET_STRUCT_POINT_Y)
Consolidated array index constant in *(main::SCREEN+1)
Consolidated array index constant in *(main::SCREEN+2)
Consolidated array index constant in *((char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT+OFFSET_STRUCT_POINT_Y)
Consolidated array index constant in *(main::SCREEN+3)
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] *main::SCREEN = *((char *)(struct Point *) 4096)
  [1] *(main::SCREEN+1) = *((char *)(struct Point *) 4096+OFFSET_STRUCT_POINT_Y)
  [2] *(main::SCREEN+2) = *((char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT)
  [3] *(main::SCREEN+3) = *((char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT+OFFSET_STRUCT_POINT_Y)
  to:main::@return
main::@return: scope:[main]  from main
  [4] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
struct Point *points

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

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

Uplifting [Point] best 41 combination 
Uplifting [main] best 41 combination 
Uplifting [] best 41 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct - accessing pointer to struct in memory using arrow operator
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-ptr-6.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 SIZEOF_STRUCT_POINT = 2
  .const OFFSET_STRUCT_POINT_Y = 1
.segment Code
  // main
main: {
    .label SCREEN = $400
    // [0] *main::SCREEN = *((char *)(struct Point *) 4096) -- _deref_pbuc1=_deref_pbuc2 
    lda $1000
    sta SCREEN
    // [1] *(main::SCREEN+1) = *((char *)(struct Point *) 4096+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda $1000+OFFSET_STRUCT_POINT_Y
    sta SCREEN+1
    // [2] *(main::SCREEN+2) = *((char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT) -- _deref_pbuc1=_deref_pbuc2 
    lda $1000+SIZEOF_STRUCT_POINT
    sta SCREEN+2
    // [3] *(main::SCREEN+3) = *((char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda $1000+SIZEOF_STRUCT_POINT+OFFSET_STRUCT_POINT_Y
    sta SCREEN+3
    jmp __breturn
    // main::@return
  __breturn:
    // [4] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

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



FINAL ASSEMBLER
Score: 38

  // File Comments
// Minimal struct - accessing pointer to struct in memory using arrow operator
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-ptr-6.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 SIZEOF_STRUCT_POINT = 2
  .const OFFSET_STRUCT_POINT_Y = 1
.segment Code
  // main
main: {
    .label SCREEN = $400
    // SCREEN[0] = points->x
    // [0] *main::SCREEN = *((char *)(struct Point *) 4096) -- _deref_pbuc1=_deref_pbuc2 
    lda $1000
    sta SCREEN
    // SCREEN[1] = points->y
    // [1] *(main::SCREEN+1) = *((char *)(struct Point *) 4096+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda $1000+OFFSET_STRUCT_POINT_Y
    sta SCREEN+1
    // SCREEN[2] = points->x
    // [2] *(main::SCREEN+2) = *((char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT) -- _deref_pbuc1=_deref_pbuc2 
    lda $1000+SIZEOF_STRUCT_POINT
    sta SCREEN+2
    // SCREEN[3] = points->y
    // [3] *(main::SCREEN+3) = *((char *)(struct Point *) 4096+SIZEOF_STRUCT_POINT+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 
    lda $1000+SIZEOF_STRUCT_POINT+OFFSET_STRUCT_POINT_Y
    sta SCREEN+3
    // main::@return
    // }
    // [4] return 
    rts
}
  // File Data

