
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  main::c_center_x#0 = main::p_x
  main::c_center_y#0 = main::p_y
  main::SCREEN[0] = main::c_center_x#0
  main::SCREEN[1] = main::c_center_y#0
  main::SCREEN[2] = main::c_radius
  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
void __start()
void main()
__constant char * const main::SCREEN = (char *)$400
struct Point main::c_center
char main::c_center_x
char main::c_center_x#0
char main::c_center_y
char main::c_center_y#0
__constant char main::c_radius = 5
__constant char main::p_x = $a
__constant char main::p_y = $a

Adding number conversion cast (unumber) 0 in main::SCREEN[0] = main::c_center_x#0
Adding number conversion cast (unumber) 1 in main::SCREEN[1] = main::c_center_y#0
Adding number conversion cast (unumber) 2 in main::SCREEN[2] = main::c_radius
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
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant main::c_center_x#0 = main::p_x
Constant main::c_center_y#0 = main::p_y
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::SCREEN in [2] main::SCREEN[0] = main::c_center_x#0
Successful SSA optimization PassNSimplifyExpressionWithZero
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::c_center_x#0 = main::p_x
Constant inlined main::c_center_y#0 = main::p_y
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN+1)
Consolidated array index constant in *(main::SCREEN+2)
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 = main::p_x
  [1] *(main::SCREEN+1) = main::p_y
  [2] *(main::SCREEN+2) = main::c_radius
  to:main::@return
main::@return: scope:[main]  from main
  [3] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
struct Point main::c_center
char main::c_center_x
char main::c_center_y

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

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

Uplifting [Point] best 27 combination 
Uplifting [Circle] best 27 combination 
Uplifting [main] best 27 combination 
Uplifting [] best 27 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct - nesting structs
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-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
.segment Code
  // main
main: {
    .const p_x = $a
    .const p_y = $a
    .const c_radius = 5
    .label SCREEN = $400
    // [0] *main::SCREEN = main::p_x -- _deref_pbuc1=vbuc2 
    lda #p_x
    sta SCREEN
    // [1] *(main::SCREEN+1) = main::p_y -- _deref_pbuc1=vbuc2 
    lda #p_y
    sta SCREEN+1
    // [2] *(main::SCREEN+2) = main::c_radius -- _deref_pbuc1=vbuc2 
    lda #c_radius
    sta SCREEN+2
    jmp __breturn
    // main::@return
  __breturn:
    // [3] return 
    rts
}
  // File Data

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

FINAL SYMBOL TABLE
void main()
__constant char * const main::SCREEN = (char *) 1024
struct Point main::c_center
char main::c_center_x
char main::c_center_y
__constant char main::c_radius = 5
__constant char main::p_x = $a
__constant char main::p_y = $a



FINAL ASSEMBLER
Score: 24

  // File Comments
// Minimal struct - nesting structs
  // Upstart
  // Commodore 64 PRG executable file
.file [name="struct-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
.segment Code
  // main
main: {
    .const p_x = $a
    .const p_y = $a
    .const c_radius = 5
    .label SCREEN = $400
    // SCREEN[0] = c.center.x
    // [0] *main::SCREEN = main::p_x -- _deref_pbuc1=vbuc2 
    lda #p_x
    sta SCREEN
    // SCREEN[1] = c.center.y
    // [1] *(main::SCREEN+1) = main::p_y -- _deref_pbuc1=vbuc2 
    lda #p_y
    sta SCREEN+1
    // SCREEN[2] = c.radius
    // [2] *(main::SCREEN+2) = main::c_radius -- _deref_pbuc1=vbuc2 
    lda #c_radius
    sta SCREEN+2
    // main::@return
    // }
    // [3] return 
    rts
}
  // File Data

