Inlined call vicSelectGfxBank::$0 = call toDd00(vicSelectGfxBank::gfx)
Inlined call call __init
Eliminating unused variable with no statement memset::$2
Eliminating unused variable with no statement main::$1
Eliminating unused variable with no statement main::$5
Eliminating unused variable with no statement main::$6

CONTROL FLOW GRAPH SSA

void * memset(void *str , char c , unsigned int num)
memset: scope:[memset]  from main
  memset::c#4 = phi( main/memset::c#0 )
  memset::str#3 = phi( main/memset::str#0 )
  memset::num#1 = phi( main/memset::num#0 )
  memset::$0 = memset::num#1 > 0
  memset::$1 = ! memset::$0
  if(memset::$1) goto memset::@1
  to:memset::@2
memset::@1: scope:[memset]  from memset memset::@3
  memset::str#1 = phi( memset/memset::str#3, memset::@3/memset::str#4 )
  memset::return#0 = memset::str#1
  to:memset::@return
memset::@2: scope:[memset]  from memset
  memset::c#3 = phi( memset/memset::c#4 )
  memset::num#2 = phi( memset/memset::num#1 )
  memset::str#2 = phi( memset/memset::str#3 )
  memset::$4 = (char *)memset::str#2
  memset::end#0 = memset::$4 + memset::num#2
  memset::dst#0 = ((char *)) memset::str#2
  to:memset::@3
memset::@3: scope:[memset]  from memset::@2 memset::@4
  memset::c#2 = phi( memset::@2/memset::c#3, memset::@4/memset::c#1 )
  memset::str#4 = phi( memset::@2/memset::str#2, memset::@4/memset::str#5 )
  memset::end#1 = phi( memset::@2/memset::end#0, memset::@4/memset::end#2 )
  memset::dst#2 = phi( memset::@2/memset::dst#0, memset::@4/memset::dst#1 )
  memset::$3 = memset::dst#2 != memset::end#1
  if(memset::$3) goto memset::@4
  to:memset::@1
memset::@4: scope:[memset]  from memset::@3
  memset::str#5 = phi( memset::@3/memset::str#4 )
  memset::end#2 = phi( memset::@3/memset::end#1 )
  memset::dst#3 = phi( memset::@3/memset::dst#2 )
  memset::c#1 = phi( memset::@3/memset::c#2 )
  *memset::dst#3 = memset::c#1
  memset::dst#1 = ++ memset::dst#3
  to:memset::@3
memset::@return: scope:[memset]  from memset::@1
  memset::return#3 = phi( memset::@1/memset::return#0 )
  memset::return#1 = memset::return#3
  return 
  to:@return

void print_uint(unsigned int w)
print_uint: scope:[print_uint]  from main::@11
  print_char_cursor#27 = phi( main::@11/print_char_cursor#29 )
  print_uint::w#1 = phi( main::@11/print_uint::w#0 )
  print_uint::$0 = byte1  print_uint::w#1
  print_uchar::b#0 = print_uint::$0
  call print_uchar
  to:print_uint::@1
print_uint::@1: scope:[print_uint]  from print_uint
  print_uint::w#2 = phi( print_uint/print_uint::w#1 )
  print_char_cursor#14 = phi( print_uint/print_char_cursor#5 )
  print_char_cursor#0 = print_char_cursor#14
  print_uint::$2 = byte0  print_uint::w#2
  print_uchar::b#1 = print_uint::$2
  call print_uchar
  to:print_uint::@2
print_uint::@2: scope:[print_uint]  from print_uint::@1
  print_char_cursor#15 = phi( print_uint::@1/print_char_cursor#5 )
  print_char_cursor#1 = print_char_cursor#15
  to:print_uint::@return
print_uint::@return: scope:[print_uint]  from print_uint::@2
  print_char_cursor#16 = phi( print_uint::@2/print_char_cursor#1 )
  print_char_cursor#2 = print_char_cursor#16
  return 
  to:@return

void print_uchar(char b)
print_uchar: scope:[print_uchar]  from print_uint print_uint::@1
  print_char_cursor#28 = phi( print_uint/print_char_cursor#27, print_uint::@1/print_char_cursor#0 )
  print_uchar::b#2 = phi( print_uint/print_uchar::b#0, print_uint::@1/print_uchar::b#1 )
  print_uchar::$0 = print_uchar::b#2 >> 4
  print_char::ch#0 = print_hextab[print_uchar::$0]
  call print_char
  to:print_uchar::@1
print_uchar::@1: scope:[print_uchar]  from print_uchar
  print_uchar::b#3 = phi( print_uchar/print_uchar::b#2 )
  print_char_cursor#17 = phi( print_uchar/print_char_cursor#7 )
  print_char_cursor#3 = print_char_cursor#17
  print_uchar::$2 = print_uchar::b#3 & $f
  print_char::ch#1 = print_hextab[print_uchar::$2]
  call print_char
  to:print_uchar::@2
print_uchar::@2: scope:[print_uchar]  from print_uchar::@1
  print_char_cursor#18 = phi( print_uchar::@1/print_char_cursor#7 )
  print_char_cursor#4 = print_char_cursor#18
  to:print_uchar::@return
print_uchar::@return: scope:[print_uchar]  from print_uchar::@2
  print_char_cursor#19 = phi( print_uchar::@2/print_char_cursor#4 )
  print_char_cursor#5 = print_char_cursor#19
  return 
  to:@return

void print_char(char ch)
print_char: scope:[print_char]  from main::@15 print_uchar print_uchar::@1
  print_char_cursor#20 = phi( main::@15/print_char_cursor#8, print_uchar/print_char_cursor#28, print_uchar::@1/print_char_cursor#3 )
  print_char::ch#3 = phi( main::@15/print_char::ch#2, print_uchar/print_char::ch#0, print_uchar::@1/print_char::ch#1 )
  *print_char_cursor#20 = print_char::ch#3
  print_char_cursor#6 = ++ print_char_cursor#20
  to:print_char::@return
print_char::@return: scope:[print_char]  from print_char
  print_char_cursor#21 = phi( print_char/print_char_cursor#6 )
  print_char_cursor#7 = print_char_cursor#21
  return 
  to:@return

void main()
main: scope:[main]  from __start::@1
  print_char_cursor#40 = phi( __start::@1/print_char_cursor#31 )
  memset::str#0 = (void *)sieve
  memset::c#0 = 0
  memset::num#0 = COUNT
  call memset
  memset::return#2 = memset::return#1
  to:main::@14
main::@14: scope:[main]  from main
  print_char_cursor#38 = phi( main/print_char_cursor#40 )
  main::i#0 = 2
  main::sieve_i#0 = & sieve[main::i#0]
  to:main::@1
main::@1: scope:[main]  from main::@14 main::@4
  print_char_cursor#37 = phi( main::@14/print_char_cursor#38, main::@4/print_char_cursor#39 )
  main::sieve_i#4 = phi( main::@14/main::sieve_i#0, main::@4/main::sieve_i#1 )
  main::i#4 = phi( main::@14/main::i#0, main::@4/main::i#2 )
  main::$2 = main::i#4 < SQRT_COUNT
  if(main::$2) goto main::@2
  to:main::@3
main::@2: scope:[main]  from main::@1
  print_char_cursor#41 = phi( main::@1/print_char_cursor#37 )
  main::i#12 = phi( main::@1/main::i#4 )
  main::sieve_i#2 = phi( main::@1/main::sieve_i#4 )
  main::$14 = 0 != *main::sieve_i#2
  main::$3 = ! main::$14
  main::$4 = ! main::$3
  if(main::$4) goto main::@4
  to:main::@7
main::@3: scope:[main]  from main::@1
  print_char_cursor#36 = phi( main::@1/print_char_cursor#37 )
  main::i#1 = 2
  to:main::@8
main::@4: scope:[main]  from main::@2 main::@5
  print_char_cursor#39 = phi( main::@2/print_char_cursor#41, main::@5/print_char_cursor#42 )
  main::sieve_i#3 = phi( main::@2/main::sieve_i#2, main::@5/main::sieve_i#5 )
  main::i#5 = phi( main::@2/main::i#12, main::@5/main::i#13 )
  main::i#2 = ++ main::i#5
  main::sieve_i#1 = ++ main::sieve_i#3
  to:main::@1
main::@7: scope:[main]  from main::@2
  print_char_cursor#44 = phi( main::@2/print_char_cursor#41 )
  main::sieve_i#7 = phi( main::@2/main::sieve_i#2 )
  main::i#6 = phi( main::@2/main::i#12 )
  main::j#0 = main::i#6 * 2
  main::s#0 = & sieve[main::j#0]
  to:main::@5
main::@5: scope:[main]  from main::@6 main::@7
  print_char_cursor#42 = phi( main::@6/print_char_cursor#43, main::@7/print_char_cursor#44 )
  main::s#3 = phi( main::@6/main::s#1, main::@7/main::s#0 )
  main::sieve_i#5 = phi( main::@6/main::sieve_i#6, main::@7/main::sieve_i#7 )
  main::i#13 = phi( main::@6/main::i#7, main::@7/main::i#6 )
  main::j#2 = phi( main::@6/main::j#1, main::@7/main::j#0 )
  main::$7 = main::j#2 < COUNT
  if(main::$7) goto main::@6
  to:main::@4
main::@6: scope:[main]  from main::@5
  print_char_cursor#43 = phi( main::@5/print_char_cursor#42 )
  main::sieve_i#6 = phi( main::@5/main::sieve_i#5 )
  main::j#3 = phi( main::@5/main::j#2 )
  main::i#7 = phi( main::@5/main::i#13 )
  main::s#2 = phi( main::@5/main::s#3 )
  *main::s#2 = 1
  main::s#1 = main::s#2 + main::i#7
  main::j#1 = main::j#3 + main::i#7
  to:main::@5
main::@8: scope:[main]  from main::@10 main::@3
  print_char_cursor#34 = phi( main::@10/print_char_cursor#35, main::@3/print_char_cursor#36 )
  main::i#8 = phi( main::@10/main::i#3, main::@3/main::i#1 )
  main::$8 = main::i#8 < $4c7
  if(main::$8) goto main::@9
  to:main::@12
main::@9: scope:[main]  from main::@8
  print_char_cursor#32 = phi( main::@8/print_char_cursor#34 )
  main::i#9 = phi( main::@8/main::i#8 )
  main::$15 = 0 != sieve[main::i#9]
  main::$9 = ! main::$15
  main::$10 = ! main::$9
  if(main::$10) goto main::@10
  to:main::@11
main::@10: scope:[main]  from main::@16 main::@9
  print_char_cursor#35 = phi( main::@16/print_char_cursor#9, main::@9/print_char_cursor#32 )
  main::i#10 = phi( main::@16/main::i#14, main::@9/main::i#9 )
  main::i#3 = ++ main::i#10
  to:main::@8
main::@11: scope:[main]  from main::@9
  print_char_cursor#29 = phi( main::@9/print_char_cursor#32 )
  main::i#11 = phi( main::@9/main::i#9 )
  print_uint::w#0 = main::i#11
  call print_uint
  to:main::@15
main::@15: scope:[main]  from main::@11
  main::i#15 = phi( main::@11/main::i#11 )
  print_char_cursor#22 = phi( main::@11/print_char_cursor#2 )
  print_char_cursor#8 = print_char_cursor#22
  print_char::ch#2 = ' '
  call print_char
  to:main::@16
main::@16: scope:[main]  from main::@15
  main::i#14 = phi( main::@15/main::i#15 )
  print_char_cursor#23 = phi( main::@15/print_char_cursor#7 )
  print_char_cursor#9 = print_char_cursor#23
  to:main::@10
main::@12: scope:[main]  from main::@13 main::@8
  print_char_cursor#30 = phi( main::@13/print_char_cursor#33, main::@8/print_char_cursor#34 )
  if(true) goto main::@13
  to:main::@return
main::@13: scope:[main]  from main::@12
  print_char_cursor#33 = phi( main::@12/print_char_cursor#30 )
  *(SCREEN+$3e7) = ++ *(SCREEN+$3e7)
  to:main::@12
main::@return: scope:[main]  from main::@12
  print_char_cursor#24 = phi( main::@12/print_char_cursor#30 )
  print_char_cursor#10 = print_char_cursor#24
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  print_screen#0 = (char *)$400
  print_line_cursor#0 = print_screen#0
  print_char_cursor#11 = print_line_cursor#0
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  print_line_cursor#4 = phi( __start::__init1/print_line_cursor#0 )
  print_screen#4 = phi( __start::__init1/print_screen#0 )
  print_char_cursor#31 = phi( __start::__init1/print_char_cursor#11 )
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  print_line_cursor#3 = phi( __start::@1/print_line_cursor#4 )
  print_screen#3 = phi( __start::@1/print_screen#4 )
  print_char_cursor#25 = phi( __start::@1/print_char_cursor#10 )
  print_char_cursor#12 = print_char_cursor#25
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  print_char_cursor#26 = phi( __start::@2/print_char_cursor#12 )
  print_line_cursor#2 = phi( __start::@2/print_line_cursor#3 )
  print_screen#2 = phi( __start::@2/print_screen#3 )
  print_screen#1 = print_screen#2
  print_line_cursor#1 = print_line_cursor#2
  print_char_cursor#13 = print_char_cursor#26
  return 
  to:@return

SYMBOL TABLE SSA
__constant const unsigned int COUNT = $4000
__constant char RADIX::BINARY = 2
__constant char RADIX::DECIMAL = $a
__constant char RADIX::HEXADECIMAL = $10
__constant char RADIX::OCTAL = 8
__constant char * const SCREEN = (char *)$400
__constant const char SQRT_COUNT = $80
void __start()
void main()
bool main::$10
bool main::$14
bool main::$15
bool main::$2
bool main::$3
bool main::$4
bool main::$7
bool main::$8
bool main::$9
unsigned int main::i
unsigned int main::i#0
unsigned int main::i#1
unsigned int main::i#10
unsigned int main::i#11
unsigned int main::i#12
unsigned int main::i#13
unsigned int main::i#14
unsigned int main::i#15
unsigned int main::i#2
unsigned int main::i#3
unsigned int main::i#4
unsigned int main::i#5
unsigned int main::i#6
unsigned int main::i#7
unsigned int main::i#8
unsigned int main::i#9
unsigned int main::j
unsigned int main::j#0
unsigned int main::j#1
unsigned int main::j#2
unsigned int main::j#3
char *main::s
char *main::s#0
char *main::s#1
char *main::s#2
char *main::s#3
char *main::sieve_i
char *main::sieve_i#0
char *main::sieve_i#1
char *main::sieve_i#2
char *main::sieve_i#3
char *main::sieve_i#4
char *main::sieve_i#5
char *main::sieve_i#6
char *main::sieve_i#7
void * memset(void *str , char c , unsigned int num)
bool memset::$0
bool memset::$1
bool memset::$3
char *memset::$4
char memset::c
char memset::c#0
char memset::c#1
char memset::c#2
char memset::c#3
char memset::c#4
char *memset::dst
char *memset::dst#0
char *memset::dst#1
char *memset::dst#2
char *memset::dst#3
char *memset::end
char *memset::end#0
char *memset::end#1
char *memset::end#2
unsigned int memset::num
unsigned int memset::num#0
unsigned int memset::num#1
unsigned int memset::num#2
void *memset::return
void *memset::return#0
void *memset::return#1
void *memset::return#2
void *memset::return#3
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 print_char(char ch)
char print_char::ch
char print_char::ch#0
char print_char::ch#1
char print_char::ch#2
char print_char::ch#3
char *print_char_cursor
char *print_char_cursor#0
char *print_char_cursor#1
char *print_char_cursor#10
char *print_char_cursor#11
char *print_char_cursor#12
char *print_char_cursor#13
char *print_char_cursor#14
char *print_char_cursor#15
char *print_char_cursor#16
char *print_char_cursor#17
char *print_char_cursor#18
char *print_char_cursor#19
char *print_char_cursor#2
char *print_char_cursor#20
char *print_char_cursor#21
char *print_char_cursor#22
char *print_char_cursor#23
char *print_char_cursor#24
char *print_char_cursor#25
char *print_char_cursor#26
char *print_char_cursor#27
char *print_char_cursor#28
char *print_char_cursor#29
char *print_char_cursor#3
char *print_char_cursor#30
char *print_char_cursor#31
char *print_char_cursor#32
char *print_char_cursor#33
char *print_char_cursor#34
char *print_char_cursor#35
char *print_char_cursor#36
char *print_char_cursor#37
char *print_char_cursor#38
char *print_char_cursor#39
char *print_char_cursor#4
char *print_char_cursor#40
char *print_char_cursor#41
char *print_char_cursor#42
char *print_char_cursor#43
char *print_char_cursor#44
char *print_char_cursor#5
char *print_char_cursor#6
char *print_char_cursor#7
char *print_char_cursor#8
char *print_char_cursor#9
__constant const char print_hextab[] = "0123456789abcdef"z
char *print_line_cursor
char *print_line_cursor#0
char *print_line_cursor#1
char *print_line_cursor#2
char *print_line_cursor#3
char *print_line_cursor#4
char *print_screen
char *print_screen#0
char *print_screen#1
char *print_screen#2
char *print_screen#3
char *print_screen#4
void print_uchar(char b)
char print_uchar::$0
number print_uchar::$2
char print_uchar::b
char print_uchar::b#0
char print_uchar::b#1
char print_uchar::b#2
char print_uchar::b#3
void print_uint(unsigned int w)
char print_uint::$0
char print_uint::$2
unsigned int print_uint::w
unsigned int print_uint::w#0
unsigned int print_uint::w#1
unsigned int print_uint::w#2
__constant char *sieve = (char *)$1000

Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#1 > 0
Adding number conversion cast (unumber) 4 in print_uchar::$0 = print_uchar::b#2 >> 4
Adding number conversion cast (unumber) $f in print_uchar::$2 = print_uchar::b#3 & $f
Adding number conversion cast (unumber) print_uchar::$2 in print_uchar::$2 = print_uchar::b#3 & (unumber)$f
Adding number conversion cast (unumber) 0 in memset::c#0 = 0
Adding number conversion cast (unumber) 0 in main::$14 = 0 != *main::sieve_i#2
Adding number conversion cast (unumber) 2 in main::i#1 = 2
Adding number conversion cast (unumber) 2 in main::j#0 = main::i#6 * 2
Adding number conversion cast (unumber) 1 in *main::s#2 = 1
Adding number conversion cast (unumber) $4c7 in main::$8 = main::i#8 < $4c7
Adding number conversion cast (unumber) 0 in main::$15 = 0 != sieve[main::i#9]
Adding number conversion cast (unumber) $3e7 in *(SCREEN+$3e7) = ++ *(SCREEN+$3e7)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast memset::dst#0 = (char *)memset::str#2
Inlining cast memset::c#0 = (unumber)0
Inlining cast main::i#1 = (unumber)2
Inlining cast *main::s#2 = (unumber)1
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 4096
Simplifying constant integer cast 0
Simplifying constant integer cast 4
Simplifying constant integer cast $f
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 2
Simplifying constant integer cast 2
Simplifying constant integer cast 1
Simplifying constant integer cast $4c7
Simplifying constant integer cast 0
Simplifying constant integer cast $3e7
Simplifying constant pointer cast (char *) 1024
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 4
Finalized unsigned number type (char) $f
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 1
Finalized unsigned number type (unsigned int) $4c7
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $3e7
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to char in print_uchar::$2 = print_uchar::b#3 & $f
Inversing boolean not [2] memset::$1 = memset::num#1 <= 0 from [1] memset::$0 = memset::num#1 > 0
Inversing boolean not [67] main::$3 = 0 == *main::sieve_i#2 from [66] main::$14 = 0 != *main::sieve_i#2
Inversing boolean not [68] main::$4 = 0 != *main::sieve_i#2 from [67] main::$3 = 0 == *main::sieve_i#2
Inversing boolean not [90] main::$9 = 0 == sieve[main::i#9] from [89] main::$15 = 0 != sieve[main::i#9]
Inversing boolean not [91] main::$10 = 0 != sieve[main::i#9] from [90] main::$9 = 0 == sieve[main::i#9]
Successful SSA optimization Pass2UnaryNotSimplification
Alias memset::return#0 = memset::str#1 memset::return#3 memset::return#1 
Alias memset::str#2 = memset::str#3 
Alias memset::num#1 = memset::num#2 
Alias memset::c#3 = memset::c#4 
Alias memset::c#1 = memset::c#2 
Alias memset::dst#2 = memset::dst#3 
Alias memset::end#1 = memset::end#2 
Alias memset::str#4 = memset::str#5 
Alias print_uchar::b#0 = print_uint::$0 
Alias print_uint::w#1 = print_uint::w#2 
Alias print_char_cursor#0 = print_char_cursor#14 
Alias print_uchar::b#1 = print_uint::$2 
Alias print_char_cursor#1 = print_char_cursor#15 print_char_cursor#16 print_char_cursor#2 
Alias print_uchar::b#2 = print_uchar::b#3 
Alias print_char_cursor#17 = print_char_cursor#3 
Alias print_char_cursor#18 = print_char_cursor#4 print_char_cursor#19 print_char_cursor#5 
Alias print_char_cursor#21 = print_char_cursor#6 print_char_cursor#7 
Alias print_char_cursor#38 = print_char_cursor#40 
Alias main::sieve_i#2 = main::sieve_i#4 main::sieve_i#7 
Alias main::i#12 = main::i#4 main::i#6 
Alias print_char_cursor#36 = print_char_cursor#41 print_char_cursor#37 print_char_cursor#44 
Alias main::s#2 = main::s#3 
Alias main::i#13 = main::i#7 
Alias main::j#2 = main::j#3 
Alias main::sieve_i#5 = main::sieve_i#6 
Alias print_char_cursor#42 = print_char_cursor#43 
Alias main::i#11 = main::i#9 main::i#8 main::i#15 main::i#14 
Alias print_char_cursor#29 = print_char_cursor#32 print_char_cursor#34 
Alias print_char_cursor#22 = print_char_cursor#8 
Alias print_char_cursor#23 = print_char_cursor#9 
Alias print_char_cursor#10 = print_char_cursor#33 print_char_cursor#30 print_char_cursor#24 
Alias print_screen#0 = print_line_cursor#0 print_char_cursor#11 print_char_cursor#31 print_screen#4 print_line_cursor#4 print_screen#3 print_line_cursor#3 print_screen#2 print_line_cursor#2 print_screen#1 print_line_cursor#1 
Alias print_char_cursor#12 = print_char_cursor#25 print_char_cursor#26 print_char_cursor#13 
Successful SSA optimization Pass2AliasElimination
Alias main::i#10 = main::i#11 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values memset::num#1 memset::num#0
Identical Phi Values memset::str#2 memset::str#0
Identical Phi Values memset::c#3 memset::c#0
Identical Phi Values memset::end#1 memset::end#0
Identical Phi Values memset::str#4 memset::str#2
Identical Phi Values memset::c#1 memset::c#3
Identical Phi Values print_uint::w#1 print_uint::w#0
Identical Phi Values print_char_cursor#27 print_char_cursor#29
Identical Phi Values print_char_cursor#0 print_char_cursor#18
Identical Phi Values print_char_cursor#1 print_char_cursor#18
Identical Phi Values print_char_cursor#17 print_char_cursor#21
Identical Phi Values print_char_cursor#18 print_char_cursor#21
Identical Phi Values print_char_cursor#38 print_screen#0
Identical Phi Values main::i#13 main::i#12
Identical Phi Values main::sieve_i#5 main::sieve_i#2
Identical Phi Values print_char_cursor#42 print_char_cursor#36
Identical Phi Values print_char_cursor#22 print_char_cursor#1
Identical Phi Values print_char_cursor#23 print_char_cursor#21
Identical Phi Values print_char_cursor#10 print_char_cursor#29
Identical Phi Values print_char_cursor#12 print_char_cursor#10
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values memset::return#0 memset::str#0
Identical Phi Values main::i#5 main::i#12
Identical Phi Values main::sieve_i#3 main::sieve_i#2
Identical Phi Values print_char_cursor#39 print_char_cursor#36
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values print_char_cursor#36 print_screen#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition memset::$1 [2] if(memset::num#0<=0) goto memset::@1
Simple Condition memset::$3 [9] if(memset::dst#2!=memset::end#0) goto memset::@4
Simple Condition main::$2 [45] if(main::i#12<SQRT_COUNT) goto main::@2
Simple Condition main::$4 [47] if(0!=*main::sieve_i#2) goto main::@4
Simple Condition main::$7 [56] if(main::j#2<COUNT) goto main::@6
Simple Condition main::$8 [62] if(main::i#10<$4c7) goto main::@9
Simple Condition main::$10 [64] if(0!=sieve[main::i#10]) goto main::@10
Successful SSA optimization Pass2ConditionalJumpSimplification
Rewriting array member address-of to pointer addition [42] main::sieve_i#0 = sieve + main::i#0
Rewriting array member address-of to pointer addition [53] main::s#0 = sieve + main::j#0
Successful SSA optimization PassNArrayElementAddressOfRewriting
Constant right-side identified [36] memset::str#0 = (void *)sieve
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant memset::str#0 = (void *)sieve
Constant memset::c#0 = 0
Constant memset::num#0 = COUNT
Constant main::i#0 = 2
Constant main::i#1 = 2
Constant print_char::ch#2 = ' '
Constant print_screen#0 = (char *) 1024
Successful SSA optimization Pass2ConstantIdentification
Constant memset::$4 = (char *)memset::str#0
Constant memset::dst#0 = (char *)memset::str#0
Constant memset::return#2 = memset::str#0
Successful SSA optimization Pass2ConstantIdentification
if() condition always false - eliminating [2] if(memset::num#0<=0) goto memset::@1
if() condition always true - replacing block destination [74] if(true) goto main::@13
Successful SSA optimization Pass2ConstantIfs
De-inlining pointer[w] to *(pointer+w)   [64] if(0!=sieve[main::i#10]) goto main::@10
Successful SSA optimization Pass2DeInlineWordDerefIdx
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Eliminating unused constant memset::return#2
Successful SSA optimization PassNEliminateUnusedVars
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Constant right-side identified [0] memset::end#0 = memset::$4 + memset::num#0
Constant right-side identified [24] main::sieve_i#0 = sieve + main::i#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant memset::end#0 = memset::$4+memset::num#0
Constant main::sieve_i#0 = sieve+main::i#0
Successful SSA optimization Pass2ConstantIdentification
Rewriting multiplication to use shift [28] main::j#0 = main::i#12 * 2
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings memset::dst#0
Inlining constant with var siblings print_char::ch#2
Inlining constant with var siblings main::i#0
Inlining constant with var siblings main::i#1
Inlining constant with var siblings main::sieve_i#0
Constant inlined print_char::ch#2 = ' '
Constant inlined memset::$4 = (char *)memset::str#0
Constant inlined main::i#0 = 2
Constant inlined memset::dst#0 = (char *)memset::str#0
Constant inlined memset::num#0 = COUNT
Constant inlined main::i#1 = 2
Constant inlined main::sieve_i#0 = sieve+2
Successful SSA optimization Pass2ConstantInlining
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 8
Finalized unsigned number type (char) $a
Finalized unsigned number type (char) $10
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@17(between main::@9 and main::@10)
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@14
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of main::@12
Adding NOP phi() at start of memset
Adding NOP phi() at start of memset::@2
Adding NOP phi() at start of memset::@1
Adding NOP phi() at start of print_uint::@2
Adding NOP phi() at start of print_uchar::@2
CALL GRAPH
Calls in [main] to memset:1 print_uint:13 print_char:15 
Calls in [print_uint] to print_uchar:50 print_uchar:54 
Calls in [print_uchar] to print_char:66 print_char:71 

Created 12 initial phi equivalence classes
Coalesced [14] print_char_cursor#47 = print_char_cursor#21
Coalesced [16] print_char_cursor#51 = print_char_cursor#21
Coalesced [19] main::i#17 = main::i#3
Coalesced [20] print_char_cursor#50 = print_char_cursor#35
Coalesced (already) [21] print_char_cursor#52 = print_char_cursor#29
Coalesced [25] main::j#5 = main::j#0
Coalesced [26] main::s#5 = main::s#0
Coalesced [31] main::i#16 = main::i#2
Coalesced [32] main::sieve_i#8 = main::sieve_i#1
Coalesced [36] main::j#4 = main::j#1
Coalesced [37] main::s#4 = main::s#1
Coalesced [46] memset::dst#4 = memset::dst#1
Coalesced [48] print_uchar::b#4 = print_uchar::b#0
Coalesced [49] print_char_cursor#45 = print_char_cursor#29
Coalesced [52] print_uchar::b#5 = print_uchar::b#1
Coalesced (already) [53] print_char_cursor#46 = print_char_cursor#21
Coalesced [64] print_char::ch#4 = print_char::ch#0
Coalesced (already) [65] print_char_cursor#48 = print_char_cursor#28
Coalesced [69] print_char::ch#5 = print_char::ch#1
Coalesced (already) [70] print_char_cursor#49 = print_char_cursor#21
Coalesced down to 9 phi equivalence classes
Culled Empty Block label main::@14
Culled Empty Block label main::@3
Culled Empty Block label main::@12
Culled Empty Block label main::@16
Culled Empty Block label main::@17
Culled Empty Block label memset::@2
Culled Empty Block label memset::@1
Culled Empty Block label print_uint::@2
Culled Empty Block label print_uchar::@2
Renumbering block memset::@3 to memset::@1
Renumbering block memset::@4 to memset::@2
Renumbering block main::@4 to main::@3
Renumbering block main::@5 to main::@4
Renumbering block main::@6 to main::@5
Renumbering block main::@7 to main::@6
Renumbering block main::@8 to main::@7
Renumbering block main::@9 to main::@8
Renumbering block main::@10 to main::@9
Renumbering block main::@11 to main::@10
Renumbering block main::@13 to main::@11
Renumbering block main::@15 to main::@12
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@12
Adding NOP phi() at start of memset

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  [1] call memset
  to:main::@1
main::@1: scope:[main]  from main main::@3
  [2] main::sieve_i#2 = phi( main/sieve+2, main::@3/main::sieve_i#1 )
  [2] main::i#12 = phi( main/2, main::@3/main::i#2 )
  [3] if(main::i#12<SQRT_COUNT) goto main::@2
  to:main::@7
main::@7: scope:[main]  from main::@1 main::@9
  [4] print_char_cursor#29 = phi( main::@9/print_char_cursor#35, main::@1/print_screen#0 )
  [4] main::i#10 = phi( main::@9/main::i#3, main::@1/2 )
  [5] if(main::i#10<$4c7) goto main::@8
  to:main::@11
main::@11: scope:[main]  from main::@11 main::@7
  [6] *(SCREEN+$3e7) = ++ *(SCREEN+$3e7)
  to:main::@11
main::@8: scope:[main]  from main::@7
  [7] main::$16 = sieve + main::i#10
  [8] if(0!=*main::$16) goto main::@9
  to:main::@10
main::@10: scope:[main]  from main::@8
  [9] print_uint::w#0 = main::i#10
  [10] call print_uint
  to:main::@12
main::@12: scope:[main]  from main::@10
  [11] phi()
  [12] call print_char
  to:main::@9
main::@9: scope:[main]  from main::@12 main::@8
  [13] print_char_cursor#35 = phi( main::@12/print_char_cursor#21, main::@8/print_char_cursor#29 )
  [14] main::i#3 = ++ main::i#10
  to:main::@7
main::@2: scope:[main]  from main::@1
  [15] if(0!=*main::sieve_i#2) goto main::@3
  to:main::@6
main::@6: scope:[main]  from main::@2
  [16] main::j#0 = main::i#12 << 1
  [17] main::s#0 = sieve + main::j#0
  to:main::@4
main::@4: scope:[main]  from main::@5 main::@6
  [18] main::s#2 = phi( main::@5/main::s#1, main::@6/main::s#0 )
  [18] main::j#2 = phi( main::@5/main::j#1, main::@6/main::j#0 )
  [19] if(main::j#2<COUNT) goto main::@5
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@4
  [20] main::i#2 = ++ main::i#12
  [21] main::sieve_i#1 = ++ main::sieve_i#2
  to:main::@1
main::@5: scope:[main]  from main::@4
  [22] *main::s#2 = 1
  [23] main::s#1 = main::s#2 + main::i#12
  [24] main::j#1 = main::j#2 + main::i#12
  to:main::@4

void * memset(void *str , char c , unsigned int num)
memset: scope:[memset]  from main
  [25] phi()
  to:memset::@1
memset::@1: scope:[memset]  from memset memset::@2
  [26] memset::dst#2 = phi( memset/(char *)memset::str#0, memset::@2/memset::dst#1 )
  [27] if(memset::dst#2!=memset::end#0) goto memset::@2
  to:memset::@return
memset::@return: scope:[memset]  from memset::@1
  [28] return 
  to:@return
memset::@2: scope:[memset]  from memset::@1
  [29] *memset::dst#2 = memset::c#0
  [30] memset::dst#1 = ++ memset::dst#2
  to:memset::@1

void print_uint(unsigned int w)
print_uint: scope:[print_uint]  from main::@10
  [31] print_uchar::b#0 = byte1  print_uint::w#0
  [32] call print_uchar
  to:print_uint::@1
print_uint::@1: scope:[print_uint]  from print_uint
  [33] print_uchar::b#1 = byte0  print_uint::w#0
  [34] call print_uchar
  to:print_uint::@return
print_uint::@return: scope:[print_uint]  from print_uint::@1
  [35] return 
  to:@return

void print_char(char ch)
print_char: scope:[print_char]  from main::@12 print_uchar print_uchar::@1
  [36] print_char_cursor#20 = phi( main::@12/print_char_cursor#21, print_uchar/print_char_cursor#28, print_uchar::@1/print_char_cursor#21 )
  [36] print_char::ch#3 = phi( main::@12/' ', print_uchar/print_char::ch#0, print_uchar::@1/print_char::ch#1 )
  [37] *print_char_cursor#20 = print_char::ch#3
  [38] print_char_cursor#21 = ++ print_char_cursor#20
  to:print_char::@return
print_char::@return: scope:[print_char]  from print_char
  [39] return 
  to:@return

void print_uchar(char b)
print_uchar: scope:[print_uchar]  from print_uint print_uint::@1
  [40] print_char_cursor#28 = phi( print_uint/print_char_cursor#29, print_uint::@1/print_char_cursor#21 )
  [40] print_uchar::b#2 = phi( print_uint/print_uchar::b#0, print_uint::@1/print_uchar::b#1 )
  [41] print_uchar::$0 = print_uchar::b#2 >> 4
  [42] print_char::ch#0 = print_hextab[print_uchar::$0]
  [43] call print_char
  to:print_uchar::@1
print_uchar::@1: scope:[print_uchar]  from print_uchar
  [44] print_uchar::$2 = print_uchar::b#2 & $f
  [45] print_char::ch#1 = print_hextab[print_uchar::$2]
  [46] call print_char
  to:print_uchar::@return
print_uchar::@return: scope:[print_uchar]  from print_uchar::@1
  [47] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
char *main::$16 // 22.0
unsigned int main::i
unsigned int main::i#10 // 6.111111111111112
unsigned int main::i#12 // 24.6
unsigned int main::i#2 // 11.0
unsigned int main::i#3 // 22.0
unsigned int main::j
unsigned int main::j#0 // 16.5
unsigned int main::j#1 // 202.0
unsigned int main::j#2 // 78.5
char *main::s
char *main::s#0 // 22.0
char *main::s#1 // 101.0
char *main::s#2 // 104.66666666666666
char *main::sieve_i
char *main::sieve_i#1 // 22.0
char *main::sieve_i#2 // 3.0
void * memset(void *str , char c , unsigned int num)
char memset::c
char *memset::dst
char *memset::dst#1 // 202.0
char *memset::dst#2 // 134.66666666666666
char *memset::end
unsigned int memset::num
void *memset::return
void *memset::str
void print_char(char ch)
char print_char::ch
char print_char::ch#0 // 2002.0
char print_char::ch#1 // 2002.0
char print_char::ch#3 // 12003.0
char *print_char_cursor
char *print_char_cursor#20 // 11007.5
char *print_char_cursor#21 // 794.6428571428571
char *print_char_cursor#28 // 401.00000000000006
char *print_char_cursor#29 // 20.5
char *print_char_cursor#35 // 16.5
char *print_line_cursor
char *print_screen
void print_uchar(char b)
char print_uchar::$0 // 2002.0
char print_uchar::$2 // 2002.0
char print_uchar::b
char print_uchar::b#0 // 202.0
char print_uchar::b#1 // 202.0
char print_uchar::b#2 // 551.0
void print_uint(unsigned int w)
unsigned int print_uint::w
unsigned int print_uint::w#0 // 71.0

Initial phi equivalence classes
[ main::i#12 main::i#2 ]
[ main::sieve_i#2 main::sieve_i#1 ]
[ main::i#10 main::i#3 ]
[ main::j#2 main::j#1 main::j#0 ]
[ main::s#2 main::s#1 main::s#0 ]
[ memset::dst#2 memset::dst#1 ]
[ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
[ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 ]
[ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ]
Added variable main::$16 to live range equivalence class [ main::$16 ]
Added variable print_uint::w#0 to live range equivalence class [ print_uint::w#0 ]
Added variable print_uchar::$0 to live range equivalence class [ print_uchar::$0 ]
Added variable print_uchar::$2 to live range equivalence class [ print_uchar::$2 ]
Complete equivalence classes
[ main::i#12 main::i#2 ]
[ main::sieve_i#2 main::sieve_i#1 ]
[ main::i#10 main::i#3 ]
[ main::j#2 main::j#1 main::j#0 ]
[ main::s#2 main::s#1 main::s#0 ]
[ memset::dst#2 memset::dst#1 ]
[ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
[ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 ]
[ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ]
[ main::$16 ]
[ print_uint::w#0 ]
[ print_uchar::$0 ]
[ print_uchar::$2 ]
Allocated zp[1]:2 [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
Allocated zp[2]:3 [ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 ]
Allocated zp[1]:5 [ print_uchar::$0 ]
Allocated zp[1]:6 [ print_uchar::$2 ]
Allocated zp[1]:7 [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ]
Allocated zp[2]:8 [ memset::dst#2 memset::dst#1 ]
Allocated zp[2]:10 [ main::j#2 main::j#1 main::j#0 ]
Allocated zp[2]:12 [ main::s#2 main::s#1 main::s#0 ]
Allocated zp[2]:14 [ print_uint::w#0 ]
Allocated zp[2]:16 [ main::i#12 main::i#2 ]
Allocated zp[2]:18 [ main::i#10 main::i#3 ]
Allocated zp[2]:20 [ main::sieve_i#2 main::sieve_i#1 ]
Allocated zp[2]:22 [ main::$16 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [3] if(main::i#12<SQRT_COUNT) goto main::@2 [ main::i#12 main::sieve_i#2 ] (  [ main::i#12 main::sieve_i#2 ] { }  ) always clobbers reg byte a 
Statement [5] if(main::i#10<$4c7) goto main::@8 [ main::i#10 print_char_cursor#29 ] (  [ main::i#10 print_char_cursor#29 ] { }  ) always clobbers reg byte a 
Statement [7] main::$16 = sieve + main::i#10 [ main::i#10 print_char_cursor#29 main::$16 ] (  [ main::i#10 print_char_cursor#29 main::$16 ] { }  ) always clobbers reg byte a 
Statement [8] if(0!=*main::$16) goto main::@9 [ main::i#10 print_char_cursor#29 ] (  [ main::i#10 print_char_cursor#29 ] { }  ) always clobbers reg byte a reg byte y 
Statement [9] print_uint::w#0 = main::i#10 [ main::i#10 print_char_cursor#29 print_uint::w#0 ] (  [ main::i#10 print_char_cursor#29 print_uint::w#0 ] { { print_uint::w#0 = main::i#10 } }  ) always clobbers reg byte a 
Statement [15] if(0!=*main::sieve_i#2) goto main::@3 [ main::i#12 main::sieve_i#2 ] (  [ main::i#12 main::sieve_i#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [16] main::j#0 = main::i#12 << 1 [ main::i#12 main::sieve_i#2 main::j#0 ] (  [ main::i#12 main::sieve_i#2 main::j#0 ] { }  ) always clobbers reg byte a 
Statement [17] main::s#0 = sieve + main::j#0 [ main::i#12 main::sieve_i#2 main::j#0 main::s#0 ] (  [ main::i#12 main::sieve_i#2 main::j#0 main::s#0 ] { }  ) always clobbers reg byte a 
Statement [19] if(main::j#2<COUNT) goto main::@5 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] (  [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] { }  ) always clobbers reg byte a 
Statement [22] *main::s#2 = 1 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] (  [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [23] main::s#1 = main::s#2 + main::i#12 [ main::i#12 main::sieve_i#2 main::j#2 main::s#1 ] (  [ main::i#12 main::sieve_i#2 main::j#2 main::s#1 ] { }  ) always clobbers reg byte a 
Statement [24] main::j#1 = main::j#2 + main::i#12 [ main::i#12 main::sieve_i#2 main::j#1 main::s#1 ] (  [ main::i#12 main::sieve_i#2 main::j#1 main::s#1 ] { }  ) always clobbers reg byte a 
Statement [27] if(memset::dst#2!=memset::end#0) goto memset::@2 [ memset::dst#2 ] ( memset:1 [ memset::dst#2 ] { }  ) always clobbers reg byte a 
Statement [29] *memset::dst#2 = memset::c#0 [ memset::dst#2 ] ( memset:1 [ memset::dst#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [37] *print_char_cursor#20 = print_char::ch#3 [ print_char_cursor#20 ] ( print_char:12 [ main::i#10 print_char_cursor#20 ] { { print_char_cursor#20 = print_char_cursor#21 } }  print_uint:10::print_uchar:32::print_char:43 [ main::i#10 print_uint::w#0 print_uchar::b#2 print_char_cursor#20 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#0 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#29 } { print_char::ch#0 = print_char::ch#3 } }  print_uint:10::print_uchar:34::print_char:43 [ main::i#10 print_uchar::b#2 print_char_cursor#20 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#1 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#21 } { print_char::ch#0 = print_char::ch#3 } }  print_uint:10::print_uchar:32::print_char:46 [ main::i#10 print_uint::w#0 print_char_cursor#20 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#0 = print_uchar::b#2 } { print_char_cursor#28 = print_char_cursor#29 } { print_char::ch#1 = print_char::ch#3 } { print_char_cursor#20 = print_char_cursor#21 } }  print_uint:10::print_uchar:34::print_char:46 [ main::i#10 print_char_cursor#20 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#1 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#21 } { print_char::ch#1 = print_char::ch#3 } }  ) always clobbers reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:7 [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ]
Statement [41] print_uchar::$0 = print_uchar::b#2 >> 4 [ print_char_cursor#28 print_uchar::b#2 print_uchar::$0 ] ( print_uint:10::print_uchar:32 [ main::i#10 print_uint::w#0 print_char_cursor#28 print_uchar::b#2 print_uchar::$0 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#0 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#29 } { print_char::ch#0 = print_char::ch#3 } }  print_uint:10::print_uchar:34 [ main::i#10 print_char_cursor#28 print_uchar::b#2 print_uchar::$0 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#1 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#21 } { print_char::ch#0 = print_char::ch#3 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:7 [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ]
Statement [44] print_uchar::$2 = print_uchar::b#2 & $f [ print_char_cursor#21 print_uchar::$2 ] ( print_uint:10::print_uchar:32 [ main::i#10 print_uint::w#0 print_char_cursor#21 print_uchar::$2 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#0 = print_uchar::b#2 } { print_char_cursor#28 = print_char_cursor#29 } { print_char::ch#1 = print_char::ch#3 } { print_char_cursor#20 = print_char_cursor#21 } }  print_uint:10::print_uchar:34 [ main::i#10 print_char_cursor#21 print_uchar::$2 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#1 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#21 } { print_char::ch#1 = print_char::ch#3 } }  ) always clobbers reg byte a 
Statement [3] if(main::i#12<SQRT_COUNT) goto main::@2 [ main::i#12 main::sieve_i#2 ] (  [ main::i#12 main::sieve_i#2 ] { }  ) always clobbers reg byte a 
Statement [5] if(main::i#10<$4c7) goto main::@8 [ main::i#10 print_char_cursor#29 ] (  [ main::i#10 print_char_cursor#29 ] { }  ) always clobbers reg byte a 
Statement [7] main::$16 = sieve + main::i#10 [ main::i#10 print_char_cursor#29 main::$16 ] (  [ main::i#10 print_char_cursor#29 main::$16 ] { }  ) always clobbers reg byte a 
Statement [8] if(0!=*main::$16) goto main::@9 [ main::i#10 print_char_cursor#29 ] (  [ main::i#10 print_char_cursor#29 ] { }  ) always clobbers reg byte a reg byte y 
Statement [9] print_uint::w#0 = main::i#10 [ main::i#10 print_char_cursor#29 print_uint::w#0 ] (  [ main::i#10 print_char_cursor#29 print_uint::w#0 ] { { print_uint::w#0 = main::i#10 } }  ) always clobbers reg byte a 
Statement [15] if(0!=*main::sieve_i#2) goto main::@3 [ main::i#12 main::sieve_i#2 ] (  [ main::i#12 main::sieve_i#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [16] main::j#0 = main::i#12 << 1 [ main::i#12 main::sieve_i#2 main::j#0 ] (  [ main::i#12 main::sieve_i#2 main::j#0 ] { }  ) always clobbers reg byte a 
Statement [17] main::s#0 = sieve + main::j#0 [ main::i#12 main::sieve_i#2 main::j#0 main::s#0 ] (  [ main::i#12 main::sieve_i#2 main::j#0 main::s#0 ] { }  ) always clobbers reg byte a 
Statement [19] if(main::j#2<COUNT) goto main::@5 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] (  [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] { }  ) always clobbers reg byte a 
Statement [22] *main::s#2 = 1 [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] (  [ main::i#12 main::sieve_i#2 main::j#2 main::s#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [23] main::s#1 = main::s#2 + main::i#12 [ main::i#12 main::sieve_i#2 main::j#2 main::s#1 ] (  [ main::i#12 main::sieve_i#2 main::j#2 main::s#1 ] { }  ) always clobbers reg byte a 
Statement [24] main::j#1 = main::j#2 + main::i#12 [ main::i#12 main::sieve_i#2 main::j#1 main::s#1 ] (  [ main::i#12 main::sieve_i#2 main::j#1 main::s#1 ] { }  ) always clobbers reg byte a 
Statement [27] if(memset::dst#2!=memset::end#0) goto memset::@2 [ memset::dst#2 ] ( memset:1 [ memset::dst#2 ] { }  ) always clobbers reg byte a 
Statement [29] *memset::dst#2 = memset::c#0 [ memset::dst#2 ] ( memset:1 [ memset::dst#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [37] *print_char_cursor#20 = print_char::ch#3 [ print_char_cursor#20 ] ( print_char:12 [ main::i#10 print_char_cursor#20 ] { { print_char_cursor#20 = print_char_cursor#21 } }  print_uint:10::print_uchar:32::print_char:43 [ main::i#10 print_uint::w#0 print_uchar::b#2 print_char_cursor#20 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#0 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#29 } { print_char::ch#0 = print_char::ch#3 } }  print_uint:10::print_uchar:34::print_char:43 [ main::i#10 print_uchar::b#2 print_char_cursor#20 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#1 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#21 } { print_char::ch#0 = print_char::ch#3 } }  print_uint:10::print_uchar:32::print_char:46 [ main::i#10 print_uint::w#0 print_char_cursor#20 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#0 = print_uchar::b#2 } { print_char_cursor#28 = print_char_cursor#29 } { print_char::ch#1 = print_char::ch#3 } { print_char_cursor#20 = print_char_cursor#21 } }  print_uint:10::print_uchar:34::print_char:46 [ main::i#10 print_char_cursor#20 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#1 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#21 } { print_char::ch#1 = print_char::ch#3 } }  ) always clobbers reg byte y 
Statement [41] print_uchar::$0 = print_uchar::b#2 >> 4 [ print_char_cursor#28 print_uchar::b#2 print_uchar::$0 ] ( print_uint:10::print_uchar:32 [ main::i#10 print_uint::w#0 print_char_cursor#28 print_uchar::b#2 print_uchar::$0 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#0 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#29 } { print_char::ch#0 = print_char::ch#3 } }  print_uint:10::print_uchar:34 [ main::i#10 print_char_cursor#28 print_uchar::b#2 print_uchar::$0 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#1 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#21 } { print_char::ch#0 = print_char::ch#3 } }  ) always clobbers reg byte a 
Statement [44] print_uchar::$2 = print_uchar::b#2 & $f [ print_char_cursor#21 print_uchar::$2 ] ( print_uint:10::print_uchar:32 [ main::i#10 print_uint::w#0 print_char_cursor#21 print_uchar::$2 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#0 = print_uchar::b#2 } { print_char_cursor#28 = print_char_cursor#29 } { print_char::ch#1 = print_char::ch#3 } { print_char_cursor#20 = print_char_cursor#21 } }  print_uint:10::print_uchar:34 [ main::i#10 print_char_cursor#21 print_uchar::$2 ] { { print_uint::w#0 = main::i#10 } { print_uchar::b#1 = print_uchar::b#2 } { print_char_cursor#20 = print_char_cursor#28 print_char_cursor#21 } { print_char::ch#1 = print_char::ch#3 } }  ) always clobbers reg byte a 
Potential registers zp[2]:16 [ main::i#12 main::i#2 ] : zp[2]:16 , 
Potential registers zp[2]:20 [ main::sieve_i#2 main::sieve_i#1 ] : zp[2]:20 , 
Potential registers zp[2]:18 [ main::i#10 main::i#3 ] : zp[2]:18 , 
Potential registers zp[2]:10 [ main::j#2 main::j#1 main::j#0 ] : zp[2]:10 , 
Potential registers zp[2]:12 [ main::s#2 main::s#1 main::s#0 ] : zp[2]:12 , 
Potential registers zp[2]:8 [ memset::dst#2 memset::dst#1 ] : zp[2]:8 , 
Potential registers zp[1]:2 [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:3 [ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 ] : zp[2]:3 , 
Potential registers zp[1]:7 [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] : zp[1]:7 , reg byte x , 
Potential registers zp[2]:22 [ main::$16 ] : zp[2]:22 , 
Potential registers zp[2]:14 [ print_uint::w#0 ] : zp[2]:14 , 
Potential registers zp[1]:5 [ print_uchar::$0 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ print_uchar::$2 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [print_char] 16,007: zp[1]:2 [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ] 
Uplift Scope [] 12,240.14: zp[2]:3 [ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 ] 
Uplift Scope [print_uchar] 2,002: zp[1]:5 [ print_uchar::$0 ] 2,002: zp[1]:6 [ print_uchar::$2 ] 955: zp[1]:7 [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] 
Uplift Scope [main] 297: zp[2]:10 [ main::j#2 main::j#1 main::j#0 ] 227.67: zp[2]:12 [ main::s#2 main::s#1 main::s#0 ] 35.6: zp[2]:16 [ main::i#12 main::i#2 ] 28.11: zp[2]:18 [ main::i#10 main::i#3 ] 25: zp[2]:20 [ main::sieve_i#2 main::sieve_i#1 ] 22: zp[2]:22 [ main::$16 ] 
Uplift Scope [memset] 336.67: zp[2]:8 [ memset::dst#2 memset::dst#1 ] 
Uplift Scope [print_uint] 71: zp[2]:14 [ print_uint::w#0 ] 
Uplift Scope [MOS6526_CIA] 
Uplift Scope [MOS6569_VICII] 
Uplift Scope [MOS6581_SID] 
Uplift Scope [RADIX] 

Uplifting [print_char] best 10740 combination reg byte a [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ] 
Uplifting [] best 10740 combination zp[2]:3 [ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 ] 
Uplifting [print_uchar] best 10722 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] 
Uplifting [main] best 10722 combination zp[2]:10 [ main::j#2 main::j#1 main::j#0 ] zp[2]:12 [ main::s#2 main::s#1 main::s#0 ] zp[2]:16 [ main::i#12 main::i#2 ] zp[2]:18 [ main::i#10 main::i#3 ] zp[2]:20 [ main::sieve_i#2 main::sieve_i#1 ] zp[2]:22 [ main::$16 ] 
Uplifting [memset] best 10722 combination zp[2]:8 [ memset::dst#2 memset::dst#1 ] 
Uplifting [print_uint] best 10722 combination zp[2]:14 [ print_uint::w#0 ] 
Uplifting [MOS6526_CIA] best 10722 combination 
Uplifting [MOS6569_VICII] best 10722 combination 
Uplifting [MOS6581_SID] best 10722 combination 
Uplifting [RADIX] best 10722 combination 
Coalescing zero page register [ zp[2]:18 [ main::i#10 main::i#3 ] ] with [ zp[2]:14 [ print_uint::w#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:3 [ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 ] ] with [ zp[2]:16 [ main::i#12 main::i#2 ] ]
Coalescing zero page register [ zp[2]:22 [ main::$16 ] ] with [ zp[2]:8 [ memset::dst#2 memset::dst#1 ] ]
Allocated (was zp[2]:3) zp[2]:2 [ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 main::i#12 main::i#2 ]
Allocated (was zp[2]:22) zp[2]:4 [ main::$16 memset::dst#2 memset::dst#1 ]
Allocated (was zp[2]:10) zp[2]:6 [ main::j#2 main::j#1 main::j#0 ]
Allocated (was zp[2]:12) zp[2]:8 [ main::s#2 main::s#1 main::s#0 ]
Allocated (was zp[2]:18) zp[2]:10 [ main::i#10 main::i#3 print_uint::w#0 ]
Allocated (was zp[2]:20) zp[2]:12 [ main::sieve_i#2 main::sieve_i#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
/// @file
/// C standard library string.h
///
/// Functions to manipulate C strings and arrays.
/// NULL pointer
  // Upstart
  // Commodore 64 PRG executable file
.file [name="sieve-min.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
  .const COUNT = $4000
  /* Up to what number? */
  .const SQRT_COUNT = $80
  .label SCREEN = $400
  /* Sqrt of COUNT */
  .label sieve = $1000
  .label print_screen = $400
  .label print_char_cursor = 2
.segment Code
  // main
main: {
    .label i = 2
    .label sieve_i = $c
    .label j = 6
    .label s = 8
    .label i_1 = $a
    .label __16 = 4
    // [1] call memset
  // Fill sieve with zeros
    // [25] phi from main to memset [phi:main->memset]
  memset_from_main:
    jsr memset
    // [2] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [2] phi main::sieve_i#2 = sieve+2 [phi:main->main::@1#0] -- pbuz1=pbuc1 
    lda #<sieve+2
    sta.z sieve_i
    lda #>sieve+2
    sta.z sieve_i+1
    // [2] phi main::i#12 = 2 [phi:main->main::@1#1] -- vwuz1=vwuc1 
    lda #<2
    sta.z i
    lda #>2
    sta.z i+1
    jmp __b1
    // main::@1
  __b1:
    // [3] if(main::i#12<SQRT_COUNT) goto main::@2 -- vwuz1_lt_vbuc1_then_la1 
    lda.z i+1
    bne !+
    lda.z i
    cmp #SQRT_COUNT
    bcc __b2
  !:
    // [4] phi from main::@1 to main::@7 [phi:main::@1->main::@7]
  __b7_from___b1:
    // [4] phi print_char_cursor#29 = print_screen#0 [phi:main::@1->main::@7#0] -- pbuz1=pbuc1 
    lda #<print_screen
    sta.z print_char_cursor
    lda #>print_screen
    sta.z print_char_cursor+1
    // [4] phi main::i#10 = 2 [phi:main::@1->main::@7#1] -- vwuz1=vbuc1 
    lda #<2
    sta.z i_1
    lda #>2
    sta.z i_1+1
    jmp __b7
    // main::@7
  __b7:
    // [5] if(main::i#10<$4c7) goto main::@8 -- vwuz1_lt_vwuc1_then_la1 
    lda.z i_1+1
    cmp #>$4c7
    bcc __b8
    bne !+
    lda.z i_1
    cmp #<$4c7
    bcc __b8
  !:
    jmp __b11
    // main::@11
  __b11:
    // [6] *(SCREEN+$3e7) = ++ *(SCREEN+$3e7) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc SCREEN+$3e7
    jmp __b11
    // main::@8
  __b8:
    // [7] main::$16 = sieve + main::i#10 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z i_1
    clc
    adc #<sieve
    sta.z __16
    lda.z i_1+1
    adc #>sieve
    sta.z __16+1
    // [8] if(0!=*main::$16) goto main::@9 -- 0_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (__16),y
    cmp #0
    bne __b9_from___b8
    jmp __b10
    // main::@10
  __b10:
    // [9] print_uint::w#0 = main::i#10
    // [10] call print_uint
    jsr print_uint
    // [11] phi from main::@10 to main::@12 [phi:main::@10->main::@12]
  __b12_from___b10:
    jmp __b12
    // main::@12
  __b12:
    // [12] call print_char
    // [36] phi from main::@12 to print_char [phi:main::@12->print_char]
  print_char_from___b12:
    // [36] phi print_char_cursor#20 = print_char_cursor#21 [phi:main::@12->print_char#0] -- register_copy 
    // [36] phi print_char::ch#3 = ' ' [phi:main::@12->print_char#1] -- vbuaa=vbuc1 
    lda #' '
    jsr print_char
    // [13] phi from main::@12 main::@8 to main::@9 [phi:main::@12/main::@8->main::@9]
  __b9_from___b12:
  __b9_from___b8:
    // [13] phi print_char_cursor#35 = print_char_cursor#21 [phi:main::@12/main::@8->main::@9#0] -- register_copy 
    jmp __b9
    // main::@9
  __b9:
    // [14] main::i#3 = ++ main::i#10 -- vwuz1=_inc_vwuz1 
    inc.z i_1
    bne !+
    inc.z i_1+1
  !:
    // [4] phi from main::@9 to main::@7 [phi:main::@9->main::@7]
  __b7_from___b9:
    // [4] phi print_char_cursor#29 = print_char_cursor#35 [phi:main::@9->main::@7#0] -- register_copy 
    // [4] phi main::i#10 = main::i#3 [phi:main::@9->main::@7#1] -- register_copy 
    jmp __b7
    // main::@2
  __b2:
    // [15] if(0!=*main::sieve_i#2) goto main::@3 -- 0_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (sieve_i),y
    cmp #0
    bne __b3
    jmp __b6
    // main::@6
  __b6:
    // [16] main::j#0 = main::i#12 << 1 -- vwuz1=vwuz2_rol_1 
    /* Prime number - mark all multiples */
    lda.z i
    asl
    sta.z j
    lda.z i+1
    rol
    sta.z j+1
    // [17] main::s#0 = sieve + main::j#0 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z j
    clc
    adc #<sieve
    sta.z s
    lda.z j+1
    adc #>sieve
    sta.z s+1
    // [18] phi from main::@5 main::@6 to main::@4 [phi:main::@5/main::@6->main::@4]
  __b4_from___b5:
  __b4_from___b6:
    // [18] phi main::s#2 = main::s#1 [phi:main::@5/main::@6->main::@4#0] -- register_copy 
    // [18] phi main::j#2 = main::j#1 [phi:main::@5/main::@6->main::@4#1] -- register_copy 
    jmp __b4
    // main::@4
  __b4:
    // [19] if(main::j#2<COUNT) goto main::@5 -- vwuz1_lt_vwuc1_then_la1 
    lda.z j+1
    cmp #>COUNT
    bcc __b5
    bne !+
    lda.z j
    cmp #<COUNT
    bcc __b5
  !:
    jmp __b3
    // main::@3
  __b3:
    // [20] main::i#2 = ++ main::i#12 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // [21] main::sieve_i#1 = ++ main::sieve_i#2 -- pbuz1=_inc_pbuz1 
    inc.z sieve_i
    bne !+
    inc.z sieve_i+1
  !:
    // [2] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
  __b1_from___b3:
    // [2] phi main::sieve_i#2 = main::sieve_i#1 [phi:main::@3->main::@1#0] -- register_copy 
    // [2] phi main::i#12 = main::i#2 [phi:main::@3->main::@1#1] -- register_copy 
    jmp __b1
    // main::@5
  __b5:
    // [22] *main::s#2 = 1 -- _deref_pbuz1=vbuc1 
    lda #1
    ldy #0
    sta (s),y
    // [23] main::s#1 = main::s#2 + main::i#12 -- pbuz1=pbuz1_plus_vwuz2 
    clc
    lda.z s
    adc.z i
    sta.z s
    lda.z s+1
    adc.z i+1
    sta.z s+1
    // [24] main::j#1 = main::j#2 + main::i#12 -- vwuz1=vwuz1_plus_vwuz2 
    clc
    lda.z j
    adc.z i
    sta.z j
    lda.z j+1
    adc.z i+1
    sta.z j+1
    jmp __b4_from___b5
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// void * memset(void *str, char c, unsigned int num)
memset: {
    .const c = 0
    .label str = sieve
    .label end = str+COUNT
    .label dst = 4
    // [26] phi from memset to memset::@1 [phi:memset->memset::@1]
  __b1_from_memset:
    // [26] phi memset::dst#2 = (char *)memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1 
    lda #<str
    sta.z dst
    lda #>str
    sta.z dst+1
    jmp __b1
    // memset::@1
  __b1:
    // [27] if(memset::dst#2!=memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1 
    lda.z dst+1
    cmp #>end
    bne __b2
    lda.z dst
    cmp #<end
    bne __b2
    jmp __breturn
    // memset::@return
  __breturn:
    // [28] return 
    rts
    // memset::@2
  __b2:
    // [29] *memset::dst#2 = memset::c#0 -- _deref_pbuz1=vbuc1 
    lda #c
    ldy #0
    sta (dst),y
    // [30] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    // [26] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
  __b1_from___b2:
    // [26] phi memset::dst#2 = memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy 
    jmp __b1
}
  // print_uint
// Print a unsigned int as HEX
// void print_uint(__zp($a) unsigned int w)
print_uint: {
    .label w = $a
    // [31] print_uchar::b#0 = byte1  print_uint::w#0 -- vbuxx=_byte1_vwuz1 
    ldx.z w+1
    // [32] call print_uchar
    // [40] phi from print_uint to print_uchar [phi:print_uint->print_uchar]
  print_uchar_from_print_uint:
    // [40] phi print_char_cursor#28 = print_char_cursor#29 [phi:print_uint->print_uchar#0] -- register_copy 
    // [40] phi print_uchar::b#2 = print_uchar::b#0 [phi:print_uint->print_uchar#1] -- register_copy 
    jsr print_uchar
    jmp __b1
    // print_uint::@1
  __b1:
    // [33] print_uchar::b#1 = byte0  print_uint::w#0 -- vbuxx=_byte0_vwuz1 
    ldx.z w
    // [34] call print_uchar
    // [40] phi from print_uint::@1 to print_uchar [phi:print_uint::@1->print_uchar]
  print_uchar_from___b1:
    // [40] phi print_char_cursor#28 = print_char_cursor#21 [phi:print_uint::@1->print_uchar#0] -- register_copy 
    // [40] phi print_uchar::b#2 = print_uchar::b#1 [phi:print_uint::@1->print_uchar#1] -- register_copy 
    jsr print_uchar
    jmp __breturn
    // print_uint::@return
  __breturn:
    // [35] return 
    rts
}
  // print_char
// Print a single char
// void print_char(__register(A) char ch)
print_char: {
    // [37] *print_char_cursor#20 = print_char::ch#3 -- _deref_pbuz1=vbuaa 
    ldy #0
    sta (print_char_cursor),y
    // [38] print_char_cursor#21 = ++ print_char_cursor#20 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    jmp __breturn
    // print_char::@return
  __breturn:
    // [39] return 
    rts
}
  // print_uchar
// Print a char as HEX
// void print_uchar(__register(X) char b)
print_uchar: {
    // [41] print_uchar::$0 = print_uchar::b#2 >> 4 -- vbuaa=vbuxx_ror_4 
    txa
    lsr
    lsr
    lsr
    lsr
    // [42] print_char::ch#0 = print_hextab[print_uchar::$0] -- vbuaa=pbuc1_derefidx_vbuaa 
    tay
    lda print_hextab,y
    // [43] call print_char
  // Table of hexadecimal digits
    // [36] phi from print_uchar to print_char [phi:print_uchar->print_char]
  print_char_from_print_uchar:
    // [36] phi print_char_cursor#20 = print_char_cursor#28 [phi:print_uchar->print_char#0] -- register_copy 
    // [36] phi print_char::ch#3 = print_char::ch#0 [phi:print_uchar->print_char#1] -- register_copy 
    jsr print_char
    jmp __b1
    // print_uchar::@1
  __b1:
    // [44] print_uchar::$2 = print_uchar::b#2 & $f -- vbuxx=vbuxx_band_vbuc1 
    lda #$f
    axs #0
    // [45] print_char::ch#1 = print_hextab[print_uchar::$2] -- vbuaa=pbuc1_derefidx_vbuxx 
    lda print_hextab,x
    // [46] call print_char
    // [36] phi from print_uchar::@1 to print_char [phi:print_uchar::@1->print_char]
  print_char_from___b1:
    // [36] phi print_char_cursor#20 = print_char_cursor#21 [phi:print_uchar::@1->print_char#0] -- register_copy 
    // [36] phi print_char::ch#3 = print_char::ch#1 [phi:print_uchar::@1->print_char#1] -- register_copy 
    jsr print_char
    jmp __breturn
    // print_uchar::@return
  __breturn:
    // [47] return 
    rts
}
  // File Data
.segment Data
  print_hextab: .text "0123456789abcdef"

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b7
Removing instruction jmp __b11
Removing instruction jmp __b10
Removing instruction jmp __b12
Removing instruction jmp __b9
Removing instruction jmp __b6
Removing instruction jmp __b4
Removing instruction jmp __b3
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b9_from___b8 with __b9
Replacing label __b4_from___b5 with __b4
Removing instruction __b12_from___b10:
Removing instruction print_char_from___b12:
Removing instruction __b9_from___b12:
Removing instruction __b9_from___b8:
Removing instruction __b4_from___b5:
Removing instruction __b4_from___b6:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction memset_from_main:
Removing instruction __b1_from_main:
Removing instruction __b7_from___b1:
Removing instruction __b10:
Removing instruction __b12:
Removing instruction __b7_from___b9:
Removing instruction __b6:
Removing instruction __b1_from___b3:
Removing instruction __b1_from_memset:
Removing instruction __breturn:
Removing instruction __b1_from___b2:
Removing instruction print_uchar_from_print_uint:
Removing instruction __b1:
Removing instruction print_uchar_from___b1:
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction print_char_from_print_uchar:
Removing instruction __b1:
Removing instruction print_char_from___b1:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant const unsigned int COUNT = $4000
__constant char RADIX::BINARY = 2
__constant char RADIX::DECIMAL = $a
__constant char RADIX::HEXADECIMAL = $10
__constant char RADIX::OCTAL = 8
__constant char * const SCREEN = (char *) 1024
__constant const char SQRT_COUNT = $80
void main()
char *main::$16 // zp[2]:4 22.0
unsigned int main::i
unsigned int main::i#10 // i_1 zp[2]:10 6.111111111111112
unsigned int main::i#12 // i zp[2]:2 24.6
unsigned int main::i#2 // i zp[2]:2 11.0
unsigned int main::i#3 // i_1 zp[2]:10 22.0
unsigned int main::j
unsigned int main::j#0 // j zp[2]:6 16.5
unsigned int main::j#1 // j zp[2]:6 202.0
unsigned int main::j#2 // j zp[2]:6 78.5
char *main::s
char *main::s#0 // s zp[2]:8 22.0
char *main::s#1 // s zp[2]:8 101.0
char *main::s#2 // s zp[2]:8 104.66666666666666
char *main::sieve_i
char *main::sieve_i#1 // sieve_i zp[2]:12 22.0
char *main::sieve_i#2 // sieve_i zp[2]:12 3.0
void * memset(void *str , char c , unsigned int num)
char memset::c
__constant char memset::c#0 = 0 // c
char *memset::dst
char *memset::dst#1 // dst zp[2]:4 202.0
char *memset::dst#2 // dst zp[2]:4 134.66666666666666
char *memset::end
__constant char *memset::end#0 = (char *)memset::str#0+COUNT // end
unsigned int memset::num
void *memset::return
void *memset::str
__constant void *memset::str#0 = (void *)sieve // str
void print_char(char ch)
char print_char::ch
char print_char::ch#0 // reg byte a 2002.0
char print_char::ch#1 // reg byte a 2002.0
char print_char::ch#3 // reg byte a 12003.0
char *print_char_cursor
char *print_char_cursor#20 // print_char_cursor zp[2]:2 11007.5
char *print_char_cursor#21 // print_char_cursor zp[2]:2 794.6428571428571
char *print_char_cursor#28 // print_char_cursor zp[2]:2 401.00000000000006
char *print_char_cursor#29 // print_char_cursor zp[2]:2 20.5
char *print_char_cursor#35 // print_char_cursor zp[2]:2 16.5
__constant const char print_hextab[] = "0123456789abcdef"z
char *print_line_cursor
char *print_screen
__constant char *print_screen#0 = (char *) 1024 // print_screen
void print_uchar(char b)
char print_uchar::$0 // reg byte a 2002.0
char print_uchar::$2 // reg byte x 2002.0
char print_uchar::b
char print_uchar::b#0 // reg byte x 202.0
char print_uchar::b#1 // reg byte x 202.0
char print_uchar::b#2 // reg byte x 551.0
void print_uint(unsigned int w)
unsigned int print_uint::w
unsigned int print_uint::w#0 // w zp[2]:10 71.0
__constant char *sieve = (char *) 4096

zp[2]:12 [ main::sieve_i#2 main::sieve_i#1 ]
zp[2]:10 [ main::i#10 main::i#3 print_uint::w#0 ]
zp[2]:6 [ main::j#2 main::j#1 main::j#0 ]
zp[2]:8 [ main::s#2 main::s#1 main::s#0 ]
reg byte a [ print_char::ch#3 print_char::ch#0 print_char::ch#1 ]
zp[2]:2 [ print_char_cursor#20 print_char_cursor#29 print_char_cursor#35 print_char_cursor#21 print_char_cursor#28 main::i#12 main::i#2 ]
reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ]
zp[2]:4 [ main::$16 memset::dst#2 memset::dst#1 ]
reg byte a [ print_uchar::$0 ]
reg byte x [ print_uchar::$2 ]


FINAL ASSEMBLER
Score: 9717

  // File Comments
/// @file
/// C standard library string.h
///
/// Functions to manipulate C strings and arrays.
/// NULL pointer
  // Upstart
  // Commodore 64 PRG executable file
.file [name="sieve-min.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
  .const COUNT = $4000
  /* Up to what number? */
  .const SQRT_COUNT = $80
  .label SCREEN = $400
  /* Sqrt of COUNT */
  .label sieve = $1000
  .label print_screen = $400
  .label print_char_cursor = 2
.segment Code
  // main
main: {
    .label i = 2
    .label sieve_i = $c
    .label j = 6
    .label s = 8
    .label i_1 = $a
    .label __16 = 4
    // memset(sieve, 0, COUNT)
    // [1] call memset
  // Fill sieve with zeros
    // [25] phi from main to memset [phi:main->memset]
    jsr memset
    // [2] phi from main to main::@1 [phi:main->main::@1]
    // [2] phi main::sieve_i#2 = sieve+2 [phi:main->main::@1#0] -- pbuz1=pbuc1 
    lda #<sieve+2
    sta.z sieve_i
    lda #>sieve+2
    sta.z sieve_i+1
    // [2] phi main::i#12 = 2 [phi:main->main::@1#1] -- vwuz1=vwuc1 
    lda #<2
    sta.z i
    lda #>2
    sta.z i+1
    // main::@1
  __b1:
    // while (i < SQRT_COUNT)
    // [3] if(main::i#12<SQRT_COUNT) goto main::@2 -- vwuz1_lt_vbuc1_then_la1 
    lda.z i+1
    bne !+
    lda.z i
    cmp #SQRT_COUNT
    bcc __b2
  !:
    // [4] phi from main::@1 to main::@7 [phi:main::@1->main::@7]
    // [4] phi print_char_cursor#29 = print_screen#0 [phi:main::@1->main::@7#0] -- pbuz1=pbuc1 
    lda #<print_screen
    sta.z print_char_cursor
    lda #>print_screen
    sta.z print_char_cursor+1
    // [4] phi main::i#10 = 2 [phi:main::@1->main::@7#1] -- vwuz1=vbuc1 
    lda #<2
    sta.z i_1
    lda #>2
    sta.z i_1+1
    // main::@7
  __b7:
    // for (i = 2; i < 0x04c7; ++i)
    // [5] if(main::i#10<$4c7) goto main::@8 -- vwuz1_lt_vwuc1_then_la1 
    lda.z i_1+1
    cmp #>$4c7
    bcc __b8
    bne !+
    lda.z i_1
    cmp #<$4c7
    bcc __b8
  !:
    // main::@11
  __b11:
    // (*(SCREEN+999))++;
    // [6] *(SCREEN+$3e7) = ++ *(SCREEN+$3e7) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc SCREEN+$3e7
    jmp __b11
    // main::@8
  __b8:
    // if (!sieve[i])
    // [7] main::$16 = sieve + main::i#10 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z i_1
    clc
    adc #<sieve
    sta.z __16
    lda.z i_1+1
    adc #>sieve
    sta.z __16+1
    // [8] if(0!=*main::$16) goto main::@9 -- 0_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (__16),y
    cmp #0
    bne __b9
    // main::@10
    // print_uint(i)
    // [9] print_uint::w#0 = main::i#10
    // [10] call print_uint
    jsr print_uint
    // [11] phi from main::@10 to main::@12 [phi:main::@10->main::@12]
    // main::@12
    // print_char(' ')
    // [12] call print_char
    // [36] phi from main::@12 to print_char [phi:main::@12->print_char]
    // [36] phi print_char_cursor#20 = print_char_cursor#21 [phi:main::@12->print_char#0] -- register_copy 
    // [36] phi print_char::ch#3 = ' ' [phi:main::@12->print_char#1] -- vbuaa=vbuc1 
    lda #' '
    jsr print_char
    // [13] phi from main::@12 main::@8 to main::@9 [phi:main::@12/main::@8->main::@9]
    // [13] phi print_char_cursor#35 = print_char_cursor#21 [phi:main::@12/main::@8->main::@9#0] -- register_copy 
    // main::@9
  __b9:
    // for (i = 2; i < 0x04c7; ++i)
    // [14] main::i#3 = ++ main::i#10 -- vwuz1=_inc_vwuz1 
    inc.z i_1
    bne !+
    inc.z i_1+1
  !:
    // [4] phi from main::@9 to main::@7 [phi:main::@9->main::@7]
    // [4] phi print_char_cursor#29 = print_char_cursor#35 [phi:main::@9->main::@7#0] -- register_copy 
    // [4] phi main::i#10 = main::i#3 [phi:main::@9->main::@7#1] -- register_copy 
    jmp __b7
    // main::@2
  __b2:
    // if (!*sieve_i)
    // [15] if(0!=*main::sieve_i#2) goto main::@3 -- 0_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (sieve_i),y
    cmp #0
    bne __b3
    // main::@6
    // unsigned int j = i*2
    // [16] main::j#0 = main::i#12 << 1 -- vwuz1=vwuz2_rol_1 
    /* Prime number - mark all multiples */
    lda.z i
    asl
    sta.z j
    lda.z i+1
    rol
    sta.z j+1
    // unsigned char* s = &sieve[j]
    // [17] main::s#0 = sieve + main::j#0 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z j
    clc
    adc #<sieve
    sta.z s
    lda.z j+1
    adc #>sieve
    sta.z s+1
    // [18] phi from main::@5 main::@6 to main::@4 [phi:main::@5/main::@6->main::@4]
    // [18] phi main::s#2 = main::s#1 [phi:main::@5/main::@6->main::@4#0] -- register_copy 
    // [18] phi main::j#2 = main::j#1 [phi:main::@5/main::@6->main::@4#1] -- register_copy 
    // main::@4
  __b4:
    // while (j < COUNT)
    // [19] if(main::j#2<COUNT) goto main::@5 -- vwuz1_lt_vwuc1_then_la1 
    lda.z j+1
    cmp #>COUNT
    bcc __b5
    bne !+
    lda.z j
    cmp #<COUNT
    bcc __b5
  !:
    // main::@3
  __b3:
    // i++;
    // [20] main::i#2 = ++ main::i#12 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // sieve_i++;
    // [21] main::sieve_i#1 = ++ main::sieve_i#2 -- pbuz1=_inc_pbuz1 
    inc.z sieve_i
    bne !+
    inc.z sieve_i+1
  !:
    // [2] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
    // [2] phi main::sieve_i#2 = main::sieve_i#1 [phi:main::@3->main::@1#0] -- register_copy 
    // [2] phi main::i#12 = main::i#2 [phi:main::@3->main::@1#1] -- register_copy 
    jmp __b1
    // main::@5
  __b5:
    // *s = 1
    // [22] *main::s#2 = 1 -- _deref_pbuz1=vbuc1 
    lda #1
    ldy #0
    sta (s),y
    // s += i
    // [23] main::s#1 = main::s#2 + main::i#12 -- pbuz1=pbuz1_plus_vwuz2 
    clc
    lda.z s
    adc.z i
    sta.z s
    lda.z s+1
    adc.z i+1
    sta.z s+1
    // j += i
    // [24] main::j#1 = main::j#2 + main::i#12 -- vwuz1=vwuz1_plus_vwuz2 
    clc
    lda.z j
    adc.z i
    sta.z j
    lda.z j+1
    adc.z i+1
    sta.z j+1
    jmp __b4
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// void * memset(void *str, char c, unsigned int num)
memset: {
    .const c = 0
    .label str = sieve
    .label end = str+COUNT
    .label dst = 4
    // [26] phi from memset to memset::@1 [phi:memset->memset::@1]
    // [26] phi memset::dst#2 = (char *)memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1 
    lda #<str
    sta.z dst
    lda #>str
    sta.z dst+1
    // memset::@1
  __b1:
    // for(char* dst = str; dst!=end; dst++)
    // [27] if(memset::dst#2!=memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1 
    lda.z dst+1
    cmp #>end
    bne __b2
    lda.z dst
    cmp #<end
    bne __b2
    // memset::@return
    // }
    // [28] return 
    rts
    // memset::@2
  __b2:
    // *dst = c
    // [29] *memset::dst#2 = memset::c#0 -- _deref_pbuz1=vbuc1 
    lda #c
    ldy #0
    sta (dst),y
    // for(char* dst = str; dst!=end; dst++)
    // [30] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    // [26] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
    // [26] phi memset::dst#2 = memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy 
    jmp __b1
}
  // print_uint
// Print a unsigned int as HEX
// void print_uint(__zp($a) unsigned int w)
print_uint: {
    .label w = $a
    // print_uchar(BYTE1(w))
    // [31] print_uchar::b#0 = byte1  print_uint::w#0 -- vbuxx=_byte1_vwuz1 
    ldx.z w+1
    // [32] call print_uchar
    // [40] phi from print_uint to print_uchar [phi:print_uint->print_uchar]
    // [40] phi print_char_cursor#28 = print_char_cursor#29 [phi:print_uint->print_uchar#0] -- register_copy 
    // [40] phi print_uchar::b#2 = print_uchar::b#0 [phi:print_uint->print_uchar#1] -- register_copy 
    jsr print_uchar
    // print_uint::@1
    // print_uchar(BYTE0(w))
    // [33] print_uchar::b#1 = byte0  print_uint::w#0 -- vbuxx=_byte0_vwuz1 
    ldx.z w
    // [34] call print_uchar
    // [40] phi from print_uint::@1 to print_uchar [phi:print_uint::@1->print_uchar]
    // [40] phi print_char_cursor#28 = print_char_cursor#21 [phi:print_uint::@1->print_uchar#0] -- register_copy 
    // [40] phi print_uchar::b#2 = print_uchar::b#1 [phi:print_uint::@1->print_uchar#1] -- register_copy 
    jsr print_uchar
    // print_uint::@return
    // }
    // [35] return 
    rts
}
  // print_char
// Print a single char
// void print_char(__register(A) char ch)
print_char: {
    // *(print_char_cursor++) = ch
    // [37] *print_char_cursor#20 = print_char::ch#3 -- _deref_pbuz1=vbuaa 
    ldy #0
    sta (print_char_cursor),y
    // *(print_char_cursor++) = ch;
    // [38] print_char_cursor#21 = ++ print_char_cursor#20 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    // print_char::@return
    // }
    // [39] return 
    rts
}
  // print_uchar
// Print a char as HEX
// void print_uchar(__register(X) char b)
print_uchar: {
    // b>>4
    // [41] print_uchar::$0 = print_uchar::b#2 >> 4 -- vbuaa=vbuxx_ror_4 
    txa
    lsr
    lsr
    lsr
    lsr
    // print_char(print_hextab[b>>4])
    // [42] print_char::ch#0 = print_hextab[print_uchar::$0] -- vbuaa=pbuc1_derefidx_vbuaa 
    tay
    lda print_hextab,y
    // [43] call print_char
  // Table of hexadecimal digits
    // [36] phi from print_uchar to print_char [phi:print_uchar->print_char]
    // [36] phi print_char_cursor#20 = print_char_cursor#28 [phi:print_uchar->print_char#0] -- register_copy 
    // [36] phi print_char::ch#3 = print_char::ch#0 [phi:print_uchar->print_char#1] -- register_copy 
    jsr print_char
    // print_uchar::@1
    // b&$f
    // [44] print_uchar::$2 = print_uchar::b#2 & $f -- vbuxx=vbuxx_band_vbuc1 
    lda #$f
    axs #0
    // print_char(print_hextab[b&$f])
    // [45] print_char::ch#1 = print_hextab[print_uchar::$2] -- vbuaa=pbuc1_derefidx_vbuxx 
    lda print_hextab,x
    // [46] call print_char
    // [36] phi from print_uchar::@1 to print_char [phi:print_uchar::@1->print_char]
    // [36] phi print_char_cursor#20 = print_char_cursor#21 [phi:print_uchar::@1->print_char#0] -- register_copy 
    // [36] phi print_char::ch#3 = print_char::ch#1 [phi:print_uchar::@1->print_char#1] -- register_copy 
    jsr print_char
    // print_uchar::@return
    // }
    // [47] return 
    rts
}
  // File Data
.segment Data
  print_hextab: .text "0123456789abcdef"

