Loading link script "xmega65.ld"
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Warning! Adding boolean cast to non-boolean condition *((byte*) main::msg)
Culled Empty Block (label) @1
Culled Empty Block (label) @2
Culled Empty Block (label) memset::@7
Culled Empty Block (label) memset::@6
Culled Empty Block (label) memset::@8
Culled Empty Block (label) memset::@9
Culled Empty Block (label) memset::@3
Culled Empty Block (label) @3
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) main::@12
Culled Empty Block (label) main::@9
Culled Empty Block (label) main::@13
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@15
Culled Empty Block (label) main::@16
Culled Empty Block (label) @5
Culled Empty Block (label) @6

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@4
memset: scope:[memset]  from main main::@17
  (byte) memset::c#5 ← phi( main/(byte) memset::c#0 main::@17/(byte) memset::c#1 )
  (void*) memset::str#4 ← phi( main/(void*) memset::str#0 main::@17/(void*) memset::str#1 )
  (word) memset::num#2 ← phi( main/(word) memset::num#0 main::@17/(word) memset::num#1 )
  (bool~) memset::$0 ← (word) memset::num#2 > (number) 0
  (bool~) memset::$1 ← ! (bool~) memset::$0
  if((bool~) memset::$1) goto memset::@1
  to:memset::@2
memset::@1: scope:[memset]  from memset memset::@4
  (void*) memset::str#2 ← phi( memset/(void*) memset::str#4 memset::@4/(void*) memset::str#5 )
  (void*) memset::return#0 ← (void*) memset::str#2
  to:memset::@return
memset::@2: scope:[memset]  from memset
  (byte) memset::c#4 ← phi( memset/(byte) memset::c#5 )
  (word) memset::num#3 ← phi( memset/(word) memset::num#2 )
  (void*) memset::str#3 ← phi( memset/(void*) memset::str#4 )
  (byte*~) memset::$2 ← ((byte*)) (void*) memset::str#3
  (byte*~) memset::$3 ← (byte*~) memset::$2 + (word) memset::num#3
  (byte*) memset::end#0 ← (byte*~) memset::$3
  (byte*) memset::dst#0 ← ((byte*)) (void*) memset::str#3
  to:memset::@4
memset::@4: scope:[memset]  from memset::@2 memset::@5
  (byte) memset::c#3 ← phi( memset::@2/(byte) memset::c#4 memset::@5/(byte) memset::c#2 )
  (void*) memset::str#5 ← phi( memset::@2/(void*) memset::str#3 memset::@5/(void*) memset::str#6 )
  (byte*) memset::end#1 ← phi( memset::@2/(byte*) memset::end#0 memset::@5/(byte*) memset::end#2 )
  (byte*) memset::dst#2 ← phi( memset::@2/(byte*) memset::dst#0 memset::@5/(byte*) memset::dst#1 )
  (bool~) memset::$4 ← (byte*) memset::dst#2 != (byte*) memset::end#1
  if((bool~) memset::$4) goto memset::@5
  to:memset::@1
memset::@5: scope:[memset]  from memset::@4
  (void*) memset::str#6 ← phi( memset::@4/(void*) memset::str#5 )
  (byte*) memset::end#2 ← phi( memset::@4/(byte*) memset::end#1 )
  (byte*) memset::dst#3 ← phi( memset::@4/(byte*) memset::dst#2 )
  (byte) memset::c#2 ← phi( memset::@4/(byte) memset::c#3 )
  *((byte*) memset::dst#3) ← (byte) memset::c#2
  (byte*) memset::dst#1 ← ++ (byte*) memset::dst#3
  to:memset::@4
memset::@return: scope:[memset]  from memset::@1
  (void*) memset::return#4 ← phi( memset::@1/(void*) memset::return#0 )
  (void*) memset::return#1 ← (void*) memset::return#4
  return 
  to:@return
@4: scope:[]  from @begin
  (byte*) RASTER#0 ← ((byte*)) (number) $d012
  (byte*) VIC_MEMORY#0 ← ((byte*)) (number) $d018
  (byte*) SCREEN#0 ← ((byte*)) (number) $400
  (byte*) BGCOL#0 ← ((byte*)) (number) $d021
  (byte*) COLS#0 ← ((byte*)) (number) $d800
  (byte) BLACK#0 ← (number) 0
  (byte) WHITE#0 ← (number) 1
  (byte[]) MESSAGE#0 ← (const string) $3
  to:@7
main: scope:[main]  from @7
  *((byte*) VIC_MEMORY#0) ← (number) $14
  (void*) memset::str#0 ← (void*)(byte*) SCREEN#0
  (byte) memset::c#0 ← (byte) ' '
  (word) memset::num#0 ← (number) $28*(number) $19
  call memset 
  (void*) memset::return#2 ← (void*) memset::return#1
  to:main::@17
main::@17: scope:[main]  from main
  (void*) memset::str#1 ← (void*)(byte*) COLS#0
  (byte) memset::c#1 ← (byte) WHITE#0
  (word) memset::num#1 ← (number) $28*(number) $19
  call memset 
  (void*) memset::return#3 ← (void*) memset::return#1
  to:main::@18
main::@18: scope:[main]  from main::@17
  (byte*~) main::$2 ← (byte*) SCREEN#0 + (number) $28
  (byte*) main::sc#0 ← (byte*~) main::$2
  (byte*) main::msg#0 ← (byte[]) MESSAGE#0
  to:main::@1
main::@1: scope:[main]  from main::@18 main::@2
  (byte*) main::sc#3 ← phi( main::@18/(byte*) main::sc#0 main::@2/(byte*) main::sc#1 )
  (byte*) main::msg#2 ← phi( main::@18/(byte*) main::msg#0 main::@2/(byte*) main::msg#1 )
  (bool~) main::$6 ← (number) 0 != *((byte*) main::msg#2)
  if((bool~) main::$6) goto main::@2
  to:main::@7
main::@2: scope:[main]  from main::@1
  (byte*) main::sc#2 ← phi( main::@1/(byte*) main::sc#3 )
  (byte*) main::msg#3 ← phi( main::@1/(byte*) main::msg#2 )
  *((byte*) main::sc#2) ← *((byte*) main::msg#3)
  (byte*) main::sc#1 ← ++ (byte*) main::sc#2
  (byte*) main::msg#1 ← ++ (byte*) main::msg#3
  to:main::@1
main::@7: scope:[main]  from main::@1 main::@10 main::@14
  if(true) goto main::@8
  to:main::@return
main::@8: scope:[main]  from main::@7
  (bool~) main::$3 ← *((byte*) RASTER#0) == (number) $36
  (bool~) main::$4 ← *((byte*) RASTER#0) == (number) $42
  (bool~) main::$5 ← (bool~) main::$3 || (bool~) main::$4
  if((bool~) main::$5) goto main::@10
  to:main::@14
main::@10: scope:[main]  from main::@8
  *((byte*) BGCOL#0) ← (byte) WHITE#0
  to:main::@7
main::@14: scope:[main]  from main::@8
  *((byte*) BGCOL#0) ← (byte) BLACK#0
  to:main::@7
main::@return: scope:[main]  from main::@7
  return 
  to:@return
syscall1: scope:[syscall1]  from
  (byte*~) syscall1::$0 ← (byte*) SCREEN#0 + (number) $4f
  *((byte*~) syscall1::$0) ← (byte) '>'
  to:syscall1::@return
syscall1::@return: scope:[syscall1]  from syscall1
  return 
  to:@return
syscall2: scope:[syscall2]  from
  (byte*~) syscall2::$0 ← (byte*) SCREEN#0 + (number) $4e
  *((byte*~) syscall2::$0) ← (byte) '<'
  to:syscall2::@return
syscall2::@return: scope:[syscall2]  from syscall2
  return 
  to:@return
@7: scope:[]  from @4
  (byte) JMP#0 ← (number) $4c
  (byte) NOP#0 ← (number) $ea
  (void()*~) $0 ← & (void()) syscall1()
  (void()*~) $1 ← & (void()) syscall2()
  (struct SysCall[]) SYSCALLS#0 ← { { (byte) JMP#0, (void()*~) $0, (byte) NOP#0 }, { (byte) JMP#0, (void()*~) $1, (byte) NOP#0 } }
  (void()*~) $2 ← & (void()) main()
  (struct SysCall[]) SYSCALL_RESET#0 ← { { (byte) JMP#0, (void()*~) $2, (byte) NOP#0 } }
  call main 
  to:@8
@8: scope:[]  from @7
  to:@end
@end: scope:[]  from @8

SYMBOL TABLE SSA
(void()*~) $0
(void()*~) $1
(void()*~) $2
(const string) $3 = (string) "hello world!"
(label) @4
(label) @7
(label) @8
(label) @begin
(label) @end
(byte*) BGCOL
(byte*) BGCOL#0
(byte) BLACK
(byte) BLACK#0
(byte*) COLS
(byte*) COLS#0
(byte) JMP
(byte) JMP#0
(byte[]) MESSAGE
(byte[]) MESSAGE#0
(byte) NOP
(byte) NOP#0
(byte*) RASTER
(byte*) RASTER#0
(byte*) SCREEN
(byte*) SCREEN#0
(struct SysCall[]) SYSCALLS
(struct SysCall[]) SYSCALLS#0
(struct SysCall[]) SYSCALL_RESET
(struct SysCall[]) SYSCALL_RESET#0
(void()*) SysCall::syscall
(byte) SysCall::xjmp
(byte) SysCall::xnop
(byte*) VIC_MEMORY
(byte*) VIC_MEMORY#0
(byte) WHITE
(byte) WHITE#0
(void()) main()
(byte*~) main::$2
(bool~) main::$3
(bool~) main::$4
(bool~) main::$5
(bool~) main::$6
(label) main::@1
(label) main::@10
(label) main::@14
(label) main::@17
(label) main::@18
(label) main::@2
(label) main::@7
(label) main::@8
(label) main::@return
(byte*) main::msg
(byte*) main::msg#0
(byte*) main::msg#1
(byte*) main::msg#2
(byte*) main::msg#3
(byte*) main::sc
(byte*) main::sc#0
(byte*) main::sc#1
(byte*) main::sc#2
(byte*) main::sc#3
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(bool~) memset::$0
(bool~) memset::$1
(byte*~) memset::$2
(byte*~) memset::$3
(bool~) memset::$4
(label) memset::@1
(label) memset::@2
(label) memset::@4
(label) memset::@5
(label) memset::@return
(byte) memset::c
(byte) memset::c#0
(byte) memset::c#1
(byte) memset::c#2
(byte) memset::c#3
(byte) memset::c#4
(byte) memset::c#5
(byte*) memset::dst
(byte*) memset::dst#0
(byte*) memset::dst#1
(byte*) memset::dst#2
(byte*) memset::dst#3
(byte*) memset::end
(byte*) memset::end#0
(byte*) memset::end#1
(byte*) memset::end#2
(word) memset::num
(word) memset::num#0
(word) memset::num#1
(word) memset::num#2
(word) memset::num#3
(void*) memset::return
(void*) memset::return#0
(void*) memset::return#1
(void*) memset::return#2
(void*) memset::return#3
(void*) memset::return#4
(void*) memset::str
(void*) memset::str#0
(void*) memset::str#1
(void*) memset::str#2
(void*) memset::str#3
(void*) memset::str#4
(void*) memset::str#5
(void*) memset::str#6
(void()) syscall1()
(byte*~) syscall1::$0
(label) syscall1::@return
(void()) syscall2()
(byte*~) syscall2::$0
(label) syscall2::@return

Adding number conversion cast (unumber) 0 in (bool~) memset::$0 ← (word) memset::num#2 > (number) 0
Adding number conversion cast (unumber) 0 in (byte) BLACK#0 ← (number) 0
Adding number conversion cast (unumber) 1 in (byte) WHITE#0 ← (number) 1
Adding number conversion cast (unumber) $14 in *((byte*) VIC_MEMORY#0) ← (number) $14
Adding number conversion cast (unumber) $28*$19 in (word) memset::num#0 ← (number) $28*(number) $19
Adding number conversion cast (unumber) $28*$19 in (word) memset::num#1 ← (number) $28*(number) $19
Adding number conversion cast (unumber) $28 in (byte*~) main::$2 ← (byte*) SCREEN#0 + (number) $28
Adding number conversion cast (unumber) 0 in (bool~) main::$6 ← (number) 0 != *((byte*) main::msg#2)
Adding number conversion cast (unumber) $36 in (bool~) main::$3 ← *((byte*) RASTER#0) == (number) $36
Adding number conversion cast (unumber) $42 in (bool~) main::$4 ← *((byte*) RASTER#0) == (number) $42
Adding number conversion cast (unumber) $4f in (byte*~) syscall1::$0 ← (byte*) SCREEN#0 + (number) $4f
Adding number conversion cast (unumber) $4e in (byte*~) syscall2::$0 ← (byte*) SCREEN#0 + (number) $4e
Adding number conversion cast (unumber) $4c in (byte) JMP#0 ← (number) $4c
Adding number conversion cast (unumber) $ea in (byte) NOP#0 ← (number) $ea
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*~) memset::$2 ← (byte*)(void*) memset::str#3
Inlining cast (byte*) memset::dst#0 ← (byte*)(void*) memset::str#3
Inlining cast (byte*) RASTER#0 ← (byte*)(number) $d012
Inlining cast (byte*) VIC_MEMORY#0 ← (byte*)(number) $d018
Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400
Inlining cast (byte*) BGCOL#0 ← (byte*)(number) $d021
Inlining cast (byte*) COLS#0 ← (byte*)(number) $d800
Inlining cast (byte) BLACK#0 ← (unumber)(number) 0
Inlining cast (byte) WHITE#0 ← (unumber)(number) 1
Inlining cast *((byte*) VIC_MEMORY#0) ← (unumber)(number) $14
Inlining cast (word) memset::num#0 ← (unumber)(number) $28*(number) $19
Inlining cast (word) memset::num#1 ← (unumber)(number) $28*(number) $19
Inlining cast (byte) JMP#0 ← (unumber)(number) $4c
Inlining cast (byte) NOP#0 ← (unumber)(number) $ea
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast 0
Simplifying constant pointer cast (byte*) 53266
Simplifying constant pointer cast (byte*) 53272
Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 53281
Simplifying constant pointer cast (byte*) 55296
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast $14
Simplifying constant integer cast $28
Simplifying constant integer cast 0
Simplifying constant integer cast $36
Simplifying constant integer cast $42
Simplifying constant integer cast $4f
Simplifying constant integer cast $4e
Simplifying constant integer cast $4c
Simplifying constant integer cast $ea
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) $14
Finalized unsigned number type (byte) $28
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $36
Finalized unsigned number type (byte) $42
Finalized unsigned number type (byte) $4f
Finalized unsigned number type (byte) $4e
Finalized unsigned number type (byte) $4c
Finalized unsigned number type (byte) $ea
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [2] (bool~) memset::$1 ← (word) memset::num#2 <= (byte) 0 from [1] (bool~) memset::$0 ← (word) memset::num#2 > (byte) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (void*) memset::return#0 = (void*) memset::str#2 (void*) memset::return#4 (void*) memset::return#1 
Alias (void*) memset::str#3 = (void*) memset::str#4 
Alias (word) memset::num#2 = (word) memset::num#3 
Alias (byte) memset::c#4 = (byte) memset::c#5 
Alias (byte*) memset::end#0 = (byte*~) memset::$3 
Alias (byte) memset::c#2 = (byte) memset::c#3 
Alias (byte*) memset::dst#2 = (byte*) memset::dst#3 
Alias (byte*) memset::end#1 = (byte*) memset::end#2 
Alias (void*) memset::str#5 = (void*) memset::str#6 
Alias (byte*) main::sc#0 = (byte*~) main::$2 
Alias (byte*) main::msg#2 = (byte*) main::msg#3 
Alias (byte*) main::sc#2 = (byte*) main::sc#3 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte*) memset::end#1 (byte*) memset::end#0
Identical Phi Values (void*) memset::str#5 (void*) memset::str#3
Identical Phi Values (byte) memset::c#2 (byte) memset::c#4
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (void*) memset::return#0 (void*) memset::str#3
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) memset::$1 [3] if((word) memset::num#2<=(byte) 0) goto memset::@1
Simple Condition (bool~) memset::$4 [13] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@5
Simple Condition (bool~) main::$6 [44] if((byte) 0!=*((byte*) main::msg#2)) goto main::@2
Successful SSA optimization Pass2ConditionalJumpSimplification
Rewriting || if()-condition to two if()s [52] (bool~) main::$5 ← (bool~) main::$3 || (bool~) main::$4
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant right-side identified [31] (word) memset::num#0 ← (unumber)(number) $28*(number) $19
Constant right-side identified [36] (word) memset::num#1 ← (unumber)(number) $28*(number) $19
Constant right-side identified [65] (void()*~) $0 ← & (void()) syscall1()
Constant right-side identified [66] (void()*~) $1 ← & (void()) syscall2()
Constant right-side identified [68] (void()*~) $2 ← & (void()) main()
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) RASTER#0 = (byte*) 53266
Constant (const byte*) VIC_MEMORY#0 = (byte*) 53272
Constant (const byte*) SCREEN#0 = (byte*) 1024
Constant (const byte*) BGCOL#0 = (byte*) 53281
Constant (const byte*) COLS#0 = (byte*) 55296
Constant (const byte) BLACK#0 = 0
Constant (const byte) WHITE#0 = 1
Constant (const byte[]) MESSAGE#0 = $3
Constant (const byte) memset::c#0 = ' '
Constant (const word) memset::num#0 = (unumber)$28*$19
Constant (const word) memset::num#1 = (unumber)$28*$19
Constant (const byte) JMP#0 = $4c
Constant (const byte) NOP#0 = $ea
Constant (const void()*) $0 = &syscall1
Constant (const void()*) $1 = &syscall2
Constant (const void()*) $2 = &main
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte) memset::c#1 = WHITE#0
Constant (const byte*) main::msg#0 = MESSAGE#0
Successful SSA optimization Pass2ConstantIdentification
Constant value identified (void*)SCREEN#0 in [29] (void*) memset::str#0 ← (void*)(const byte*) SCREEN#0
Constant value identified (void*)COLS#0 in [34] (void*) memset::str#1 ← (void*)(const byte*) COLS#0
Successful SSA optimization Pass2ConstantValues
if() condition always true - replacing block destination [49] if(true) goto main::@8
Successful SSA optimization Pass2ConstantIfs
Converting *(pointer+n) to pointer[n] [58] *((byte*~) syscall1::$0) ← (byte) '>'  -- *(SCREEN#0 + $4f)
Converting *(pointer+n) to pointer[n] [61] *((byte*~) syscall2::$0) ← (byte) '<'  -- *(SCREEN#0 + $4e)
Successful SSA optimization Pass2InlineDerefIdx
Eliminating unused variable (void*) memset::return#2 and assignment [13] (void*) memset::return#2 ← (void*) memset::str#3
Eliminating unused variable (void*) memset::return#3 and assignment [16] (void*) memset::return#3 ← (void*) memset::str#3
Eliminating unused variable (byte*~) syscall1::$0 and assignment [29] (byte*~) syscall1::$0 ← (const byte*) SCREEN#0 + (byte) $4f
Eliminating unused variable (byte*~) syscall2::$0 and assignment [32] (byte*~) syscall2::$0 ← (const byte*) SCREEN#0 + (byte) $4e
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Simple Condition (bool~) main::$3 [23] if(*((const byte*) RASTER#0)==(byte) $36) goto main::@10
Simple Condition (bool~) main::$4 [33] if(*((const byte*) RASTER#0)==(byte) $42) goto main::@10
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [15] (byte*) main::sc#0 ← (const byte*) SCREEN#0 + (byte) $28
Successful SSA optimization Pass2ConstantRValueConsolidation
Identified constant from value list (struct SysCall) { xjmp: (const byte) JMP#0, syscall: (const void()*) $0, xnop: (const byte) NOP#0 }
Identified constant from value list (struct SysCall) { xjmp: (const byte) JMP#0, syscall: (const void()*) $1, xnop: (const byte) NOP#0 }
Identified constant from value list (struct SysCall) { xjmp: (const byte) JMP#0, syscall: (const void()*) $2, xnop: (const byte) NOP#0 }
Successful SSA optimization Pass2ConstantInitializerValueLists
Identified constant from value list (struct SysCall[]) { { xjmp: (const byte) JMP#0, syscall: (const void()*) $0, xnop: (const byte) NOP#0 }, { xjmp: (const byte) JMP#0, syscall: (const void()*) $1, xnop: (const byte) NOP#0 } }
Identified constant from value list (struct SysCall[]) { { xjmp: (const byte) JMP#0, syscall: (const void()*) $2, xnop: (const byte) NOP#0 } }
Successful SSA optimization Pass2ConstantInitializerValueLists
Constant (const void*) memset::str#0 = (void*)SCREEN#0
Constant (const void*) memset::str#1 = (void*)COLS#0
Constant (const byte*) main::sc#0 = SCREEN#0+$28
Constant (const struct SysCall[]) SYSCALLS#0 = { { xjmp: JMP#0, syscall: $0, xnop: NOP#0 }, { xjmp: JMP#0, syscall: $1, xnop: NOP#0 } }
Constant (const struct SysCall[]) SYSCALL_RESET#0 = { { xjmp: JMP#0, syscall: $2, xnop: NOP#0 } }
Successful SSA optimization Pass2ConstantIdentification
Inlining Noop Cast [2] (byte*~) memset::$2 ← (byte*)(void*) memset::str#3 keeping memset::str#3
Inlining Noop Cast [4] (byte*) memset::dst#0 ← (byte*)(void*) memset::str#3 keeping memset::str#3
Successful SSA optimization Pass2NopCastInlining
Inlining constant with var siblings (const byte) memset::c#0
Inlining constant with var siblings (const word) memset::num#0
Inlining constant with var siblings (const word) memset::num#1
Inlining constant with var siblings (const byte) memset::c#1
Inlining constant with var siblings (const void*) memset::str#0
Inlining constant with var siblings (const void*) memset::str#1
Inlining constant with var siblings (const byte*) main::msg#0
Inlining constant with var siblings (const byte*) main::sc#0
Constant inlined memset::str#1 = (void*)(const byte*) COLS#0
Constant inlined memset::str#0 = (void*)(const byte*) SCREEN#0
Constant inlined main::msg#0 = (const byte[]) MESSAGE#0
Constant inlined memset::num#1 = (word)(number) $28*(number) $19
Constant inlined main::sc#0 = (const byte*) SCREEN#0+(byte) $28
Constant inlined memset::c#0 = (byte) ' '
Constant inlined memset::num#0 = (word)(number) $28*(number) $19
Constant inlined memset::c#1 = (const byte) WHITE#0
Constant inlined $0 = &(void()) syscall1()
Constant inlined $1 = &(void()) syscall2()
Constant inlined $2 = &(void()) main()
Constant inlined $3 = (const byte[]) MESSAGE#0
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN#0+$4f)
Consolidated array index constant in *(SCREEN#0+$4e)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @4
Adding NOP phi() at start of @7
Adding NOP phi() at start of @8
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@17
Adding NOP phi() at start of main::@18
Adding NOP phi() at start of main::@7
Adding NOP phi() at start of memset::@1
CALL GRAPH
Calls in [] to main:3 
Calls in [main] to memset:7 memset:9 

Created 6 initial phi equivalence classes
Coalesced [21] main::msg#4 ← main::msg#1
Coalesced [22] main::sc#4 ← main::sc#1
Coalesced [33] memset::dst#5 ← memset::dst#1
Coalesced down to 6 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) @8
Culled Empty Block (label) main::@18
Culled Empty Block (label) main::@7
Culled Empty Block (label) memset::@1
Renumbering block @7 to @1
Renumbering block memset::@2 to memset::@1
Renumbering block memset::@4 to memset::@2
Renumbering block memset::@5 to memset::@3
Renumbering block main::@8 to main::@3
Renumbering block main::@10 to main::@4
Renumbering block main::@14 to main::@5
Renumbering block main::@17 to main::@6
Renumbering block main::@19 to main::@7
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::@6

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*) VIC_MEMORY#0) ← (byte) $14
  [5] call memset 
  to:main::@6
main::@6: scope:[main]  from main
  [6] phi()
  [7] call memset 
  to:main::@1
main::@1: scope:[main]  from main::@2 main::@6
  [8] (byte*) main::sc#2 ← phi( main::@6/(const byte*) SCREEN#0+(byte) $28 main::@2/(byte*) main::sc#1 )
  [8] (byte*) main::msg#2 ← phi( main::@6/(const byte[]) MESSAGE#0 main::@2/(byte*) main::msg#1 )
  [9] if((byte) 0!=*((byte*) main::msg#2)) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@1 main::@4 main::@5
  [10] if(*((const byte*) RASTER#0)==(byte) $36) goto main::@4
  to:main::@7
main::@7: scope:[main]  from main::@3
  [11] if(*((const byte*) RASTER#0)==(byte) $42) goto main::@4
  to:main::@5
main::@5: scope:[main]  from main::@7
  [12] *((const byte*) BGCOL#0) ← (const byte) BLACK#0
  to:main::@3
main::@4: scope:[main]  from main::@3 main::@7
  [13] *((const byte*) BGCOL#0) ← (const byte) WHITE#0
  to:main::@3
main::@2: scope:[main]  from main::@1
  [14] *((byte*) main::sc#2) ← *((byte*) main::msg#2)
  [15] (byte*) main::sc#1 ← ++ (byte*) main::sc#2
  [16] (byte*) main::msg#1 ← ++ (byte*) main::msg#2
  to:main::@1
memset: scope:[memset]  from main main::@6
  [17] (byte) memset::c#4 ← phi( main/(byte) ' ' main::@6/(const byte) WHITE#0 )
  [17] (void*) memset::str#3 ← phi( main/(void*)(const byte*) SCREEN#0 main::@6/(void*)(const byte*) COLS#0 )
  [17] (word) memset::num#2 ← phi( main/(word)(number) $28*(number) $19 main::@6/(word)(number) $28*(number) $19 )
  [18] if((word) memset::num#2<=(byte) 0) goto memset::@return
  to:memset::@1
memset::@1: scope:[memset]  from memset
  [19] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2
  [20] (byte*~) memset::dst#4 ← (byte*)(void*) memset::str#3
  to:memset::@2
memset::@2: scope:[memset]  from memset::@1 memset::@3
  [21] (byte*) memset::dst#2 ← phi( memset::@1/(byte*~) memset::dst#4 memset::@3/(byte*) memset::dst#1 )
  [22] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3
  to:memset::@return
memset::@return: scope:[memset]  from memset memset::@2
  [23] return 
  to:@return
memset::@3: scope:[memset]  from memset::@2
  [24] *((byte*) memset::dst#2) ← (byte) memset::c#4
  [25] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
  to:memset::@2
syscall2: scope:[syscall2]  from
  [26] *((const byte*) SCREEN#0+(byte) $4e) ← (byte) '<'
  to:syscall2::@return
syscall2::@return: scope:[syscall2]  from syscall2
  [27] return 
  to:@return
syscall1: scope:[syscall1]  from
  [28] *((const byte*) SCREEN#0+(byte) $4f) ← (byte) '>'
  to:syscall1::@return
syscall1::@return: scope:[syscall1]  from syscall1
  [29] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte*) BGCOL
(byte) BLACK
(byte*) COLS
(byte) JMP
(byte[]) MESSAGE
(byte) NOP
(byte*) RASTER
(byte*) SCREEN
(struct SysCall[]) SYSCALLS
(struct SysCall[]) SYSCALL_RESET
(void()*) SysCall::syscall
(byte) SysCall::xjmp
(byte) SysCall::xnop
(byte*) VIC_MEMORY
(byte) WHITE
(void()) main()
(byte*) main::msg
(byte*) main::msg#1 22.0
(byte*) main::msg#2 11.0
(byte*) main::sc
(byte*) main::sc#1 11.0
(byte*) main::sc#2 11.0
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(byte) memset::c
(byte) memset::c#4 1.375
(byte*) memset::dst
(byte*) memset::dst#1 22.0
(byte*) memset::dst#2 15.333333333333332
(byte*~) memset::dst#4 4.0
(byte*) memset::end
(byte*) memset::end#0 2.1666666666666665
(word) memset::num
(word) memset::num#2 2.0
(void*) memset::return
(void*) memset::str
(void*) memset::str#3
(void()) syscall1()
(void()) syscall2()

Initial phi equivalence classes
[ main::msg#2 main::msg#1 ]
[ main::sc#2 main::sc#1 ]
[ memset::num#2 ]
[ memset::str#3 ]
[ memset::c#4 ]
[ memset::dst#2 memset::dst#4 memset::dst#1 ]
Added variable memset::end#0 to zero page equivalence class [ memset::end#0 ]
Complete equivalence classes
[ main::msg#2 main::msg#1 ]
[ main::sc#2 main::sc#1 ]
[ memset::num#2 ]
[ memset::str#3 ]
[ memset::c#4 ]
[ memset::dst#2 memset::dst#4 memset::dst#1 ]
[ memset::end#0 ]
Allocated zp ZP_WORD:2 [ main::msg#2 main::msg#1 ]
Allocated zp ZP_WORD:4 [ main::sc#2 main::sc#1 ]
Allocated zp ZP_WORD:6 [ memset::num#2 ]
Allocated zp ZP_WORD:8 [ memset::str#3 ]
Allocated zp ZP_BYTE:10 [ memset::c#4 ]
Allocated zp ZP_WORD:11 [ memset::dst#2 memset::dst#4 memset::dst#1 ]
Allocated zp ZP_WORD:13 [ memset::end#0 ]

INITIAL ASM
Target platform is custom
  // File Comments
// XMega65 Kernal Development Template
// Each function of the kernal is a no-args function
// The functions are placed in the SYSCALLS table surrounded by JMP and NOP
  // Upstart
  .file [name="xmega65.bin", type="bin", segments="XMega65Bin"]
.segmentdef XMega65Bin [segments="Syscall, Code, Data, Stack, Zeropage"]
.segmentdef Syscall [start=$8000, max=$81ff]
.segmentdef Code [start=$8200, min=$8200, max=$bdff]
.segmentdef Data [startAfter="Code", min=$8200, max=$bdff]
.segmentdef Stack [min=$be00, max=$beff, fill]
.segmentdef Zeropage [min=$bf00, max=$bfff, fill]
  // Global Constants & labels
  .label RASTER = $d012
  .label VIC_MEMORY = $d018
  .label SCREEN = $400
  .label BGCOL = $d021
  .label COLS = $d800
  .const BLACK = 0
  .const WHITE = 1
  .const JMP = $4c
  .const NOP = $ea
  // @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:
.segment Code
  // main
main: {
    .label sc = 4
    .label msg = 2
    // [4] *((const byte*) VIC_MEMORY#0) ← (byte) $14 -- _deref_pbuc1=vbuc2 
    // Initialize screen memory
    lda #$14
    sta VIC_MEMORY
    // [5] call memset 
    // [17] phi from main to memset [phi:main->memset]
  memset_from_main:
    // [17] phi (byte) memset::c#4 = (byte) ' ' [phi:main->memset#0] -- vbuz1=vbuc1 
    lda #' '
    sta.z memset.c
    // [17] phi (void*) memset::str#3 = (void*)(const byte*) SCREEN#0 [phi:main->memset#1] -- pvoz1=pvoc1 
    lda #<SCREEN
    sta.z memset.str
    lda #>SCREEN
    sta.z memset.str+1
    // [17] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [6] phi from main to main::@6 [phi:main->main::@6]
  b6_from_main:
    jmp b6
    // main::@6
  b6:
    // [7] call memset 
    // [17] phi from main::@6 to memset [phi:main::@6->memset]
  memset_from_b6:
    // [17] phi (byte) memset::c#4 = (const byte) WHITE#0 [phi:main::@6->memset#0] -- vbuz1=vbuc1 
    lda #WHITE
    sta.z memset.c
    // [17] phi (void*) memset::str#3 = (void*)(const byte*) COLS#0 [phi:main::@6->memset#1] -- pvoz1=pvoc1 
    lda #<COLS
    sta.z memset.str
    lda #>COLS
    sta.z memset.str+1
    // [17] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@6->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [8] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
  b1_from_b6:
    // [8] phi (byte*) main::sc#2 = (const byte*) SCREEN#0+(byte) $28 [phi:main::@6->main::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN+$28
    sta.z sc
    lda #>SCREEN+$28
    sta.z sc+1
    // [8] phi (byte*) main::msg#2 = (const byte[]) MESSAGE#0 [phi:main::@6->main::@1#1] -- pbuz1=pbuc1 
    lda #<MESSAGE
    sta.z msg
    lda #>MESSAGE
    sta.z msg+1
    jmp b1
    // main::@1
  b1:
    // [9] if((byte) 0!=*((byte*) main::msg#2)) goto main::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (msg),y
    cmp #0
    bne b2
    jmp b3
    // main::@3
  b3:
    // [10] if(*((const byte*) RASTER#0)==(byte) $36) goto main::@4 -- _deref_pbuc1_eq_vbuc2_then_la1 
    lda #$36
    cmp RASTER
    beq b4
    jmp b7
    // main::@7
  b7:
    // [11] if(*((const byte*) RASTER#0)==(byte) $42) goto main::@4 -- _deref_pbuc1_eq_vbuc2_then_la1 
    lda #$42
    cmp RASTER
    beq b4
    jmp b5
    // main::@5
  b5:
    // [12] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL
    jmp b3
    // main::@4
  b4:
    // [13] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BGCOL
    jmp b3
    // main::@2
  b2:
    // [14] *((byte*) main::sc#2) ← *((byte*) main::msg#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (msg),y
    ldy #0
    sta (sc),y
    // [15] (byte*) main::sc#1 ← ++ (byte*) main::sc#2 -- pbuz1=_inc_pbuz1 
    inc.z sc
    bne !+
    inc.z sc+1
  !:
    // [16] (byte*) main::msg#1 ← ++ (byte*) main::msg#2 -- pbuz1=_inc_pbuz1 
    inc.z msg
    bne !+
    inc.z msg+1
  !:
    // [8] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  b1_from_b2:
    // [8] phi (byte*) main::sc#2 = (byte*) main::sc#1 [phi:main::@2->main::@1#0] -- register_copy 
    // [8] phi (byte*) main::msg#2 = (byte*) main::msg#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp b1
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zeropage(8) str, byte zeropage($a) c, word zeropage(6) num)
memset: {
    .label end = $d
    .label dst = $b
    .label num = 6
    .label str = 8
    .label c = $a
    // [18] if((word) memset::num#2<=(byte) 0) goto memset::@return -- vwuz1_le_0_then_la1 
    lda.z num
    bne !+
    lda.z num+1
    beq breturn
  !:
    jmp b1
    // memset::@1
  b1:
    // [19] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 -- pbuz1=pbuz2_plus_vwuz3 
    lda.z str
    clc
    adc.z num
    sta.z end
    lda.z str+1
    adc.z num+1
    sta.z end+1
    // [20] (byte*~) memset::dst#4 ← (byte*)(void*) memset::str#3 -- pbuz1=pbuz2 
    lda.z str
    sta.z dst
    lda.z str+1
    sta.z dst+1
    // [21] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
  b2_from_b1:
  b2_from_b3:
    // [21] phi (byte*) memset::dst#2 = (byte*~) memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    jmp b2
    // memset::@2
  b2:
    // [22] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 
    lda.z dst+1
    cmp.z end+1
    bne b3
    lda.z dst
    cmp.z end
    bne b3
    jmp breturn
    // memset::@return
  breturn:
    // [23] return 
    rts
    // memset::@3
  b3:
    // [24] *((byte*) memset::dst#2) ← (byte) memset::c#4 -- _deref_pbuz1=vbuz2 
    lda.z c
    ldy #0
    sta (dst),y
    // [25] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp b2_from_b3
}
  // syscall2
syscall2: {
    // [26] *((const byte*) SCREEN#0+(byte) $4e) ← (byte) '<' -- _deref_pbuc1=vbuc2 
    lda #'<'
    sta SCREEN+$4e
    jmp breturn
    // syscall2::@return
  breturn:
    // [27] return 
    rts
}
  // syscall1
syscall1: {
    // [28] *((const byte*) SCREEN#0+(byte) $4f) ← (byte) '>' -- _deref_pbuc1=vbuc2 
    lda #'>'
    sta SCREEN+$4f
    jmp breturn
    // syscall1::@return
  breturn:
    // [29] return 
    rts
}
  // File Data
.segment Data
  MESSAGE: .text "hello world!"
  .byte 0
.segment Syscall
SYSCALLS:
  .byte JMP
  .word syscall1
  .byte NOP
  .byte JMP
  .word syscall2
  .byte NOP
  .align $100
SYSCALL_RESET:
  .byte JMP
  .word main
  .byte NOP

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) VIC_MEMORY#0) ← (byte) $14 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [9] if((byte) 0!=*((byte*) main::msg#2)) goto main::@2 [ main::msg#2 main::sc#2 ] (  [ main::msg#2 main::sc#2 ] main:2 [ main::msg#2 main::sc#2 ] ) always clobbers reg byte a reg byte y 
Statement [10] if(*((const byte*) RASTER#0)==(byte) $36) goto main::@4 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [11] if(*((const byte*) RASTER#0)==(byte) $42) goto main::@4 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [12] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [13] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [14] *((byte*) main::sc#2) ← *((byte*) main::msg#2) [ main::msg#2 main::sc#2 ] (  [ main::msg#2 main::sc#2 ] main:2 [ main::msg#2 main::sc#2 ] ) always clobbers reg byte a reg byte y 
Statement [18] if((word) memset::num#2<=(byte) 0) goto memset::@return [ memset::num#2 memset::str#3 memset::c#4 ] ( memset:5 [ memset::num#2 memset::str#3 memset::c#4 ] main:2::memset:5 [ memset::num#2 memset::str#3 memset::c#4 ] memset:7 [ memset::num#2 memset::str#3 memset::c#4 ] main:2::memset:7 [ memset::num#2 memset::str#3 memset::c#4 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:10 [ memset::c#4 ]
Statement [19] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 [ memset::str#3 memset::c#4 memset::end#0 ] ( memset:5 [ memset::str#3 memset::c#4 memset::end#0 ] main:2::memset:5 [ memset::str#3 memset::c#4 memset::end#0 ] memset:7 [ memset::str#3 memset::c#4 memset::end#0 ] main:2::memset:7 [ memset::str#3 memset::c#4 memset::end#0 ] ) always clobbers reg byte a 
Statement [20] (byte*~) memset::dst#4 ← (byte*)(void*) memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( memset:5 [ memset::c#4 memset::end#0 memset::dst#4 ] main:2::memset:5 [ memset::c#4 memset::end#0 memset::dst#4 ] memset:7 [ memset::c#4 memset::end#0 memset::dst#4 ] main:2::memset:7 [ memset::c#4 memset::end#0 memset::dst#4 ] ) always clobbers reg byte a 
Statement [22] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( memset:5 [ memset::c#4 memset::end#0 memset::dst#2 ] main:2::memset:5 [ memset::c#4 memset::end#0 memset::dst#2 ] memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] main:2::memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a 
Statement [24] *((byte*) memset::dst#2) ← (byte) memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( memset:5 [ memset::c#4 memset::end#0 memset::dst#2 ] main:2::memset:5 [ memset::c#4 memset::end#0 memset::dst#2 ] memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] main:2::memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:10 [ memset::c#4 ]
Statement [26] *((const byte*) SCREEN#0+(byte) $4e) ← (byte) '<' [ ] (  [ ] ) always clobbers reg byte a 
Statement [28] *((const byte*) SCREEN#0+(byte) $4f) ← (byte) '>' [ ] (  [ ] ) always clobbers reg byte a 
Statement [4] *((const byte*) VIC_MEMORY#0) ← (byte) $14 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [9] if((byte) 0!=*((byte*) main::msg#2)) goto main::@2 [ main::msg#2 main::sc#2 ] (  [ main::msg#2 main::sc#2 ] main:2 [ main::msg#2 main::sc#2 ] ) always clobbers reg byte a reg byte y 
Statement [10] if(*((const byte*) RASTER#0)==(byte) $36) goto main::@4 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [11] if(*((const byte*) RASTER#0)==(byte) $42) goto main::@4 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [12] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [13] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 [ ] (  [ ] main:2 [ ] ) always clobbers reg byte a 
Statement [14] *((byte*) main::sc#2) ← *((byte*) main::msg#2) [ main::msg#2 main::sc#2 ] (  [ main::msg#2 main::sc#2 ] main:2 [ main::msg#2 main::sc#2 ] ) always clobbers reg byte a reg byte y 
Statement [18] if((word) memset::num#2<=(byte) 0) goto memset::@return [ memset::num#2 memset::str#3 memset::c#4 ] ( memset:5 [ memset::num#2 memset::str#3 memset::c#4 ] main:2::memset:5 [ memset::num#2 memset::str#3 memset::c#4 ] memset:7 [ memset::num#2 memset::str#3 memset::c#4 ] main:2::memset:7 [ memset::num#2 memset::str#3 memset::c#4 ] ) always clobbers reg byte a 
Statement [19] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 [ memset::str#3 memset::c#4 memset::end#0 ] ( memset:5 [ memset::str#3 memset::c#4 memset::end#0 ] main:2::memset:5 [ memset::str#3 memset::c#4 memset::end#0 ] memset:7 [ memset::str#3 memset::c#4 memset::end#0 ] main:2::memset:7 [ memset::str#3 memset::c#4 memset::end#0 ] ) always clobbers reg byte a 
Statement [20] (byte*~) memset::dst#4 ← (byte*)(void*) memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( memset:5 [ memset::c#4 memset::end#0 memset::dst#4 ] main:2::memset:5 [ memset::c#4 memset::end#0 memset::dst#4 ] memset:7 [ memset::c#4 memset::end#0 memset::dst#4 ] main:2::memset:7 [ memset::c#4 memset::end#0 memset::dst#4 ] ) always clobbers reg byte a 
Statement [22] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( memset:5 [ memset::c#4 memset::end#0 memset::dst#2 ] main:2::memset:5 [ memset::c#4 memset::end#0 memset::dst#2 ] memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] main:2::memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a 
Statement [24] *((byte*) memset::dst#2) ← (byte) memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( memset:5 [ memset::c#4 memset::end#0 memset::dst#2 ] main:2::memset:5 [ memset::c#4 memset::end#0 memset::dst#2 ] memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] main:2::memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a reg byte y 
Statement [26] *((const byte*) SCREEN#0+(byte) $4e) ← (byte) '<' [ ] (  [ ] ) always clobbers reg byte a 
Statement [28] *((const byte*) SCREEN#0+(byte) $4f) ← (byte) '>' [ ] (  [ ] ) always clobbers reg byte a 
Potential registers zp ZP_WORD:2 [ main::msg#2 main::msg#1 ] : zp ZP_WORD:2 , 
Potential registers zp ZP_WORD:4 [ main::sc#2 main::sc#1 ] : zp ZP_WORD:4 , 
Potential registers zp ZP_WORD:6 [ memset::num#2 ] : zp ZP_WORD:6 , 
Potential registers zp ZP_WORD:8 [ memset::str#3 ] : zp ZP_WORD:8 , 
Potential registers zp ZP_BYTE:10 [ memset::c#4 ] : zp ZP_BYTE:10 , reg byte x , 
Potential registers zp ZP_WORD:11 [ memset::dst#2 memset::dst#4 memset::dst#1 ] : zp ZP_WORD:11 , 
Potential registers zp ZP_WORD:13 [ memset::end#0 ] : zp ZP_WORD:13 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 33: zp ZP_WORD:2 [ main::msg#2 main::msg#1 ] 22: zp ZP_WORD:4 [ main::sc#2 main::sc#1 ] 
Uplift Scope [memset] 41.33: zp ZP_WORD:11 [ memset::dst#2 memset::dst#4 memset::dst#1 ] 2.17: zp ZP_WORD:13 [ memset::end#0 ] 2: zp ZP_WORD:6 [ memset::num#2 ] 1.38: zp ZP_BYTE:10 [ memset::c#4 ] 0: zp ZP_WORD:8 [ memset::str#3 ] 
Uplift Scope [syscall1] 
Uplift Scope [syscall2] 
Uplift Scope [SysCall] 
Uplift Scope [] 

Uplifting [main] best 1885 combination zp ZP_WORD:2 [ main::msg#2 main::msg#1 ] zp ZP_WORD:4 [ main::sc#2 main::sc#1 ] 
Uplifting [memset] best 1869 combination zp ZP_WORD:11 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp ZP_WORD:13 [ memset::end#0 ] zp ZP_WORD:6 [ memset::num#2 ] reg byte x [ memset::c#4 ] zp ZP_WORD:8 [ memset::str#3 ] 
Uplifting [syscall1] best 1869 combination 
Uplifting [syscall2] best 1869 combination 
Uplifting [SysCall] best 1869 combination 
Uplifting [] best 1869 combination 
Coalescing zero page register [ zp ZP_WORD:6 [ memset::num#2 ] ] with [ zp ZP_WORD:13 [ memset::end#0 ] ] - score: 1
Coalescing zero page register [ zp ZP_WORD:8 [ memset::str#3 ] ] with [ zp ZP_WORD:11 [ memset::dst#2 memset::dst#4 memset::dst#1 ] ] - score: 1
Coalescing zero page register [ zp ZP_WORD:6 [ memset::num#2 memset::end#0 ] ] with [ zp ZP_WORD:2 [ main::msg#2 main::msg#1 ] ]
Coalescing zero page register [ zp ZP_WORD:8 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 ] ] with [ zp ZP_WORD:4 [ main::sc#2 main::sc#1 ] ]
Allocated (was zp ZP_WORD:6) zp ZP_WORD:2 [ memset::num#2 memset::end#0 main::msg#2 main::msg#1 ]
Allocated (was zp ZP_WORD:8) zp ZP_WORD:4 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 main::sc#2 main::sc#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// XMega65 Kernal Development Template
// Each function of the kernal is a no-args function
// The functions are placed in the SYSCALLS table surrounded by JMP and NOP
  // Upstart
  .file [name="xmega65.bin", type="bin", segments="XMega65Bin"]
.segmentdef XMega65Bin [segments="Syscall, Code, Data, Stack, Zeropage"]
.segmentdef Syscall [start=$8000, max=$81ff]
.segmentdef Code [start=$8200, min=$8200, max=$bdff]
.segmentdef Data [startAfter="Code", min=$8200, max=$bdff]
.segmentdef Stack [min=$be00, max=$beff, fill]
.segmentdef Zeropage [min=$bf00, max=$bfff, fill]
  // Global Constants & labels
  .label RASTER = $d012
  .label VIC_MEMORY = $d018
  .label SCREEN = $400
  .label BGCOL = $d021
  .label COLS = $d800
  .const BLACK = 0
  .const WHITE = 1
  .const JMP = $4c
  .const NOP = $ea
  // @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:
.segment Code
  // main
main: {
    .label sc = 4
    .label msg = 2
    // [4] *((const byte*) VIC_MEMORY#0) ← (byte) $14 -- _deref_pbuc1=vbuc2 
    // Initialize screen memory
    lda #$14
    sta VIC_MEMORY
    // [5] call memset 
    // [17] phi from main to memset [phi:main->memset]
  memset_from_main:
    // [17] phi (byte) memset::c#4 = (byte) ' ' [phi:main->memset#0] -- vbuxx=vbuc1 
    ldx #' '
    // [17] phi (void*) memset::str#3 = (void*)(const byte*) SCREEN#0 [phi:main->memset#1] -- pvoz1=pvoc1 
    lda #<SCREEN
    sta.z memset.str
    lda #>SCREEN
    sta.z memset.str+1
    // [17] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [6] phi from main to main::@6 [phi:main->main::@6]
  b6_from_main:
    jmp b6
    // main::@6
  b6:
    // [7] call memset 
    // [17] phi from main::@6 to memset [phi:main::@6->memset]
  memset_from_b6:
    // [17] phi (byte) memset::c#4 = (const byte) WHITE#0 [phi:main::@6->memset#0] -- vbuxx=vbuc1 
    ldx #WHITE
    // [17] phi (void*) memset::str#3 = (void*)(const byte*) COLS#0 [phi:main::@6->memset#1] -- pvoz1=pvoc1 
    lda #<COLS
    sta.z memset.str
    lda #>COLS
    sta.z memset.str+1
    // [17] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@6->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [8] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
  b1_from_b6:
    // [8] phi (byte*) main::sc#2 = (const byte*) SCREEN#0+(byte) $28 [phi:main::@6->main::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN+$28
    sta.z sc
    lda #>SCREEN+$28
    sta.z sc+1
    // [8] phi (byte*) main::msg#2 = (const byte[]) MESSAGE#0 [phi:main::@6->main::@1#1] -- pbuz1=pbuc1 
    lda #<MESSAGE
    sta.z msg
    lda #>MESSAGE
    sta.z msg+1
    jmp b1
    // main::@1
  b1:
    // [9] if((byte) 0!=*((byte*) main::msg#2)) goto main::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (msg),y
    cmp #0
    bne b2
    jmp b3
    // main::@3
  b3:
    // [10] if(*((const byte*) RASTER#0)==(byte) $36) goto main::@4 -- _deref_pbuc1_eq_vbuc2_then_la1 
    lda #$36
    cmp RASTER
    beq b4
    jmp b7
    // main::@7
  b7:
    // [11] if(*((const byte*) RASTER#0)==(byte) $42) goto main::@4 -- _deref_pbuc1_eq_vbuc2_then_la1 
    lda #$42
    cmp RASTER
    beq b4
    jmp b5
    // main::@5
  b5:
    // [12] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL
    jmp b3
    // main::@4
  b4:
    // [13] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BGCOL
    jmp b3
    // main::@2
  b2:
    // [14] *((byte*) main::sc#2) ← *((byte*) main::msg#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (msg),y
    ldy #0
    sta (sc),y
    // [15] (byte*) main::sc#1 ← ++ (byte*) main::sc#2 -- pbuz1=_inc_pbuz1 
    inc.z sc
    bne !+
    inc.z sc+1
  !:
    // [16] (byte*) main::msg#1 ← ++ (byte*) main::msg#2 -- pbuz1=_inc_pbuz1 
    inc.z msg
    bne !+
    inc.z msg+1
  !:
    // [8] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  b1_from_b2:
    // [8] phi (byte*) main::sc#2 = (byte*) main::sc#1 [phi:main::@2->main::@1#0] -- register_copy 
    // [8] phi (byte*) main::msg#2 = (byte*) main::msg#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp b1
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zeropage(4) str, byte register(X) c, word zeropage(2) num)
memset: {
    .label end = 2
    .label dst = 4
    .label num = 2
    .label str = 4
    // [18] if((word) memset::num#2<=(byte) 0) goto memset::@return -- vwuz1_le_0_then_la1 
    lda.z num
    bne !+
    lda.z num+1
    beq breturn
  !:
    jmp b1
    // memset::@1
  b1:
    // [19] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 -- pbuz1=pbuz2_plus_vwuz1 
    lda.z end
    clc
    adc.z str
    sta.z end
    lda.z end+1
    adc.z str+1
    sta.z end+1
    // [20] (byte*~) memset::dst#4 ← (byte*)(void*) memset::str#3
    // [21] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
  b2_from_b1:
  b2_from_b3:
    // [21] phi (byte*) memset::dst#2 = (byte*~) memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    jmp b2
    // memset::@2
  b2:
    // [22] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 
    lda.z dst+1
    cmp.z end+1
    bne b3
    lda.z dst
    cmp.z end
    bne b3
    jmp breturn
    // memset::@return
  breturn:
    // [23] return 
    rts
    // memset::@3
  b3:
    // [24] *((byte*) memset::dst#2) ← (byte) memset::c#4 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (dst),y
    // [25] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp b2_from_b3
}
  // syscall2
syscall2: {
    // [26] *((const byte*) SCREEN#0+(byte) $4e) ← (byte) '<' -- _deref_pbuc1=vbuc2 
    lda #'<'
    sta SCREEN+$4e
    jmp breturn
    // syscall2::@return
  breturn:
    // [27] return 
    rts
}
  // syscall1
syscall1: {
    // [28] *((const byte*) SCREEN#0+(byte) $4f) ← (byte) '>' -- _deref_pbuc1=vbuc2 
    lda #'>'
    sta SCREEN+$4f
    jmp breturn
    // syscall1::@return
  breturn:
    // [29] return 
    rts
}
  // File Data
.segment Data
  MESSAGE: .text "hello world!"
  .byte 0
.segment Syscall
SYSCALLS:
  .byte JMP
  .word syscall1
  .byte NOP
  .byte JMP
  .word syscall2
  .byte NOP
  .align $100
SYSCALL_RESET:
  .byte JMP
  .word main
  .byte NOP

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b6
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp b7
Removing instruction jmp b5
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp breturn
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b2_from_b3 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction bend_from_b1:
Removing instruction b6_from_main:
Removing instruction memset_from_b6:
Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bbegin:
Removing instruction bend:
Removing instruction memset_from_main:
Removing instruction b6:
Removing instruction b1_from_b6:
Removing instruction b7:
Removing instruction b5:
Removing instruction b1_from_b2:
Removing instruction b1:
Removing instruction breturn:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) BGCOL
(const byte*) BGCOL#0 BGCOL = (byte*) 53281
(byte) BLACK
(const byte) BLACK#0 BLACK = (byte) 0
(byte*) COLS
(const byte*) COLS#0 COLS = (byte*) 55296
(byte) JMP
(const byte) JMP#0 JMP = (byte) $4c
(byte[]) MESSAGE
(const byte[]) MESSAGE#0 MESSAGE = (string) "hello world!"
(byte) NOP
(const byte) NOP#0 NOP = (byte) $ea
(byte*) RASTER
(const byte*) RASTER#0 RASTER = (byte*) 53266
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
(struct SysCall[]) SYSCALLS
(const struct SysCall[]) SYSCALLS#0 SYSCALLS = { { xjmp: (const byte) JMP#0, syscall: &(void()) syscall1(), xnop: (const byte) NOP#0 }, { xjmp: (const byte) JMP#0, syscall: &(void()) syscall2(), xnop: (const byte) NOP#0 } }
(struct SysCall[]) SYSCALL_RESET
(const struct SysCall[]) SYSCALL_RESET#0 SYSCALL_RESET = { { xjmp: (const byte) JMP#0, syscall: &(void()) main(), xnop: (const byte) NOP#0 } }
(void()*) SysCall::syscall
(byte) SysCall::xjmp
(byte) SysCall::xnop
(byte*) VIC_MEMORY
(const byte*) VIC_MEMORY#0 VIC_MEMORY = (byte*) 53272
(byte) WHITE
(const byte) WHITE#0 WHITE = (byte) 1
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(byte*) main::msg
(byte*) main::msg#1 msg zp ZP_WORD:2 22.0
(byte*) main::msg#2 msg zp ZP_WORD:2 11.0
(byte*) main::sc
(byte*) main::sc#1 sc zp ZP_WORD:4 11.0
(byte*) main::sc#2 sc zp ZP_WORD:4 11.0
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(label) memset::@1
(label) memset::@2
(label) memset::@3
(label) memset::@return
(byte) memset::c
(byte) memset::c#4 reg byte x 1.375
(byte*) memset::dst
(byte*) memset::dst#1 dst zp ZP_WORD:4 22.0
(byte*) memset::dst#2 dst zp ZP_WORD:4 15.333333333333332
(byte*~) memset::dst#4 dst zp ZP_WORD:4 4.0
(byte*) memset::end
(byte*) memset::end#0 end zp ZP_WORD:2 2.1666666666666665
(word) memset::num
(word) memset::num#2 num zp ZP_WORD:2 2.0
(void*) memset::return
(void*) memset::str
(void*) memset::str#3 str zp ZP_WORD:4
(void()) syscall1()
(label) syscall1::@return
(void()) syscall2()
(label) syscall2::@return

zp ZP_WORD:2 [ memset::num#2 memset::end#0 main::msg#2 main::msg#1 ]
zp ZP_WORD:4 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 main::sc#2 main::sc#1 ]
reg byte x [ memset::c#4 ]


FINAL ASSEMBLER
Score: 1633

  // File Comments
// XMega65 Kernal Development Template
// Each function of the kernal is a no-args function
// The functions are placed in the SYSCALLS table surrounded by JMP and NOP
  // Upstart
  .file [name="xmega65.bin", type="bin", segments="XMega65Bin"]
.segmentdef XMega65Bin [segments="Syscall, Code, Data, Stack, Zeropage"]
.segmentdef Syscall [start=$8000, max=$81ff]
.segmentdef Code [start=$8200, min=$8200, max=$bdff]
.segmentdef Data [startAfter="Code", min=$8200, max=$bdff]
.segmentdef Stack [min=$be00, max=$beff, fill]
.segmentdef Zeropage [min=$bf00, max=$bfff, fill]
  // Global Constants & labels
  .label RASTER = $d012
  .label VIC_MEMORY = $d018
  .label SCREEN = $400
  .label BGCOL = $d021
  .label COLS = $d800
  .const BLACK = 0
  .const WHITE = 1
  .const JMP = $4c
  .const NOP = $ea
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
.segment Code
  // main
main: {
    .label sc = 4
    .label msg = 2
    // *VIC_MEMORY = 0x14
    // [4] *((const byte*) VIC_MEMORY#0) ← (byte) $14 -- _deref_pbuc1=vbuc2 
    // Initialize screen memory
    lda #$14
    sta VIC_MEMORY
    // memset(SCREEN, ' ', 40*25)
    // [5] call memset 
    // [17] phi from main to memset [phi:main->memset]
    // [17] phi (byte) memset::c#4 = (byte) ' ' [phi:main->memset#0] -- vbuxx=vbuc1 
    ldx #' '
    // [17] phi (void*) memset::str#3 = (void*)(const byte*) SCREEN#0 [phi:main->memset#1] -- pvoz1=pvoc1 
    lda #<SCREEN
    sta.z memset.str
    lda #>SCREEN
    sta.z memset.str+1
    // [17] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [6] phi from main to main::@6 [phi:main->main::@6]
    // main::@6
    // memset(COLS, WHITE, 40*25)
    // [7] call memset 
    // [17] phi from main::@6 to memset [phi:main::@6->memset]
    // [17] phi (byte) memset::c#4 = (const byte) WHITE#0 [phi:main::@6->memset#0] -- vbuxx=vbuc1 
    ldx #WHITE
    // [17] phi (void*) memset::str#3 = (void*)(const byte*) COLS#0 [phi:main::@6->memset#1] -- pvoz1=pvoc1 
    lda #<COLS
    sta.z memset.str
    lda #>COLS
    sta.z memset.str+1
    // [17] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@6->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [8] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
    // [8] phi (byte*) main::sc#2 = (const byte*) SCREEN#0+(byte) $28 [phi:main::@6->main::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN+$28
    sta.z sc
    lda #>SCREEN+$28
    sta.z sc+1
    // [8] phi (byte*) main::msg#2 = (const byte[]) MESSAGE#0 [phi:main::@6->main::@1#1] -- pbuz1=pbuc1 
    lda #<MESSAGE
    sta.z msg
    lda #>MESSAGE
    sta.z msg+1
    // main::@1
  b1:
    // while(*msg)
    // [9] if((byte) 0!=*((byte*) main::msg#2)) goto main::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (msg),y
    cmp #0
    bne b2
    // main::@3
  b3:
    // if(*RASTER==54 || *RASTER==66)
    // [10] if(*((const byte*) RASTER#0)==(byte) $36) goto main::@4 -- _deref_pbuc1_eq_vbuc2_then_la1 
    lda #$36
    cmp RASTER
    beq b4
    // main::@7
    // [11] if(*((const byte*) RASTER#0)==(byte) $42) goto main::@4 -- _deref_pbuc1_eq_vbuc2_then_la1 
    lda #$42
    cmp RASTER
    beq b4
    // main::@5
    // *BGCOL = BLACK
    // [12] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL
    jmp b3
    // main::@4
  b4:
    // *BGCOL = WHITE
    // [13] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BGCOL
    jmp b3
    // main::@2
  b2:
    // *sc++ = *msg++
    // [14] *((byte*) main::sc#2) ← *((byte*) main::msg#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (msg),y
    sta (sc),y
    // *sc++ = *msg++;
    // [15] (byte*) main::sc#1 ← ++ (byte*) main::sc#2 -- pbuz1=_inc_pbuz1 
    inc.z sc
    bne !+
    inc.z sc+1
  !:
    // [16] (byte*) main::msg#1 ← ++ (byte*) main::msg#2 -- pbuz1=_inc_pbuz1 
    inc.z msg
    bne !+
    inc.z msg+1
  !:
    // [8] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
    // [8] phi (byte*) main::sc#2 = (byte*) main::sc#1 [phi:main::@2->main::@1#0] -- register_copy 
    // [8] phi (byte*) main::msg#2 = (byte*) main::msg#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp b1
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zeropage(4) str, byte register(X) c, word zeropage(2) num)
memset: {
    .label end = 2
    .label dst = 4
    .label num = 2
    .label str = 4
    // if(num>0)
    // [18] if((word) memset::num#2<=(byte) 0) goto memset::@return -- vwuz1_le_0_then_la1 
    lda.z num
    bne !+
    lda.z num+1
    beq breturn
  !:
    // memset::@1
    // end = (char*)str + num
    // [19] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 -- pbuz1=pbuz2_plus_vwuz1 
    lda.z end
    clc
    adc.z str
    sta.z end
    lda.z end+1
    adc.z str+1
    sta.z end+1
    // [20] (byte*~) memset::dst#4 ← (byte*)(void*) memset::str#3
    // [21] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
    // [21] phi (byte*) memset::dst#2 = (byte*~) memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    // memset::@2
  b2:
    // for(char* dst = str; dst!=end; dst++)
    // [22] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 
    lda.z dst+1
    cmp.z end+1
    bne b3
    lda.z dst
    cmp.z end
    bne b3
    // memset::@return
  breturn:
    // }
    // [23] return 
    rts
    // memset::@3
  b3:
    // *dst = c
    // [24] *((byte*) memset::dst#2) ← (byte) memset::c#4 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (dst),y
    // for(char* dst = str; dst!=end; dst++)
    // [25] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp b2
}
  // syscall2
syscall2: {
    // *(SCREEN+78) = '<'
    // [26] *((const byte*) SCREEN#0+(byte) $4e) ← (byte) '<' -- _deref_pbuc1=vbuc2 
    lda #'<'
    sta SCREEN+$4e
    // syscall2::@return
    // }
    // [27] return 
    rts
}
  // syscall1
syscall1: {
    // *(SCREEN+79) = '>'
    // [28] *((const byte*) SCREEN#0+(byte) $4f) ← (byte) '>' -- _deref_pbuc1=vbuc2 
    lda #'>'
    sta SCREEN+$4f
    // syscall1::@return
    // }
    // [29] return 
    rts
}
  // File Data
.segment Data
  MESSAGE: .text "hello world!"
  .byte 0
.segment Syscall
SYSCALLS:
  .byte JMP
  .word syscall1
  .byte NOP
  .byte JMP
  .word syscall2
  .byte NOP
  .align $100
SYSCALL_RESET:
  .byte JMP
  .word main
  .byte NOP

