Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx 
Culled Empty Block (label) @1
Culled Empty Block (label) @2
Culled Empty Block (label) @3
Culled Empty Block (label) @4
Culled Empty Block (label) main::@1
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@6
Culled Empty Block (label) raster::@2

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) RASTER#0 ← ((byte*)) (number) $d012
  (byte*) BORDERCOL#0 ← ((byte*)) (number) $d020
  (byte*) BGCOL#0 ← ((byte*)) (number) $d021
  to:@5
main: scope:[main]  from @6
  asm { sei  }
  to:main::@2
main::@2: scope:[main]  from main main::@2 main::@7
  (bool~) main::$0 ← *((byte*) RASTER#0) != (number) $a
  if((bool~) main::$0) goto main::@2
  to:main::@4
main::@4: scope:[main]  from main::@2 main::@4
  (bool~) main::$1 ← *((byte*) RASTER#0) != (number) $b
  if((bool~) main::$1) goto main::@4
  to:main::@5
main::@5: scope:[main]  from main::@4
  call raster 
  to:main::@7
main::@7: scope:[main]  from main::@5
  if(true) goto main::@2
  to:main::@return
main::@return: scope:[main]  from main::@7
  return 
  to:@return
@5: scope:[]  from @begin
  (byte[]) rastercols#0 ← { (number) $b, (number) 0, (number) $b, (number) $b, (number) $c, (number) $b, (number) $c, (number) $c, (number) $f, (number) $c, (number) $f, (number) $f, (number) 1, (number) $f, (number) 1, (number) 1, (number) $f, (number) 1, (number) $f, (number) $f, (number) $c, (number) $f, (number) $c, (number) $c, (number) $b, (number) $c, (number) $b, (number) $b, (number) 0, (number) $b, (number) 0, (number) $ff }
  to:@6
raster: scope:[raster]  from main::@5
  asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
  (byte) raster::i#0 ← (number) 0
  (byte) raster::col#0 ← *((byte[]) rastercols#0 + (byte) raster::i#0)
  to:raster::@1
raster::@1: scope:[raster]  from raster raster::@1
  (byte) raster::i#2 ← phi( raster/(byte) raster::i#0 raster::@1/(byte) raster::i#1 )
  (byte) raster::col#2 ← phi( raster/(byte) raster::col#0 raster::@1/(byte) raster::col#1 )
  *((byte*) BGCOL#0) ← (byte) raster::col#2
  *((byte*) BORDERCOL#0) ← (byte) raster::col#2
  (byte) raster::i#1 ← ++ (byte) raster::i#2
  (byte) raster::col#1 ← *((byte[]) rastercols#0 + (byte) raster::i#1)
  asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
  (bool~) raster::$0 ← (byte) raster::col#1 != (number) $ff
  if((bool~) raster::$0) goto raster::@1
  to:raster::@return
raster::@return: scope:[raster]  from raster::@1
  return 
  to:@return
@6: scope:[]  from @5
  call main 
  to:@7
@7: scope:[]  from @6
  to:@end
@end: scope:[]  from @7

SYMBOL TABLE SSA
(label) @5
(label) @6
(label) @7
(label) @begin
(label) @end
(byte*) BGCOL
(byte*) BGCOL#0
(byte*) BORDERCOL
(byte*) BORDERCOL#0
(byte*) RASTER
(byte*) RASTER#0
(void()) main()
(bool~) main::$0
(bool~) main::$1
(label) main::@2
(label) main::@4
(label) main::@5
(label) main::@7
(label) main::@return
(void()) raster()
(bool~) raster::$0
(label) raster::@1
(label) raster::@return
(byte) raster::col
(byte) raster::col#0
(byte) raster::col#1
(byte) raster::col#2
(byte) raster::i
(byte) raster::i#0
(byte) raster::i#1
(byte) raster::i#2
(byte[]) rastercols
(byte[]) rastercols#0

Adding number conversion cast (unumber) $a in (bool~) main::$0 ← *((byte*) RASTER#0) != (number) $a
Adding number conversion cast (unumber) $b in (bool~) main::$1 ← *((byte*) RASTER#0) != (number) $b
Adding number conversion cast (unumber) 0 in (byte) raster::i#0 ← (number) 0
Adding number conversion cast (unumber) $ff in (bool~) raster::$0 ← (byte) raster::col#1 != (number) $ff
Successful SSA optimization PassNAddNumberTypeConversions
Adding number conversion cast (byte) to elements in (byte[]) rastercols#0 ← { (byte)(number) $b, (byte)(number) 0, (byte)(number) $b, (byte)(number) $b, (byte)(number) $c, (byte)(number) $b, (byte)(number) $c, (byte)(number) $c, (byte)(number) $f, (byte)(number) $c, (byte)(number) $f, (byte)(number) $f, (byte)(number) 1, (byte)(number) $f, (byte)(number) 1, (byte)(number) 1, (byte)(number) $f, (byte)(number) 1, (byte)(number) $f, (byte)(number) $f, (byte)(number) $c, (byte)(number) $f, (byte)(number) $c, (byte)(number) $c, (byte)(number) $b, (byte)(number) $c, (byte)(number) $b, (byte)(number) $b, (byte)(number) 0, (byte)(number) $b, (byte)(number) 0, (byte)(number) $ff }
Successful SSA optimization PassNAddArrayNumberTypeConversions
Inlining cast (byte*) RASTER#0 ← (byte*)(number) $d012
Inlining cast (byte*) BORDERCOL#0 ← (byte*)(number) $d020
Inlining cast (byte*) BGCOL#0 ← (byte*)(number) $d021
Inlining cast (byte) raster::i#0 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 53266
Simplifying constant pointer cast (byte*) 53280
Simplifying constant pointer cast (byte*) 53281
Simplifying constant integer cast $a
Simplifying constant integer cast $b
Simplifying constant integer cast $b
Simplifying constant integer cast 0
Simplifying constant integer cast $b
Simplifying constant integer cast $b
Simplifying constant integer cast $c
Simplifying constant integer cast $b
Simplifying constant integer cast $c
Simplifying constant integer cast $c
Simplifying constant integer cast $f
Simplifying constant integer cast $c
Simplifying constant integer cast $f
Simplifying constant integer cast $f
Simplifying constant integer cast 1
Simplifying constant integer cast $f
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast $f
Simplifying constant integer cast 1
Simplifying constant integer cast $f
Simplifying constant integer cast $f
Simplifying constant integer cast $c
Simplifying constant integer cast $f
Simplifying constant integer cast $c
Simplifying constant integer cast $c
Simplifying constant integer cast $b
Simplifying constant integer cast $c
Simplifying constant integer cast $b
Simplifying constant integer cast $b
Simplifying constant integer cast 0
Simplifying constant integer cast $b
Simplifying constant integer cast 0
Simplifying constant integer cast $ff
Simplifying constant integer cast 0
Simplifying constant integer cast $ff
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $a
Finalized unsigned number type (byte) $b
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $ff
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simple Condition (bool~) main::$0 [5] if(*((byte*) RASTER#0)!=(byte) $a) goto main::@2
Simple Condition (bool~) main::$1 [7] if(*((byte*) RASTER#0)!=(byte) $b) goto main::@4
Simple Condition (bool~) raster::$0 [22] if((byte) raster::col#1!=(byte) $ff) goto raster::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [11] (byte[]) rastercols#0 ← { (byte) $b, (byte) 0, (byte) $b, (byte) $b, (byte) $c, (byte) $b, (byte) $c, (byte) $c, (byte) $f, (byte) $c, (byte) $f, (byte) $f, (byte) 1, (byte) $f, (byte) 1, (byte) 1, (byte) $f, (byte) 1, (byte) $f, (byte) $f, (byte) $c, (byte) $f, (byte) $c, (byte) $c, (byte) $b, (byte) $c, (byte) $b, (byte) $b, (byte) 0, (byte) $b, (byte) 0, (byte) $ff }
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) RASTER#0 = (byte*) 53266
Constant (const byte*) BORDERCOL#0 = (byte*) 53280
Constant (const byte*) BGCOL#0 = (byte*) 53281
Constant (const byte[]) rastercols#0 = { $b, 0, $b, $b, $c, $b, $c, $c, $f, $c, $f, $f, 1, $f, 1, 1, $f, 1, $f, $f, $c, $f, $c, $c, $b, $c, $b, $b, 0, $b, 0, $ff }
Constant (const byte) raster::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [9] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Simplifying expression containing zero rastercols#0 in [14] (byte) raster::col#0 ← *((const byte[]) rastercols#0 + (const byte) raster::i#0)
Successful SSA optimization PassNSimplifyExpressionWithZero
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Inlining constant with var siblings (const byte) raster::i#0
Constant inlined raster::i#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting raster::@3(between raster::@1 and raster::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @5
Adding NOP phi() at start of @6
Adding NOP phi() at start of @7
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of main::@7
CALL GRAPH
Calls in [] to main:3 
Calls in [main] to raster:10 

Created 2 initial phi equivalence classes
Coalesced [14] raster::col#3 ← raster::col#0
Coalesced [23] raster::col#4 ← raster::col#1
Coalesced [24] raster::i#3 ← raster::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @5
Culled Empty Block (label) @7
Culled Empty Block (label) main::@7
Culled Empty Block (label) raster::@3
Renumbering block @6 to @1
Renumbering block main::@2 to main::@1
Renumbering block main::@4 to main::@2
Renumbering block main::@5 to main::@3
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::@3

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
  asm { sei  }
  to:main::@1
main::@1: scope:[main]  from main main::@1 main::@3
  [5] if(*((const byte*) RASTER#0)!=(byte) $a) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [6] if(*((const byte*) RASTER#0)!=(byte) $b) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@2
  [7] phi()
  [8] call raster 
  to:main::@1
raster: scope:[raster]  from main::@3
  asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
  [10] (byte) raster::col#0 ← *((const byte[]) rastercols#0)
  to:raster::@1
raster::@1: scope:[raster]  from raster raster::@1
  [11] (byte) raster::i#2 ← phi( raster/(byte) 0 raster::@1/(byte) raster::i#1 )
  [11] (byte) raster::col#2 ← phi( raster/(byte) raster::col#0 raster::@1/(byte) raster::col#1 )
  [12] *((const byte*) BGCOL#0) ← (byte) raster::col#2
  [13] *((const byte*) BORDERCOL#0) ← (byte) raster::col#2
  [14] (byte) raster::i#1 ← ++ (byte) raster::i#2
  [15] (byte) raster::col#1 ← *((const byte[]) rastercols#0 + (byte) raster::i#1)
  asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
  [17] if((byte) raster::col#1!=(byte) $ff) goto raster::@1
  to:raster::@return
raster::@return: scope:[raster]  from raster::@1
  [18] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte*) BGCOL
(byte*) BORDERCOL
(byte*) RASTER
(void()) main()
(void()) raster()
(byte) raster::col
(byte) raster::col#0 4.0
(byte) raster::col#1 101.0
(byte) raster::col#2 152.5
(byte) raster::i
(byte) raster::i#1 75.75
(byte) raster::i#2 67.33333333333333
(byte[]) rastercols

Initial phi equivalence classes
[ raster::col#2 raster::col#0 raster::col#1 ]
[ raster::i#2 raster::i#1 ]
Complete equivalence classes
[ raster::col#2 raster::col#0 raster::col#1 ]
[ raster::i#2 raster::i#1 ]
Allocated zp ZP_BYTE:2 [ raster::col#2 raster::col#0 raster::col#1 ]
Allocated zp ZP_BYTE:3 [ raster::i#2 raster::i#1 ]

INITIAL ASM
  // File Comments
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label RASTER = $d012
  .label BORDERCOL = $d020
  .label BGCOL = $d021
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    // asm { sei  }
    sei
    jmp b1
    // main::@1
  b1:
    // [5] if(*((const byte*) RASTER#0)!=(byte) $a) goto main::@1 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$a
    cmp RASTER
    bne b1
    jmp b2
    // main::@2
  b2:
    // [6] if(*((const byte*) RASTER#0)!=(byte) $b) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$b
    cmp RASTER
    bne b2
    // [7] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  b3_from_b2:
    jmp b3
    // main::@3
  b3:
    // [8] call raster 
    jsr raster
    jmp b1
}
  // raster
raster: {
    .label col = 2
    .label i = 3
    // asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    // [10] (byte) raster::col#0 ← *((const byte[]) rastercols#0) -- vbuz1=_deref_pbuc1 
    lda rastercols
    sta col
    // [11] phi from raster to raster::@1 [phi:raster->raster::@1]
  b1_from_raster:
    // [11] phi (byte) raster::i#2 = (byte) 0 [phi:raster->raster::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    // [11] phi (byte) raster::col#2 = (byte) raster::col#0 [phi:raster->raster::@1#1] -- register_copy 
    jmp b1
    // [11] phi from raster::@1 to raster::@1 [phi:raster::@1->raster::@1]
  b1_from_b1:
    // [11] phi (byte) raster::i#2 = (byte) raster::i#1 [phi:raster::@1->raster::@1#0] -- register_copy 
    // [11] phi (byte) raster::col#2 = (byte) raster::col#1 [phi:raster::@1->raster::@1#1] -- register_copy 
    jmp b1
    // raster::@1
  b1:
    // [12] *((const byte*) BGCOL#0) ← (byte) raster::col#2 -- _deref_pbuc1=vbuz1 
    lda col
    sta BGCOL
    // [13] *((const byte*) BORDERCOL#0) ← (byte) raster::col#2 -- _deref_pbuc1=vbuz1 
    lda col
    sta BORDERCOL
    // [14] (byte) raster::i#1 ← ++ (byte) raster::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // [15] (byte) raster::col#1 ← *((const byte[]) rastercols#0 + (byte) raster::i#1) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy i
    lda rastercols,y
    sta col
    // asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    // [17] if((byte) raster::col#1!=(byte) $ff) goto raster::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$ff
    cmp col
    bne b1_from_b1
    jmp breturn
    // raster::@return
  breturn:
    // [18] return 
    rts
}
  // File Data
  rastercols: .byte $b, 0, $b, $b, $c, $b, $c, $c, $f, $c, $f, $f, 1, $f, 1, 1, $f, 1, $f, $f, $c, $f, $c, $c, $b, $c, $b, $b, 0, $b, 0, $ff

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [5] if(*((const byte*) RASTER#0)!=(byte) $a) goto main::@1 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [6] if(*((const byte*) RASTER#0)!=(byte) $b) goto main::@2 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ raster::col#2 raster::col#0 raster::col#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ raster::i#2 raster::i#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [raster] 257.5: zp ZP_BYTE:2 [ raster::col#2 raster::col#0 raster::col#1 ] 143.08: zp ZP_BYTE:3 [ raster::i#2 raster::i#1 ] 
Uplift Scope [main] 
Uplift Scope [] 

Uplifting [raster] best 9585 combination reg byte a [ raster::col#2 raster::col#0 raster::col#1 ] reg byte x [ raster::i#2 raster::i#1 ] 
Uplifting [main] best 9585 combination 
Uplifting [] best 9585 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label RASTER = $d012
  .label BORDERCOL = $d020
  .label BGCOL = $d021
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    // asm { sei  }
    sei
    jmp b1
    // main::@1
  b1:
    // [5] if(*((const byte*) RASTER#0)!=(byte) $a) goto main::@1 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$a
    cmp RASTER
    bne b1
    jmp b2
    // main::@2
  b2:
    // [6] if(*((const byte*) RASTER#0)!=(byte) $b) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$b
    cmp RASTER
    bne b2
    // [7] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  b3_from_b2:
    jmp b3
    // main::@3
  b3:
    // [8] call raster 
    jsr raster
    jmp b1
}
  // raster
raster: {
    // asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    // [10] (byte) raster::col#0 ← *((const byte[]) rastercols#0) -- vbuaa=_deref_pbuc1 
    lda rastercols
    // [11] phi from raster to raster::@1 [phi:raster->raster::@1]
  b1_from_raster:
    // [11] phi (byte) raster::i#2 = (byte) 0 [phi:raster->raster::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [11] phi (byte) raster::col#2 = (byte) raster::col#0 [phi:raster->raster::@1#1] -- register_copy 
    jmp b1
    // [11] phi from raster::@1 to raster::@1 [phi:raster::@1->raster::@1]
  b1_from_b1:
    // [11] phi (byte) raster::i#2 = (byte) raster::i#1 [phi:raster::@1->raster::@1#0] -- register_copy 
    // [11] phi (byte) raster::col#2 = (byte) raster::col#1 [phi:raster::@1->raster::@1#1] -- register_copy 
    jmp b1
    // raster::@1
  b1:
    // [12] *((const byte*) BGCOL#0) ← (byte) raster::col#2 -- _deref_pbuc1=vbuaa 
    sta BGCOL
    // [13] *((const byte*) BORDERCOL#0) ← (byte) raster::col#2 -- _deref_pbuc1=vbuaa 
    sta BORDERCOL
    // [14] (byte) raster::i#1 ← ++ (byte) raster::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [15] (byte) raster::col#1 ← *((const byte[]) rastercols#0 + (byte) raster::i#1) -- vbuaa=pbuc1_derefidx_vbuxx 
    lda rastercols,x
    // asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    // [17] if((byte) raster::col#1!=(byte) $ff) goto raster::@1 -- vbuaa_neq_vbuc1_then_la1 
    cmp #$ff
    bne b1_from_b1
    jmp breturn
    // raster::@return
  breturn:
    // [18] return 
    rts
}
  // File Data
  rastercols: .byte $b, 0, $b, $b, $c, $b, $c, $c, $f, $c, $f, $f, 1, $f, 1, 1, $f, 1, $f, $f, $c, $f, $c, $c, $b, $c, $b, $b, 0, $b, 0, $ff

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b1 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction bend_from_b1:
Removing instruction b3_from_b2:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b3:
Removing instruction b1_from_raster:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) BGCOL
(const byte*) BGCOL#0 BGCOL = (byte*) 53281
(byte*) BORDERCOL
(const byte*) BORDERCOL#0 BORDERCOL = (byte*) 53280
(byte*) RASTER
(const byte*) RASTER#0 RASTER = (byte*) 53266
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(void()) raster()
(label) raster::@1
(label) raster::@return
(byte) raster::col
(byte) raster::col#0 reg byte a 4.0
(byte) raster::col#1 reg byte a 101.0
(byte) raster::col#2 reg byte a 152.5
(byte) raster::i
(byte) raster::i#1 reg byte x 75.75
(byte) raster::i#2 reg byte x 67.33333333333333
(byte[]) rastercols
(const byte[]) rastercols#0 rastercols = { (byte) $b, (byte) 0, (byte) $b, (byte) $b, (byte) $c, (byte) $b, (byte) $c, (byte) $c, (byte) $f, (byte) $c, (byte) $f, (byte) $f, (byte) 1, (byte) $f, (byte) 1, (byte) 1, (byte) $f, (byte) 1, (byte) $f, (byte) $f, (byte) $c, (byte) $f, (byte) $c, (byte) $c, (byte) $b, (byte) $c, (byte) $b, (byte) $b, (byte) 0, (byte) $b, (byte) 0, (byte) $ff }

reg byte a [ raster::col#2 raster::col#0 raster::col#1 ]
reg byte x [ raster::i#2 raster::i#1 ]


FINAL ASSEMBLER
Score: 8340

  // File Comments
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label RASTER = $d012
  .label BORDERCOL = $d020
  .label BGCOL = $d021
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    // asm
    // asm { sei  }
    sei
    // main::@1
  b1:
    // while (*RASTER!=$a)
    // [5] if(*((const byte*) RASTER#0)!=(byte) $a) goto main::@1 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$a
    cmp RASTER
    bne b1
    // main::@2
  b2:
    // while (*RASTER!=$b)
    // [6] if(*((const byte*) RASTER#0)!=(byte) $b) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$b
    cmp RASTER
    bne b2
    // [7] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
    // main::@3
    // raster()
    // [8] call raster 
    jsr raster
    jmp b1
}
  // raster
raster: {
    // asm
    // asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    // col = rastercols[i]
    // [10] (byte) raster::col#0 ← *((const byte[]) rastercols#0) -- vbuaa=_deref_pbuc1 
    lda rastercols
    // [11] phi from raster to raster::@1 [phi:raster->raster::@1]
    // [11] phi (byte) raster::i#2 = (byte) 0 [phi:raster->raster::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [11] phi (byte) raster::col#2 = (byte) raster::col#0 [phi:raster->raster::@1#1] -- register_copy 
    // [11] phi from raster::@1 to raster::@1 [phi:raster::@1->raster::@1]
    // [11] phi (byte) raster::i#2 = (byte) raster::i#1 [phi:raster::@1->raster::@1#0] -- register_copy 
    // [11] phi (byte) raster::col#2 = (byte) raster::col#1 [phi:raster::@1->raster::@1#1] -- register_copy 
    // raster::@1
  b1:
    // *BGCOL = col
    // [12] *((const byte*) BGCOL#0) ← (byte) raster::col#2 -- _deref_pbuc1=vbuaa 
    sta BGCOL
    // *BORDERCOL = col
    // [13] *((const byte*) BORDERCOL#0) ← (byte) raster::col#2 -- _deref_pbuc1=vbuaa 
    sta BORDERCOL
    // col  = rastercols[++i];
    // [14] (byte) raster::i#1 ← ++ (byte) raster::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // col  = rastercols[++i]
    // [15] (byte) raster::col#1 ← *((const byte[]) rastercols#0 + (byte) raster::i#1) -- vbuaa=pbuc1_derefidx_vbuxx 
    lda rastercols,x
    // asm
    // asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop  }
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    // while (col!=$ff)
    // [17] if((byte) raster::col#1!=(byte) $ff) goto raster::@1 -- vbuaa_neq_vbuc1_then_la1 
    cmp #$ff
    bne b1
    // raster::@return
    // }
    // [18] return 
    rts
}
  // File Data
  rastercols: .byte $b, 0, $b, $b, $c, $b, $c, $c, $f, $c, $f, $f, 1, $f, 1, 1, $f, 1, $f, $f, $c, $f, $c, $c, $b, $c, $b, $b, 0, $b, 0, $ff

