Resolved forward reference irq to interrupt(KERNEL_MIN)(void()) irq()
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

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte) col ← (byte) 0
  to:@2

(void()) main()
main: scope:[main]  from @2
  *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
  to:main::@1
main::@1: scope:[main]  from main main::@2
  if(true) goto main::@2
  to:main::@return
main::@2: scope:[main]  from main::@1
  (byte) col ← ++ (byte) col
  to:main::@1
main::@return: scope:[main]  from main::@1
  return 
  to:@return

interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq]  from
  asm { lda$dc0d  }
  *((const byte*) BGCOL) ← (byte) col
  to:irq::@return
irq::@return: scope:[irq]  from irq
  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*) BGCOL = (byte*)(number) $d020
(const void()**) KERNEL_IRQ = (void()**)(number) $314
(byte) col loadstore
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return

Simplifying constant pointer cast (void()**) 788
Simplifying constant pointer cast (byte*) 53280
Successful SSA optimization PassNCastSimplification
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
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::@1
CALL GRAPH
Calls in [] to main:2 

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

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] (byte) col ← (byte) 0
  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 void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
  to:main::@1
main::@1: scope:[main]  from main main::@1
  [5] (byte) col ← ++ (byte) col
  to:main::@1

interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq]  from
  asm { lda$dc0d  }
  [7] *((const byte*) BGCOL) ← (byte) col
  to:irq::@return
irq::@return: scope:[irq]  from irq
  [8] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) col loadstore 26.0
interrupt(KERNEL_MIN)(void()) irq()
(void()) main()

Initial phi equivalence classes
Added variable col to live range equivalence class [ col ]
Complete equivalence classes
[ col ]
Allocated zp[1]:2 [ col ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label KERNEL_IRQ = $314
  .label BGCOL = $d020
  .label col = 2
  // @begin
__bbegin:
  // [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta.z col
  // [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: {
    // [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 
    lda #<irq
    sta KERNEL_IRQ
    lda #>irq
    sta KERNEL_IRQ+1
    jmp __b1
    // main::@1
  __b1:
    // [5] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1 
    inc.z col
    jmp __b1
}
  // irq
irq: {
    // entry interrupt(KERNEL_MIN)
    // asm { lda$dc0d  }
    lda $dc0d
    // [7] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1 
    lda.z col
    sta BGCOL
    jmp __breturn
    // irq::@return
  __breturn:
    // [8] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) col ← (byte) 0 [ ] (  [ ] ) always clobbers reg byte a 
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement asm { lda$dc0d  } always clobbers reg byte a 
Statement [7] *((const byte*) BGCOL) ← (byte) col [ ] (  [ ] ) always clobbers reg byte a 
Potential registers zp[1]:2 [ col ] : zp[1]:2 , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 26: zp[1]:2 [ col ] 
Uplift Scope [main] 
Uplift Scope [irq] 

Uplifting [] best 129 combination zp[1]:2 [ col ] 
Uplifting [main] best 129 combination 
Uplifting [irq] best 129 combination 
Attempting to uplift remaining variables inzp[1]:2 [ col ]
Uplifting [] best 129 combination zp[1]:2 [ col ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label KERNEL_IRQ = $314
  .label BGCOL = $d020
  .label col = 2
  // @begin
__bbegin:
  // [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta.z col
  // [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: {
    // [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 
    lda #<irq
    sta KERNEL_IRQ
    lda #>irq
    sta KERNEL_IRQ+1
    jmp __b1
    // main::@1
  __b1:
    // [5] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1 
    inc.z col
    jmp __b1
}
  // irq
irq: {
    // entry interrupt(KERNEL_MIN)
    // asm { lda$dc0d  }
    lda $dc0d
    // [7] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1 
    lda.z col
    sta BGCOL
    jmp __breturn
    // irq::@return
  __breturn:
    // [8] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __bend:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Adding RTS to root block 
Succesful ASM optimization Pass5AddMainRts

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte*) BGCOL = (byte*) 53280
(const void()**) KERNEL_IRQ = (void()**) 788
(byte) col loadstore zp[1]:2 26.0
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
(label) main::@1

zp[1]:2 [ col ]


FINAL ASSEMBLER
Score: 123

  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label KERNEL_IRQ = $314
  .label BGCOL = $d020
  .label col = 2
  // @begin
__bbegin:
  // col = 0
  // [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta.z col
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  jsr main
  rts
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    // *KERNEL_IRQ = &irq
    // [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 
    lda #<irq
    sta KERNEL_IRQ
    lda #>irq
    sta KERNEL_IRQ+1
    // main::@1
  __b1:
    // col++;
    // [5] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1 
    inc.z col
    jmp __b1
}
  // irq
irq: {
    // entry interrupt(KERNEL_MIN)
    // asm
    // asm { lda$dc0d  }
    lda $dc0d
    // *BGCOL = col
    // [7] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1 
    lda.z col
    sta BGCOL
    // irq::@return
    // }
    // [8] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // File Data

