Identified constant variable (dword) main::dw
Culled Empty Block (label) @1

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

(void()) main()
main: scope:[main]  from @2
  (dword) output::dw#0 ← (const dword) main::dw
  call output 
  to:main::@1
main::@1: scope:[main]  from main
  to:main::@return
main::@return: scope:[main]  from main::@1
  return 
  to:@return

(void()) output((dword) output::dw)
output: scope:[output]  from main
  (dword) output::dw#1 ← phi( main/(dword) output::dw#0 )
  *((const dword*) screen) ← (dword) output::dw#1
  to:output::@return
output::@return: scope:[output]  from output
  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
(void()) main()
(label) main::@1
(label) main::@return
(const dword) main::dw = (dword)(const byte*) main::msg
(const byte*) main::msg[]  = (byte*) "camelot"
(void()) output((dword) output::dw)
(label) output::@return
(dword) output::dw
(dword) output::dw#0
(dword) output::dw#1
(const dword*) screen = (dword*)(number) $400

Simplifying constant pointer cast (dword*) 1024
Successful SSA optimization PassNCastSimplification
Identical Phi Values (dword) output::dw#1 (dword) output::dw#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant (const dword) output::dw#0 = main::dw
Successful SSA optimization Pass2ConstantIdentification
Constant inlined output::dw#0 = (const dword) main::dw
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
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
Adding NOP phi() at start of main::@1
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to output:6 

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
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

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] phi()
  [5] call output 
  to:main::@return
main::@return: scope:[main]  from main
  [6] return 
  to:@return

(void()) output((dword) output::dw)
output: scope:[output]  from main
  [7] *((const dword*) screen) ← (const dword) main::dw
  to:output::@return
output::@return: scope:[output]  from output
  [8] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(void()) output((dword) output::dw)
(dword) output::dw

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Test casting the address of an inline string to a dword.
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label screen = $400
  // @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 dw = msg
    // [5] call output 
    jsr output
    jmp __breturn
    // main::@return
  __breturn:
    // [6] return 
    rts
    msg: .text "camelot"
    .byte 0
}
  // output
output: {
    // [7] *((const dword*) screen) ← (const dword) main::dw -- _deref_pduc1=vduc2 
    lda #<main.dw
    sta screen
    lda #>main.dw
    sta screen+1
    lda #<main.dw>>$10
    sta screen+2
    lda #>main.dw>>$10
    sta screen+3
    jmp __breturn
    // output::@return
  __breturn:
    // [8] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [7] *((const dword*) screen) ← (const dword) main::dw [ ] ( main:2::output:5 [ ] ) always clobbers reg byte a 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 
Uplift Scope [output] 
Uplift Scope [] 

Uplifting [main] best 60 combination 
Uplifting [output] best 60 combination 
Uplifting [] best 60 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test casting the address of an inline string to a dword.
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label screen = $400
  // @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 dw = msg
    // [5] call output 
    jsr output
    jmp __breturn
    // main::@return
  __breturn:
    // [6] return 
    rts
    msg: .text "camelot"
    .byte 0
}
  // output
output: {
    // [7] *((const dword*) screen) ← (const dword) main::dw -- _deref_pduc1=vduc2 
    lda #<main.dw
    sta screen
    lda #>main.dw
    sta screen+1
    lda #<main.dw>>$10
    sta screen+2
    lda #>main.dw>>$10
    sta screen+3
    jmp __breturn
    // output::@return
  __breturn:
    // [8] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
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 main_from___b1:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
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()) main()
(label) main::@return
(const dword) main::dw = (dword)(const byte*) main::msg
(const byte*) main::msg[]  = (byte*) "camelot"
(void()) output((dword) output::dw)
(label) output::@return
(dword) output::dw
(const dword*) screen = (dword*) 1024



FINAL ASSEMBLER
Score: 42

  // File Comments
// Test casting the address of an inline string to a dword.
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label screen = $400
  // @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 dw = msg
    // output(dw)
    // [5] call output 
    jsr output
    // main::@return
    // }
    // [6] return 
    rts
    msg: .text "camelot"
    .byte 0
}
  // output
output: {
    // *screen = dw
    // [7] *((const dword*) screen) ← (const dword) main::dw -- _deref_pduc1=vduc2 
    lda #<main.dw
    sta screen
    lda #>main.dw
    sta screen+1
    lda #<main.dw>>$10
    sta screen+2
    lda #>main.dw>>$10
    sta screen+3
    // output::@return
    // }
    // [8] return 
    rts
}
  // File Data

