Converting variable modified inside __stackcall procedure main() to load/store idx
Adding parameter assignment in __stackcall procedure print::spacing = param(print::spacing)
Adding parameter assignment in __stackcall procedure print::str = param(print::str)
Inlined call call __init
Calling convention __stackcall adding prepare/execute/finalize for call print(main::str, 1)
Calling convention __stackcall adding prepare/execute/finalize for call print(main::str1, 2)
Calling convention __stackcall adding prepare/execute/finalize for call main
Calling convention STACK_CALL replacing param(print::str) with stackidx(char *,print::OFFSET_STACK_STR)
Calling convention STACK_CALL replacing param(print::spacing) with stackidx(char,print::OFFSET_STACK_SPACING)
Calling convention STACK_CALL adding stack push stackpush(char *) = main::str
Calling convention STACK_CALL adding stack push stackpush(char) = 1
Calling convention STACK_CALL adding stack push stackpush(char *) = main::str1
Calling convention STACK_CALL adding stack push stackpush(char) = 2

CONTROL FLOW GRAPH SSA

__stackcall void main()
main: scope:[main]  from
  stackpush(char *) = main::str
  stackpush(char) = 1
  callexecute print 
  sideeffect stackpullbytes(3)
  stackpush(char *) = main::str1
  stackpush(char) = 2
  callexecute print 
  sideeffect stackpullbytes(3)
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return

__stackcall void print(char *str , char spacing)
print: scope:[print]  from
  print::str#0 = stackidx(char *,print::OFFSET_STACK_STR)
  print::spacing#0 = stackidx(char,print::OFFSET_STACK_SPACING)
  to:print::@1
print::@1: scope:[print]  from print print::@3
  print::spacing#4 = phi( print/print::spacing#0, print::@3/print::spacing#1 )
  print::str#2 = phi( print/print::str#0, print::@3/print::str#4 )
  print::$1 = 0 != *print::str#2
  if(print::$1) goto print::@2
  to:print::@return
print::@2: scope:[print]  from print::@1
  print::spacing#2 = phi( print::@1/print::spacing#4 )
  print::str#3 = phi( print::@1/print::str#2 )
  SCREEN[idx] = *print::str#3
  idx = ++ idx
  print::str#1 = ++ print::str#3
  print::c#0 = 0
  to:print::@3
print::@3: scope:[print]  from print::@2 print::@4
  print::str#4 = phi( print::@2/print::str#1, print::@4/print::str#5 )
  print::spacing#1 = phi( print::@2/print::spacing#2, print::@4/print::spacing#3 )
  print::c#2 = phi( print::@2/print::c#0, print::@4/print::c#1 )
  print::$0 = print::c#2 < print::spacing#1
  if(print::$0) goto print::@4
  to:print::@1
print::@4: scope:[print]  from print::@3
  print::str#5 = phi( print::@3/print::str#4 )
  print::spacing#3 = phi( print::@3/print::spacing#1 )
  print::c#3 = phi( print::@3/print::c#2 )
  SCREEN[idx] = ' '
  idx = ++ idx
  print::c#1 = ++ print::c#3
  to:print::@3
print::@return: scope:[print]  from print::@1
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  idx = 0
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  callexecute main 
  to:__start::@return
__start::@return: scope:[__start]  from __start::@1
  return 
  to:@return

SYMBOL TABLE SSA
__constant char * const SCREEN = (char *)$400
__constant unsigned int STACK_BASE = $103
void __start()
__loadstore char idx
__stackcall void main()
__constant char main::str[6] = "hello"
__constant char main::str1[6] = "world"
__stackcall void print(char *str , char spacing)
bool print::$0
bool print::$1
__constant char print::OFFSET_STACK_SPACING = 0
__constant char print::OFFSET_STACK_STR = 1
char print::c
char print::c#0
char print::c#1
char print::c#2
char print::c#3
char print::spacing
char print::spacing#0
char print::spacing#1
char print::spacing#2
char print::spacing#3
char print::spacing#4
char *print::str
char *print::str#0
char *print::str#1
char *print::str#2
char *print::str#3
char *print::str#4
char *print::str#5

Adding number conversion cast (unumber) 1 in stackpush(char) = 1
Adding number conversion cast (unumber) 2 in stackpush(char) = 2
Adding number conversion cast (unumber) 0 in print::$1 = 0 != *print::str#2
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast stackpush(char) = (unumber)1
Inlining cast stackpush(char) = (unumber)2
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias print::str#2 = print::str#3 
Alias print::spacing#2 = print::spacing#4 
Alias print::c#2 = print::c#3 
Alias print::spacing#1 = print::spacing#3 
Alias print::str#4 = print::str#5 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values print::spacing#1 print::spacing#2
Identical Phi Values print::str#4 print::str#1
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values print::spacing#2 print::spacing#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition print::$1 [13] if(0!=*print::str#2) goto print::@2
Simple Condition print::$0 [20] if(print::c#2<print::spacing#0) goto print::@4
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant print::c#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings print::c#0
Constant inlined print::c#0 = 0
Successful SSA optimization Pass2ConstantInlining
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting print::@5(between print::@3 and print::@1)
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1
CALL GRAPH
Calls in [__start] to main:3 
Calls in [main] to print:23 print:27 

Created 2 initial phi equivalence classes
Coalesced [7] print::str#6 = print::str#0
Coalesced [16] print::str#7 = print::str#1
Coalesced [20] print::c#4 = print::c#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block label print::@5
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1

FINAL CONTROL FLOW GRAPH

void __start()
__start: scope:[__start]  from
  [0] phi()
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  [1] idx = 0
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  [2] phi()
  [3] callexecute main 
  to:__start::@return
__start::@return: scope:[__start]  from __start::@1
  [4] return 
  to:@return

__stackcall void print(char *str , char spacing)
print: scope:[print]  from
  [5] print::str#0 = stackidx(char *,print::OFFSET_STACK_STR)
  [6] print::spacing#0 = stackidx(char,print::OFFSET_STACK_SPACING)
  to:print::@1
print::@1: scope:[print]  from print print::@3
  [7] print::str#2 = phi( print/print::str#0, print::@3/print::str#1 )
  [8] if(0!=*print::str#2) goto print::@2
  to:print::@return
print::@return: scope:[print]  from print::@1
  [9] return 
  to:@return
print::@2: scope:[print]  from print::@1
  [10] SCREEN[idx] = *print::str#2
  [11] idx = ++ idx
  [12] print::str#1 = ++ print::str#2
  to:print::@3
print::@3: scope:[print]  from print::@2 print::@4
  [13] print::c#2 = phi( print::@2/0, print::@4/print::c#1 )
  [14] if(print::c#2<print::spacing#0) goto print::@4
  to:print::@1
print::@4: scope:[print]  from print::@3
  [15] SCREEN[idx] = ' '
  [16] idx = ++ idx
  [17] print::c#1 = ++ print::c#2
  to:print::@3

__stackcall void main()
main: scope:[main]  from
  [18] stackpush(char *) = main::str
  [19] stackpush(char) = 1
  [20] callexecute print 
  sideeffect stackpullbytes(3)
  [22] stackpush(char *) = main::str1
  [23] stackpush(char) = 2
  [24] callexecute print 
  sideeffect stackpullbytes(3)
  to:main::@return
main::@return: scope:[main]  from main
  [26] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void __start()
__loadstore char idx // 1571.8095238095236
__stackcall void main()
__stackcall void print(char *str , char spacing)
char print::c
char print::c#1 // 20002.0
char print::c#2 // 7500.75
char print::spacing
char print::spacing#0 // 918.3636363636363
char *print::str
char *print::str#0 // 101.0
char *print::str#1 // 1833.6666666666665
char *print::str#2 // 3276.25

Initial phi equivalence classes
[ print::str#2 print::str#0 print::str#1 ]
[ print::c#2 print::c#1 ]
Added variable idx to live range equivalence class [ idx ]
Added variable print::spacing#0 to live range equivalence class [ print::spacing#0 ]
Complete equivalence classes
[ print::str#2 print::str#0 print::str#1 ]
[ print::c#2 print::c#1 ]
[ idx ]
[ print::spacing#0 ]
Allocated zp[1]:2 [ print::c#2 print::c#1 ]
Allocated zp[2]:3 [ print::str#2 print::str#0 print::str#1 ]
Allocated zp[1]:5 [ idx ]
Allocated zp[1]:6 [ print::spacing#0 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] idx = 0 [ idx ] (  [ idx ] { }  ) always clobbers reg byte a 
Statement [5] print::str#0 = stackidx(char *,print::OFFSET_STACK_STR) [ idx print::str#0 ] ( main:3::print:20 [ idx print::str#0 ] { }  main:3::print:24 [ idx print::str#0 ] { }  ) always clobbers reg byte a reg byte x 
Statement [6] print::spacing#0 = stackidx(char,print::OFFSET_STACK_SPACING) [ idx print::str#0 print::spacing#0 ] ( main:3::print:20 [ idx print::str#0 print::spacing#0 ] { }  main:3::print:24 [ idx print::str#0 print::spacing#0 ] { }  ) always clobbers reg byte a reg byte x 
Statement [8] if(0!=*print::str#2) goto print::@2 [ idx print::spacing#0 print::str#2 ] ( main:3::print:20 [ idx print::spacing#0 print::str#2 ] { }  main:3::print:24 [ idx print::spacing#0 print::str#2 ] { }  ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp[1]:6 [ print::spacing#0 ]
Removing always clobbered register reg byte y as potential for zp[1]:6 [ print::spacing#0 ]
Statement [10] SCREEN[idx] = *print::str#2 [ idx print::spacing#0 print::str#2 ] ( main:3::print:20 [ idx print::spacing#0 print::str#2 ] { }  main:3::print:24 [ idx print::spacing#0 print::str#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [15] SCREEN[idx] = ' ' [ idx print::spacing#0 print::str#1 print::c#2 ] ( main:3::print:20 [ idx print::spacing#0 print::str#1 print::c#2 ] { }  main:3::print:24 [ idx print::spacing#0 print::str#1 print::c#2 ] { }  ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ print::c#2 print::c#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:2 [ print::c#2 print::c#1 ]
Statement [18] stackpush(char *) = main::str [ idx ] ( main:3 [ idx ] { }  ) always clobbers reg byte a 
Statement [19] stackpush(char) = 1 [ idx ] ( main:3 [ idx ] { }  ) always clobbers reg byte a 
Statement sideeffect stackpullbytes(3) always clobbers reg byte a reg byte x 
Statement [22] stackpush(char *) = main::str1 [ idx ] ( main:3 [ idx ] { }  ) always clobbers reg byte a 
Statement [23] stackpush(char) = 2 [ idx ] ( main:3 [ idx ] { }  ) always clobbers reg byte a 
Statement sideeffect stackpullbytes(3) always clobbers reg byte a reg byte x 
Statement [1] idx = 0 [ idx ] (  [ idx ] { }  ) always clobbers reg byte a 
Statement [5] print::str#0 = stackidx(char *,print::OFFSET_STACK_STR) [ idx print::str#0 ] ( main:3::print:20 [ idx print::str#0 ] { }  main:3::print:24 [ idx print::str#0 ] { }  ) always clobbers reg byte a reg byte x 
Statement [6] print::spacing#0 = stackidx(char,print::OFFSET_STACK_SPACING) [ idx print::str#0 print::spacing#0 ] ( main:3::print:20 [ idx print::str#0 print::spacing#0 ] { }  main:3::print:24 [ idx print::str#0 print::spacing#0 ] { }  ) always clobbers reg byte a reg byte x 
Statement [8] if(0!=*print::str#2) goto print::@2 [ idx print::spacing#0 print::str#2 ] ( main:3::print:20 [ idx print::spacing#0 print::str#2 ] { }  main:3::print:24 [ idx print::spacing#0 print::str#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [10] SCREEN[idx] = *print::str#2 [ idx print::spacing#0 print::str#2 ] ( main:3::print:20 [ idx print::spacing#0 print::str#2 ] { }  main:3::print:24 [ idx print::spacing#0 print::str#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [15] SCREEN[idx] = ' ' [ idx print::spacing#0 print::str#1 print::c#2 ] ( main:3::print:20 [ idx print::spacing#0 print::str#1 print::c#2 ] { }  main:3::print:24 [ idx print::spacing#0 print::str#1 print::c#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [18] stackpush(char *) = main::str [ idx ] ( main:3 [ idx ] { }  ) always clobbers reg byte a 
Statement [19] stackpush(char) = 1 [ idx ] ( main:3 [ idx ] { }  ) always clobbers reg byte a 
Statement sideeffect stackpullbytes(3) always clobbers reg byte a reg byte x 
Statement [22] stackpush(char *) = main::str1 [ idx ] ( main:3 [ idx ] { }  ) always clobbers reg byte a 
Statement [23] stackpush(char) = 2 [ idx ] ( main:3 [ idx ] { }  ) always clobbers reg byte a 
Statement sideeffect stackpullbytes(3) always clobbers reg byte a reg byte x 
Potential registers zp[2]:3 [ print::str#2 print::str#0 print::str#1 ] : zp[2]:3 , 
Potential registers zp[1]:2 [ print::c#2 print::c#1 ] : zp[1]:2 , reg byte x , 
Potential registers zp[1]:5 [ idx ] : zp[1]:5 , 
Potential registers zp[1]:6 [ print::spacing#0 ] : zp[1]:6 , reg byte x , 

REGISTER UPLIFT SCOPES
Uplift Scope [print] 27,502.75: zp[1]:2 [ print::c#2 print::c#1 ] 5,210.92: zp[2]:3 [ print::str#2 print::str#0 print::str#1 ] 918.36: zp[1]:6 [ print::spacing#0 ] 
Uplift Scope [] 1,571.81: zp[1]:5 [ idx ] 
Uplift Scope [main] 
Uplift Scope [__start] 

Uplifting [print] best 4012 combination reg byte x [ print::c#2 print::c#1 ] zp[2]:3 [ print::str#2 print::str#0 print::str#1 ] zp[1]:6 [ print::spacing#0 ] 
Uplifting [] best 4012 combination zp[1]:5 [ idx ] 
Uplifting [main] best 4012 combination 
Uplifting [__start] best 4012 combination 
Attempting to uplift remaining variables inzp[1]:5 [ idx ]
Uplifting [] best 4012 combination zp[1]:5 [ idx ] 
Attempting to uplift remaining variables inzp[1]:6 [ print::spacing#0 ]
Uplifting [print] best 4012 combination zp[1]:6 [ print::spacing#0 ] 
Allocated (was zp[2]:3) zp[2]:2 [ print::str#2 print::str#0 print::str#1 ]
Allocated (was zp[1]:5) zp[1]:4 [ idx ]
Allocated (was zp[1]:6) zp[1]:5 [ print::spacing#0 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test a procedure with calling convention stack
// Test that comments are handled correctly
  // Upstart
  // Commodore 64 PRG executable file
.file [name="procedure-callingconvention-stack-12.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(__start)
  // Global Constants & labels
  .const STACK_BASE = $103
  .label SCREEN = $400
  .label idx = 4
.segment Code
  // __start
__start: {
    jmp __init1
    // __start::__init1
  __init1:
    // [1] idx = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z idx
    // [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
  __b1_from___init1:
    jmp __b1
    // __start::@1
  __b1:
    // [3] callexecute main  -- call_vprc1 
    jsr main
    jmp __breturn
    // __start::@return
  __breturn:
    // [4] return 
    rts
}
  // print
// void print(__zp(2) char *str, __zp(5) char spacing)
print: {
    .const OFFSET_STACK_STR = 1
    .const OFFSET_STACK_SPACING = 0
    .label str = 2
    .label spacing = 5
    // [5] print::str#0 = stackidx(char *,print::OFFSET_STACK_STR) -- pbuz1=_stackidxptr_vbuc1 
    tsx
    lda STACK_BASE+OFFSET_STACK_STR,x
    sta.z str
    lda STACK_BASE+OFFSET_STACK_STR+1,x
    sta.z str+1
    // [6] print::spacing#0 = stackidx(char,print::OFFSET_STACK_SPACING) -- vbuz1=_stackidxbyte_vbuc1 
    tsx
    lda STACK_BASE+OFFSET_STACK_SPACING,x
    sta.z spacing
    // [7] phi from print print::@3 to print::@1 [phi:print/print::@3->print::@1]
  __b1_from_print:
  __b1_from___b3:
    // [7] phi print::str#2 = print::str#0 [phi:print/print::@3->print::@1#0] -- register_copy 
    jmp __b1
    // print::@1
  __b1:
    // [8] if(0!=*print::str#2) goto print::@2 -- 0_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (str),y
    cmp #0
    bne __b2
    jmp __breturn
    // print::@return
  __breturn:
    // [9] return 
    rts
    // print::@2
  __b2:
    // [10] SCREEN[idx] = *print::str#2 -- pbuc1_derefidx_vbuz1=_deref_pbuz2 
    ldy #0
    lda (str),y
    ldy.z idx
    sta SCREEN,y
    // [11] idx = ++ idx -- vbuz1=_inc_vbuz1 
    inc.z idx
    // [12] print::str#1 = ++ print::str#2 -- pbuz1=_inc_pbuz1 
    inc.z str
    bne !+
    inc.z str+1
  !:
    // [13] phi from print::@2 to print::@3 [phi:print::@2->print::@3]
  __b3_from___b2:
    // [13] phi print::c#2 = 0 [phi:print::@2->print::@3#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b3
    // print::@3
  __b3:
    // [14] if(print::c#2<print::spacing#0) goto print::@4 -- vbuxx_lt_vbuz1_then_la1 
    cpx.z spacing
    bcc __b4
    jmp __b1_from___b3
    // print::@4
  __b4:
    // [15] SCREEN[idx] = ' ' -- pbuc1_derefidx_vbuz1=vbuc2 
    lda #' '
    ldy.z idx
    sta SCREEN,y
    // [16] idx = ++ idx -- vbuz1=_inc_vbuz1 
    inc.z idx
    // [17] print::c#1 = ++ print::c#2 -- vbuxx=_inc_vbuxx 
    inx
    // [13] phi from print::@4 to print::@3 [phi:print::@4->print::@3]
  __b3_from___b4:
    // [13] phi print::c#2 = print::c#1 [phi:print::@4->print::@3#0] -- register_copy 
    jmp __b3
}
  // main
main: {
    // [18] stackpush(char *) = main::str -- _stackpushptr_=pbuc1 
    // Print "hello"
    lda #>str
    pha
    lda #<str
    pha
    // [19] stackpush(char) = 1 -- _stackpushbyte_=vbuc1 
    lda #1
    pha
    // [20] callexecute print  -- call_vprc1 
    jsr print
    // sideeffect stackpullbytes(3) -- _stackpullbyte_3 
    tsx
    txa
    axs #-3
    txs
    // [22] stackpush(char *) = main::str1 -- _stackpushptr_=pbuc1 
    // Print "world"
    lda #>str1
    pha
    lda #<str1
    pha
    // [23] stackpush(char) = 2 -- _stackpushbyte_=vbuc1 
    lda #2
    pha
    // [24] callexecute print  -- call_vprc1 
    jsr print
    // sideeffect stackpullbytes(3) -- _stackpullbyte_3 
    tsx
    txa
    axs #-3
    txs
    jmp __breturn
    // main::@return
  __breturn:
    // [26] return 
    rts
  .segment Data
    str: .text "hello"
    .byte 0
    str1: .text "world"
    .byte 0
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __init1
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b3
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b3 with __b1
Removing instruction __b1_from___init1:
Removing instruction __b1_from_print:
Removing instruction __b1_from___b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __init1:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __b3_from___b2:
Removing instruction __b3_from___b4:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant char * const SCREEN = (char *) 1024
__constant unsigned int STACK_BASE = $103
void __start()
__loadstore char idx // zp[1]:4 1571.8095238095236
__stackcall void main()
__constant char main::str[6] = "hello"
__constant char main::str1[6] = "world"
__stackcall void print(char *str , char spacing)
__constant char print::OFFSET_STACK_SPACING = 0
__constant char print::OFFSET_STACK_STR = 1
char print::c
char print::c#1 // reg byte x 20002.0
char print::c#2 // reg byte x 7500.75
char print::spacing
char print::spacing#0 // spacing zp[1]:5 918.3636363636363
char *print::str
char *print::str#0 // str zp[2]:2 101.0
char *print::str#1 // str zp[2]:2 1833.6666666666665
char *print::str#2 // str zp[2]:2 3276.25

zp[2]:2 [ print::str#2 print::str#0 print::str#1 ]
reg byte x [ print::c#2 print::c#1 ]
zp[1]:4 [ idx ]
zp[1]:5 [ print::spacing#0 ]


FINAL ASSEMBLER
Score: 3613

  // File Comments
// Test a procedure with calling convention stack
// Test that comments are handled correctly
  // Upstart
  // Commodore 64 PRG executable file
.file [name="procedure-callingconvention-stack-12.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(__start)
  // Global Constants & labels
  .const STACK_BASE = $103
  .label SCREEN = $400
  .label idx = 4
.segment Code
  // __start
__start: {
    // __start::__init1
    // char idx = 0
    // [1] idx = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z idx
    // [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
    // __start::@1
    // [3] callexecute main  -- call_vprc1 
    jsr main
    // __start::@return
    // [4] return 
    rts
}
  // print
// void print(__zp(2) char *str, __zp(5) char spacing)
print: {
    .const OFFSET_STACK_STR = 1
    .const OFFSET_STACK_SPACING = 0
    .label str = 2
    .label spacing = 5
    // [5] print::str#0 = stackidx(char *,print::OFFSET_STACK_STR) -- pbuz1=_stackidxptr_vbuc1 
    tsx
    lda STACK_BASE+OFFSET_STACK_STR,x
    sta.z str
    lda STACK_BASE+OFFSET_STACK_STR+1,x
    sta.z str+1
    // [6] print::spacing#0 = stackidx(char,print::OFFSET_STACK_SPACING) -- vbuz1=_stackidxbyte_vbuc1 
    tsx
    lda STACK_BASE+OFFSET_STACK_SPACING,x
    sta.z spacing
    // [7] phi from print print::@3 to print::@1 [phi:print/print::@3->print::@1]
    // [7] phi print::str#2 = print::str#0 [phi:print/print::@3->print::@1#0] -- register_copy 
    // print::@1
  __b1:
    // while(*str)
    // [8] if(0!=*print::str#2) goto print::@2 -- 0_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (str),y
    cmp #0
    bne __b2
    // print::@return
    // }
    // [9] return 
    rts
    // print::@2
  __b2:
    // SCREEN[idx++] = *(str++)
    // [10] SCREEN[idx] = *print::str#2 -- pbuc1_derefidx_vbuz1=_deref_pbuz2 
    ldy #0
    lda (str),y
    ldy.z idx
    sta SCREEN,y
    // SCREEN[idx++] = *(str++);
    // [11] idx = ++ idx -- vbuz1=_inc_vbuz1 
    inc.z idx
    // [12] print::str#1 = ++ print::str#2 -- pbuz1=_inc_pbuz1 
    inc.z str
    bne !+
    inc.z str+1
  !:
    // [13] phi from print::@2 to print::@3 [phi:print::@2->print::@3]
    // [13] phi print::c#2 = 0 [phi:print::@2->print::@3#0] -- vbuxx=vbuc1 
    ldx #0
    // print::@3
  __b3:
    // for(char c=0;c<spacing;c++)
    // [14] if(print::c#2<print::spacing#0) goto print::@4 -- vbuxx_lt_vbuz1_then_la1 
    cpx.z spacing
    bcc __b4
    jmp __b1
    // print::@4
  __b4:
    // SCREEN[idx++] = ' '
    // [15] SCREEN[idx] = ' ' -- pbuc1_derefidx_vbuz1=vbuc2 
    lda #' '
    ldy.z idx
    sta SCREEN,y
    // SCREEN[idx++] = ' ';
    // [16] idx = ++ idx -- vbuz1=_inc_vbuz1 
    inc.z idx
    // for(char c=0;c<spacing;c++)
    // [17] print::c#1 = ++ print::c#2 -- vbuxx=_inc_vbuxx 
    inx
    // [13] phi from print::@4 to print::@3 [phi:print::@4->print::@3]
    // [13] phi print::c#2 = print::c#1 [phi:print::@4->print::@3#0] -- register_copy 
    jmp __b3
}
  // main
main: {
    // print("hello", 1)
    // [18] stackpush(char *) = main::str -- _stackpushptr_=pbuc1 
    // Print "hello"
    lda #>str
    pha
    lda #<str
    pha
    // [19] stackpush(char) = 1 -- _stackpushbyte_=vbuc1 
    lda #1
    pha
    // [20] callexecute print  -- call_vprc1 
    jsr print
    // sideeffect stackpullbytes(3) -- _stackpullbyte_3 
    tsx
    txa
    axs #-3
    txs
    // print("world", 2)
    // [22] stackpush(char *) = main::str1 -- _stackpushptr_=pbuc1 
    // Print "world"
    lda #>str1
    pha
    lda #<str1
    pha
    // [23] stackpush(char) = 2 -- _stackpushbyte_=vbuc1 
    lda #2
    pha
    // [24] callexecute print  -- call_vprc1 
    jsr print
    // sideeffect stackpullbytes(3) -- _stackpullbyte_3 
    tsx
    txa
    axs #-3
    txs
    // main::@return
    // }
    // [26] return 
    rts
  .segment Data
    str: .text "hello"
    .byte 0
    str1: .text "world"
    .byte 0
}
  // File Data

