
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  main::$2 = (char *)main::SCREEN
  main::$0 = main::$2 + OFFSET_STRUCT_POINTDEF_X
  *main::$0 = main::p_x
  main::$3 = (char *)main::SCREEN
  main::$1 = main::$3 + OFFSET_STRUCT_POINTDEF_Y
  *main::$1 = main::p_y
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return

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

SYMBOL TABLE SSA
__constant char OFFSET_STRUCT_POINTDEF_X = 0
__constant char OFFSET_STRUCT_POINTDEF_Y = 1
void __start()
void main()
char *main::$0
char *main::$1
char *main::$2
char *main::$3
__constant struct PointDef *main::SCREEN = (struct PointDef *)$400
__constant char main::p_x = 4
__constant char main::p_y = 7

Simplifying constant pointer cast (struct PointDef *) 1024
Successful SSA optimization PassNCastSimplification
Constant right-side identified [0] main::$2 = (char *)main::SCREEN
Constant right-side identified [3] main::$3 = (char *)main::SCREEN
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::$2 = (char *)main::SCREEN
Constant main::$3 = (char *)main::SCREEN
Successful SSA optimization Pass2ConstantIdentification
Converting *(pointer+n) to pointer[n] [2] *main::$0 = main::p_x  -- main::$2[OFFSET_STRUCT_POINTDEF_X]
Converting *(pointer+n) to pointer[n] [5] *main::$1 = main::p_y  -- main::$3[OFFSET_STRUCT_POINTDEF_Y]
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero main::$2 in [1] main::$0 = main::$2 + OFFSET_STRUCT_POINTDEF_X
Simplifying expression containing zero main::$2 in [2] main::$2[OFFSET_STRUCT_POINTDEF_X] = main::p_x
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable main::$0 and assignment [0] main::$0 = main::$2
Eliminating unused variable main::$1 and assignment [2] main::$1 = main::$3 + OFFSET_STRUCT_POINTDEF_Y
Eliminating unused constant OFFSET_STRUCT_POINTDEF_X
Successful SSA optimization PassNEliminateUnusedVars
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::@1
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Constant inlined main::$2 = (char *)main::SCREEN
Constant inlined main::$3 = (char *)main::SCREEN
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((char *)main::SCREEN+OFFSET_STRUCT_POINTDEF_Y)
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 *)main::SCREEN) = main::p_x
  [1] *((char *)main::SCREEN+OFFSET_STRUCT_POINTDEF_Y) = main::p_y
  to:main::@return
main::@return: scope:[main]  from main
  [2] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *((char *)main::SCREEN) = main::p_x [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *((char *)main::SCREEN+OFFSET_STRUCT_POINTDEF_Y) = main::p_y [ ] (  [ ] { }  ) always clobbers reg byte a 

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

Uplifting [PointDef] best 21 combination 
Uplifting [main] best 21 combination 
Uplifting [] best 21 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="typedef-1.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_POINTDEF_Y = 1
.segment Code
  // main
main: {
    .const p_x = 4
    .const p_y = 7
    .label SCREEN = $400
    // [0] *((char *)main::SCREEN) = main::p_x -- _deref_pbuc1=vbuc2 
    lda #p_x
    sta SCREEN
    // [1] *((char *)main::SCREEN+OFFSET_STRUCT_POINTDEF_Y) = main::p_y -- _deref_pbuc1=vbuc2 
    lda #p_y
    sta SCREEN+OFFSET_STRUCT_POINTDEF_Y
    jmp __breturn
    // main::@return
  __breturn:
    // [2] 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_POINTDEF_Y = 1
void main()
__constant struct PointDef *main::SCREEN = (struct PointDef *) 1024
__constant char main::p_x = 4
__constant char main::p_y = 7



FINAL ASSEMBLER
Score: 18

  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="typedef-1.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_POINTDEF_Y = 1
.segment Code
  // main
main: {
    .const p_x = 4
    .const p_y = 7
    .label SCREEN = $400
    // *SCREEN = p
    // [0] *((char *)main::SCREEN) = main::p_x -- _deref_pbuc1=vbuc2 
    lda #p_x
    sta SCREEN
    // [1] *((char *)main::SCREEN+OFFSET_STRUCT_POINTDEF_Y) = main::p_y -- _deref_pbuc1=vbuc2 
    lda #p_y
    sta SCREEN+OFFSET_STRUCT_POINTDEF_Y
    // main::@return
    // }
    // [2] return 
    rts
}
  // File Data

