Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  to:main::@1
main::@1: scope:[main]  from main main::@3
  if(true) goto main::@2
  to:main::@return
main::@2: scope:[main]  from main::@1
  call menu
  to:main::@3
main::@3: scope:[main]  from main::@2
  to:main::@1
main::@return: scope:[main]  from main::@1
  return 
  to:@return

void menu()
menu: scope:[menu]  from main::@2
  to:menu::@1
menu::@1: scope:[menu]  from menu
  if(true) goto menu::@2
  to:menu::@return
menu::@2: scope:[menu]  from menu::@1
  call mode
  to:menu::@3
menu::@3: scope:[menu]  from menu::@2
  to:menu::@return
menu::@return: scope:[menu]  from menu::@1 menu::@3
  return 
  to:@return

void mode()
mode: scope:[mode]  from menu::@2
  to:mode::@1
mode::@1: scope:[mode]  from mode mode::@2 mode::@3
  if(true) goto mode::@2
  to:mode::@return
mode::@2: scope:[mode]  from mode::@1
  mode::$0 = *B == 0
  mode::$1 = ! mode::$0
  if(mode::$1) goto mode::@1
  to:mode::@3
mode::@3: scope:[mode]  from mode::@2
  to:mode::@1
mode::@return: scope:[mode]  from mode::@1
  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
__constant char *B = (char *)$1000
void __start()
void main()
void menu()
void mode()
bool mode::$0
bool mode::$1

Adding number conversion cast (unumber) 0 in mode::$0 = *B == 0
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 4096
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [8] mode::$1 = *B != 0 from [7] mode::$0 = *B == 0
Successful SSA optimization Pass2UnaryNotSimplification
Simple Condition mode::$1 [8] if(*B!=0) goto mode::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
if() condition always true - replacing block destination [0] if(true) goto main::@2
if() condition always true - replacing block destination [3] if(true) goto menu::@2
if() condition always true - replacing block destination [6] if(true) goto mode::@2
Successful SSA optimization Pass2ConstantIfs
Removing unused block main::@return
Removing unused block mode::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
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
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of menu
Adding NOP phi() at start of menu::@1
Adding NOP phi() at start of menu::@2
Adding NOP phi() at start of menu::@3
Adding NOP phi() at start of mode
Adding NOP phi() at start of mode::@1
Adding NOP phi() at start of mode::@3
CALL GRAPH
Calls in [main] to menu:3 
Calls in [menu] to mode:8 

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

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@1
  [1] phi()
  [2] call menu
  to:main::@1

void menu()
menu: scope:[menu]  from main::@1
  [3] phi()
  to:menu::@1
menu::@1: scope:[menu]  from menu
  [4] phi()
  [5] call mode
  to:menu::@return
menu::@return: scope:[menu]  from menu::@1
  [6] return 
  to:@return

void mode()
mode: scope:[mode]  from menu::@1
  [7] phi()
  to:mode::@1
mode::@1: scope:[mode]  from mode mode::@1 mode::@2
  [8] if(*B!=0) goto mode::@1
  to:mode::@2
mode::@2: scope:[mode]  from mode::@1
  [9] phi()
  to:mode::@1


VARIABLE REGISTER WEIGHTS
void main()
void menu()
void mode()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [8] if(*B!=0) goto mode::@1 [ ] ( menu:2::mode:5 [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 6917 combination 
Uplifting [menu] best 6917 combination 
Uplifting [mode] best 6917 combination 
Uplifting [] best 6917 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Error cleaning up unused blocks
  // Upstart
  // Commodore 64 PRG executable file
.file [name="emptyblock-error.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 B = $1000
.segment Code
  // main
main: {
    // [1] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1]
  __b1_from_main:
  __b1_from___b1:
    jmp __b1
    // main::@1
  __b1:
    // [2] call menu
    // [3] phi from main::@1 to menu [phi:main::@1->menu]
  menu_from___b1:
    jsr menu
    jmp __b1_from___b1
}
  // menu
menu: {
    // [4] phi from menu to menu::@1 [phi:menu->menu::@1]
  __b1_from_menu:
    jmp __b1
    // menu::@1
  __b1:
    // [5] call mode
    // [7] phi from menu::@1 to mode [phi:menu::@1->mode]
  mode_from___b1:
    jsr mode
    jmp __breturn
    // menu::@return
  __breturn:
    // [6] return 
    rts
}
  // mode
mode: {
    jmp __b1
    // mode::@1
  __b1:
    // [8] if(*B!=0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1 
    lda B
    bne __b1
    // [9] phi from mode::@1 to mode::@2 [phi:mode::@1->mode::@2]
  __b2_from___b1:
    jmp __b2
    // mode::@2
  __b2:
    jmp __b1
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b2
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b1 with __b1
Removing instruction __b1_from_main:
Removing instruction __b1_from___b1:
Removing instruction menu_from___b1:
Removing instruction __b1_from_menu:
Removing instruction mode_from___b1:
Removing instruction __b2_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __b2:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant char *B = (char *) 4096
void main()
void menu()
void mode()



FINAL ASSEMBLER
Score: 6551

  // File Comments
// Error cleaning up unused blocks
  // Upstart
  // Commodore 64 PRG executable file
.file [name="emptyblock-error.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 B = $1000
.segment Code
  // main
main: {
    // [1] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1]
    // main::@1
  __b1:
    // menu()
    // [2] call menu
    // [3] phi from main::@1 to menu [phi:main::@1->menu]
    jsr menu
    jmp __b1
}
  // menu
menu: {
    // [4] phi from menu to menu::@1 [phi:menu->menu::@1]
    // menu::@1
    // mode()
    // [5] call mode
    // [7] phi from menu::@1 to mode [phi:menu::@1->mode]
    jsr mode
    // menu::@return
    // }
    // [6] return 
    rts
}
  // mode
mode: {
    // mode::@1
  __b1:
    // if(*B == 0)
    // [8] if(*B!=0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1 
    lda B
    bne __b1
    // [9] phi from mode::@1 to mode::@2 [phi:mode::@1->mode::@2]
    // mode::@2
    jmp __b1
}
  // File Data

