Created struct value member variable (byte) main::q_x
Created struct value member variable (byte) main::q_y
Converted struct value to member variables (struct Point) main::q
Created struct value member variable (byte) main::$0_x
Created struct value member variable (byte) main::$0_y
Converted struct value to member variables (struct Point~) main::$0
Created struct value member variable (byte) point::return_x
Created struct value member variable (byte) point::return_y
Converted struct value to member variables (struct Point) point::return
Created struct value member variable (byte) point::p_x
Created struct value member variable (byte) point::p_y
Converted struct value to member variables (struct Point) point::p
Adding struct value member variable default initializer (byte) main::q_x ← (byte) 0
Adding struct value member variable default initializer (byte) main::q_y ← (byte) 0
Converted procedure call LValue to member unwinding { (byte) main::$0_x, (byte) main::$0_y } ← call point 
Adding struct value member variable copy (byte) main::q_x ← (byte) main::$0_x
Adding struct value member variable copy (byte) main::q_y ← (byte) main::$0_y
Adding struct value list initializer (byte) point::p_x ← (number) 2
Adding struct value list initializer (byte) point::p_y ← (number) 3
Adding struct value member variable copy (byte) point::return_x ← (byte) point::p_x
Adding struct value member variable copy (byte) point::return_y ← (byte) point::p_y
Adding struct value member variable copy (byte) point::return_x ← (byte) point::return_x
Adding struct value member variable copy (byte) point::return_y ← (byte) point::return_y
Converted procedure struct return value to member unwinding return { (byte) point::return_x, (byte) point::return_y }
Replacing struct member reference (struct Point) main::q.x with member unwinding reference (byte) main::q_x
Replacing struct member reference (struct Point) main::q.y with member unwinding reference (byte) main::q_y
Identified constant variable (byte) point::p_x
Identified constant variable (byte) point::p_y
Culled Empty Block (label) @1
Culled Empty Block (label) point::@1
Unwinding list assignment { (byte) main::$0_x, (byte) main::$0_y } ← { (byte) point::return_x, (byte) point::return_y }
Unwinding list assignment { (byte) point::return_x#0, (byte) point::return_y#0 } ← { (byte) point::return_x#2, (byte) point::return_y#2 }
Adding versioned struct unwinding for (struct Point) point::return#0
Adding versioned struct unwinding for (struct Point) point::return#1

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@2
main: scope:[main]  from @2
  (byte) main::q_x#0 ← (byte) 0
  (byte) main::q_y#0 ← (byte) 0
  call point 
  (byte) point::return_x#0 ← (byte) point::return_x#2
  (byte) point::return_y#0 ← (byte) point::return_y#2
  to:main::@1
main::@1: scope:[main]  from main
  (byte) point::return_y#3 ← phi( main/(byte) point::return_y#0 )
  (byte) point::return_x#3 ← phi( main/(byte) point::return_x#0 )
  (byte) main::$0_x ← (byte) point::return_x#3
  (byte) main::$0_y ← (byte) point::return_y#3
  (byte) main::q_x#1 ← (byte) main::$0_x
  (byte) main::q_y#1 ← (byte) main::$0_y
  (byte*) main::SCREEN#0 ← ((byte*)) (number) $400
  *((byte*) main::SCREEN#0 + (number) 0) ← (byte) main::q_x#1
  *((byte*) main::SCREEN#0 + (number) 1) ← (byte) main::q_y#1
  to:main::@return
main::@return: scope:[main]  from main::@1
  return 
  to:@return
point: scope:[point]  from main
  (byte) point::p_x#0 ← (number) 2
  (byte) point::p_y#0 ← (number) 3
  (byte) point::return_x#1 ← (byte) point::p_x#0
  (byte) point::return_y#1 ← (byte) point::p_y#0
  (struct Point) point::return#0 ← struct-unwound {(byte) point::return_x#1, (byte) point::return_y#1}
  to:point::@return
point::@return: scope:[point]  from point
  (byte) point::return_y#4 ← phi( point/(byte) point::return_y#1 )
  (byte) point::return_x#4 ← phi( point/(byte) point::return_x#1 )
  (byte) point::return_x#2 ← (byte) point::return_x#4
  (byte) point::return_y#2 ← (byte) point::return_y#4
  (struct Point) point::return#1 ← struct-unwound {(byte) point::return_x#2, (byte) point::return_y#2}
  return 
  to:@return
@2: scope:[]  from @begin
  call main 
  to:@3
@3: scope:[]  from @2
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(byte) Point::x
(byte) Point::y
(void()) main()
(struct Point~) main::$0
(byte) main::$0_x
(byte) main::$0_y
(label) main::@1
(label) main::@return
(byte*) main::SCREEN
(byte*) main::SCREEN#0
(byte) main::q_x
(byte) main::q_x#0
(byte) main::q_x#1
(byte) main::q_y
(byte) main::q_y#0
(byte) main::q_y#1
(struct Point()) point()
(label) point::@return
(byte) point::p_x
(byte) point::p_x#0
(byte) point::p_y
(byte) point::p_y#0
(struct Point) point::return
(struct Point) point::return#0
(struct Point) point::return#1
(byte) point::return_x
(byte) point::return_x#0
(byte) point::return_x#1
(byte) point::return_x#2
(byte) point::return_x#3
(byte) point::return_x#4
(byte) point::return_y
(byte) point::return_y#0
(byte) point::return_y#1
(byte) point::return_y#2
(byte) point::return_y#3
(byte) point::return_y#4

Adding number conversion cast (unumber) 0 in *((byte*) main::SCREEN#0 + (number) 0) ← (byte) main::q_x#1
Adding number conversion cast (unumber) 1 in *((byte*) main::SCREEN#0 + (number) 1) ← (byte) main::q_y#1
Adding number conversion cast (unumber) 2 in (byte) point::p_x#0 ← (number) 2
Adding number conversion cast (unumber) 3 in (byte) point::p_y#0 ← (number) 3
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*) main::SCREEN#0 ← (byte*)(number) $400
Inlining cast (byte) point::p_x#0 ← (unumber)(number) 2
Inlining cast (byte) point::p_y#0 ← (unumber)(number) 3
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) point::return_x#0 = (byte) point::return_x#3 
Alias (byte) point::return_y#0 = (byte) point::return_y#3 
Alias (byte) main::q_x#1 = (byte) main::$0_x 
Alias (byte) main::q_y#1 = (byte) main::$0_y 
Alias (byte) point::p_x#0 = (byte) point::return_x#1 (byte) point::return_x#4 (byte) point::return_x#2 
Alias (byte) point::p_y#0 = (byte) point::return_y#1 (byte) point::return_y#4 (byte) point::return_y#2 
Successful SSA optimization Pass2AliasElimination
Constant (const byte) main::q_x#0 = 0
Constant (const byte) main::q_y#0 = 0
Constant (const byte*) main::SCREEN#0 = (byte*) 1024
Constant (const byte) point::p_x#0 = 2
Constant (const byte) point::p_y#0 = 3
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte) point::return_x#0 = point::p_x#0
Constant (const byte) point::return_y#0 = point::p_y#0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte) main::q_x#1 = point::return_x#0
Constant (const byte) main::q_y#1 = point::return_y#0
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::SCREEN#0 in [11] *((const byte*) main::SCREEN#0 + (byte) 0) ← (const byte) main::q_x#1
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (struct Point) point::return#0 and assignment [4] (struct Point) point::return#0 ← struct-unwound {(const byte) point::p_x#0, (const byte) point::p_y#0}
Eliminating unused variable (struct Point) point::return#1 and assignment [5] (struct Point) point::return#1 ← struct-unwound {(const byte) point::p_x#0, (const byte) point::p_y#0}
Eliminating unused constant (const byte) main::q_x#0
Eliminating unused constant (const byte) main::q_y#0
Successful SSA optimization PassNEliminateUnusedVars
Constant inlined main::q_x#1 = (const byte) point::p_x#0
Constant inlined point::return_y#0 = (const byte) point::p_y#0
Constant inlined point::return_x#0 = (const byte) point::p_x#0
Constant inlined main::q_y#1 = (const byte) point::p_y#0
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN#0+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of point
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to point:6 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3
Renumbering block @2 to @1
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of point

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] phi()
  [5] call point 
  to:main::@1
main::@1: scope:[main]  from main
  [6] *((const byte*) main::SCREEN#0) ← (const byte) point::p_x#0
  [7] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) point::p_y#0
  to:main::@return
main::@return: scope:[main]  from main::@1
  [8] return 
  to:@return
point: scope:[point]  from main
  [9] phi()
  to:point::@return
point::@return: scope:[point]  from point
  [10] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(void()) main()
(struct Point~) main::$0
(byte*) main::SCREEN
(byte) main::q_x
(byte) main::q_y
(struct Point()) point()
(byte) point::p_x
(byte) point::p_y
(struct Point) point::return
(byte) point::return_x
(byte) point::return_y

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic
  // File Comments
// Minimal struct - struct return value
  // 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 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label SCREEN = $400
    // [5] call point 
    // [9] phi from main to point [phi:main->point]
  point_from_main:
    jsr point
    jmp b1
    // main::@1
  b1:
    // [6] *((const byte*) main::SCREEN#0) ← (const byte) point::p_x#0 -- _deref_pbuc1=vbuc2 
    lda #point.p_x
    sta SCREEN
    // [7] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) point::p_y#0 -- _deref_pbuc1=vbuc2 
    lda #point.p_y
    sta SCREEN+1
    jmp breturn
    // main::@return
  breturn:
    // [8] return 
    rts
}
  // point
point: {
    .label p_x = 2
    .label p_y = 3
    jmp breturn
    // point::@return
  breturn:
    // [10] return 
    rts
}
  // File Data

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

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

Uplifting [Point] best 78 combination 
Uplifting [main] best 78 combination 
Uplifting [point] best 78 combination 
Uplifting [] best 78 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal struct - struct return value
  // 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 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label SCREEN = $400
    // [5] call point 
    // [9] phi from main to point [phi:main->point]
  point_from_main:
    jsr point
    jmp b1
    // main::@1
  b1:
    // [6] *((const byte*) main::SCREEN#0) ← (const byte) point::p_x#0 -- _deref_pbuc1=vbuc2 
    lda #point.p_x
    sta SCREEN
    // [7] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) point::p_y#0 -- _deref_pbuc1=vbuc2 
    lda #point.p_y
    sta SCREEN+1
    jmp breturn
    // main::@return
  breturn:
    // [8] return 
    rts
}
  // point
point: {
    .label p_x = 2
    .label p_y = 3
    jmp breturn
    // point::@return
  breturn:
    // [10] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction point_from_main:
Removing instruction b1:
Removing instruction breturn:
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
(byte) Point::x
(byte) Point::y
(void()) main()
(struct Point~) main::$0
(label) main::@1
(label) main::@return
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = (byte*) 1024
(byte) main::q_x
(byte) main::q_y
(struct Point()) point()
(label) point::@return
(byte) point::p_x
(const byte) point::p_x#0 p_x = (byte) 2
(byte) point::p_y
(const byte) point::p_y#0 p_y = (byte) 3
(struct Point) point::return
(byte) point::return_x
(byte) point::return_y



FINAL ASSEMBLER
Score: 30

  // File Comments
// Minimal struct - struct return value
  // 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 
  // [4] phi from @1 to main [phi:@1->main]
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label SCREEN = $400
    // point()
    // [5] call point 
    // [9] phi from main to point [phi:main->point]
    jsr point
    // main::@1
    // SCREEN[0] = q.x
    // [6] *((const byte*) main::SCREEN#0) ← (const byte) point::p_x#0 -- _deref_pbuc1=vbuc2 
    lda #point.p_x
    sta SCREEN
    // SCREEN[1] = q.y
    // [7] *((const byte*) main::SCREEN#0+(byte) 1) ← (const byte) point::p_y#0 -- _deref_pbuc1=vbuc2 
    lda #point.p_y
    sta SCREEN+1
    // main::@return
    // }
    // [8] return 
    rts
}
  // point
point: {
    .label p_x = 2
    .label p_y = 3
    // point::@return
    // [10] return 
    rts
}
  // File Data

