Identified constant variable (byte*) B
Culled Empty Block (label) main::@4
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@6
Culled Empty Block (label) @1
Culled Empty Block (label) menu::@4
Culled Empty Block (label) menu::@3
Culled Empty Block (label) menu::@5
Culled Empty Block (label) menu::@6
Culled Empty Block (label) menu::@7
Culled Empty Block (label) @2
Culled Empty Block (label) mode::@5
Culled Empty Block (label) mode::@3
Culled Empty Block (label) mode::@6
Culled Empty Block (label) mode::@4
Culled Empty Block (label) mode::@8

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

(void()) main()
main: scope:[main]  from @3
  to:main::@1
main::@1: scope:[main]  from main main::@7
  if(true) goto main::@2
  to:main::@return
main::@2: scope:[main]  from main::@1
  call menu 
  to:main::@7
main::@7: 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::@8
menu::@8: scope:[menu]  from menu::@2
  to:menu::@return
menu::@return: scope:[menu]  from menu::@1 menu::@8
  return 
  to:@return

(void()) mode()
mode: scope:[mode]  from menu::@2
  to:mode::@1
mode::@1: scope:[mode]  from mode mode::@2 mode::@7
  if(true) goto mode::@2
  to:mode::@return
mode::@2: scope:[mode]  from mode::@1
  (bool~) mode::$0 ← *((const byte*) B) == (number) 0
  (bool~) mode::$1 ← ! (bool~) mode::$0
  if((bool~) mode::$1) goto mode::@1
  to:mode::@7
mode::@7: scope:[mode]  from mode::@2
  to:mode::@1
mode::@return: scope:[mode]  from mode::@1
  return 
  to:@return
@3: scope:[]  from @begin
  call main 
  to:@4
@4: scope:[]  from @3
  to:@end
@end: scope:[]  from @4

SYMBOL TABLE SSA
(label) @3
(label) @4
(label) @begin
(label) @end
(const byte*) B = (byte*)(number) $1000
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@7
(label) main::@return
(void()) menu()
(label) menu::@1
(label) menu::@2
(label) menu::@8
(label) menu::@return
(void()) mode()
(bool~) mode::$0
(bool~) mode::$1
(label) mode::@1
(label) mode::@2
(label) mode::@7
(label) mode::@return

Adding number conversion cast (unumber) 0 in (bool~) mode::$0 ← *((const byte*) B) == (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 4096
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [8] (bool~) mode::$1 ← *((const byte*) B) != (byte) 0 from [7] (bool~) mode::$0 ← *((const byte*) B) == (byte) 0
Successful SSA optimization Pass2UnaryNotSimplification
Simple Condition (bool~) mode::$1 [9] if(*((const byte*) B)!=(byte) 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
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @3
Adding NOP phi() at start of @4
Adding NOP phi() at start of @end
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::@7
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::@8
Adding NOP phi() at start of mode
Adding NOP phi() at start of mode::@1
Adding NOP phi() at start of mode::@7
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to menu:8 
Calls in [menu] to mode:13 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) main::@1
Culled Empty Block (label) main::@7
Culled Empty Block (label) menu::@1
Culled Empty Block (label) menu::@8
Culled Empty Block (label) mode::@1
Renumbering block @3 to @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::@7 to mode::@2
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::@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
@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::@1
main::@1: scope:[main]  from main main::@1
  [5] phi()
  [6] call menu 
  to:main::@1

(void()) menu()
menu: scope:[menu]  from main::@1
  [7] phi()
  to:menu::@1
menu::@1: scope:[menu]  from menu
  [8] phi()
  [9] call mode 
  to:menu::@return
menu::@return: scope:[menu]  from menu::@1
  [10] return 
  to:@return

(void()) mode()
mode: scope:[mode]  from menu::@1
  [11] phi()
  to:mode::@1
mode::@1: scope:[mode]  from mode mode::@1 mode::@2
  [12] if(*((const byte*) B)!=(byte) 0) goto mode::@1
  to:mode::@2
mode::@2: scope:[mode]  from mode::@1
  [13] phi()
  to:mode::@1


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

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Error cleaning up unused blocks
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label B = $1000
  // @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: {
    // [5] 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:
    // [6] call menu 
    // [7] phi from main::@1 to menu [phi:main::@1->menu]
  menu_from___b1:
    jsr menu
    jmp __b1_from___b1
}
  // menu
menu: {
    // [8] phi from menu to menu::@1 [phi:menu->menu::@1]
  __b1_from_menu:
    jmp __b1
    // menu::@1
  __b1:
    // [9] call mode 
    // [11] phi from menu::@1 to mode [phi:menu::@1->mode]
  mode_from___b1:
    jsr mode
    jmp __breturn
    // menu::@return
  __breturn:
    // [10] return 
    rts
}
  // mode
mode: {
    jmp __b1
    // mode::@1
  __b1:
    // [12] if(*((const byte*) B)!=(byte) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1 
    lda B
    cmp #0
    bne __b1
    // [13] phi from mode::@1 to mode::@2 [phi:mode::@1->mode::@2]
  __b2_from___b1:
    jmp __b2
    // mode::@2
  __b2:
    jmp __b1
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [12] if(*((const byte*) B)!=(byte) 0) goto mode::@1 [ ] ( main:2::menu:6::mode:9 [ ] ) always clobbers reg byte a 

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

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

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Error cleaning up unused blocks
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label B = $1000
  // @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: {
    // [5] 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:
    // [6] call menu 
    // [7] phi from main::@1 to menu [phi:main::@1->menu]
  menu_from___b1:
    jsr menu
    jmp __b1_from___b1
}
  // menu
menu: {
    // [8] phi from menu to menu::@1 [phi:menu->menu::@1]
  __b1_from_menu:
    jmp __b1
    // menu::@1
  __b1:
    // [9] call mode 
    // [11] phi from menu::@1 to mode [phi:menu::@1->mode]
  mode_from___b1:
    jsr mode
    jmp __breturn
    // menu::@return
  __breturn:
    // [10] return 
    rts
}
  // mode
mode: {
    jmp __b1
    // mode::@1
  __b1:
    // [12] if(*((const byte*) B)!=(byte) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1 
    lda B
    cmp #0
    bne __b1
    // [13] 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 __bend
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 __bbegin with __b1
Replacing label __b1_from___b1 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___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 __bend:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __b2:
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
(const byte*) B = (byte*) 4096
(void()) main()
(label) main::@1
(void()) menu()
(label) menu::@1
(label) menu::@return
(void()) mode()
(label) mode::@1
(label) mode::@2



FINAL ASSEMBLER
Score: 8551

  // File Comments
// Error cleaning up unused blocks
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label B = $1000
  // @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: {
    // [5] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1]
    // main::@1
  __b1:
    // menu()
    // [6] call menu 
    // [7] phi from main::@1 to menu [phi:main::@1->menu]
    jsr menu
    jmp __b1
}
  // menu
menu: {
    // [8] phi from menu to menu::@1 [phi:menu->menu::@1]
    // menu::@1
    // mode()
    // [9] call mode 
    // [11] phi from menu::@1 to mode [phi:menu::@1->mode]
    jsr mode
    // menu::@return
    // }
    // [10] return 
    rts
}
  // mode
mode: {
    // mode::@1
  __b1:
    // if(*B == 0)
    // [12] if(*((const byte*) B)!=(byte) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1 
    lda B
    cmp #0
    bne __b1
    // [13] phi from mode::@1 to mode::@2 [phi:mode::@1->mode::@2]
    // mode::@2
    jmp __b1
}
  // File Data

