Resolved forward reference irq2 to interrupt(KERNEL_MIN)(void()) irq2()
Culled Empty Block (label) @2

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) SCREEN#0 ← ((byte*)) (number) $400
  to:@1
main: scope:[main]  from @3
  *((byte*) SCREEN#0) ← (byte) 'x'
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return
@1: scope:[]  from @begin
  (void()**) HARDWARE_IRQ#0 ← ((void()**)) (number) $fffe
  to:@3
irq1: scope:[irq1]  from
  (void()*~) irq1::$0 ← & interrupt(KERNEL_MIN)(void()) irq2()
  *((void()**) HARDWARE_IRQ#0) ← (void()*~) irq1::$0
  to:irq1::@return
irq1::@return: scope:[irq1]  from irq1
  return 
  to:@return
irq2: scope:[irq2]  from
  (void()*~) irq2::$0 ← & interrupt(KERNEL_MIN)(void()) irq1()
  *((void()**) HARDWARE_IRQ#0) ← (void()*~) irq2::$0
  to:irq2::@return
irq2::@return: scope:[irq2]  from irq2
  return 
  to:@return
@3: scope:[]  from @1
  call main 
  to:@4
@4: scope:[]  from @3
  to:@end
@end: scope:[]  from @4

SYMBOL TABLE SSA
(label) @1
(label) @3
(label) @4
(label) @begin
(label) @end
(void()**) HARDWARE_IRQ
(void()**) HARDWARE_IRQ#0
(byte*) SCREEN
(byte*) SCREEN#0
interrupt(KERNEL_MIN)(void()) irq1()
(void()*~) irq1::$0
(label) irq1::@return
interrupt(KERNEL_MIN)(void()) irq2()
(void()*~) irq2::$0
(label) irq2::@return
(void()) main()
(label) main::@return

Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400
Inlining cast (void()**) HARDWARE_IRQ#0 ← (void()**)(number) $fffe
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (void()**) 65534
Successful SSA optimization PassNCastSimplification
Constant right-side identified [4] (void()*~) irq1::$0 ← & interrupt(KERNEL_MIN)(void()) irq2()
Constant right-side identified [7] (void()*~) irq2::$0 ← & interrupt(KERNEL_MIN)(void()) irq1()
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) SCREEN#0 = (byte*) 1024
Constant (const void()**) HARDWARE_IRQ#0 = (void()**) 65534
Constant (const void()*) irq1::$0 = &irq2
Constant (const void()*) irq2::$0 = &irq1
Successful SSA optimization Pass2ConstantIdentification
Constant inlined irq1::$0 = &interrupt(KERNEL_MIN)(void()) irq2()
Constant inlined irq2::$0 = &interrupt(KERNEL_MIN)(void()) irq1()
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
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:3 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @1
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()
main: scope:[main]  from @1
  [4] *((const byte*) SCREEN#0) ← (byte) 'x'
  to:main::@return
main::@return: scope:[main]  from main
  [5] return 
  to:@return
irq2: scope:[irq2]  from
  [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1()
  to:irq2::@return
irq2::@return: scope:[irq2]  from irq2
  [7] return 
  to:@return
irq1: scope:[irq1]  from
  [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2()
  to:irq1::@return
irq1::@return: scope:[irq1]  from irq1
  [9] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()**) HARDWARE_IRQ
(byte*) SCREEN
interrupt(KERNEL_MIN)(void()) irq1()
interrupt(KERNEL_MIN)(void()) irq2()
(void()) main()

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
  // File Comments
// Unused interrupts pointing to each other but never used from main loop - should be optimized away
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label HARDWARE_IRQ = $fffe
  // @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: {
    // [4] *((const byte*) SCREEN#0) ← (byte) 'x' -- _deref_pbuc1=vbuc2 
    lda #'x'
    sta SCREEN
    jmp breturn
    // main::@return
  breturn:
    // [5] return 
    rts
}
  // irq2
// Unused Interrupt Routine
irq2: {
    // entry interrupt(KERNEL_MIN)
    // [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1() -- _deref_pptc1=pprc2 
    lda #<irq1
    sta HARDWARE_IRQ
    lda #>irq1
    sta HARDWARE_IRQ+1
    jmp breturn
    // irq2::@return
  breturn:
    // [7] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // irq1
// Unused Interrupt Routine
irq1: {
    // entry interrupt(KERNEL_MIN)
    // [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2() -- _deref_pptc1=pprc2 
    lda #<irq2
    sta HARDWARE_IRQ
    lda #>irq2
    sta HARDWARE_IRQ+1
    jmp breturn
    // irq1::@return
  breturn:
    // [9] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) SCREEN#0) ← (byte) 'x' [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1() [ ] (  [ ] ) always clobbers reg byte a 
Statement [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2() [ ] (  [ ] ) always clobbers reg byte a 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 
Uplift Scope [irq1] 
Uplift Scope [irq2] 
Uplift Scope [] 

Uplifting [main] best 63 combination 
Uplifting [irq1] best 63 combination 
Uplifting [irq2] best 63 combination 
Uplifting [] best 63 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Unused interrupts pointing to each other but never used from main loop - should be optimized away
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label HARDWARE_IRQ = $fffe
  // @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: {
    // [4] *((const byte*) SCREEN#0) ← (byte) 'x' -- _deref_pbuc1=vbuc2 
    lda #'x'
    sta SCREEN
    jmp breturn
    // main::@return
  breturn:
    // [5] return 
    rts
}
  // irq2
// Unused Interrupt Routine
irq2: {
    // entry interrupt(KERNEL_MIN)
    // [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1() -- _deref_pptc1=pprc2 
    lda #<irq1
    sta HARDWARE_IRQ
    lda #>irq1
    sta HARDWARE_IRQ+1
    jmp breturn
    // irq2::@return
  breturn:
    // [7] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // irq1
// Unused Interrupt Routine
irq1: {
    // entry interrupt(KERNEL_MIN)
    // [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2() -- _deref_pptc1=pprc2 
    lda #<irq2
    sta HARDWARE_IRQ
    lda #>irq2
    sta HARDWARE_IRQ+1
    jmp breturn
    // irq1::@return
  breturn:
    // [9] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // 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
Removing instruction b1_from_bbegin:
Removing instruction b1:
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 bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()**) HARDWARE_IRQ
(const void()**) HARDWARE_IRQ#0 HARDWARE_IRQ = (void()**) 65534
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
interrupt(KERNEL_MIN)(void()) irq1()
(label) irq1::@return
interrupt(KERNEL_MIN)(void()) irq2()
(label) irq2::@return
(void()) main()
(label) main::@return



FINAL ASSEMBLER
Score: 42

  // File Comments
// Unused interrupts pointing to each other but never used from main loop - should be optimized away
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label HARDWARE_IRQ = $fffe
  // @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: {
    // *SCREEN = 'x'
    // [4] *((const byte*) SCREEN#0) ← (byte) 'x' -- _deref_pbuc1=vbuc2 
    lda #'x'
    sta SCREEN
    // main::@return
    // }
    // [5] return 
    rts
}
  // irq2
// Unused Interrupt Routine
irq2: {
    // entry interrupt(KERNEL_MIN)
    // *HARDWARE_IRQ = &irq1
    // [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1() -- _deref_pptc1=pprc2 
    lda #<irq1
    sta HARDWARE_IRQ
    lda #>irq1
    sta HARDWARE_IRQ+1
    // irq2::@return
    // }
    // [7] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // irq1
// Unused Interrupt Routine
irq1: {
    // entry interrupt(KERNEL_MIN)
    // *HARDWARE_IRQ = &irq2
    // [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2() -- _deref_pptc1=pprc2 
    lda #<irq2
    sta HARDWARE_IRQ
    lda #>irq2
    sta HARDWARE_IRQ+1
    // irq1::@return
    // }
    // [9] return  - exit interrupt(KERNEL_MIN)
    jmp $ea81
}
  // File Data

