
CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  to:@2
main: scope:[main]  from @2
  (byte*) SCREEN#5 ← phi( @2/(byte*) SCREEN#11 )
  (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@1
main::@1: scope:[main]  from main main::@7
  (byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#5 main::@7/(byte*) SCREEN#6 )
  (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@7/(byte) main::i#1 )
  (byte) plot::x#0 ← (byte) main::i#2
  call plot 
  to:main::@7
main::@7: scope:[main]  from main::@1
  (byte*) SCREEN#6 ← phi( main::@1/(byte*) SCREEN#2 )
  (byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
  (byte) main::i#1 ← (byte) main::i#3 + rangenext(0,10)
  (bool~) main::$1 ← (byte) main::i#1 != rangelast(0,10)
  if((bool~) main::$1) goto main::@1
  to:main::@4
main::@4: scope:[main]  from main::@7
  (byte*) SCREEN#7 ← phi( main::@7/(byte*) SCREEN#6 )
  (byte) main::j#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@2
main::@2: scope:[main]  from main::@4 main::@8
  (byte*) SCREEN#3 ← phi( main::@4/(byte*) SCREEN#7 main::@8/(byte*) SCREEN#8 )
  (byte) main::j#2 ← phi( main::@4/(byte) main::j#0 main::@8/(byte) main::j#1 )
  (byte) plot::x#1 ← (byte) main::j#2
  call plot 
  to:main::@8
main::@8: scope:[main]  from main::@2
  (byte*) SCREEN#8 ← phi( main::@2/(byte*) SCREEN#3 )
  (byte) main::j#3 ← phi( main::@2/(byte) main::j#2 )
  (byte) main::j#1 ← (byte) main::j#3 + rangenext(0,10)
  (bool~) main::$3 ← (byte) main::j#1 != rangelast(0,10)
  if((bool~) main::$3) goto main::@2
  to:main::@5
main::@5: scope:[main]  from main::@8
  (byte*) SCREEN#9 ← phi( main::@8/(byte*) SCREEN#8 )
  (byte) main::k#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@3
main::@3: scope:[main]  from main::@5 main::@9
  (byte*) SCREEN#4 ← phi( main::@5/(byte*) SCREEN#9 main::@9/(byte*) SCREEN#10 )
  (byte) main::k#2 ← phi( main::@5/(byte) main::k#0 main::@9/(byte) main::k#1 )
  (byte) plot::x#2 ← (byte) main::k#2
  call plot 
  to:main::@9
main::@9: scope:[main]  from main::@3
  (byte*) SCREEN#10 ← phi( main::@3/(byte*) SCREEN#4 )
  (byte) main::k#3 ← phi( main::@3/(byte) main::k#2 )
  (byte) main::k#1 ← (byte) main::k#3 + rangenext(0,10)
  (bool~) main::$5 ← (byte) main::k#1 != rangelast(0,10)
  if((bool~) main::$5) goto main::@3
  to:main::@return
main::@return: scope:[main]  from main::@9
  return 
  to:@return
plot: scope:[plot]  from main::@1 main::@2 main::@3
  (byte) plot::x#3 ← phi( main::@1/(byte) plot::x#0 main::@2/(byte) plot::x#1 main::@3/(byte) plot::x#2 )
  (byte*) SCREEN#1 ← phi( main::@1/(byte*) SCREEN#2 main::@2/(byte*) SCREEN#3 main::@3/(byte*) SCREEN#4 )
  *((byte*) SCREEN#1 + (byte) plot::x#3) ← (byte) '*'
  to:plot::@return
plot::@return: scope:[plot]  from plot
  return 
  to:@return
@2: scope:[]  from @begin
  (byte*) SCREEN#11 ← phi( @begin/(byte*) SCREEN#0 )
  call main 
  to:@3
@3: scope:[]  from @2
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#10
(byte*) SCREEN#11
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SCREEN#4
(byte*) SCREEN#5
(byte*) SCREEN#6
(byte*) SCREEN#7
(byte*) SCREEN#8
(byte*) SCREEN#9
(void()) main()
(bool~) main::$1
(bool~) main::$3
(bool~) main::$5
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@7
(label) main::@8
(label) main::@9
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::j
(byte) main::j#0
(byte) main::j#1
(byte) main::j#2
(byte) main::j#3
(byte) main::k
(byte) main::k#0
(byte) main::k#1
(byte) main::k#2
(byte) main::k#3
(void()) plot((byte) plot::x)
(label) plot::@return
(byte) plot::x
(byte) plot::x#0
(byte) plot::x#1
(byte) plot::x#2
(byte) plot::x#3

Culled Empty Block (label) @3
Successful SSA optimization Pass2CullEmptyBlocks
Alias (byte) main::i#2 = (byte) main::i#3 
Alias (byte*) SCREEN#2 = (byte*) SCREEN#6 (byte*) SCREEN#7 
Alias (byte) main::j#2 = (byte) main::j#3 
Alias (byte*) SCREEN#3 = (byte*) SCREEN#8 (byte*) SCREEN#9 
Alias (byte) main::k#2 = (byte) main::k#3 
Alias (byte*) SCREEN#10 = (byte*) SCREEN#4 
Alias (byte*) SCREEN#0 = (byte*) SCREEN#11 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) SCREEN#2
Self Phi Eliminated (byte*) SCREEN#3
Self Phi Eliminated (byte*) SCREEN#10
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) SCREEN#5 (byte*) SCREEN#0
Redundant Phi (byte*) SCREEN#2 (byte*) SCREEN#5
Redundant Phi (byte*) SCREEN#3 (byte*) SCREEN#2
Redundant Phi (byte*) SCREEN#10 (byte*) SCREEN#3
Successful SSA optimization Pass2RedundantPhiElimination
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#0
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) main::$1 [9] if((byte) main::i#1!=rangelast(0,10)) goto main::@1
Simple Condition (bool~) main::$3 [18] if((byte) main::j#1!=rangelast(0,10)) goto main::@2
Simple Condition (bool~) main::$5 [27] if((byte) main::k#1!=rangelast(0,10)) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) SCREEN#0 = ((byte*))1024
Constant (const byte) main::i#0 = 0
Constant (const byte) main::j#0 = 0
Constant (const byte) main::k#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,10)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 11
Resolved ranged next value main::j#1 ← ++ main::j#2 to ++
Resolved ranged comparison value if(main::j#1!=rangelast(0,10)) goto main::@2 to (byte/signed byte/word/signed word/dword/signed dword) 11
Resolved ranged next value main::k#1 ← ++ main::k#2 to ++
Resolved ranged comparison value if(main::k#1!=rangelast(0,10)) goto main::@3 to (byte/signed byte/word/signed word/dword/signed dword) 11
Culled Empty Block (label) main::@4
Culled Empty Block (label) main::@5
Successful SSA optimization Pass2CullEmptyBlocks
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::j#0
Inlining constant with var siblings (const byte) main::k#0
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::k#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::j#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@10(between main::@7 and main::@1)
Added new block during phi lifting main::@11(between main::@8 and main::@2)
Added new block during phi lifting main::@12(between main::@9 and main::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to plot:8 plot:14 plot:20 

Created 4 initial phi equivalence classes
Coalesced [7] plot::x#4 ← plot::x#0
Coalesced [13] plot::x#5 ← plot::x#1
Coalesced [19] plot::x#6 ← plot::x#2
Coalesced [24] main::k#4 ← main::k#1
Coalesced [25] main::j#4 ← main::j#1
Coalesced [26] main::i#4 ← main::i#1
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) main::@12
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@10
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@2
@2: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @2
  [3] phi()
main: scope:[main]  from @2
  [4] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@7
  [5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@7/(byte) main::i#1 )
  [6] (byte) plot::x#0 ← (byte) main::i#2
  [7] call plot 
  to:main::@7
main::@7: scope:[main]  from main::@1
  [8] (byte) main::i#1 ← ++ (byte) main::i#2
  [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@7 main::@8
  [10] (byte) main::j#2 ← phi( main::@7/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@8/(byte) main::j#1 )
  [11] (byte) plot::x#1 ← (byte) main::j#2
  [12] call plot 
  to:main::@8
main::@8: scope:[main]  from main::@2
  [13] (byte) main::j#1 ← ++ (byte) main::j#2
  [14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@8 main::@9
  [15] (byte) main::k#2 ← phi( main::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@9/(byte) main::k#1 )
  [16] (byte) plot::x#2 ← (byte) main::k#2
  [17] call plot 
  to:main::@9
main::@9: scope:[main]  from main::@3
  [18] (byte) main::k#1 ← ++ (byte) main::k#2
  [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@3
  to:main::@return
main::@return: scope:[main]  from main::@9
  [20] return 
  to:@return
plot: scope:[plot]  from main::@1 main::@2 main::@3
  [21] (byte) plot::x#3 ← phi( main::@1/(byte) plot::x#0 main::@2/(byte) plot::x#1 main::@3/(byte) plot::x#2 )
  [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*'
  to:plot::@return
plot::@return: scope:[plot]  from plot
  [23] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 11.0
(byte) main::j
(byte) main::j#1 16.5
(byte) main::j#2 11.0
(byte) main::k
(byte) main::k#1 16.5
(byte) main::k#2 11.0
(void()) plot((byte) plot::x)
(byte) plot::x
(byte) plot::x#0 22.0
(byte) plot::x#1 22.0
(byte) plot::x#2 22.0
(byte) plot::x#3 35.0

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#2 main::j#1 ]
[ main::k#2 main::k#1 ]
[ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#2 main::j#1 ]
[ main::k#2 main::k#1 ]
[ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Allocated zp ZP_BYTE:4 [ main::k#2 main::k#1 ]
Allocated zp ZP_BYTE:5 [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ]

INITIAL ASM
//SEG0 File Comments
// Allocates ZP to j/k-variables even though all of i, j, k could be allocates to x and be more efficient.
// Reason: Pass4RegisterUpliftCombinations.isAllocationOverlapping() believes i/j/k variables overlaps insode plot()
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SCREEN = $400
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
  jmp b2
//SEG5 @2
b2:
//SEG6 [2] call main 
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
  jsr main
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
    .label i = 2
    .label j = 3
    .label k = 4
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    jmp b1
  //SEG13 [5] phi from main::@7 to main::@1 [phi:main::@7->main::@1]
  b1_from_b7:
  //SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@7->main::@1#0] -- register_copy 
    jmp b1
  //SEG15 main::@1
  b1:
  //SEG16 [6] (byte) plot::x#0 ← (byte) main::i#2 -- vbuz1=vbuz2 
    lda i
    sta plot.x
  //SEG17 [7] call plot 
  //SEG18 [21] phi from main::@1 to plot [phi:main::@1->plot]
  plot_from_b1:
  //SEG19 [21] phi (byte) plot::x#3 = (byte) plot::x#0 [phi:main::@1->plot#0] -- register_copy 
    jsr plot
    jmp b7
  //SEG20 main::@7
  b7:
  //SEG21 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc i
  //SEG22 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda i
    cmp #$b
    bne b1_from_b7
  //SEG23 [10] phi from main::@7 to main::@2 [phi:main::@7->main::@2]
  b2_from_b7:
  //SEG24 [10] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta j
    jmp b2
  //SEG25 [10] phi from main::@8 to main::@2 [phi:main::@8->main::@2]
  b2_from_b8:
  //SEG26 [10] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@8->main::@2#0] -- register_copy 
    jmp b2
  //SEG27 main::@2
  b2:
  //SEG28 [11] (byte) plot::x#1 ← (byte) main::j#2 -- vbuz1=vbuz2 
    lda j
    sta plot.x
  //SEG29 [12] call plot 
  //SEG30 [21] phi from main::@2 to plot [phi:main::@2->plot]
  plot_from_b2:
  //SEG31 [21] phi (byte) plot::x#3 = (byte) plot::x#1 [phi:main::@2->plot#0] -- register_copy 
    jsr plot
    jmp b8
  //SEG32 main::@8
  b8:
  //SEG33 [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuz1=_inc_vbuz1 
    inc j
  //SEG34 [14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@2 -- vbuz1_neq_vbuc1_then_la1 
    lda j
    cmp #$b
    bne b2_from_b8
  //SEG35 [15] phi from main::@8 to main::@3 [phi:main::@8->main::@3]
  b3_from_b8:
  //SEG36 [15] phi (byte) main::k#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@3#0] -- vbuz1=vbuc1 
    lda #0
    sta k
    jmp b3
  //SEG37 [15] phi from main::@9 to main::@3 [phi:main::@9->main::@3]
  b3_from_b9:
  //SEG38 [15] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@9->main::@3#0] -- register_copy 
    jmp b3
  //SEG39 main::@3
  b3:
  //SEG40 [16] (byte) plot::x#2 ← (byte) main::k#2 -- vbuz1=vbuz2 
    lda k
    sta plot.x
  //SEG41 [17] call plot 
  //SEG42 [21] phi from main::@3 to plot [phi:main::@3->plot]
  plot_from_b3:
  //SEG43 [21] phi (byte) plot::x#3 = (byte) plot::x#2 [phi:main::@3->plot#0] -- register_copy 
    jsr plot
    jmp b9
  //SEG44 main::@9
  b9:
  //SEG45 [18] (byte) main::k#1 ← ++ (byte) main::k#2 -- vbuz1=_inc_vbuz1 
    inc k
  //SEG46 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@3 -- vbuz1_neq_vbuc1_then_la1 
    lda k
    cmp #$b
    bne b3_from_b9
    jmp breturn
  //SEG47 main::@return
  breturn:
  //SEG48 [20] return 
    rts
}
//SEG49 plot
// plot(byte zeropage(5) x)
plot: {
    .label x = 5
  //SEG50 [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuz1=vbuc2 
    ldy x
    lda #'*'
    sta SCREEN,y
    jmp breturn
  //SEG51 plot::@return
  breturn:
  //SEG52 [23] return 
    rts
}

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*' [ ] ( main:2::plot:7 [ main::i#2 ] main:2::plot:12 [ main::j#2 ] main:2::plot:17 [ main::k#2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::k#2 main::k#1 ]
Statement [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*' [ ] ( main:2::plot:7 [ main::i#2 ] main:2::plot:12 [ main::j#2 ] main:2::plot:17 [ main::k#2 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ main::j#2 main::j#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:4 [ main::k#2 main::k#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:5 [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [plot] 101: zp ZP_BYTE:5 [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ] 
Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 27.5: zp ZP_BYTE:3 [ main::j#2 main::j#1 ] 27.5: zp ZP_BYTE:4 [ main::k#2 main::k#1 ] 
Uplift Scope [] 

Uplifting [plot] best 886 combination reg byte x [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ] 
Uplifting [main] best 526 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::j#2 main::j#1 ] reg byte x [ main::k#2 main::k#1 ] 
Uplifting [] best 526 combination 

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Allocates ZP to j/k-variables even though all of i, j, k could be allocates to x and be more efficient.
// Reason: Pass4RegisterUpliftCombinations.isAllocationOverlapping() believes i/j/k variables overlaps insode plot()
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SCREEN = $400
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
  jmp b2
//SEG5 @2
b2:
//SEG6 [2] call main 
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
  jsr main
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b1
  //SEG13 [5] phi from main::@7 to main::@1 [phi:main::@7->main::@1]
  b1_from_b7:
  //SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@7->main::@1#0] -- register_copy 
    jmp b1
  //SEG15 main::@1
  b1:
  //SEG16 [6] (byte) plot::x#0 ← (byte) main::i#2
  //SEG17 [7] call plot 
  //SEG18 [21] phi from main::@1 to plot [phi:main::@1->plot]
  plot_from_b1:
  //SEG19 [21] phi (byte) plot::x#3 = (byte) plot::x#0 [phi:main::@1->plot#0] -- register_copy 
    jsr plot
    jmp b7
  //SEG20 main::@7
  b7:
  //SEG21 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG22 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b1_from_b7
  //SEG23 [10] phi from main::@7 to main::@2 [phi:main::@7->main::@2]
  b2_from_b7:
  //SEG24 [10] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b2
  //SEG25 [10] phi from main::@8 to main::@2 [phi:main::@8->main::@2]
  b2_from_b8:
  //SEG26 [10] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@8->main::@2#0] -- register_copy 
    jmp b2
  //SEG27 main::@2
  b2:
  //SEG28 [11] (byte) plot::x#1 ← (byte) main::j#2
  //SEG29 [12] call plot 
  //SEG30 [21] phi from main::@2 to plot [phi:main::@2->plot]
  plot_from_b2:
  //SEG31 [21] phi (byte) plot::x#3 = (byte) plot::x#1 [phi:main::@2->plot#0] -- register_copy 
    jsr plot
    jmp b8
  //SEG32 main::@8
  b8:
  //SEG33 [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG34 [14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b2_from_b8
  //SEG35 [15] phi from main::@8 to main::@3 [phi:main::@8->main::@3]
  b3_from_b8:
  //SEG36 [15] phi (byte) main::k#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@3#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b3
  //SEG37 [15] phi from main::@9 to main::@3 [phi:main::@9->main::@3]
  b3_from_b9:
  //SEG38 [15] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@9->main::@3#0] -- register_copy 
    jmp b3
  //SEG39 main::@3
  b3:
  //SEG40 [16] (byte) plot::x#2 ← (byte) main::k#2
  //SEG41 [17] call plot 
  //SEG42 [21] phi from main::@3 to plot [phi:main::@3->plot]
  plot_from_b3:
  //SEG43 [21] phi (byte) plot::x#3 = (byte) plot::x#2 [phi:main::@3->plot#0] -- register_copy 
    jsr plot
    jmp b9
  //SEG44 main::@9
  b9:
  //SEG45 [18] (byte) main::k#1 ← ++ (byte) main::k#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG46 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@3 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b3_from_b9
    jmp breturn
  //SEG47 main::@return
  breturn:
  //SEG48 [20] return 
    rts
}
//SEG49 plot
// plot(byte register(X) x)
plot: {
  //SEG50 [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #'*'
    sta SCREEN,x
    jmp breturn
  //SEG51 plot::@return
  breturn:
  //SEG52 [23] return 
    rts
}

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b2
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b7
Removing instruction jmp b2
Removing instruction jmp b8
Removing instruction jmp b3
Removing instruction jmp b9
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b7 with b1
Replacing label b2_from_b8 with b2
Replacing label b3_from_b9 with b3
Removing instruction b2_from_bbegin:
Removing instruction b2:
Removing instruction main_from_b2:
Removing instruction bend_from_b2:
Removing instruction b1_from_b7:
Removing instruction plot_from_b1:
Removing instruction b2_from_b8:
Removing instruction plot_from_b2:
Removing instruction b3_from_b9:
Removing instruction plot_from_b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b7:
Removing instruction b2_from_b7:
Removing instruction b8:
Removing instruction b3_from_b8:
Removing instruction b9:
Removing instruction breturn:
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
Removing instruction jmp b2
Removing instruction jmp b3
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @2
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@7
(label) main::@8
(label) main::@9
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 11.0
(byte) main::j
(byte) main::j#1 reg byte x 16.5
(byte) main::j#2 reg byte x 11.0
(byte) main::k
(byte) main::k#1 reg byte x 16.5
(byte) main::k#2 reg byte x 11.0
(void()) plot((byte) plot::x)
(label) plot::@return
(byte) plot::x
(byte) plot::x#0 reg byte x 22.0
(byte) plot::x#1 reg byte x 22.0
(byte) plot::x#2 reg byte x 22.0
(byte) plot::x#3 reg byte x 35.0

reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::j#2 main::j#1 ]
reg byte x [ main::k#2 main::k#1 ]
reg byte x [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ]


FINAL ASSEMBLER
Score: 292

//SEG0 File Comments
// Allocates ZP to j/k-variables even though all of i, j, k could be allocates to x and be more efficient.
// Reason: Pass4RegisterUpliftCombinations.isAllocationOverlapping() believes i/j/k variables overlaps insode plot()
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SCREEN = $400
//SEG3 @begin
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG5 @2
//SEG6 [2] call main 
//SEG7 [4] phi from @2 to main [phi:@2->main]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
//SEG9 @end
//SEG10 main
main: {
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  //SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG13 [5] phi from main::@7 to main::@1 [phi:main::@7->main::@1]
  //SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@7->main::@1#0] -- register_copy 
  //SEG15 main::@1
  b1:
  //SEG16 [6] (byte) plot::x#0 ← (byte) main::i#2
  //SEG17 [7] call plot 
  //SEG18 [21] phi from main::@1 to plot [phi:main::@1->plot]
  //SEG19 [21] phi (byte) plot::x#3 = (byte) plot::x#0 [phi:main::@1->plot#0] -- register_copy 
    jsr plot
  //SEG20 main::@7
  //SEG21 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG22 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b1
  //SEG23 [10] phi from main::@7 to main::@2 [phi:main::@7->main::@2]
  //SEG24 [10] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG25 [10] phi from main::@8 to main::@2 [phi:main::@8->main::@2]
  //SEG26 [10] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@8->main::@2#0] -- register_copy 
  //SEG27 main::@2
  b2:
  //SEG28 [11] (byte) plot::x#1 ← (byte) main::j#2
  //SEG29 [12] call plot 
  //SEG30 [21] phi from main::@2 to plot [phi:main::@2->plot]
  //SEG31 [21] phi (byte) plot::x#3 = (byte) plot::x#1 [phi:main::@2->plot#0] -- register_copy 
    jsr plot
  //SEG32 main::@8
  //SEG33 [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG34 [14] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b2
  //SEG35 [15] phi from main::@8 to main::@3 [phi:main::@8->main::@3]
  //SEG36 [15] phi (byte) main::k#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@3#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG37 [15] phi from main::@9 to main::@3 [phi:main::@9->main::@3]
  //SEG38 [15] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@9->main::@3#0] -- register_copy 
  //SEG39 main::@3
  b3:
  //SEG40 [16] (byte) plot::x#2 ← (byte) main::k#2
  //SEG41 [17] call plot 
  //SEG42 [21] phi from main::@3 to plot [phi:main::@3->plot]
  //SEG43 [21] phi (byte) plot::x#3 = (byte) plot::x#2 [phi:main::@3->plot#0] -- register_copy 
    jsr plot
  //SEG44 main::@9
  //SEG45 [18] (byte) main::k#1 ← ++ (byte) main::k#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG46 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@3 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b3
  //SEG47 main::@return
  //SEG48 [20] return 
    rts
}
//SEG49 plot
// plot(byte register(X) x)
plot: {
  //SEG50 [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #'*'
    sta SCREEN,x
  //SEG51 plot::@return
  //SEG52 [23] return 
    rts
}

