Resolved forward reference fn1 to (void()) fn1()
Resolved forward reference fn2 to (void()) fn2()
Culled Empty Block (label) @1
Culled Empty Block (label) @2

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

(void()) main()
main: scope:[main]  from @3
  (void()*) main::f#0 ← (void()*) 0
  (void()*) main::f#1 ← &(void()) fn1()
  (word~) main::$0 ← ((word)) (void()*) main::f#1
  (byte~) main::$1 ← < (word~) main::$0
  *((const byte*) main::SCREEN + (number) 0) ← (byte~) main::$1
  (word~) main::$2 ← ((word)) (void()*) main::f#1
  (byte~) main::$3 ← > (word~) main::$2
  *((const byte*) main::SCREEN + (number) 1) ← (byte~) main::$3
  (void()*) main::f#2 ← &(void()) fn2()
  (word~) main::$4 ← ((word)) (void()*) main::f#2
  (byte~) main::$5 ← < (word~) main::$4
  *((const byte*) main::SCREEN + (number) 2) ← (byte~) main::$5
  (word~) main::$6 ← ((word)) (void()*) main::f#2
  (byte~) main::$7 ← > (word~) main::$6
  *((const byte*) main::SCREEN + (number) 3) ← (byte~) main::$7
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return

(void()) fn1()
fn1: scope:[fn1]  from
  *((const byte*) fn1::BORDERCOL) ← ++ *((const byte*) fn1::BORDERCOL)
  to:fn1::@return
fn1::@return: scope:[fn1]  from fn1
  return 
  to:@return

(void()) fn2()
fn2: scope:[fn2]  from
  *((const byte*) fn2::BGCOL) ← ++ *((const byte*) fn2::BGCOL)
  to:fn2::@return
fn2::@return: scope:[fn2]  from fn2
  return 
  to:@return
@3: scope:[]  from @begin
  call main 
  to:@4
@4: scope:[]  from @3
  to:@end
@end: scope:[]  from @4

SYMBOL TABLE SSA
(label) @3
(label) @4
(label) @begin
(label) @end
(void()) fn1()
(label) fn1::@return
(const byte*) fn1::BORDERCOL = (byte*)(number) $d020
(void()) fn2()
(label) fn2::@return
(const byte*) fn2::BGCOL = (byte*)(number) $d021
(void()) main()
(word~) main::$0
(byte~) main::$1
(word~) main::$2
(byte~) main::$3
(word~) main::$4
(byte~) main::$5
(word~) main::$6
(byte~) main::$7
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(void()*) main::f
(void()*) main::f#0
(void()*) main::f#1
(void()*) main::f#2

Adding number conversion cast (unumber) 0 in *((const byte*) main::SCREEN + (number) 0) ← (byte~) main::$1
Adding number conversion cast (unumber) 1 in *((const byte*) main::SCREEN + (number) 1) ← (byte~) main::$3
Adding number conversion cast (unumber) 2 in *((const byte*) main::SCREEN + (number) 2) ← (byte~) main::$5
Adding number conversion cast (unumber) 3 in *((const byte*) main::SCREEN + (number) 3) ← (byte~) main::$7
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (word~) main::$0 ← (word)(void()*) main::f#1
Inlining cast (word~) main::$2 ← (word)(void()*) main::f#1
Inlining cast (word~) main::$4 ← (word)(void()*) main::f#2
Inlining cast (word~) main::$6 ← (word)(void()*) main::f#2
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 53280
Simplifying constant pointer cast (byte*) 53281
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant (const void()*) main::f#0 = (void()*) 0
Constant (const void()*) main::f#1 = &fn1
Constant (const void()*) main::f#2 = &fn2
Successful SSA optimization Pass2ConstantIdentification
Constant (const word) main::$0 = (word)main::f#1
Constant (const word) main::$2 = (word)main::f#1
Constant (const word) main::$4 = (word)main::f#2
Constant (const word) main::$6 = (word)main::f#2
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::SCREEN in [4] *((const byte*) main::SCREEN + (byte) 0) ← (byte~) main::$1
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const void()*) main::f#0
Successful SSA optimization PassNEliminateUnusedVars
Constant right-side identified [0] (byte~) main::$1 ← < (const word) main::$0
Constant right-side identified [2] (byte~) main::$3 ← > (const word) main::$2
Constant right-side identified [4] (byte~) main::$5 ← < (const word) main::$4
Constant right-side identified [6] (byte~) main::$7 ← > (const word) main::$6
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::$1 = <main::$0
Constant (const byte) main::$3 = >main::$2
Constant (const byte) main::$5 = <main::$4
Constant (const byte) main::$7 = >main::$6
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings (const void()*) main::f#1
Inlining constant with different constant siblings (const void()*) main::f#2
Constant inlined main::$1 = <(word)&(void()) fn1()
Constant inlined main::$2 = (word)&(void()) fn1()
Constant inlined main::$0 = (word)&(void()) fn1()
Constant inlined main::$5 = <(word)&(void()) fn2()
Constant inlined main::$6 = (word)&(void()) fn2()
Constant inlined main::f#2 = &(void()) fn2()
Constant inlined main::$3 = >(word)&(void()) fn1()
Constant inlined main::$4 = (word)&(void()) fn2()
Constant inlined main::$7 = >(word)&(void()) fn2()
Constant inlined main::f#1 = &(void()) fn1()
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN+1)
Consolidated array index constant in *(main::SCREEN+2)
Consolidated array index constant in *(main::SCREEN+3)
Successful SSA optimization Pass2ConstantAdditionElimination
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
CALL GRAPH
Calls in [] to main:2 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @4
Renumbering block @3 to @1
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end

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] *((const byte*) main::SCREEN) ← <(word)&(void()) fn1()
  [5] *((const byte*) main::SCREEN+(byte) 1) ← >(word)&(void()) fn1()
  [6] *((const byte*) main::SCREEN+(byte) 2) ← <(word)&(void()) fn2()
  [7] *((const byte*) main::SCREEN+(byte) 3) ← >(word)&(void()) fn2()
  to:main::@return
main::@return: scope:[main]  from main
  [8] return 
  to:@return

(void()) fn2()
fn2: scope:[fn2]  from
  [9] *((const byte*) fn2::BGCOL) ← ++ *((const byte*) fn2::BGCOL)
  to:fn2::@return
fn2::@return: scope:[fn2]  from fn2
  [10] return 
  to:@return

(void()) fn1()
fn1: scope:[fn1]  from
  [11] *((const byte*) fn1::BORDERCOL) ← ++ *((const byte*) fn1::BORDERCOL)
  to:fn1::@return
fn1::@return: scope:[fn1]  from fn1
  [12] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) fn1()
(void()) fn2()
(void()) main()
(void()*) main::f

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Tests creating pointers to non-args no-return functions
  // 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 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label SCREEN = $400
    // [4] *((const byte*) main::SCREEN) ← <(word)&(void()) fn1() -- _deref_pbuc1=vbuc2 
    lda #<fn1
    sta SCREEN
    // [5] *((const byte*) main::SCREEN+(byte) 1) ← >(word)&(void()) fn1() -- _deref_pbuc1=vbuc2 
    lda #>fn1
    sta SCREEN+1
    // [6] *((const byte*) main::SCREEN+(byte) 2) ← <(word)&(void()) fn2() -- _deref_pbuc1=vbuc2 
    lda #<fn2
    sta SCREEN+2
    // [7] *((const byte*) main::SCREEN+(byte) 3) ← >(word)&(void()) fn2() -- _deref_pbuc1=vbuc2 
    lda #>fn2
    sta SCREEN+3
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
}
  // fn2
fn2: {
    .label BGCOL = $d021
    // [9] *((const byte*) fn2::BGCOL) ← ++ *((const byte*) fn2::BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    jmp __breturn
    // fn2::@return
  __breturn:
    // [10] return 
    rts
}
  // fn1
fn1: {
    .label BORDERCOL = $d020
    // [11] *((const byte*) fn1::BORDERCOL) ← ++ *((const byte*) fn1::BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
    jmp __breturn
    // fn1::@return
  __breturn:
    // [12] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) main::SCREEN) ← <(word)&(void()) fn1() [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [5] *((const byte*) main::SCREEN+(byte) 1) ← >(word)&(void()) fn1() [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [6] *((const byte*) main::SCREEN+(byte) 2) ← <(word)&(void()) fn2() [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [7] *((const byte*) main::SCREEN+(byte) 3) ← >(word)&(void()) fn2() [ ] ( main:2 [ ] ) always clobbers reg byte a 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 
Uplift Scope [fn1] 
Uplift Scope [fn2] 
Uplift Scope [] 

Uplifting [main] best 75 combination 
Uplifting [fn1] best 75 combination 
Uplifting [fn2] best 75 combination 
Uplifting [] best 75 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests creating pointers to non-args no-return functions
  // 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 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label SCREEN = $400
    // [4] *((const byte*) main::SCREEN) ← <(word)&(void()) fn1() -- _deref_pbuc1=vbuc2 
    lda #<fn1
    sta SCREEN
    // [5] *((const byte*) main::SCREEN+(byte) 1) ← >(word)&(void()) fn1() -- _deref_pbuc1=vbuc2 
    lda #>fn1
    sta SCREEN+1
    // [6] *((const byte*) main::SCREEN+(byte) 2) ← <(word)&(void()) fn2() -- _deref_pbuc1=vbuc2 
    lda #<fn2
    sta SCREEN+2
    // [7] *((const byte*) main::SCREEN+(byte) 3) ← >(word)&(void()) fn2() -- _deref_pbuc1=vbuc2 
    lda #>fn2
    sta SCREEN+3
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
}
  // fn2
fn2: {
    .label BGCOL = $d021
    // [9] *((const byte*) fn2::BGCOL) ← ++ *((const byte*) fn2::BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    jmp __breturn
    // fn2::@return
  __breturn:
    // [10] return 
    rts
}
  // fn1
fn1: {
    .label BORDERCOL = $d020
    // [11] *((const byte*) fn1::BORDERCOL) ← ++ *((const byte*) fn1::BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
    jmp __breturn
    // fn1::@return
  __breturn:
    // [12] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __breturn:
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 __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) fn1()
(label) fn1::@return
(const byte*) fn1::BORDERCOL = (byte*) 53280
(void()) fn2()
(label) fn2::@return
(const byte*) fn2::BGCOL = (byte*) 53281
(void()) main()
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(void()*) main::f



FINAL ASSEMBLER
Score: 54

  // File Comments
// Tests creating pointers to non-args no-return functions
  // 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 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label SCREEN = $400
    // SCREEN[0] = <(word)f
    // [4] *((const byte*) main::SCREEN) ← <(word)&(void()) fn1() -- _deref_pbuc1=vbuc2 
    lda #<fn1
    sta SCREEN
    // SCREEN[1] = >(word)f
    // [5] *((const byte*) main::SCREEN+(byte) 1) ← >(word)&(void()) fn1() -- _deref_pbuc1=vbuc2 
    lda #>fn1
    sta SCREEN+1
    // SCREEN[2] = <(word)f
    // [6] *((const byte*) main::SCREEN+(byte) 2) ← <(word)&(void()) fn2() -- _deref_pbuc1=vbuc2 
    lda #<fn2
    sta SCREEN+2
    // SCREEN[3] = >(word)f
    // [7] *((const byte*) main::SCREEN+(byte) 3) ← >(word)&(void()) fn2() -- _deref_pbuc1=vbuc2 
    lda #>fn2
    sta SCREEN+3
    // main::@return
    // }
    // [8] return 
    rts
}
  // fn2
fn2: {
    .label BGCOL = $d021
    // (*BGCOL)++;
    // [9] *((const byte*) fn2::BGCOL) ← ++ *((const byte*) fn2::BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    // fn2::@return
    // }
    // [10] return 
    rts
}
  // fn1
fn1: {
    .label BORDERCOL = $d020
    // (*BORDERCOL)++;
    // [11] *((const byte*) fn1::BORDERCOL) ← ++ *((const byte*) fn1::BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
    // fn1::@return
    // }
    // [12] return 
    rts
}
  // File Data

