Culled Empty Block (label) main::@2
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@12
Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@7
Culled Empty Block (label) main::@8
Culled Empty Block (label) main::@9
Culled Empty Block (label) main::@10

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (bool) framedone#0 ← true
  to:@1
main: scope:[main]  from @1
  (bool) framedone#9 ← phi( @1/(bool) framedone#8 )
  to:main::@1
main::@1: scope:[main]  from main main::@6
  (bool) framedone#7 ← phi( main/(bool) framedone#9 main::@6/(bool) framedone#1 )
  if(true) goto main::@4
  to:main::@return
main::@4: scope:[main]  from main::@1 main::@4
  (bool) framedone#4 ← phi( main::@1/(bool) framedone#7 main::@4/(bool) framedone#4 )
  (bool~) main::$0 ← ! (bool) framedone#4
  if((bool~) main::$0) goto main::@4
  to:main::@6
main::@6: scope:[main]  from main::@4
  (bool) framedone#1 ← false
  to:main::@1
main::@return: scope:[main]  from main::@1
  (bool) framedone#5 ← phi( main::@1/(bool) framedone#7 )
  (bool) framedone#2 ← (bool) framedone#5
  return 
  to:@return
@1: scope:[]  from @begin
  (bool) framedone#8 ← phi( @begin/(bool) framedone#0 )
  call main 
  to:@2
@2: scope:[]  from @1
  (bool) framedone#6 ← phi( @1/(bool) framedone#2 )
  (bool) framedone#3 ← (bool) framedone#6
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(bool) framedone
(bool) framedone#0
(bool) framedone#1
(bool) framedone#2
(bool) framedone#3
(bool) framedone#4
(bool) framedone#5
(bool) framedone#6
(bool) framedone#7
(bool) framedone#8
(bool) framedone#9
(void()) main()
(bool~) main::$0
(label) main::@1
(label) main::@4
(label) main::@6
(label) main::@return

Alias (bool) framedone#2 = (bool) framedone#5 (bool) framedone#7 
Alias (bool) framedone#0 = (bool) framedone#8 
Alias (bool) framedone#3 = (bool) framedone#6 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (bool) framedone#4
Successful SSA optimization Pass2SelfPhiElimination
Identical Phi Values (bool) framedone#9 (bool) framedone#0
Identical Phi Values (bool) framedone#4 (bool) framedone#2
Identical Phi Values (bool) framedone#3 (bool) framedone#2
Successful SSA optimization Pass2IdenticalPhiElimination
Rewriting ! if()-condition to reversed if() [5] (bool~) main::$0 ← ! (bool) framedone#2
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant (const bool) framedone#0 = true
Constant (const bool) framedone#1 = false
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [3] if(true) goto main::@4
Successful SSA optimization Pass2ConstantIfs
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Inlining constant with var siblings (const bool) framedone#0
Inlining constant with var siblings (const bool) framedone#1
Constant inlined framedone#1 = false
Constant inlined framedone#0 = true
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@6
CALL GRAPH
Calls in [] to main:2 

Created 1 initial phi equivalence classes
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@6
Renumbering block main::@4 to main::@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

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()
  to:main::@1
main::@1: scope:[main]  from main main::@2
  [5] (bool) framedone#2 ← phi( main/true main::@2/false )
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [6] if((bool) framedone#2) goto main::@1
  to:main::@2


VARIABLE REGISTER WEIGHTS
(bool) framedone
(bool) framedone#2 50.5
(void()) main()

Initial phi equivalence classes
[ framedone#2 ]
Complete equivalence classes
[ framedone#2 ]
Allocated zp ZP_BOOL:2 [ framedone#2 ]

INITIAL ASM
  // File Comments
// Some bool code that causes a NullPointerException
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label framedone = 2
  // @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 to main::@1 [phi:main->main::@1]
  b1_from_main:
    // [5] phi (bool) framedone#2 = true [phi:main->main::@1#0] -- vboz1=vboc1 
    lda #1
    sta framedone
    jmp b1
    // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  b1_from_b2:
    // [5] phi (bool) framedone#2 = false [phi:main::@2->main::@1#0] -- vboz1=vboc1 
    lda #0
    sta framedone
    jmp b1
    // main::@1
  b1:
    jmp b2
    // main::@2
  b2:
    // [6] if((bool) framedone#2) goto main::@1 -- vboz1_then_la1 
    lda framedone
    cmp #0
    bne b1_from_b2
    jmp b2
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BOOL:2 [ framedone#2 ] : zp ZP_BOOL:2 , reg byte a , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 50.5: zp ZP_BOOL:2 [ framedone#2 ] 
Uplift Scope [main] 

Uplifting [] best 892 combination reg byte a [ framedone#2 ] 
Uplifting [main] best 892 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Some bool code that causes a NullPointerException
  // Basic 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: {
    // [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    // [5] phi (bool) framedone#2 = true [phi:main->main::@1#0] -- vboaa=vboc1 
    lda #1
    jmp b1
    // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  b1_from_b2:
    // [5] phi (bool) framedone#2 = false [phi:main::@2->main::@1#0] -- vboaa=vboc1 
    lda #0
    jmp b1
    // main::@1
  b1:
    jmp b2
    // main::@2
  b2:
    // [6] if((bool) framedone#2) goto main::@1 -- vboaa_then_la1 
    cmp #0
    bne b1_from_b2
    jmp b2
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Relabelling long label b1_from_b2 to b1
Succesful ASM optimization Pass5RelabelLongLabels
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(bool) framedone
(bool) framedone#2 reg byte a 50.5
(void()) main()
(label) main::@1
(label) main::@2

reg byte a [ framedone#2 ]


FINAL ASSEMBLER
Score: 820

  // File Comments
// Some bool code that causes a NullPointerException
  // Basic 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: {
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (bool) framedone#2 = true [phi:main->main::@1#0] -- vboaa=vboc1 
    lda #1
    jmp b2
    // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  b1:
    // [5] phi (bool) framedone#2 = false [phi:main::@2->main::@1#0] -- vboaa=vboc1 
    lda #0
    // main::@1
    // main::@2
  b2:
    // while(!framedone)
    // [6] if((bool) framedone#2) goto main::@1 -- vboaa_then_la1 
    cmp #0
    bne b1
    jmp b2
}
  // File Data

