Resolved forward reference hello to (void()) hello()
Culled Empty Block (label) @1
Culled Empty Block (label) do10::@2
Culled Empty Block (label) hello::@2

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@2
main: scope:[main]  from @3
  (void()*~) main::$0 ← & (void()) hello()
  (void()*) main::f#0 ← (void()*~) main::$0
  (void()*) do10::fn#0 ← (void()*) main::f#0
  call do10 
  to:main::@1
main::@1: scope:[main]  from main
  to:main::@return
main::@return: scope:[main]  from main::@1
  return 
  to:@return
do10: scope:[do10]  from main
  (void()*) do10::fn#2 ← phi( main/(void()*) do10::fn#0 )
  (byte) do10::i#0 ← (byte) 0
  to:do10::@1
do10::@1: scope:[do10]  from do10 do10::@1
  (byte) do10::i#2 ← phi( do10/(byte) do10::i#0 do10::@1/(byte) do10::i#1 )
  (void()*) do10::fn#1 ← phi( do10/(void()*) do10::fn#2 do10::@1/(void()*) do10::fn#1 )
  call *((void()*) do10::fn#1) 
  (byte) do10::i#1 ← (byte) do10::i#2 + rangenext(0,9)
  (bool~) do10::$1 ← (byte) do10::i#1 != rangelast(0,9)
  if((bool~) do10::$1) goto do10::@1
  to:do10::@return
do10::@return: scope:[do10]  from do10::@1
  return 
  to:@return
@2: scope:[]  from @begin
  (byte*) SCREEN#0 ← ((byte*)) (number) $400
  (byte[]) msg#0 ← (const string) $0
  (byte) idx#0 ← (number) 0
  to:@3
hello: scope:[hello]  from
  (byte) idx#5 ← phi( @3/(byte) idx#6 )
  (byte) hello::i#0 ← (number) 0
  to:hello::@1
hello::@1: scope:[hello]  from hello hello::@1
  (byte) idx#3 ← phi( hello/(byte) idx#5 hello::@1/(byte) idx#1 )
  (byte) hello::i#2 ← phi( hello/(byte) hello::i#0 hello::@1/(byte) hello::i#1 )
  *((byte*) SCREEN#0 + (byte) idx#3) ← *((byte[]) msg#0 + (byte) hello::i#2)
  (byte) idx#1 ← ++ (byte) idx#3
  (byte) hello::i#1 ← ++ (byte) hello::i#2
  (bool~) hello::$0 ← *((byte[]) msg#0 + (byte) hello::i#1) != (byte) '@'
  if((bool~) hello::$0) goto hello::@1
  to:hello::@return
hello::@return: scope:[hello]  from hello::@1
  (byte) idx#4 ← phi( hello::@1/(byte) idx#1 )
  (byte) idx#2 ← (byte) idx#4
  return 
  to:@return
@3: scope:[]  from @2
  (byte) idx#6 ← phi( @2/(byte) idx#0 )
  call main 
  to:@4
@4: scope:[]  from @3
  to:@end
@end: scope:[]  from @4

SYMBOL TABLE SSA
(const string) $0 = (string) "hello @"
(label) @2
(label) @3
(label) @4
(label) @begin
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(void()) do10((void()*) do10::fn)
(bool~) do10::$1
(label) do10::@1
(label) do10::@return
(void()*) do10::fn
(void()*) do10::fn#0
(void()*) do10::fn#1
(void()*) do10::fn#2
(byte) do10::i
(byte) do10::i#0
(byte) do10::i#1
(byte) do10::i#2
(void()) hello()
(bool~) hello::$0
(label) hello::@1
(label) hello::@return
(byte) hello::i
(byte) hello::i#0
(byte) hello::i#1
(byte) hello::i#2
(byte) idx
(byte) idx#0
(byte) idx#1
(byte) idx#2
(byte) idx#3
(byte) idx#4
(byte) idx#5
(byte) idx#6
(void()) main()
(void()*~) main::$0
(label) main::@1
(label) main::@return
(void()*) main::f
(void()*) main::f#0
(byte[]) msg
(byte[]) msg#0

Adding number conversion cast (unumber) 0 in (byte) idx#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) hello::i#0 ← (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400
Inlining cast (byte) idx#0 ← (unumber)(number) 0
Inlining cast (byte) hello::i#0 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (void()*) main::f#0 = (void()*~) main::$0 
Alias (byte) idx#1 = (byte) idx#4 (byte) idx#2 
Alias (byte) idx#0 = (byte) idx#6 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (void()*) do10::fn#1
Successful SSA optimization Pass2SelfPhiElimination
Identical Phi Values (void()*) do10::fn#2 (void()*) do10::fn#0
Identical Phi Values (void()*) do10::fn#1 (void()*) do10::fn#2
Identical Phi Values (byte) idx#5 (byte) idx#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) do10::$1 [11] if((byte) do10::i#1!=rangelast(0,9)) goto do10::@1
Simple Condition (bool~) hello::$0 [23] if(*((byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [0] (void()*) main::f#0 ← & (void()) hello()
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const void()*) main::f#0 = &hello
Constant (const byte) do10::i#0 = 0
Constant (const byte*) SCREEN#0 = (byte*) 1024
Constant (const byte[]) msg#0 = $0
Constant (const byte) hello::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const void()*) do10::fn#0 = main::f#0
Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function [8] call hello 
Successful SSA optimization Pass2ConstantCallPointerIdentification
Resolved ranged next value [9] do10::i#1 ← ++ do10::i#2 to ++
Resolved ranged comparison value [11] if(do10::i#1!=rangelast(0,9)) goto do10::@1 to (number) $a
Eliminating unused constant (const void()*) do10::fn#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) $a in if((byte) do10::i#1!=(number) $a) goto do10::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $a
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $a
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inlining constant with var siblings (const byte) do10::i#0
Inlining constant with var siblings (const byte) hello::i#0
Constant inlined $0 = (const byte[]) msg#0
Constant inlined hello::i#0 = (byte) 0
Constant inlined do10::i#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting do10::@3(between do10::@1 and do10::@1)
Added new block during phi lifting hello::@3(between hello::@1 and hello::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @3
Adding NOP phi() at start of @4
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 do10
CALL GRAPH
Calls in [] to main:3 
Calls in [main] to do10:7 
Calls in [do10] to hello:12 

Created 3 initial phi equivalence classes
Coalesced [16] do10::i#3 ← do10::i#1
Not coalescing [17] idx#7 ← idx#0
Coalesced [24] hello::i#3 ← hello::i#1
Coalesced [25] idx#8 ← idx#1
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) main::@1
Culled Empty Block (label) do10::@3
Culled Empty Block (label) hello::@3
Renumbering block @2 to @1
Renumbering block @3 to @2
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
Adding NOP phi() at start of do10

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  [1] (byte) idx#0 ← (byte) 0
  to:@2
@2: scope:[]  from @1
  [2] phi()
  [3] call main 
  to:@end
@end: scope:[]  from @2
  [4] phi()
main: scope:[main]  from @2
  [5] phi()
  [6] call do10 
  to:main::@return
main::@return: scope:[main]  from main
  [7] return 
  to:@return
do10: scope:[do10]  from main
  [8] phi()
  to:do10::@1
do10::@1: scope:[do10]  from do10 do10::@1
  [9] (byte) do10::i#2 ← phi( do10/(byte) 0 do10::@1/(byte) do10::i#1 )
  [10] call hello 
  [11] (byte) do10::i#1 ← ++ (byte) do10::i#2
  [12] if((byte) do10::i#1!=(byte) $a) goto do10::@1
  to:do10::@return
do10::@return: scope:[do10]  from do10::@1
  [13] return 
  to:@return
hello: scope:[hello]  from do10::@1
  [14] (byte~) idx#7 ← (byte) idx#0
  to:hello::@1
hello::@1: scope:[hello]  from hello hello::@1
  [15] (byte) idx#3 ← phi( hello/(byte~) idx#7 hello::@1/(byte) idx#1 )
  [15] (byte) hello::i#2 ← phi( hello/(byte) 0 hello::@1/(byte) hello::i#1 )
  [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2)
  [17] (byte) idx#1 ← ++ (byte) idx#3
  [18] (byte) hello::i#1 ← ++ (byte) hello::i#2
  [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1
  to:hello::@return
hello::@return: scope:[hello]  from hello::@1
  [20] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) do10((void()*) do10::fn)
(void()*) do10::fn
(byte) do10::i
(byte) do10::i#1 16.5
(byte) do10::i#2 11.0
(void()) hello()
(byte) hello::i
(byte) hello::i#1 151.5
(byte) hello::i#2 101.0
(byte) idx
(byte) idx#0 0.26666666666666666
(byte) idx#1 67.33333333333333
(byte) idx#3 152.5
(byte~) idx#7 4.0
(void()) main()
(void()*) main::f
(byte[]) msg

Initial phi equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#3 idx#7 idx#1 ]
Coalescing volatile variable equivalence classes [ idx#0 ] and [ idx#3 idx#7 idx#1 ]
Complete equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#0 idx#3 idx#7 idx#1 ]
Allocated zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Allocated zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Allocated zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ]

INITIAL ASM
  // File Comments
// Tests calling into a function pointer with local variables
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label idx = 4
  // @begin
bbegin:
  jmp b1
  // @1
b1:
  // [1] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta idx
  // [2] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
  jmp b2
  // @2
b2:
  // [3] call main 
  // [5] phi from @2 to main [phi:@2->main]
main_from_b2:
  jsr main
  // [4] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
  // @end
bend:
  // main
main: {
    // [6] call do10 
    // [8] phi from main to do10 [phi:main->do10]
  do10_from_main:
    jsr do10
    jmp breturn
    // main::@return
  breturn:
    // [7] return 
    rts
}
  // do10
do10: {
    .label i = 2
    // [9] phi from do10 to do10::@1 [phi:do10->do10::@1]
  b1_from_do10:
    // [9] phi (byte) do10::i#2 = (byte) 0 [phi:do10->do10::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    jmp b1
    // [9] phi from do10::@1 to do10::@1 [phi:do10::@1->do10::@1]
  b1_from_b1:
    // [9] phi (byte) do10::i#2 = (byte) do10::i#1 [phi:do10::@1->do10::@1#0] -- register_copy 
    jmp b1
    // do10::@1
  b1:
    // [10] call hello 
    jsr hello
    // [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // [12] if((byte) do10::i#1!=(byte) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$a
    cmp i
    bne b1_from_b1
    jmp breturn
    // do10::@return
  breturn:
    // [13] return 
    rts
}
  // hello
hello: {
    .label i = 3
    // [14] (byte~) idx#7 ← (byte) idx#0
    // [15] phi from hello to hello::@1 [phi:hello->hello::@1]
  b1_from_hello:
    // [15] phi (byte) idx#3 = (byte~) idx#7 [phi:hello->hello::@1#0] -- register_copy 
    // [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuz1=vbuc1 
    lda #0
    sta i
    jmp b1
    // [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
  b1_from_b1:
    // [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy 
    // [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy 
    jmp b1
    // hello::@1
  b1:
    // [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2 
    ldy i
    lda msg,y
    ldy idx
    sta SCREEN,y
    // [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1 
    inc idx
    // [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuz1_neq_vbuc2_then_la1 
    lda #'@'
    ldy i
    cmp msg,y
    bne b1_from_b1
    jmp breturn
    // hello::@return
  breturn:
    // [20] return 
    rts
}
  // File Data
  msg: .text "hello @"

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte) idx#0 ← (byte) 0 [ idx#0 ] (  [ idx#0 ] ) always clobbers reg byte a 
Statement [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) [ idx#0 hello::i#2 idx#3 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx#0 hello::i#2 idx#3 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Statement [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 [ idx#0 hello::i#1 idx#1 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx#0 hello::i#1 idx#1 ] ) always clobbers reg byte a 
Statement [1] (byte) idx#0 ← (byte) 0 [ idx#0 ] (  [ idx#0 ] ) always clobbers reg byte a 
Statement [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) [ idx#0 hello::i#2 idx#3 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx#0 hello::i#2 idx#3 ] ) always clobbers reg byte a reg byte y 
Statement [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 [ idx#0 hello::i#1 idx#1 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx#0 hello::i#1 idx#1 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ] : zp ZP_BYTE:2 , reg byte x , 
Potential registers zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ] : zp ZP_BYTE:3 , reg byte x , 
Potential registers zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ] : zp ZP_BYTE:4 , 

REGISTER UPLIFT SCOPES
Uplift Scope [hello] 252.5: zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ] 
Uplift Scope [] 224.1: zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ] 
Uplift Scope [do10] 27.5: zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ] 
Uplift Scope [main] 

Uplifting [hello] best 4349 combination reg byte x [ hello::i#2 hello::i#1 ] 
Uplifting [] best 4349 combination zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ] 
Uplifting [do10] best 4349 combination zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ] 
Uplifting [main] best 4349 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [] best 4349 combination zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Uplifting [do10] best 4349 combination zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ] 
Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ idx#0 idx#3 idx#7 idx#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests calling into a function pointer with local variables
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label idx = 3
  // @begin
bbegin:
  jmp b1
  // @1
b1:
  // [1] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta idx
  // [2] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
  jmp b2
  // @2
b2:
  // [3] call main 
  // [5] phi from @2 to main [phi:@2->main]
main_from_b2:
  jsr main
  // [4] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
  // @end
bend:
  // main
main: {
    // [6] call do10 
    // [8] phi from main to do10 [phi:main->do10]
  do10_from_main:
    jsr do10
    jmp breturn
    // main::@return
  breturn:
    // [7] return 
    rts
}
  // do10
do10: {
    .label i = 2
    // [9] phi from do10 to do10::@1 [phi:do10->do10::@1]
  b1_from_do10:
    // [9] phi (byte) do10::i#2 = (byte) 0 [phi:do10->do10::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    jmp b1
    // [9] phi from do10::@1 to do10::@1 [phi:do10::@1->do10::@1]
  b1_from_b1:
    // [9] phi (byte) do10::i#2 = (byte) do10::i#1 [phi:do10::@1->do10::@1#0] -- register_copy 
    jmp b1
    // do10::@1
  b1:
    // [10] call hello 
    jsr hello
    // [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // [12] if((byte) do10::i#1!=(byte) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$a
    cmp i
    bne b1_from_b1
    jmp breturn
    // do10::@return
  breturn:
    // [13] return 
    rts
}
  // hello
hello: {
    // [14] (byte~) idx#7 ← (byte) idx#0
    // [15] phi from hello to hello::@1 [phi:hello->hello::@1]
  b1_from_hello:
    // [15] phi (byte) idx#3 = (byte~) idx#7 [phi:hello->hello::@1#0] -- register_copy 
    // [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuxx=vbuc1 
    ldx #0
    jmp b1
    // [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
  b1_from_b1:
    // [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy 
    // [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy 
    jmp b1
    // hello::@1
  b1:
    // [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx 
    lda msg,x
    ldy idx
    sta SCREEN,y
    // [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1 
    inc idx
    // [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuxx_neq_vbuc2_then_la1 
    lda msg,x
    cmp #'@'
    bne b1_from_b1
    jmp breturn
    // hello::@return
  breturn:
    // [20] return 
    rts
}
  // File Data
  msg: .text "hello @"

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp bend
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Removing instruction b1:
Removing instruction b2_from_b1:
Removing instruction main_from_b2:
Removing instruction bend_from_b2:
Removing instruction b1_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction b2:
Removing instruction bend:
Removing instruction do10_from_main:
Removing instruction breturn:
Removing instruction b1_from_do10:
Removing instruction breturn:
Removing instruction b1_from_hello:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Adding RTS to root block 
Succesful ASM optimization Pass5AddMainRts
Removing instruction jmp b1
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
(label) @1
(label) @2
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
(void()) do10((void()*) do10::fn)
(label) do10::@1
(label) do10::@return
(void()*) do10::fn
(byte) do10::i
(byte) do10::i#1 i zp ZP_BYTE:2 16.5
(byte) do10::i#2 i zp ZP_BYTE:2 11.0
(void()) hello()
(label) hello::@1
(label) hello::@return
(byte) hello::i
(byte) hello::i#1 reg byte x 151.5
(byte) hello::i#2 reg byte x 101.0
(byte) idx
(byte) idx#0 idx zp ZP_BYTE:3 0.26666666666666666
(byte) idx#1 idx zp ZP_BYTE:3 67.33333333333333
(byte) idx#3 idx zp ZP_BYTE:3 152.5
(byte~) idx#7 idx zp ZP_BYTE:3 4.0
(void()) main()
(label) main::@return
(void()*) main::f
(byte[]) msg
(const byte[]) msg#0 msg = (string) "hello @"

zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
reg byte x [ hello::i#2 hello::i#1 ]
zp ZP_BYTE:3 [ idx#0 idx#3 idx#7 idx#1 ]


FINAL ASSEMBLER
Score: 3326

  // File Comments
// Tests calling into a function pointer with local variables
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label idx = 3
  // @begin
bbegin:
  // @1
  // idx = 0
  // [1] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta idx
  // [2] phi from @1 to @2 [phi:@1->@2]
  // @2
  // [3] call main 
  // [5] phi from @2 to main [phi:@2->main]
  jsr main
  rts
  // [4] phi from @2 to @end [phi:@2->@end]
  // @end
  // main
main: {
    // do10(f)
    // [6] call do10 
    // [8] phi from main to do10 [phi:main->do10]
    jsr do10
    // main::@return
    // }
    // [7] return 
    rts
}
  // do10
do10: {
    .label i = 2
    // [9] phi from do10 to do10::@1 [phi:do10->do10::@1]
    // [9] phi (byte) do10::i#2 = (byte) 0 [phi:do10->do10::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    // [9] phi from do10::@1 to do10::@1 [phi:do10::@1->do10::@1]
    // [9] phi (byte) do10::i#2 = (byte) do10::i#1 [phi:do10::@1->do10::@1#0] -- register_copy 
    // do10::@1
  b1:
    // (*fn)()
    // [10] call hello 
    jsr hello
    // for( byte i: 0..9)
    // [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // [12] if((byte) do10::i#1!=(byte) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$a
    cmp i
    bne b1
    // do10::@return
    // }
    // [13] return 
    rts
}
  // hello
hello: {
    // [14] (byte~) idx#7 ← (byte) idx#0
    // [15] phi from hello to hello::@1 [phi:hello->hello::@1]
    // [15] phi (byte) idx#3 = (byte~) idx#7 [phi:hello->hello::@1#0] -- register_copy 
    // [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuxx=vbuc1 
    ldx #0
    // [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
    // [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy 
    // [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy 
    // hello::@1
  b1:
    // SCREEN[idx++] = msg[i++]
    // [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx 
    lda msg,x
    ldy idx
    sta SCREEN,y
    // SCREEN[idx++] = msg[i++];
    // [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1 
    inc idx
    // [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // while(msg[i]!='@')
    // [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuxx_neq_vbuc2_then_la1 
    lda msg,x
    cmp #'@'
    bne b1
    // hello::@return
    // }
    // [20] return 
    rts
}
  // File Data
  msg: .text "hello @"

