
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  *(SCREEN+$3f8) = (char)(unsigned int)SPRITE/$40
  *SPRITES_ENABLE = 1
  *SPRITES_XPOS = $64
  *SPRITES_YPOS = $64
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  call main
  to:__start::@1
__start::@1: scope:[__start]  from __start
  to:__start::@return
__start::@return: scope:[__start]  from __start::@1
  return 
  to:@return

SYMBOL TABLE SSA
__constant char * const SCREEN = (char *)$400
__constant char SPRITE[] = kickasm {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)
 }}
__constant char * const SPRITES_ENABLE = (char *)$d015
__constant char * const SPRITES_XPOS = (char *)$d000
__constant char * const SPRITES_YPOS = (char *)$d001
void __start()
void main()

Adding number conversion cast (unumber) $40 in *(SCREEN+$3f8) = (char)(unsigned int)SPRITE/$40
Adding number conversion cast (unumber) $3f8 in *(SCREEN+$3f8) = (char)(unsigned int)SPRITE/(unumber)$40
Adding number conversion cast (unumber) 1 in *SPRITES_ENABLE = 1
Adding number conversion cast (unumber) $64 in *SPRITES_XPOS = $64
Adding number conversion cast (unumber) $64 in *SPRITES_YPOS = $64
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *SPRITES_ENABLE = (unumber)1
Inlining cast *SPRITES_XPOS = (unumber)$64
Inlining cast *SPRITES_YPOS = (unumber)$64
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 53269
Simplifying constant pointer cast (char *) 53248
Simplifying constant pointer cast (char *) 53249
Simplifying constant integer cast $40
Simplifying constant integer cast $3f8
Simplifying constant integer cast 1
Simplifying constant integer cast $64
Simplifying constant integer cast $64
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $40
Finalized unsigned number type (unsigned int) $3f8
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $64
Finalized unsigned number type (char) $64
Successful SSA optimization PassNFinalizeNumberTypeConversions
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::@1
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Finalized unsigned number type (unsigned int) $c00
Successful SSA optimization PassNFinalizeNumberTypeConversions
CALL GRAPH

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] *(SCREEN+$3f8) = (char)(unsigned int)SPRITE/$40
  [1] *SPRITES_ENABLE = 1
  [2] *SPRITES_XPOS = $64
  [3] *SPRITES_YPOS = $64
  to:main::@return
main::@return: scope:[main]  from main
  [4] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *(SCREEN+$3f8) = (char)(unsigned int)SPRITE/$40 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *SPRITES_ENABLE = 1 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *SPRITES_XPOS = $64 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *SPRITES_YPOS = $64 [ ] (  [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 33 combination 
Uplifting [] best 33 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Example of inline kickasm resource data
  // Upstart
  // Commodore 64 PRG executable file
.file [name="inline-kasm-resource.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .label SCREEN = $400
  .label SPRITES_ENABLE = $d015
  .label SPRITES_XPOS = $d000
  .label SPRITES_YPOS = $d001
.segment Code
  // main
main: {
    // [0] *(SCREEN+$3f8) = (char)(unsigned int)SPRITE/$40 -- _deref_pbuc1=vbuc2 
    lda #$ff&SPRITE/$40
    sta SCREEN+$3f8
    // [1] *SPRITES_ENABLE = 1 -- _deref_pbuc1=vbuc2 
    lda #1
    sta SPRITES_ENABLE
    // [2] *SPRITES_XPOS = $64 -- _deref_pbuc1=vbuc2 
    lda #$64
    sta SPRITES_XPOS
    // [3] *SPRITES_YPOS = $64 -- _deref_pbuc1=vbuc2 
    lda #$64
    sta SPRITES_YPOS
    jmp __breturn
    // main::@return
  __breturn:
    // [4] return 
    rts
}
  // File Data
.segment Data
.pc = $c00 "SPRITE"
SPRITE:
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)


ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #$64
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant char * const SCREEN = (char *) 1024
__constant char SPRITE[] = kickasm {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)
 }}
__constant char * const SPRITES_ENABLE = (char *) 53269
__constant char * const SPRITES_XPOS = (char *) 53248
__constant char * const SPRITES_YPOS = (char *) 53249
void main()



FINAL ASSEMBLER
Score: 28

  // File Comments
// Example of inline kickasm resource data
  // Upstart
  // Commodore 64 PRG executable file
.file [name="inline-kasm-resource.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .label SCREEN = $400
  .label SPRITES_ENABLE = $d015
  .label SPRITES_XPOS = $d000
  .label SPRITES_YPOS = $d001
.segment Code
  // main
main: {
    // *(SCREEN+0x3f8) = (char)((unsigned int)SPRITE/$40)
    // [0] *(SCREEN+$3f8) = (char)(unsigned int)SPRITE/$40 -- _deref_pbuc1=vbuc2 
    lda #$ff&SPRITE/$40
    sta SCREEN+$3f8
    // *SPRITES_ENABLE = 1
    // [1] *SPRITES_ENABLE = 1 -- _deref_pbuc1=vbuc2 
    lda #1
    sta SPRITES_ENABLE
    // *SPRITES_XPOS = 100
    // [2] *SPRITES_XPOS = $64 -- _deref_pbuc1=vbuc2 
    lda #$64
    sta SPRITES_XPOS
    // *SPRITES_YPOS = 100
    // [3] *SPRITES_YPOS = $64 -- _deref_pbuc1=vbuc2 
    sta SPRITES_YPOS
    // main::@return
    // }
    // [4] return 
    rts
}
  // File Data
.segment Data
.pc = $c00 "SPRITE"
SPRITE:
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)


