Resolved forward reference fn1 to (void()) fn1()
Resolved forward reference fn2 to (void()) fn2()
Culled Empty Block (label) main::@4
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@6
Culled Empty Block (label) @1
Culled Empty Block (label) getfn::@4
Culled Empty Block (label) getfn::@2
Culled Empty Block (label) getfn::@5
Culled Empty Block (label) getfn::@6
Culled Empty Block (label) @2
Culled Empty Block (label) @3

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@4
main: scope:[main]  from @4
  (byte) main::i#0 ← (number) 0
  to:main::@1
main::@1: scope:[main]  from main main::@7
  (byte) main::i#3 ← phi( main/(byte) main::i#0 main::@7/(byte) main::i#4 )
  if(true) goto main::@2
  to:main::@return
main::@2: scope:[main]  from main::@1
  (byte) main::i#2 ← phi( main::@1/(byte) main::i#3 )
  (byte) main::i#1 ← ++ (byte) main::i#2
  (byte) getfn::b#0 ← (byte) main::i#1
  call getfn 
  (void()*) getfn::return#0 ← (void()*) getfn::return#3
  to:main::@7
main::@7: scope:[main]  from main::@2
  (byte) main::i#4 ← phi( main::@2/(byte) main::i#1 )
  (void()*) getfn::return#4 ← phi( main::@2/(void()*) getfn::return#0 )
  (void()*~) main::$1 ← (void()*) getfn::return#4
  call (void()*~) main::$1 
  to:main::@1
main::@return: scope:[main]  from main::@1
  return 
  to:@return
getfn: scope:[getfn]  from main::@2
  (byte) getfn::b#1 ← phi( main::@2/(byte) getfn::b#0 )
  (number~) getfn::$0 ← (byte) getfn::b#1 & (number) 1
  (bool~) getfn::$1 ← (number~) getfn::$0 == (number) 0
  if((bool~) getfn::$1) goto getfn::@1
  to:getfn::@3
getfn::@1: scope:[getfn]  from getfn
  (void()*~) getfn::$3 ← & (void()) fn1()
  (void()*) getfn::return#1 ← (void()*~) getfn::$3
  to:getfn::@return
getfn::@3: scope:[getfn]  from getfn
  (void()*~) getfn::$2 ← & (void()) fn2()
  (void()*) getfn::return#2 ← (void()*~) getfn::$2
  to:getfn::@return
getfn::@return: scope:[getfn]  from getfn::@1 getfn::@3
  (void()*) getfn::return#5 ← phi( getfn::@1/(void()*) getfn::return#1 getfn::@3/(void()*) getfn::return#2 )
  (void()*) getfn::return#3 ← (void()*) getfn::return#5
  return 
  to:@return
fn1: scope:[fn1]  from
  (byte*) fn1::BORDERCOL#0 ← ((byte*)) (number) $d020
  *((byte*) fn1::BORDERCOL#0) ← ++ *((byte*) fn1::BORDERCOL#0)
  to:fn1::@return
fn1::@return: scope:[fn1]  from fn1
  return 
  to:@return
fn2: scope:[fn2]  from
  (byte*) fn2::BGCOL#0 ← ((byte*)) (number) $d021
  *((byte*) fn2::BGCOL#0) ← ++ *((byte*) fn2::BGCOL#0)
  to:fn2::@return
fn2::@return: scope:[fn2]  from fn2
  return 
  to:@return
@4: scope:[]  from @begin
  call main 
  to:@5
@5: scope:[]  from @4
  to:@end
@end: scope:[]  from @5

SYMBOL TABLE SSA
(label) @4
(label) @5
(label) @begin
(label) @end
(void()) fn1()
(label) fn1::@return
(byte*) fn1::BORDERCOL
(byte*) fn1::BORDERCOL#0
(void()) fn2()
(label) fn2::@return
(byte*) fn2::BGCOL
(byte*) fn2::BGCOL#0
(void()*()) getfn((byte) getfn::b)
(number~) getfn::$0
(bool~) getfn::$1
(void()*~) getfn::$2
(void()*~) getfn::$3
(label) getfn::@1
(label) getfn::@3
(label) getfn::@return
(byte) getfn::b
(byte) getfn::b#0
(byte) getfn::b#1
(void()*) getfn::return
(void()*) getfn::return#0
(void()*) getfn::return#1
(void()*) getfn::return#2
(void()*) getfn::return#3
(void()*) getfn::return#4
(void()*) getfn::return#5
(void()) main()
(void()*~) main::$1
(label) main::@1
(label) main::@2
(label) main::@7
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::i#4

Adding number conversion cast (unumber) 0 in (byte) main::i#0 ← (number) 0
Adding number conversion cast (unumber) 1 in (number~) getfn::$0 ← (byte) getfn::b#1 & (number) 1
Adding number conversion cast (unumber) getfn::$0 in (number~) getfn::$0 ← (byte) getfn::b#1 & (unumber)(number) 1
Adding number conversion cast (unumber) 0 in (bool~) getfn::$1 ← (unumber~) getfn::$0 == (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) main::i#0 ← (unumber)(number) 0
Inlining cast (byte*) fn1::BORDERCOL#0 ← (byte*)(number) $d020
Inlining cast (byte*) fn2::BGCOL#0 ← (byte*)(number) $d021
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant pointer cast (byte*) 53280
Simplifying constant pointer cast (byte*) 53281
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) getfn::$0 ← (byte) getfn::b#1 & (byte) 1
Alias (byte) main::i#2 = (byte) main::i#3 
Alias (void()*) getfn::return#0 = (void()*) getfn::return#4 
Alias (byte) main::i#1 = (byte) main::i#4 
Alias (void()*) getfn::return#1 = (void()*~) getfn::$3 
Alias (void()*) getfn::return#2 = (void()*~) getfn::$2 
Alias (void()*) getfn::return#3 = (void()*) getfn::return#5 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) getfn::b#1 (byte) getfn::b#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) getfn::$1 [15] if((byte~) getfn::$0==(byte) 0) goto getfn::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [16] (void()*) getfn::return#1 ← & (void()) fn1()
Constant right-side identified [18] (void()*) getfn::return#2 ← & (void()) fn2()
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::i#0 = 0
Constant (const void()*) getfn::return#1 = &fn1
Constant (const void()*) getfn::return#2 = &fn2
Constant (const byte*) fn1::BORDERCOL#0 = (byte*) 53280
Constant (const byte*) fn2::BGCOL#0 = (byte*) 53281
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [2] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const void()*) getfn::return#1
Inlining constant with var siblings (const void()*) getfn::return#2
Constant inlined getfn::return#1 = &(void()) fn1()
Constant inlined main::i#0 = (byte) 0
Constant inlined getfn::return#2 = &(void()) fn2()
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @4
Adding NOP phi() at start of @5
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of getfn::@3
Adding NOP phi() at start of getfn::@1
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to getfn:9 

Created 2 initial phi equivalence classes
Coalesced [13] main::i#5 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @5
Culled Empty Block (label) getfn::@3
Renumbering block @4 to @1
Renumbering block main::@7 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
Adding NOP phi() at start of getfn::@1

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
  [4] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@3
  [5] (byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte) main::i#1 )
  to:main::@2
main::@2: scope:[main]  from main::@1
  [6] (byte) main::i#1 ← ++ (byte) main::i#2
  [7] (byte) getfn::b#0 ← (byte) main::i#1
  [8] call getfn 
  [9] (void()*) getfn::return#0 ← (void()*) getfn::return#3
  to:main::@3
main::@3: scope:[main]  from main::@2
  [10] (void()*~) main::$1 ← (void()*) getfn::return#0
  [11] call (void()*~) main::$1 
  to:main::@1
getfn: scope:[getfn]  from main::@2
  [12] (byte~) getfn::$0 ← (byte) getfn::b#0 & (byte) 1
  [13] if((byte~) getfn::$0==(byte) 0) goto getfn::@1
  to:getfn::@return
getfn::@1: scope:[getfn]  from getfn
  [14] phi()
  to:getfn::@return
getfn::@return: scope:[getfn]  from getfn getfn::@1
  [15] (void()*) getfn::return#3 ← phi( getfn::@1/&(void()) fn1() getfn/&(void()) fn2() )
  [16] return 
  to:@return
fn2: scope:[fn2]  from
  [17] *((const byte*) fn2::BGCOL#0) ← ++ *((const byte*) fn2::BGCOL#0)
  to:fn2::@return
fn2::@return: scope:[fn2]  from fn2
  [18] return 
  to:@return
fn1: scope:[fn1]  from
  [19] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
  to:fn1::@return
fn1::@return: scope:[fn1]  from fn1
  [20] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) fn1()
(byte*) fn1::BORDERCOL
(void()) fn2()
(byte*) fn2::BGCOL
(void()*()) getfn((byte) getfn::b)
(byte~) getfn::$0 4.0
(byte) getfn::b
(byte) getfn::b#0 13.0
(void()*) getfn::return
(void()*) getfn::return#0 22.0
(void()*) getfn::return#3 3.6666666666666665
(void()) main()
(void()*~) main::$1 11.0
(byte) main::i
(byte) main::i#1 5.5
(byte) main::i#2 22.0

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ getfn::return#3 ]
Added variable getfn::b#0 to zero page equivalence class [ getfn::b#0 ]
Added variable getfn::return#0 to zero page equivalence class [ getfn::return#0 ]
Added variable main::$1 to zero page equivalence class [ main::$1 ]
Added variable getfn::$0 to zero page equivalence class [ getfn::$0 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ getfn::return#3 ]
[ getfn::b#0 ]
[ getfn::return#0 ]
[ main::$1 ]
[ getfn::$0 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_WORD:3 [ getfn::return#3 ]
Allocated zp ZP_BYTE:5 [ getfn::b#0 ]
Allocated zp ZP_WORD:6 [ getfn::return#0 ]
Allocated zp ZP_WORD:8 [ main::$1 ]
Allocated zp ZP_BYTE:10 [ getfn::$0 ]

INITIAL ASM
  // File Comments
// Tests creating, assigning returning and calling pointers to non-args no-return functions
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @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 _1 = 8
    .label i = 2
    // [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 i
    jmp b1
    // main::@1
  b1:
    jmp b2
    // main::@2
  b2:
    // [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // [7] (byte) getfn::b#0 ← (byte) main::i#1 -- vbuz1=vbuz2 
    lda i
    sta getfn.b
    // [8] call getfn 
    jsr getfn
    // [9] (void()*) getfn::return#0 ← (void()*) getfn::return#3 -- pprz1=pprz2 
    lda getfn.return_3
    sta getfn.return
    lda getfn.return_3+1
    sta getfn.return+1
    jmp b3
    // main::@3
  b3:
    // [10] (void()*~) main::$1 ← (void()*) getfn::return#0 -- pprz1=pprz2 
    lda getfn.return
    sta _1
    lda getfn.return+1
    sta _1+1
    // [11] call (void()*~) main::$1 
    jsr bi__1
    // [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
  b1_from_b3:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy 
    jmp b1
  bi__1:
    jmp (_1)
}
  // getfn
// getfn(byte zeropage(5) b)
getfn: {
    .label _0 = $a
    .label b = 5
    .label return = 6
    .label return_3 = 3
    // [12] (byte~) getfn::$0 ← (byte) getfn::b#0 & (byte) 1 -- vbuz1=vbuz2_band_vbuc1 
    lda #1
    and b
    sta _0
    // [13] if((byte~) getfn::$0==(byte) 0) goto getfn::@1 -- vbuz1_eq_0_then_la1 
    lda _0
    cmp #0
    beq b1_from_getfn
    // [15] phi from getfn to getfn::@return [phi:getfn->getfn::@return]
  breturn_from_getfn:
    // [15] phi (void()*) getfn::return#3 = &(void()) fn2() [phi:getfn->getfn::@return#0] -- pprz1=pprc1 
    lda #<fn2
    sta return_3
    lda #>fn2
    sta return_3+1
    jmp breturn
    // [14] phi from getfn to getfn::@1 [phi:getfn->getfn::@1]
  b1_from_getfn:
    jmp b1
    // getfn::@1
  b1:
    // [15] phi from getfn::@1 to getfn::@return [phi:getfn::@1->getfn::@return]
  breturn_from_b1:
    // [15] phi (void()*) getfn::return#3 = &(void()) fn1() [phi:getfn::@1->getfn::@return#0] -- pprz1=pprc1 
    lda #<fn1
    sta return_3
    lda #>fn1
    sta return_3+1
    jmp breturn
    // getfn::@return
  breturn:
    // [16] return 
    rts
}
  // fn2
fn2: {
    .label BGCOL = $d021
    // [17] *((const byte*) fn2::BGCOL#0) ← ++ *((const byte*) fn2::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    jmp breturn
    // fn2::@return
  breturn:
    // [18] return 
    rts
}
  // fn1
fn1: {
    .label BORDERCOL = $d020
    // [19] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
    jmp breturn
    // fn1::@return
  breturn:
    // [20] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [9] (void()*) getfn::return#0 ← (void()*) getfn::return#3 [ main::i#1 getfn::return#0 ] ( main:2 [ main::i#1 getfn::return#0 ] ) 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 ]
Statement [10] (void()*~) main::$1 ← (void()*) getfn::return#0 [ main::i#1 main::$1 ] ( main:2 [ main::i#1 main::$1 ] ) always clobbers reg byte a 
Statement [11] call (void()*~) main::$1  [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a reg byte x reg byte y 
Removing always clobbered register reg byte x as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [9] (void()*) getfn::return#0 ← (void()*) getfn::return#3 [ main::i#1 getfn::return#0 ] ( main:2 [ main::i#1 getfn::return#0 ] ) always clobbers reg byte a 
Statement [10] (void()*~) main::$1 ← (void()*) getfn::return#0 [ main::i#1 main::$1 ] ( main:2 [ main::i#1 main::$1 ] ) always clobbers reg byte a 
Statement [11] call (void()*~) main::$1  [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a reg byte x reg byte y 
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , 
Potential registers zp ZP_WORD:3 [ getfn::return#3 ] : zp ZP_WORD:3 , 
Potential registers zp ZP_BYTE:5 [ getfn::b#0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_WORD:6 [ getfn::return#0 ] : zp ZP_WORD:6 , 
Potential registers zp ZP_WORD:8 [ main::$1 ] : zp ZP_WORD:8 , 
Potential registers zp ZP_BYTE:10 [ getfn::$0 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [getfn] 22: zp ZP_WORD:6 [ getfn::return#0 ] 13: zp ZP_BYTE:5 [ getfn::b#0 ] 4: zp ZP_BYTE:10 [ getfn::$0 ] 3.67: zp ZP_WORD:3 [ getfn::return#3 ] 
Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 11: zp ZP_WORD:8 [ main::$1 ] 
Uplift Scope [fn1] 
Uplift Scope [fn2] 
Uplift Scope [] 

Uplifting [getfn] best 743 combination zp ZP_WORD:6 [ getfn::return#0 ] reg byte a [ getfn::b#0 ] reg byte a [ getfn::$0 ] zp ZP_WORD:3 [ getfn::return#3 ] 
Uplifting [main] best 743 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ] zp ZP_WORD:8 [ main::$1 ] 
Uplifting [fn1] best 743 combination 
Uplifting [fn2] best 743 combination 
Uplifting [] best 743 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplifting [main] best 743 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 
Coalescing zero page register with common assignment [ zp ZP_WORD:3 [ getfn::return#3 ] ] with [ zp ZP_WORD:6 [ getfn::return#0 ] ] - score: 1
Coalescing zero page register with common assignment [ zp ZP_WORD:3 [ getfn::return#3 getfn::return#0 ] ] with [ zp ZP_WORD:8 [ main::$1 ] ] - score: 1

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests creating, assigning returning and calling pointers to non-args no-return functions
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @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 _1 = 3
    .label i = 2
    // [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 i
    jmp b1
    // main::@1
  b1:
    jmp b2
    // main::@2
  b2:
    // [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // [7] (byte) getfn::b#0 ← (byte) main::i#1 -- vbuaa=vbuz1 
    lda i
    // [8] call getfn 
    jsr getfn
    // [9] (void()*) getfn::return#0 ← (void()*) getfn::return#3
    jmp b3
    // main::@3
  b3:
    // [10] (void()*~) main::$1 ← (void()*) getfn::return#0
    // [11] call (void()*~) main::$1 
    jsr bi__1
    // [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
  b1_from_b3:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy 
    jmp b1
  bi__1:
    jmp (_1)
}
  // getfn
// getfn(byte register(A) b)
getfn: {
    .label return = 3
    // [12] (byte~) getfn::$0 ← (byte) getfn::b#0 & (byte) 1 -- vbuaa=vbuaa_band_vbuc1 
    and #1
    // [13] if((byte~) getfn::$0==(byte) 0) goto getfn::@1 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq b1_from_getfn
    // [15] phi from getfn to getfn::@return [phi:getfn->getfn::@return]
  breturn_from_getfn:
    // [15] phi (void()*) getfn::return#3 = &(void()) fn2() [phi:getfn->getfn::@return#0] -- pprz1=pprc1 
    lda #<fn2
    sta return
    lda #>fn2
    sta return+1
    jmp breturn
    // [14] phi from getfn to getfn::@1 [phi:getfn->getfn::@1]
  b1_from_getfn:
    jmp b1
    // getfn::@1
  b1:
    // [15] phi from getfn::@1 to getfn::@return [phi:getfn::@1->getfn::@return]
  breturn_from_b1:
    // [15] phi (void()*) getfn::return#3 = &(void()) fn1() [phi:getfn::@1->getfn::@return#0] -- pprz1=pprc1 
    lda #<fn1
    sta return
    lda #>fn1
    sta return+1
    jmp breturn
    // getfn::@return
  breturn:
    // [16] return 
    rts
}
  // fn2
fn2: {
    .label BGCOL = $d021
    // [17] *((const byte*) fn2::BGCOL#0) ← ++ *((const byte*) fn2::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    jmp breturn
    // fn2::@return
  breturn:
    // [18] return 
    rts
}
  // fn1
fn1: {
    .label BORDERCOL = $d020
    // [19] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
    jmp breturn
    // fn1::@return
  breturn:
    // [20] return 
    rts
}
  // File Data

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
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1 with b2
Replacing label b1_from_getfn with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1:
Removing instruction b1_from_getfn:
Removing instruction breturn_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b3:
Removing instruction b1_from_b3:
Removing instruction breturn_from_getfn:
Removing instruction breturn:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Replacing jump to rts with rts in jmp breturn
Succesful ASM optimization Pass5DoubleJumpElimination
Removing instruction bbegin:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) fn1()
(label) fn1::@return
(byte*) fn1::BORDERCOL
(const byte*) fn1::BORDERCOL#0 BORDERCOL = (byte*) 53280
(void()) fn2()
(label) fn2::@return
(byte*) fn2::BGCOL
(const byte*) fn2::BGCOL#0 BGCOL = (byte*) 53281
(void()*()) getfn((byte) getfn::b)
(byte~) getfn::$0 reg byte a 4.0
(label) getfn::@1
(label) getfn::@return
(byte) getfn::b
(byte) getfn::b#0 reg byte a 13.0
(void()*) getfn::return
(void()*) getfn::return#0 return zp ZP_WORD:3 22.0
(void()*) getfn::return#3 return zp ZP_WORD:3 3.6666666666666665
(void()) main()
(void()*~) main::$1 $1 zp ZP_WORD:3 11.0
(label) main::@1
(label) main::@2
(label) main::@3
(byte) main::i
(byte) main::i#1 i zp ZP_BYTE:2 5.5
(byte) main::i#2 i zp ZP_BYTE:2 22.0

zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
zp ZP_WORD:3 [ getfn::return#3 getfn::return#0 main::$1 ]
reg byte a [ getfn::b#0 ]
reg byte a [ getfn::$0 ]


FINAL ASSEMBLER
Score: 392

  // File Comments
// Tests creating, assigning returning and calling pointers to non-args no-return functions
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  // @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: {
    .label _1 = 3
    .label i = 2
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    // main::@1
    // main::@2
  b2:
    // *(getfn(++i))();
    // [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // getfn(++i)
    // [7] (byte) getfn::b#0 ← (byte) main::i#1 -- vbuaa=vbuz1 
    lda i
    // [8] call getfn 
    jsr getfn
    // [9] (void()*) getfn::return#0 ← (void()*) getfn::return#3
    // main::@3
    // [10] (void()*~) main::$1 ← (void()*) getfn::return#0
    // (getfn(++i))()
    // [11] call (void()*~) main::$1 
    jsr bi__1
    // [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy 
    jmp b2
  bi__1:
    jmp (_1)
}
  // getfn
// getfn(byte register(A) b)
getfn: {
    .label return = 3
    // b&1
    // [12] (byte~) getfn::$0 ← (byte) getfn::b#0 & (byte) 1 -- vbuaa=vbuaa_band_vbuc1 
    and #1
    // if((b&1)==0)
    // [13] if((byte~) getfn::$0==(byte) 0) goto getfn::@1 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq b1
    // [15] phi from getfn to getfn::@return [phi:getfn->getfn::@return]
    // [15] phi (void()*) getfn::return#3 = &(void()) fn2() [phi:getfn->getfn::@return#0] -- pprz1=pprc1 
    lda #<fn2
    sta return
    lda #>fn2
    sta return+1
    rts
    // [14] phi from getfn to getfn::@1 [phi:getfn->getfn::@1]
    // getfn::@1
  b1:
    // [15] phi from getfn::@1 to getfn::@return [phi:getfn::@1->getfn::@return]
    // [15] phi (void()*) getfn::return#3 = &(void()) fn1() [phi:getfn::@1->getfn::@return#0] -- pprz1=pprc1 
    lda #<fn1
    sta return
    lda #>fn1
    sta return+1
    // getfn::@return
    // }
    // [16] return 
    rts
}
  // fn2
fn2: {
    .label BGCOL = $d021
    // (*BGCOL)++;
    // [17] *((const byte*) fn2::BGCOL#0) ← ++ *((const byte*) fn2::BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    // fn2::@return
    // }
    // [18] return 
    rts
}
  // fn1
fn1: {
    .label BORDERCOL = $d020
    // (*BORDERCOL)++;
    // [19] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
    // fn1::@return
    // }
    // [20] return 
    rts
}
  // File Data

