Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@8

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

(void()) main()
main: scope:[main]  from @1
  to:main::@1
main::@1: scope:[main]  from main main::@4
  if(true) goto main::@2
  to:main::@return
main::@2: scope:[main]  from main::@1
  (byte) main::key#0 ← *((const byte*) RASTER)
  (bool~) main::$0 ← (byte) main::key#0 > (number) $20
  (bool~) main::$1 ← (byte) main::key#0 < (number) $40
  (bool~) main::$2 ← (bool~) main::$0 || (bool~) main::$1
  (bool~) main::$3 ← ! (bool~) main::$2
  if((bool~) main::$3) goto main::@4
  to:main::@7
main::@4: scope:[main]  from main::@2 main::@7
  (byte) main::key#2 ← phi( main::@2/(byte) main::key#0 main::@7/(byte) main::key#1 )
  *((const byte*) SCREEN) ← (byte) main::key#2
  to:main::@1
main::@7: scope:[main]  from main::@2
  (byte) main::key#1 ← (number) 0
  to:main::@4
main::@return: scope:[main]  from main::@1
  return 
  to:@return
@1: scope:[]  from @begin
  call main 
  to:@2
@2: scope:[]  from @1
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(const byte*) RASTER = (byte*)(number) $d012
(const byte*) SCREEN = (byte*)(number) $400
(void()) main()
(bool~) main::$0
(bool~) main::$1
(bool~) main::$2
(bool~) main::$3
(label) main::@1
(label) main::@2
(label) main::@4
(label) main::@7
(label) main::@return
(byte) main::key
(byte) main::key#0
(byte) main::key#1
(byte) main::key#2

Adding number conversion cast (unumber) $20 in (bool~) main::$0 ← (byte) main::key#0 > (number) $20
Adding number conversion cast (unumber) $40 in (bool~) main::$1 ← (byte) main::key#0 < (number) $40
Adding number conversion cast (unumber) 0 in (byte) main::key#1 ← (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) main::key#1 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 53266
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast $20
Simplifying constant integer cast $40
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $20
Finalized unsigned number type (byte) $40
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting ! if()-condition to reversed if() [5] (bool~) main::$3 ← ! (bool~) main::$2
Rewriting || if()-condition to two if()s [4] (bool~) main::$2 ← (bool~) main::$0 || (bool~) main::$1
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant (const byte) main::key#1 = 0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [0] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Simple Condition (bool~) main::$0 [3] if((byte) main::key#0>(byte) $20) goto main::@7
Simple Condition (bool~) main::$1 [7] if((byte) main::key#0<(byte) $40) goto main::@7
Successful SSA optimization Pass2ConditionalJumpSimplification
Negating conditional jump and destination [7] if((byte) main::key#0>=(byte) $40) goto main::@4
Successful SSA optimization Pass2ConditionalJumpSequenceImprovement
Rewriting conditional comparison [3] if((byte) main::key#0>(byte) $20) goto main::@7
Adding number conversion cast (unumber) $20+1 in if((byte) main::key#0>=(byte) $20+(number) 1) goto main::@7
Adding number conversion cast (unumber) 1 in if((byte) main::key#0>=(unumber)(byte) $20+(number) 1) goto main::@7
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast (byte) $20+(unumber)(number) 1
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inlining constant with var siblings (const byte) main::key#1
Constant inlined main::key#1 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@10(between main::@9 and main::@4)
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::@1
Adding NOP phi() at start of main::@7
CALL GRAPH
Calls in [] to main:2 

Created 1 initial phi equivalence classes
Coalesced [13] main::key#3 ← main::key#0
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1
Culled Empty Block (label) main::@7
Renumbering block main::@2 to main::@1
Renumbering block main::@4 to main::@2
Renumbering block main::@9 to main::@3
Renumbering block main::@10 to main::@4
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::@4

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] (byte) main::key#0 ← *((const byte*) RASTER)
  [6] if((byte) main::key#0>=(byte) $20+(byte) 1) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@1
  [7] if((byte) main::key#0>=(byte) $40) goto main::@4
  to:main::@2
main::@4: scope:[main]  from main::@3
  [8] phi()
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@3 main::@4
  [9] (byte) main::key#2 ← phi( main::@4/(byte) main::key#0 main::@1/(byte) 0 main::@3/(byte) 0 )
  [10] *((const byte*) SCREEN) ← (byte) main::key#2
  to:main::@1


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::key
(byte) main::key#0 11.0
(byte) main::key#2 22.0

Initial phi equivalence classes
[ main::key#2 main::key#0 ]
Complete equivalence classes
[ main::key#2 main::key#0 ]
Allocated zp[1]:2 [ main::key#2 main::key#0 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Test to provoke Exception when using complex || condition
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label RASTER = $d012
  .label SCREEN = $400
  // @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: {
    .label key = 2
    jmp __b1
    // main::@1
  __b1:
    // [5] (byte) main::key#0 ← *((const byte*) RASTER) -- vbuz1=_deref_pbuc1 
    lda RASTER
    sta.z key
    // [6] if((byte) main::key#0>=(byte) $20+(byte) 1) goto main::@2 -- vbuz1_ge_vbuc1_then_la1 
    lda.z key
    cmp #$20+1
    bcs __b2_from___b1
    jmp __b3
    // main::@3
  __b3:
    // [7] if((byte) main::key#0>=(byte) $40) goto main::@4 -- vbuz1_ge_vbuc1_then_la1 
    lda.z key
    cmp #$40
    bcs __b4_from___b3
    // [9] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
  __b2_from___b1:
  __b2_from___b3:
    // [9] phi (byte) main::key#2 = (byte) 0 [phi:main::@1/main::@3->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z key
    jmp __b2
    // [8] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    jmp __b4
    // main::@4
  __b4:
    // [9] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  __b2_from___b4:
    // [9] phi (byte) main::key#2 = (byte) main::key#0 [phi:main::@4->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [10] *((const byte*) SCREEN) ← (byte) main::key#2 -- _deref_pbuc1=vbuz1 
    lda.z key
    sta SCREEN
    jmp __b1
}
  // File Data

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

REGISTER UPLIFT SCOPES
Uplift Scope [main] 33: zp[1]:2 [ main::key#2 main::key#0 ] 
Uplift Scope [] 

Uplifting [main] best 382 combination reg byte a [ main::key#2 main::key#0 ] 
Uplifting [] best 382 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test to provoke Exception when using complex || condition
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label RASTER = $d012
  .label SCREEN = $400
  // @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: {
    jmp __b1
    // main::@1
  __b1:
    // [5] (byte) main::key#0 ← *((const byte*) RASTER) -- vbuaa=_deref_pbuc1 
    lda RASTER
    // [6] if((byte) main::key#0>=(byte) $20+(byte) 1) goto main::@2 -- vbuaa_ge_vbuc1_then_la1 
    cmp #$20+1
    bcs __b2_from___b1
    jmp __b3
    // main::@3
  __b3:
    // [7] if((byte) main::key#0>=(byte) $40) goto main::@4 -- vbuaa_ge_vbuc1_then_la1 
    cmp #$40
    bcs __b4_from___b3
    // [9] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
  __b2_from___b1:
  __b2_from___b3:
    // [9] phi (byte) main::key#2 = (byte) 0 [phi:main::@1/main::@3->main::@2#0] -- vbuaa=vbuc1 
    lda #0
    jmp __b2
    // [8] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    jmp __b4
    // main::@4
  __b4:
    // [9] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  __b2_from___b4:
    // [9] phi (byte) main::key#2 = (byte) main::key#0 [phi:main::@4->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [10] *((const byte*) SCREEN) ← (byte) main::key#2 -- _deref_pbuc1=vbuaa 
    sta SCREEN
    jmp __b1
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b3
Removing instruction jmp __b4
Removing instruction jmp __b2
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b2_from___b1 with __b2_from___b3
Replacing label __b4_from___b3 with __b2
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b2_from___b1:
Removing instruction __b4_from___b3:
Removing instruction __b4:
Removing instruction __b2_from___b4:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b3:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Relabelling long label __b2_from___b3 to b1
Succesful ASM optimization Pass5RelabelLongLabels
Removing instruction jmp __b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte*) RASTER = (byte*) 53266
(const byte*) SCREEN = (byte*) 1024
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(byte) main::key
(byte) main::key#0 reg byte a 11.0
(byte) main::key#2 reg byte a 22.0

reg byte a [ main::key#2 main::key#0 ]


FINAL ASSEMBLER
Score: 220

  // File Comments
// Test to provoke Exception when using complex || condition
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label RASTER = $d012
  .label SCREEN = $400
  // @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: {
    // main::@1
  __b1:
    // key = *RASTER
    // [5] (byte) main::key#0 ← *((const byte*) RASTER) -- vbuaa=_deref_pbuc1 
    lda RASTER
    // if (key > $20 || key < $40)
    // [6] if((byte) main::key#0>=(byte) $20+(byte) 1) goto main::@2 -- vbuaa_ge_vbuc1_then_la1 
    cmp #$20+1
    bcs b1
    // main::@3
    // [7] if((byte) main::key#0>=(byte) $40) goto main::@4 -- vbuaa_ge_vbuc1_then_la1 
    cmp #$40
    bcs __b2
    // [9] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
  b1:
    // [9] phi (byte) main::key#2 = (byte) 0 [phi:main::@1/main::@3->main::@2#0] -- vbuaa=vbuc1 
    lda #0
    // [8] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
    // main::@4
    // [9] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
    // [9] phi (byte) main::key#2 = (byte) main::key#0 [phi:main::@4->main::@2#0] -- register_copy 
    // main::@2
  __b2:
    // *SCREEN = key
    // [10] *((const byte*) SCREEN) ← (byte) main::key#2 -- _deref_pbuc1=vbuaa 
    sta SCREEN
    jmp __b1
}
  // File Data

