Created struct value member variable (byte) main::p_x
Created struct value member variable (byte) main::p_y
Converted struct value to member variables (struct Point) main::p
Created struct value member variable (struct Point) main::c_center
Created struct value member variable (byte) main::c_radius
Converted struct value to member variables (struct Circle) main::c
Adding struct value list initializer (byte) main::p_x ← (number) $a
Adding struct value list initializer (byte) main::p_y ← (number) $a
Adding struct value list initializer (struct Point) main::c_center ← (struct Point) main::p
Adding struct value list initializer (byte) main::c_radius ← (number) 5
Replacing struct member reference (struct Circle) main::c.center with member unwinding reference (struct Point) main::c_center
Replacing struct member reference (struct Circle) main::c.center with member unwinding reference (struct Point) main::c_center
Replacing struct member reference (struct Circle) main::c.radius with member unwinding reference (byte) main::c_radius
Created struct value member variable (byte) main::c_center_x
Created struct value member variable (byte) main::c_center_y
Converted struct value to member variables (struct Point) main::c_center
Adding struct value member variable copy (byte) main::c_center_x ← (byte) main::p_x
Adding struct value member variable copy (byte) main::c_center_y ← (byte) main::p_y
Replacing struct member reference (struct Point) main::c_center.x with member unwinding reference (byte) main::c_center_x
Replacing struct member reference (struct Point) main::c_center.y with member unwinding reference (byte) main::c_center_y
Identified constant variable (byte) main::p_x
Identified constant variable (byte) main::p_y
Identified constant variable (byte) main::c_radius

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@1
main: scope:[main]  from @1
  (byte) main::p_x#0 ← (number) $a
  (byte) main::p_y#0 ← (number) $a
  (byte) main::c_center_x#0 ← (byte) main::p_x#0
  (byte) main::c_center_y#0 ← (byte) main::p_y#0
  (byte) main::c_radius#0 ← (number) 5
  (byte*) main::SCREEN#0 ← ((byte*)) (number) $400
  *((byte*) main::SCREEN#0 + (number) 0) ← (byte) main::c_center_x#0
  *((byte*) main::SCREEN#0 + (number) 1) ← (byte) main::c_center_y#0
  *((byte*) main::SCREEN#0 + (number) 2) ← (byte) main::c_radius#0
  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
(label) @1
(label) @2
(label) @begin
(label) @end
(struct Point) Circle::center
(byte) Circle::radius
(byte) Point::x
(byte) Point::y
(void()) main()
(label) main::@return
(byte*) main::SCREEN
(byte*) main::SCREEN#0
(byte) main::c_center_x
(byte) main::c_center_x#0
(byte) main::c_center_y
(byte) main::c_center_y#0
(byte) main::c_radius
(byte) main::c_radius#0
(byte) main::p_x
(byte) main::p_x#0
(byte) main::p_y
(byte) main::p_y#0

Adding number conversion cast (unumber) $a in (byte) main::p_x#0 ← (number) $a
Adding number conversion cast (unumber) $a in (byte) main::p_y#0 ← (number) $a
Adding number conversion cast (unumber) 5 in (byte) main::c_radius#0 ← (number) 5
Adding number conversion cast (unumber) 0 in *((byte*) main::SCREEN#0 + (number) 0) ← (byte) main::c_center_x#0
Adding number conversion cast (unumber) 1 in *((byte*) main::SCREEN#0 + (number) 1) ← (byte) main::c_center_y#0
Adding number conversion cast (unumber) 2 in *((byte*) main::SCREEN#0 + (number) 2) ← (byte) main::c_radius#0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) main::p_x#0 ← (unumber)(number) $a
Inlining cast (byte) main::p_y#0 ← (unumber)(number) $a
Inlining cast (byte) main::c_radius#0 ← (unumber)(number) 5
Inlining cast (byte*) main::SCREEN#0 ← (byte*)(number) $400
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast $a
Simplifying constant integer cast $a
Simplifying constant integer cast 5
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $a
Finalized unsigned number type (byte) $a
Finalized unsigned number type (byte) 5
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) main::p_x#0 = (byte) main::c_center_x#0 
Alias (byte) main::p_y#0 = (byte) main::c_center_y#0 
Successful SSA optimization Pass2AliasElimination
Constant (const byte) main::p_x#0 = $a
Constant (const byte) main::p_y#0 = $a
Constant (const byte) main::c_radius#0 = 5
Constant (const byte*) main::SCREEN#0 = (byte*) 1024
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::SCREEN#0 in [6] *((const byte*) main::SCREEN#0 + (byte) 0) ← (const byte) main::p_x#0
Successful SSA optimization PassNSimplifyExpressionWithZero
Consolidated array index constant in *(main::SCREEN#0+1)
Consolidated array index constant in *(main::SCREEN#0+2)
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()
main: scope:[main]  from @1
  [4] *((const byte*) main::SCREEN#0) ← (const byte) main::p_x#0
  [5] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) main::p_y#0
  [6] *((const byte*) main::SCREEN#0+(byte) 2) ← (const byte) main::c_radius#0
  to:main::@return
main::@return: scope:[main]  from main
  [7] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(struct Point) Circle::center
(byte) Circle::radius
(byte) Point::x
(byte) Point::y
(void()) main()
(byte*) main::SCREEN
(byte) main::c_center_x
(byte) main::c_center_y
(byte) main::c_radius
(byte) main::p_x
(byte) main::p_y

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic
  // File Comments
// Minimal struct - nesting structs
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @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: {
    .const p_x = $a
    .const p_y = $a
    .const c_radius = 5
    .label SCREEN = $400
    // [4] *((const byte*) main::SCREEN#0) ← (const byte) main::p_x#0 -- _deref_pbuc1=vbuc2 
    lda #p_x
    sta SCREEN
    // [5] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2 
    lda #p_y
    sta SCREEN+1
    // [6] *((const byte*) main::SCREEN#0+(byte) 2) ← (const byte) main::c_radius#0 -- _deref_pbuc1=vbuc2 
    lda #c_radius
    sta SCREEN+2
    jmp breturn
    // main::@return
  breturn:
    // [7] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) main::SCREEN#0) ← (const byte) main::p_x#0 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [5] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) main::p_y#0 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [6] *((const byte*) main::SCREEN#0+(byte) 2) ← (const byte) main::c_radius#0 [ ] ( main:2 [ ] ) always clobbers reg byte a 

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

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

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct - nesting structs
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @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: {
    .const p_x = $a
    .const p_y = $a
    .const c_radius = 5
    .label SCREEN = $400
    // [4] *((const byte*) main::SCREEN#0) ← (const byte) main::p_x#0 -- _deref_pbuc1=vbuc2 
    lda #p_x
    sta SCREEN
    // [5] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2 
    lda #p_y
    sta SCREEN+1
    // [6] *((const byte*) main::SCREEN#0+(byte) 2) ← (const byte) main::c_radius#0 -- _deref_pbuc1=vbuc2 
    lda #c_radius
    sta SCREEN+2
    jmp breturn
    // main::@return
  breturn:
    // [7] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
Removing instruction b1:
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 bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(struct Point) Circle::center
(byte) Circle::radius
(byte) Point::x
(byte) Point::y
(void()) main()
(label) main::@return
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = (byte*) 1024
(byte) main::c_center_x
(byte) main::c_center_y
(byte) main::c_radius
(const byte) main::c_radius#0 c_radius = (byte) 5
(byte) main::p_x
(const byte) main::p_x#0 p_x = (byte) $a
(byte) main::p_y
(const byte) main::p_y#0 p_y = (byte) $a



FINAL ASSEMBLER
Score: 24

  // File Comments
// Minimal struct - nesting structs
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  // @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: {
    .const p_x = $a
    .const p_y = $a
    .const c_radius = 5
    .label SCREEN = $400
    // SCREEN[0] = c.center.x
    // [4] *((const byte*) main::SCREEN#0) ← (const byte) main::p_x#0 -- _deref_pbuc1=vbuc2 
    lda #p_x
    sta SCREEN
    // SCREEN[1] = c.center.y
    // [5] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) main::p_y#0 -- _deref_pbuc1=vbuc2 
    lda #p_y
    sta SCREEN+1
    // SCREEN[2] = c.radius
    // [6] *((const byte*) main::SCREEN#0+(byte) 2) ← (const byte) main::c_radius#0 -- _deref_pbuc1=vbuc2 
    lda #c_radius
    sta SCREEN+2
    // main::@return
    // }
    // [7] return 
    rts
}
  // File Data

