Identified constant variable (byte*) SCREEN
Culled Empty Block (label) main::@6
Culled Empty Block (label) @1

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

(void()) main()
main: scope:[main]  from @2
  (byte) main::i#0 ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@7
  (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) main::i#3 ← phi( main::@1/(byte) main::i#2 )
  (byte) main::i#1 ← (byte) main::i#3 + rangenext(0,$a)
  (bool~) main::$1 ← (byte) main::i#1 != rangelast(0,$a)
  if((bool~) main::$1) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@7
  (byte) main::j#0 ← (byte) 0
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@8
  (byte) main::j#2 ← phi( main::@2/(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::@3
  (byte) main::j#3 ← phi( main::@3/(byte) main::j#2 )
  (byte) main::j#1 ← (byte) main::j#3 + rangenext(0,$a)
  (bool~) main::$3 ← (byte) main::j#1 != rangelast(0,$a)
  if((bool~) main::$3) goto main::@3
  to:main::@4
main::@4: scope:[main]  from main::@8
  (byte) main::k#0 ← (byte) 0
  to:main::@5
main::@5: scope:[main]  from main::@4 main::@9
  (byte) main::k#2 ← phi( main::@4/(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::@5
  (byte) main::k#3 ← phi( main::@5/(byte) main::k#2 )
  (byte) main::k#1 ← (byte) main::k#3 + rangenext(0,$a)
  (bool~) main::$5 ← (byte) main::k#1 != rangelast(0,$a)
  if((bool~) main::$5) goto main::@5
  to:main::@return
main::@return: scope:[main]  from main::@9
  return 
  to:@return

(void()) plot((byte) plot::x)
plot: scope:[plot]  from main::@1 main::@3 main::@5
  (byte) plot::x#3 ← phi( main::@1/(byte) plot::x#0 main::@3/(byte) plot::x#1 main::@5/(byte) plot::x#2 )
  *((const byte*) SCREEN + (byte) plot::x#3) ← (byte) '*'
  to:plot::@return
plot::@return: scope:[plot]  from plot
  return 
  to:@return
@2: scope:[]  from @begin
  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
(const byte*) SCREEN = (byte*)(number) $400
(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

Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Alias (byte) main::i#2 = (byte) main::i#3 
Alias (byte) main::j#2 = (byte) main::j#3 
Alias (byte) main::k#2 = (byte) main::k#3 
Successful SSA optimization Pass2AliasElimination
Simple Condition (bool~) main::$1 [6] if((byte) main::i#1!=rangelast(0,$a)) goto main::@1
Simple Condition (bool~) main::$3 [13] if((byte) main::j#1!=rangelast(0,$a)) goto main::@3
Simple Condition (bool~) main::$5 [20] if((byte) main::k#1!=rangelast(0,$a)) goto main::@5
Successful SSA optimization Pass2ConditionalJumpSimplification
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 [4] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [6] if(main::i#1!=rangelast(0,$a)) goto main::@1 to (number) $b
Resolved ranged next value [11] main::j#1 ← ++ main::j#2 to ++
Resolved ranged comparison value [13] if(main::j#1!=rangelast(0,$a)) goto main::@3 to (number) $b
Resolved ranged next value [18] main::k#1 ← ++ main::k#2 to ++
Resolved ranged comparison value [20] if(main::k#1!=rangelast(0,$a)) goto main::@5 to (number) $b
Adding number conversion cast (unumber) $b in if((byte) main::i#1!=(number) $b) goto main::@1
Adding number conversion cast (unumber) $b in if((byte) main::j#1!=(number) $b) goto main::@3
Adding number conversion cast (unumber) $b in if((byte) main::k#1!=(number) $b) goto main::@5
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $b
Simplifying constant integer cast $b
Simplifying constant integer cast $b
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $b
Finalized unsigned number type (byte) $b
Finalized unsigned number type (byte) $b
Successful SSA optimization PassNFinalizeNumberTypeConversions
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) 0
Constant inlined main::k#0 = (byte) 0
Constant inlined main::j#0 = (byte) 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::@3)
Added new block during phi lifting main::@12(between main::@9 and main::@5)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of main::@4
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to plot:9 plot:16 plot:23 

Created 4 initial phi equivalence classes
Coalesced [8] plot::x#4 ← plot::x#0
Coalesced [15] plot::x#5 ← plot::x#1
Coalesced [22] plot::x#6 ← plot::x#2
Coalesced [27] main::k#4 ← main::k#1
Coalesced [28] main::j#4 ← main::j#1
Coalesced [29] main::i#4 ← main::i#1
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@2
Culled Empty Block (label) main::@4
Culled Empty Block (label) main::@12
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@10
Renumbering block @2 to @1
Renumbering block main::@3 to main::@2
Renumbering block main::@5 to main::@3
Renumbering block main::@7 to main::@4
Renumbering block main::@8 to main::@5
Renumbering block main::@9 to main::@6
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::@4
  [5] (byte) main::i#2 ← phi( main/(byte) 0 main::@4/(byte) main::i#1 )
  [6] (byte) plot::x#0 ← (byte) main::i#2
  [7] call plot 
  to:main::@4
main::@4: scope:[main]  from main::@1
  [8] (byte) main::i#1 ← ++ (byte) main::i#2
  [9] if((byte) main::i#1!=(byte) $b) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@4 main::@5
  [10] (byte) main::j#2 ← phi( main::@4/(byte) 0 main::@5/(byte) main::j#1 )
  [11] (byte) plot::x#1 ← (byte) main::j#2
  [12] call plot 
  to:main::@5
main::@5: scope:[main]  from main::@2
  [13] (byte) main::j#1 ← ++ (byte) main::j#2
  [14] if((byte) main::j#1!=(byte) $b) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@5 main::@6
  [15] (byte) main::k#2 ← phi( main::@5/(byte) 0 main::@6/(byte) main::k#1 )
  [16] (byte) plot::x#2 ← (byte) main::k#2
  [17] call plot 
  to:main::@6
main::@6: scope:[main]  from main::@3
  [18] (byte) main::k#1 ← ++ (byte) main::k#2
  [19] if((byte) main::k#1!=(byte) $b) goto main::@3
  to:main::@return
main::@return: scope:[main]  from main::@6
  [20] return 
  to:@return

(void()) plot((byte) plot::x)
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 + (byte) plot::x#3) ← (byte) '*'
  to:plot::@return
plot::@return: scope:[plot]  from plot
  [23] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(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[1]:2 [ main::i#2 main::i#1 ]
Allocated zp[1]:3 [ main::j#2 main::j#1 ]
Allocated zp[1]:4 [ main::k#2 main::k#1 ]
Allocated zp[1]:5 [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // 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()
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .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 i = 2
    .label j = 3
    .label k = 4
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    jmp __b1
    // [5] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  __b1_from___b4:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@4->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte) plot::x#0 ← (byte) main::i#2 -- vbuz1=vbuz2 
    lda.z i
    sta.z plot.x
    // [7] call plot 
    // [21] phi from main::@1 to plot [phi:main::@1->plot]
  plot_from___b1:
    // [21] phi (byte) plot::x#3 = (byte) plot::x#0 [phi:main::@1->plot#0] -- register_copy 
    jsr plot
    jmp __b4
    // main::@4
  __b4:
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [9] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z i
    bne __b1_from___b4
    // [10] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  __b2_from___b4:
    // [10] phi (byte) main::j#2 = (byte) 0 [phi:main::@4->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z j
    jmp __b2
    // [10] phi from main::@5 to main::@2 [phi:main::@5->main::@2]
  __b2_from___b5:
    // [10] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@5->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [11] (byte) plot::x#1 ← (byte) main::j#2 -- vbuz1=vbuz2 
    lda.z j
    sta.z plot.x
    // [12] call plot 
    // [21] phi from main::@2 to plot [phi:main::@2->plot]
  plot_from___b2:
    // [21] phi (byte) plot::x#3 = (byte) plot::x#1 [phi:main::@2->plot#0] -- register_copy 
    jsr plot
    jmp __b5
    // main::@5
  __b5:
    // [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuz1=_inc_vbuz1 
    inc.z j
    // [14] if((byte) main::j#1!=(byte) $b) goto main::@2 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z j
    bne __b2_from___b5
    // [15] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
  __b3_from___b5:
    // [15] phi (byte) main::k#2 = (byte) 0 [phi:main::@5->main::@3#0] -- vbuz1=vbuc1 
    lda #0
    sta.z k
    jmp __b3
    // [15] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
  __b3_from___b6:
    // [15] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@6->main::@3#0] -- register_copy 
    jmp __b3
    // main::@3
  __b3:
    // [16] (byte) plot::x#2 ← (byte) main::k#2 -- vbuz1=vbuz2 
    lda.z k
    sta.z plot.x
    // [17] call plot 
    // [21] phi from main::@3 to plot [phi:main::@3->plot]
  plot_from___b3:
    // [21] phi (byte) plot::x#3 = (byte) plot::x#2 [phi:main::@3->plot#0] -- register_copy 
    jsr plot
    jmp __b6
    // main::@6
  __b6:
    // [18] (byte) main::k#1 ← ++ (byte) main::k#2 -- vbuz1=_inc_vbuz1 
    inc.z k
    // [19] if((byte) main::k#1!=(byte) $b) goto main::@3 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z k
    bne __b3_from___b6
    jmp __breturn
    // main::@return
  __breturn:
    // [20] return 
    rts
}
  // plot
// plot(byte zp(5) x)
plot: {
    .label x = 5
    // [22] *((const byte*) SCREEN + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuz1=vbuc2 
    lda #'*'
    ldy.z x
    sta SCREEN,y
    jmp __breturn
    // plot::@return
  __breturn:
    // [23] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [22] *((const byte*) SCREEN + (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[1]:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::j#2 main::j#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::k#2 main::k#1 ]
Statement [22] *((const byte*) SCREEN + (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[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ main::j#2 main::j#1 ] : zp[1]:3 , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ main::k#2 main::k#1 ] : zp[1]:4 , reg byte x , reg byte y , 
Potential registers zp[1]:5 [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [plot] 101: zp[1]:5 [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ] 
Uplift Scope [main] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 27.5: zp[1]:3 [ main::j#2 main::j#1 ] 27.5: zp[1]: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
  // 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()
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .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: {
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // [5] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  __b1_from___b4:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@4->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte) plot::x#0 ← (byte) main::i#2
    // [7] call plot 
    // [21] phi from main::@1 to plot [phi:main::@1->plot]
  plot_from___b1:
    // [21] phi (byte) plot::x#3 = (byte) plot::x#0 [phi:main::@1->plot#0] -- register_copy 
    jsr plot
    jmp __b4
    // main::@4
  __b4:
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [9] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne __b1_from___b4
    // [10] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  __b2_from___b4:
    // [10] phi (byte) main::j#2 = (byte) 0 [phi:main::@4->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b2
    // [10] phi from main::@5 to main::@2 [phi:main::@5->main::@2]
  __b2_from___b5:
    // [10] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@5->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [11] (byte) plot::x#1 ← (byte) main::j#2
    // [12] call plot 
    // [21] phi from main::@2 to plot [phi:main::@2->plot]
  plot_from___b2:
    // [21] phi (byte) plot::x#3 = (byte) plot::x#1 [phi:main::@2->plot#0] -- register_copy 
    jsr plot
    jmp __b5
    // main::@5
  __b5:
    // [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx 
    inx
    // [14] if((byte) main::j#1!=(byte) $b) goto main::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne __b2_from___b5
    // [15] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
  __b3_from___b5:
    // [15] phi (byte) main::k#2 = (byte) 0 [phi:main::@5->main::@3#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b3
    // [15] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
  __b3_from___b6:
    // [15] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@6->main::@3#0] -- register_copy 
    jmp __b3
    // main::@3
  __b3:
    // [16] (byte) plot::x#2 ← (byte) main::k#2
    // [17] call plot 
    // [21] phi from main::@3 to plot [phi:main::@3->plot]
  plot_from___b3:
    // [21] phi (byte) plot::x#3 = (byte) plot::x#2 [phi:main::@3->plot#0] -- register_copy 
    jsr plot
    jmp __b6
    // main::@6
  __b6:
    // [18] (byte) main::k#1 ← ++ (byte) main::k#2 -- vbuxx=_inc_vbuxx 
    inx
    // [19] if((byte) main::k#1!=(byte) $b) goto main::@3 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne __b3_from___b6
    jmp __breturn
    // main::@return
  __breturn:
    // [20] return 
    rts
}
  // plot
// plot(byte register(X) x)
plot: {
    // [22] *((const byte*) SCREEN + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #'*'
    sta SCREEN,x
    jmp __breturn
    // plot::@return
  __breturn:
    // [23] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b4
Removing instruction jmp __b2
Removing instruction jmp __b5
Removing instruction jmp __b3
Removing instruction jmp __b6
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b4 with __b1
Replacing label __b2_from___b5 with __b2
Replacing label __b3_from___b6 with __b3
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from___b4:
Removing instruction plot_from___b1:
Removing instruction __b2_from___b5:
Removing instruction plot_from___b2:
Removing instruction __b3_from___b6:
Removing instruction plot_from___b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b1_from_main:
Removing instruction __b4:
Removing instruction __b2_from___b4:
Removing instruction __b5:
Removing instruction __b3_from___b5:
Removing instruction __b6:
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 __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(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

  // 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()
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .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: {
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [5] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@4->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // plot(i)
    // [6] (byte) plot::x#0 ← (byte) main::i#2
    // [7] call plot 
    // [21] phi from main::@1 to plot [phi:main::@1->plot]
    // [21] phi (byte) plot::x#3 = (byte) plot::x#0 [phi:main::@1->plot#0] -- register_copy 
    jsr plot
    // main::@4
    // for(byte i : 0..10)
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [9] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne __b1
    // [10] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
    // [10] phi (byte) main::j#2 = (byte) 0 [phi:main::@4->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    // [10] phi from main::@5 to main::@2 [phi:main::@5->main::@2]
    // [10] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@5->main::@2#0] -- register_copy 
    // main::@2
  __b2:
    // plot(j)
    // [11] (byte) plot::x#1 ← (byte) main::j#2
    // [12] call plot 
    // [21] phi from main::@2 to plot [phi:main::@2->plot]
    // [21] phi (byte) plot::x#3 = (byte) plot::x#1 [phi:main::@2->plot#0] -- register_copy 
    jsr plot
    // main::@5
    // for(byte j : 0..10)
    // [13] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx 
    inx
    // [14] if((byte) main::j#1!=(byte) $b) goto main::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne __b2
    // [15] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
    // [15] phi (byte) main::k#2 = (byte) 0 [phi:main::@5->main::@3#0] -- vbuxx=vbuc1 
    ldx #0
    // [15] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
    // [15] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@6->main::@3#0] -- register_copy 
    // main::@3
  __b3:
    // plot(k)
    // [16] (byte) plot::x#2 ← (byte) main::k#2
    // [17] call plot 
    // [21] phi from main::@3 to plot [phi:main::@3->plot]
    // [21] phi (byte) plot::x#3 = (byte) plot::x#2 [phi:main::@3->plot#0] -- register_copy 
    jsr plot
    // main::@6
    // for(byte k : 0..10)
    // [18] (byte) main::k#1 ← ++ (byte) main::k#2 -- vbuxx=_inc_vbuxx 
    inx
    // [19] if((byte) main::k#1!=(byte) $b) goto main::@3 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne __b3
    // main::@return
    // }
    // [20] return 
    rts
}
  // plot
// plot(byte register(X) x)
plot: {
    // SCREEN[x] = '*'
    // [22] *((const byte*) SCREEN + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #'*'
    sta SCREEN,x
    // plot::@return
    // }
    // [23] return 
    rts
}
  // File Data

