Inlined call main::$0 = call toUpper('c', true)
Inlined call main::$1 = call toUpper('m', false)
Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  main::toUpper1_ch#0 = 'c'
  main::toUpper1_bo#0 = true
  to:main::toUpper1
main::toUpper1: scope:[main]  from main
  main::toUpper1_bo#1 = phi( main/main::toUpper1_bo#0 )
  main::toUpper1_ch#1 = phi( main/main::toUpper1_ch#0 )
  main::toUpper1_res#0 = main::toUpper1_ch#1
  main::toUpper1_$0 = ! main::toUpper1_bo#1
  if(main::toUpper1_$0) goto main::toUpper1_@1
  to:main::toUpper1_@2
main::toUpper1_@1: scope:[main]  from main::toUpper1 main::toUpper1_@2
  main::toUpper1_res#2 = phi( main::toUpper1/main::toUpper1_res#0, main::toUpper1_@2/main::toUpper1_res#1 )
  main::toUpper1_return#0 = main::toUpper1_res#2
  to:main::toUpper1_@return
main::toUpper1_@2: scope:[main]  from main::toUpper1
  main::toUpper1_res#3 = phi( main::toUpper1/main::toUpper1_res#0 )
  main::toUpper1_res#1 = main::toUpper1_res#3 + $40
  to:main::toUpper1_@1
main::toUpper1_@return: scope:[main]  from main::toUpper1_@1
  main::toUpper1_return#2 = phi( main::toUpper1_@1/main::toUpper1_return#0 )
  main::toUpper1_return#1 = main::toUpper1_return#2
  to:main::@1
main::@1: scope:[main]  from main::toUpper1_@return
  main::toUpper1_return#3 = phi( main::toUpper1_@return/main::toUpper1_return#1 )
  main::$0 = main::toUpper1_return#3
  screen[0] = main::$0
  main::toUpper2_ch#0 = 'm'
  main::toUpper2_bo#0 = false
  to:main::toUpper2
main::toUpper2: scope:[main]  from main::@1
  main::toUpper2_bo#1 = phi( main::@1/main::toUpper2_bo#0 )
  main::toUpper2_ch#1 = phi( main::@1/main::toUpper2_ch#0 )
  main::toUpper2_res#0 = main::toUpper2_ch#1
  main::toUpper2_$0 = ! main::toUpper2_bo#1
  if(main::toUpper2_$0) goto main::toUpper2_@1
  to:main::toUpper2_@2
main::toUpper2_@1: scope:[main]  from main::toUpper2 main::toUpper2_@2
  main::toUpper2_res#2 = phi( main::toUpper2/main::toUpper2_res#0, main::toUpper2_@2/main::toUpper2_res#1 )
  main::toUpper2_return#0 = main::toUpper2_res#2
  to:main::toUpper2_@return
main::toUpper2_@2: scope:[main]  from main::toUpper2
  main::toUpper2_res#3 = phi( main::toUpper2/main::toUpper2_res#0 )
  main::toUpper2_res#1 = main::toUpper2_res#3 + $40
  to:main::toUpper2_@1
main::toUpper2_@return: scope:[main]  from main::toUpper2_@1
  main::toUpper2_return#2 = phi( main::toUpper2_@1/main::toUpper2_return#0 )
  main::toUpper2_return#1 = main::toUpper2_return#2
  to:main::@2
main::@2: scope:[main]  from main::toUpper2_@return
  main::toUpper2_return#3 = phi( main::toUpper2_@return/main::toUpper2_return#1 )
  main::$1 = main::toUpper2_return#3
  screen[1] = main::$1
  to:main::@return
main::@return: scope:[main]  from main::@2
  return 
  to:@return

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

SYMBOL TABLE SSA
void __start()
void main()
char main::$0
char main::$1
bool main::toUpper1_$0
bool main::toUpper1_bo
bool main::toUpper1_bo#0
bool main::toUpper1_bo#1
char main::toUpper1_ch
char main::toUpper1_ch#0
char main::toUpper1_ch#1
char main::toUpper1_res
char main::toUpper1_res#0
char main::toUpper1_res#1
char main::toUpper1_res#2
char main::toUpper1_res#3
char main::toUpper1_return
char main::toUpper1_return#0
char main::toUpper1_return#1
char main::toUpper1_return#2
char main::toUpper1_return#3
bool main::toUpper2_$0
bool main::toUpper2_bo
bool main::toUpper2_bo#0
bool main::toUpper2_bo#1
char main::toUpper2_ch
char main::toUpper2_ch#0
char main::toUpper2_ch#1
char main::toUpper2_res
char main::toUpper2_res#0
char main::toUpper2_res#1
char main::toUpper2_res#2
char main::toUpper2_res#3
char main::toUpper2_return
char main::toUpper2_return#0
char main::toUpper2_return#1
char main::toUpper2_return#2
char main::toUpper2_return#3
__constant char *screen = (char *)$400

Adding number conversion cast (unumber) $40 in main::toUpper1_res#1 = main::toUpper1_res#3 + $40
Adding number conversion cast (unumber) 0 in screen[0] = main::$0
Adding number conversion cast (unumber) $40 in main::toUpper2_res#1 = main::toUpper2_res#3 + $40
Adding number conversion cast (unumber) 1 in screen[1] = main::$1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast $40
Simplifying constant integer cast 0
Simplifying constant integer cast $40
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias main::toUpper1_ch#0 = main::toUpper1_ch#1 main::toUpper1_res#0 main::toUpper1_res#3 
Alias main::toUpper1_bo#0 = main::toUpper1_bo#1 
Alias main::toUpper1_return#0 = main::toUpper1_res#2 main::toUpper1_return#2 main::toUpper1_return#1 main::toUpper1_return#3 main::$0 
Alias main::toUpper2_ch#0 = main::toUpper2_ch#1 main::toUpper2_res#0 main::toUpper2_res#3 
Alias main::toUpper2_bo#0 = main::toUpper2_bo#1 
Alias main::toUpper2_return#0 = main::toUpper2_res#2 main::toUpper2_return#2 main::toUpper2_return#1 main::toUpper2_return#3 main::$1 
Successful SSA optimization Pass2AliasElimination
Rewriting ! if()-condition to reversed if() [2] main::toUpper1_$0 = ! main::toUpper1_bo#0
Rewriting ! if()-condition to reversed if() [9] main::toUpper2_$0 = ! main::toUpper2_bo#0
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant main::toUpper1_ch#0 = 'c'
Constant main::toUpper1_bo#0 = true
Constant main::toUpper2_ch#0 = 'm'
Constant main::toUpper2_bo#0 = false
Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (main::toUpper1) in block main::toUpper1_@1
if() condition always true - replacing block destination [3] if(main::toUpper1_bo#0) goto main::toUpper1_@2
if() condition always false - eliminating [10] if(main::toUpper2_bo#0) goto main::toUpper2_@2
Successful SSA optimization Pass2ConstantIfs
Simplifying expression containing zero screen in [6] screen[0] = main::toUpper1_return#0
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating variable main::toUpper2_res#1 from unused block main::toUpper2_@2
Removing PHI-reference to removed block (main::toUpper2_@2) in block main::toUpper2_@1
Removing unused block main::toUpper2_@2
Successful SSA optimization Pass2EliminateUnusedBlocks
Eliminating unused constant main::toUpper1_bo#0
Eliminating unused constant main::toUpper2_bo#0
Successful SSA optimization PassNEliminateUnusedVars
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Alias main::toUpper1_return#0 = main::toUpper1_res#1 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values main::toUpper2_return#0 main::toUpper2_ch#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant right-side identified [0] main::toUpper1_return#0 = main::toUpper1_ch#0 + $40
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::toUpper1_return#0 = main::toUpper1_ch#0+$40
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(screen+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of main
Adding NOP phi() at start of main::toUpper1
Adding NOP phi() at start of main::toUpper1_@2
Adding NOP phi() at start of main::toUpper1_@1
Adding NOP phi() at start of main::toUpper1_@return
Adding NOP phi() at start of main::toUpper2
Adding NOP phi() at start of main::toUpper2_@1
Adding NOP phi() at start of main::toUpper2_@return
CALL GRAPH

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block label main::toUpper1_@2
Culled Empty Block label main::toUpper1_@1
Culled Empty Block label main::toUpper1_@return
Culled Empty Block label main::toUpper2_@1
Culled Empty Block label main::toUpper2_@return
Adding NOP phi() at start of main
Adding NOP phi() at start of main::toUpper1
Adding NOP phi() at start of main::toUpper2

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  to:main::toUpper1
main::toUpper1: scope:[main]  from main
  [1] phi()
  to:main::@1
main::@1: scope:[main]  from main::toUpper1
  [2] *screen = main::toUpper1_return#0
  to:main::toUpper2
main::toUpper2: scope:[main]  from main::@1
  [3] phi()
  to:main::@2
main::@2: scope:[main]  from main::toUpper2
  [4] *(screen+1) = main::toUpper2_ch#0
  to:main::@return
main::@return: scope:[main]  from main::@2
  [5] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
bool main::toUpper1_bo
char main::toUpper1_ch
char main::toUpper1_res
char main::toUpper1_return
bool main::toUpper2_bo
char main::toUpper2_ch
char main::toUpper2_res
char main::toUpper2_return

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [2] *screen = main::toUpper1_return#0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *(screen+1) = main::toUpper2_ch#0 [ ] (  [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 87 combination 
Uplifting [] best 87 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test inlining a slightly complex print function (containing an if)
  // Upstart
  // Commodore 64 PRG executable file
.file [name="inline-function-if.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
  .label screen = $400
.segment Code
  // main
main: {
    .const toUpper1_ch = 'c'
    .const toUpper2_ch = 'm'
    .const toUpper1_return = toUpper1_ch+$40
    // [1] phi from main to main::toUpper1 [phi:main->main::toUpper1]
  toUpper1_from_main:
    jmp toUpper1
    // main::toUpper1
  toUpper1:
    jmp __b1
    // main::@1
  __b1:
    // [2] *screen = main::toUpper1_return#0 -- _deref_pbuc1=vbuc2 
    lda #toUpper1_return
    sta screen
    // [3] phi from main::@1 to main::toUpper2 [phi:main::@1->main::toUpper2]
  toUpper2_from___b1:
    jmp toUpper2
    // main::toUpper2
  toUpper2:
    jmp __b2
    // main::@2
  __b2:
    // [4] *(screen+1) = main::toUpper2_ch#0 -- _deref_pbuc1=vbuc2 
    lda #toUpper2_ch
    sta screen+1
    jmp __breturn
    // main::@return
  __breturn:
    // [5] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp toUpper1
Removing instruction jmp __b1
Removing instruction jmp toUpper2
Removing instruction jmp __b2
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction toUpper1_from_main:
Removing instruction toUpper1:
Removing instruction toUpper2_from___b1:
Removing instruction toUpper2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __b2:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
void main()
bool main::toUpper1_bo
char main::toUpper1_ch
__constant char main::toUpper1_ch#0 = 'c' // toUpper1_ch
char main::toUpper1_res
char main::toUpper1_return
__constant char main::toUpper1_return#0 = main::toUpper1_ch#0+$40 // toUpper1_return
bool main::toUpper2_bo
char main::toUpper2_ch
__constant char main::toUpper2_ch#0 = 'm' // toUpper2_ch
char main::toUpper2_res
char main::toUpper2_return
__constant char *screen = (char *) 1024



FINAL ASSEMBLER
Score: 18

  // File Comments
// Test inlining a slightly complex print function (containing an if)
  // Upstart
  // Commodore 64 PRG executable file
.file [name="inline-function-if.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
  .label screen = $400
.segment Code
  // main
main: {
    .const toUpper1_ch = 'c'
    .const toUpper2_ch = 'm'
    .const toUpper1_return = toUpper1_ch+$40
    // [1] phi from main to main::toUpper1 [phi:main->main::toUpper1]
    // main::toUpper1
    // main::@1
    // screen[0] = toUpper('c',true)
    // [2] *screen = main::toUpper1_return#0 -- _deref_pbuc1=vbuc2 
    lda #toUpper1_return
    sta screen
    // [3] phi from main::@1 to main::toUpper2 [phi:main::@1->main::toUpper2]
    // main::toUpper2
    // main::@2
    // screen[1] = toUpper('m',false)
    // [4] *(screen+1) = main::toUpper2_ch#0 -- _deref_pbuc1=vbuc2 
    lda #toUpper2_ch
    sta screen+1
    // main::@return
    // }
    // [5] return 
    rts
}
  // File Data

