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

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

(void()) main()
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[1]:2 [ framedone#2 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Some bool code that causes a NullPointerException
  // 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.z 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.z framedone
    jmp __b1
    // main::@1
  __b1:
    jmp __b2
    // main::@2
  __b2:
    // [6] if((bool) framedone#2) goto main::@1 -- vboz1_then_la1 
    lda.z framedone
    cmp #0
    bne __b1_from___b2
    jmp __b2
}
  // File Data

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

REGISTER UPLIFT SCOPES
Uplift Scope [] 50.5: zp[1]: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
  // 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 __bbegin with __b1
Replacing label __b1 with __b2
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
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 __b1:
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
  // 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

