Identified constant variable (byte*) screen
Inlined call (byte~) main::$0 ← call sum (number) 2 (number) 1 
Inlined call (byte~) main::$1 ← call sum (number) $a (number) 3 
Inlined call (byte~) main::$2 ← call sum (number) 4 (number) 8 
Culled Empty Block (label) main::sum1_@1
Culled Empty Block (label) main::sum2_@1
Culled Empty Block (label) main::sum3_@1
Culled Empty Block (label) @1

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@2

(void()) main()
main: scope:[main]  from @2
  (byte) main::sum1_a#0 ← (number) 2
  (byte) main::sum1_b#0 ← (number) 1
  to:main::sum1
main::sum1: scope:[main]  from main
  (byte) main::sum1_b#1 ← phi( main/(byte) main::sum1_b#0 )
  (byte) main::sum1_a#1 ← phi( main/(byte) main::sum1_a#0 )
  (byte~) main::sum1_$0 ← (byte) main::sum1_a#1 + (byte) main::sum1_b#1
  (byte) main::sum1_return#0 ← (byte~) main::sum1_$0
  to:main::sum1_@return
main::sum1_@return: scope:[main]  from main::sum1
  (byte) main::sum1_return#2 ← phi( main::sum1/(byte) main::sum1_return#0 )
  (byte) main::sum1_return#1 ← (byte) main::sum1_return#2
  to:main::@1
main::@1: scope:[main]  from main::sum1_@return
  (byte) main::sum1_return#3 ← phi( main::sum1_@return/(byte) main::sum1_return#1 )
  (byte~) main::$0 ← (byte) main::sum1_return#3
  *((const byte*) screen + (number) 0) ← (byte~) main::$0
  (byte) main::sum2_a#0 ← (number) $a
  (byte) main::sum2_b#0 ← (number) 3
  to:main::sum2
main::sum2: scope:[main]  from main::@1
  (byte) main::sum2_b#1 ← phi( main::@1/(byte) main::sum2_b#0 )
  (byte) main::sum2_a#1 ← phi( main::@1/(byte) main::sum2_a#0 )
  (byte~) main::sum2_$0 ← (byte) main::sum2_a#1 + (byte) main::sum2_b#1
  (byte) main::sum2_return#0 ← (byte~) main::sum2_$0
  to:main::sum2_@return
main::sum2_@return: scope:[main]  from main::sum2
  (byte) main::sum2_return#2 ← phi( main::sum2/(byte) main::sum2_return#0 )
  (byte) main::sum2_return#1 ← (byte) main::sum2_return#2
  to:main::@2
main::@2: scope:[main]  from main::sum2_@return
  (byte) main::sum2_return#3 ← phi( main::sum2_@return/(byte) main::sum2_return#1 )
  (byte~) main::$1 ← (byte) main::sum2_return#3
  *((const byte*) screen + (number) 1) ← (byte~) main::$1
  (byte) main::sum3_a#0 ← (number) 4
  (byte) main::sum3_b#0 ← (number) 8
  to:main::sum3
main::sum3: scope:[main]  from main::@2
  (byte) main::sum3_b#1 ← phi( main::@2/(byte) main::sum3_b#0 )
  (byte) main::sum3_a#1 ← phi( main::@2/(byte) main::sum3_a#0 )
  (byte~) main::sum3_$0 ← (byte) main::sum3_a#1 + (byte) main::sum3_b#1
  (byte) main::sum3_return#0 ← (byte~) main::sum3_$0
  to:main::sum3_@return
main::sum3_@return: scope:[main]  from main::sum3
  (byte) main::sum3_return#2 ← phi( main::sum3/(byte) main::sum3_return#0 )
  (byte) main::sum3_return#1 ← (byte) main::sum3_return#2
  to:main::@3
main::@3: scope:[main]  from main::sum3_@return
  (byte) main::sum3_return#3 ← phi( main::sum3_@return/(byte) main::sum3_return#1 )
  (byte~) main::$2 ← (byte) main::sum3_return#3
  *((const byte*) screen + (number) 2) ← (byte~) main::$2
  to:main::@return
main::@return: scope:[main]  from main::@3
  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
(void()) main()
(byte~) main::$0
(byte~) main::$1
(byte~) main::$2
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(label) main::sum1
(byte~) main::sum1_$0
(label) main::sum1_@return
(byte) main::sum1_a
(byte) main::sum1_a#0
(byte) main::sum1_a#1
(byte) main::sum1_b
(byte) main::sum1_b#0
(byte) main::sum1_b#1
(byte) main::sum1_return
(byte) main::sum1_return#0
(byte) main::sum1_return#1
(byte) main::sum1_return#2
(byte) main::sum1_return#3
(label) main::sum2
(byte~) main::sum2_$0
(label) main::sum2_@return
(byte) main::sum2_a
(byte) main::sum2_a#0
(byte) main::sum2_a#1
(byte) main::sum2_b
(byte) main::sum2_b#0
(byte) main::sum2_b#1
(byte) main::sum2_return
(byte) main::sum2_return#0
(byte) main::sum2_return#1
(byte) main::sum2_return#2
(byte) main::sum2_return#3
(label) main::sum3
(byte~) main::sum3_$0
(label) main::sum3_@return
(byte) main::sum3_a
(byte) main::sum3_a#0
(byte) main::sum3_a#1
(byte) main::sum3_b
(byte) main::sum3_b#0
(byte) main::sum3_b#1
(byte) main::sum3_return
(byte) main::sum3_return#0
(byte) main::sum3_return#1
(byte) main::sum3_return#2
(byte) main::sum3_return#3
(const byte*) screen = (byte*)(number) $400

Adding number conversion cast (unumber) 2 in (byte) main::sum1_a#0 ← (number) 2
Adding number conversion cast (unumber) 1 in (byte) main::sum1_b#0 ← (number) 1
Adding number conversion cast (unumber) 0 in *((const byte*) screen + (number) 0) ← (byte~) main::$0
Adding number conversion cast (unumber) $a in (byte) main::sum2_a#0 ← (number) $a
Adding number conversion cast (unumber) 3 in (byte) main::sum2_b#0 ← (number) 3
Adding number conversion cast (unumber) 1 in *((const byte*) screen + (number) 1) ← (byte~) main::$1
Adding number conversion cast (unumber) 4 in (byte) main::sum3_a#0 ← (number) 4
Adding number conversion cast (unumber) 8 in (byte) main::sum3_b#0 ← (number) 8
Adding number conversion cast (unumber) 2 in *((const byte*) screen + (number) 2) ← (byte~) main::$2
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) main::sum1_a#0 ← (unumber)(number) 2
Inlining cast (byte) main::sum1_b#0 ← (unumber)(number) 1
Inlining cast (byte) main::sum2_a#0 ← (unumber)(number) $a
Inlining cast (byte) main::sum2_b#0 ← (unumber)(number) 3
Inlining cast (byte) main::sum3_a#0 ← (unumber)(number) 4
Inlining cast (byte) main::sum3_b#0 ← (unumber)(number) 8
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 2
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant integer cast $a
Simplifying constant integer cast 3
Simplifying constant integer cast 1
Simplifying constant integer cast 4
Simplifying constant integer cast 8
Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $a
Finalized unsigned number type (byte) 3
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 4
Finalized unsigned number type (byte) 8
Finalized unsigned number type (byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) main::sum1_a#0 = (byte) main::sum1_a#1 
Alias (byte) main::sum1_b#0 = (byte) main::sum1_b#1 
Alias (byte) main::sum1_return#0 = (byte~) main::sum1_$0 (byte) main::sum1_return#2 (byte) main::sum1_return#1 (byte) main::sum1_return#3 (byte~) main::$0 
Alias (byte) main::sum2_a#0 = (byte) main::sum2_a#1 
Alias (byte) main::sum2_b#0 = (byte) main::sum2_b#1 
Alias (byte) main::sum2_return#0 = (byte~) main::sum2_$0 (byte) main::sum2_return#2 (byte) main::sum2_return#1 (byte) main::sum2_return#3 (byte~) main::$1 
Alias (byte) main::sum3_a#0 = (byte) main::sum3_a#1 
Alias (byte) main::sum3_b#0 = (byte) main::sum3_b#1 
Alias (byte) main::sum3_return#0 = (byte~) main::sum3_$0 (byte) main::sum3_return#2 (byte) main::sum3_return#1 (byte) main::sum3_return#3 (byte~) main::$2 
Successful SSA optimization Pass2AliasElimination
Constant (const byte) main::sum1_a#0 = 2
Constant (const byte) main::sum1_b#0 = 1
Constant (const byte) main::sum2_a#0 = $a
Constant (const byte) main::sum2_b#0 = 3
Constant (const byte) main::sum3_a#0 = 4
Constant (const byte) main::sum3_b#0 = 8
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero screen in [3] *((const byte*) screen + (byte) 0) ← (byte) main::sum1_return#0
Successful SSA optimization PassNSimplifyExpressionWithZero
Constant right-side identified [0] (byte) main::sum1_return#0 ← (const byte) main::sum1_a#0 + (const byte) main::sum1_b#0
Constant right-side identified [2] (byte) main::sum2_return#0 ← (const byte) main::sum2_a#0 + (const byte) main::sum2_b#0
Constant right-side identified [4] (byte) main::sum3_return#0 ← (const byte) main::sum3_a#0 + (const byte) main::sum3_b#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::sum1_return#0 = main::sum1_a#0+main::sum1_b#0
Constant (const byte) main::sum2_return#0 = main::sum2_a#0+main::sum2_b#0
Constant (const byte) main::sum3_return#0 = main::sum3_a#0+main::sum3_b#0
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(screen+1)
Consolidated array index constant in *(screen+2)
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 main::sum1
Adding NOP phi() at start of main::sum1_@return
Adding NOP phi() at start of main::sum2
Adding NOP phi() at start of main::sum2_@return
Adding NOP phi() at start of main::sum3
Adding NOP phi() at start of main::sum3_@return
CALL GRAPH
Calls in [] to main:2 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::sum1_@return
Culled Empty Block (label) main::sum2_@return
Culled Empty Block (label) main::sum3_@return
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 main::sum1
Adding NOP phi() at start of main::sum2
Adding NOP phi() at start of main::sum3

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()

(void()) main()
main: scope:[main]  from @1
  [4] phi()
  to:main::sum1
main::sum1: scope:[main]  from main
  [5] phi()
  to:main::@1
main::@1: scope:[main]  from main::sum1
  [6] *((const byte*) screen) ← (const byte) main::sum1_return#0
  to:main::sum2
main::sum2: scope:[main]  from main::@1
  [7] phi()
  to:main::@2
main::@2: scope:[main]  from main::sum2
  [8] *((const byte*) screen+(byte) 1) ← (const byte) main::sum2_return#0
  to:main::sum3
main::sum3: scope:[main]  from main::@2
  [9] phi()
  to:main::@3
main::@3: scope:[main]  from main::sum3
  [10] *((const byte*) screen+(byte) 2) ← (const byte) main::sum3_return#0
  to:main::@return
main::@return: scope:[main]  from main::@3
  [11] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::sum1_a
(byte) main::sum1_b
(byte) main::sum1_return
(byte) main::sum2_a
(byte) main::sum2_b
(byte) main::sum2_return
(byte) main::sum3_a
(byte) main::sum3_b
(byte) main::sum3_return

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Test minimal inline function
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label screen = $400
  // @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: {
    .const sum1_a = 2
    .const sum1_b = 1
    .const sum2_a = $a
    .const sum2_b = 3
    .const sum3_a = 4
    .const sum3_b = 8
    .const sum1_return = sum1_a+sum1_b
    .const sum2_return = sum2_a+sum2_b
    .const sum3_return = sum3_a+sum3_b
    // [5] phi from main to main::sum1 [phi:main->main::sum1]
  sum1_from_main:
    jmp sum1
    // main::sum1
  sum1:
    jmp __b1
    // main::@1
  __b1:
    // [6] *((const byte*) screen) ← (const byte) main::sum1_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum1_return
    sta screen
    // [7] phi from main::@1 to main::sum2 [phi:main::@1->main::sum2]
  sum2_from___b1:
    jmp sum2
    // main::sum2
  sum2:
    jmp __b2
    // main::@2
  __b2:
    // [8] *((const byte*) screen+(byte) 1) ← (const byte) main::sum2_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum2_return
    sta screen+1
    // [9] phi from main::@2 to main::sum3 [phi:main::@2->main::sum3]
  sum3_from___b2:
    jmp sum3
    // main::sum3
  sum3:
    jmp __b3
    // main::@3
  __b3:
    // [10] *((const byte*) screen+(byte) 2) ← (const byte) main::sum3_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum3_return
    sta screen+2
    jmp __breturn
    // main::@return
  __breturn:
    // [11] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] *((const byte*) screen) ← (const byte) main::sum1_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [8] *((const byte*) screen+(byte) 1) ← (const byte) main::sum2_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [10] *((const byte*) screen+(byte) 2) ← (const byte) main::sum3_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a 

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

Uplifting [main] best 138 combination 
Uplifting [] best 138 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test minimal inline function
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label screen = $400
  // @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: {
    .const sum1_a = 2
    .const sum1_b = 1
    .const sum2_a = $a
    .const sum2_b = 3
    .const sum3_a = 4
    .const sum3_b = 8
    .const sum1_return = sum1_a+sum1_b
    .const sum2_return = sum2_a+sum2_b
    .const sum3_return = sum3_a+sum3_b
    // [5] phi from main to main::sum1 [phi:main->main::sum1]
  sum1_from_main:
    jmp sum1
    // main::sum1
  sum1:
    jmp __b1
    // main::@1
  __b1:
    // [6] *((const byte*) screen) ← (const byte) main::sum1_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum1_return
    sta screen
    // [7] phi from main::@1 to main::sum2 [phi:main::@1->main::sum2]
  sum2_from___b1:
    jmp sum2
    // main::sum2
  sum2:
    jmp __b2
    // main::@2
  __b2:
    // [8] *((const byte*) screen+(byte) 1) ← (const byte) main::sum2_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum2_return
    sta screen+1
    // [9] phi from main::@2 to main::sum3 [phi:main::@2->main::sum3]
  sum3_from___b2:
    jmp sum3
    // main::sum3
  sum3:
    jmp __b3
    // main::@3
  __b3:
    // [10] *((const byte*) screen+(byte) 2) ← (const byte) main::sum3_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum3_return
    sta screen+2
    jmp __breturn
    // main::@return
  __breturn:
    // [11] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp sum1
Removing instruction jmp __b1
Removing instruction jmp sum2
Removing instruction jmp __b2
Removing instruction jmp sum3
Removing instruction jmp __b3
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction sum1_from_main:
Removing instruction sum1:
Removing instruction sum2_from___b1:
Removing instruction sum2:
Removing instruction sum3_from___b2:
Removing instruction sum3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b1:
Removing instruction __b2:
Removing instruction __b3:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(label) main::sum1
(byte) main::sum1_a
(const byte) main::sum1_a#0 sum1_a = (byte) 2
(byte) main::sum1_b
(const byte) main::sum1_b#0 sum1_b = (byte) 1
(byte) main::sum1_return
(const byte) main::sum1_return#0 sum1_return = (const byte) main::sum1_a#0+(const byte) main::sum1_b#0
(label) main::sum2
(byte) main::sum2_a
(const byte) main::sum2_a#0 sum2_a = (byte) $a
(byte) main::sum2_b
(const byte) main::sum2_b#0 sum2_b = (byte) 3
(byte) main::sum2_return
(const byte) main::sum2_return#0 sum2_return = (const byte) main::sum2_a#0+(const byte) main::sum2_b#0
(label) main::sum3
(byte) main::sum3_a
(const byte) main::sum3_a#0 sum3_a = (byte) 4
(byte) main::sum3_b
(const byte) main::sum3_b#0 sum3_b = (byte) 8
(byte) main::sum3_return
(const byte) main::sum3_return#0 sum3_return = (const byte) main::sum3_a#0+(const byte) main::sum3_b#0
(const byte*) screen = (byte*) 1024



FINAL ASSEMBLER
Score: 24

  // File Comments
// Test minimal inline function
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label screen = $400
  // @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: {
    .const sum1_a = 2
    .const sum1_b = 1
    .const sum2_a = $a
    .const sum2_b = 3
    .const sum3_a = 4
    .const sum3_b = 8
    .const sum1_return = sum1_a+sum1_b
    .const sum2_return = sum2_a+sum2_b
    .const sum3_return = sum3_a+sum3_b
    // [5] phi from main to main::sum1 [phi:main->main::sum1]
    // main::sum1
    // main::@1
    // screen[0] = sum(2, 1)
    // [6] *((const byte*) screen) ← (const byte) main::sum1_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum1_return
    sta screen
    // [7] phi from main::@1 to main::sum2 [phi:main::@1->main::sum2]
    // main::sum2
    // main::@2
    // screen[1] = sum(10, 3)
    // [8] *((const byte*) screen+(byte) 1) ← (const byte) main::sum2_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum2_return
    sta screen+1
    // [9] phi from main::@2 to main::sum3 [phi:main::@2->main::sum3]
    // main::sum3
    // main::@3
    // screen[2] = sum(4, 8)
    // [10] *((const byte*) screen+(byte) 2) ← (const byte) main::sum3_return#0 -- _deref_pbuc1=vbuc2 
    lda #sum3_return
    sta screen+2
    // main::@return
    // }
    // [11] return 
    rts
}
  // File Data

