Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  main::i#0 = $64
  to:main::@1
main::@1: scope:[main]  from main main::@3
  main::i#5 = phi( main/main::i#0, main::@3/main::i#1 )
  main::j#0 = $64
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@4
  main::i#4 = phi( main::@1/main::i#5, main::@4/main::i#3 )
  main::j#3 = phi( main::@1/main::j#0, main::@4/main::j#1 )
  call nest1
  to:main::@4
main::@4: scope:[main]  from main::@2
  main::i#3 = phi( main::@2/main::i#4 )
  main::j#2 = phi( main::@2/main::j#3 )
  main::j#1 = -- main::j#2
  main::$1 = main::j#1 > 0
  if(main::$1) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@4
  main::i#2 = phi( main::@4/main::i#3 )
  main::i#1 = -- main::i#2
  main::$2 = main::i#1 > 0
  if(main::$2) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@3
  return 
  to:@return

void nest1()
nest1: scope:[nest1]  from main::@2
  nest1::i#0 = $64
  to:nest1::@1
nest1::@1: scope:[nest1]  from nest1 nest1::@3
  nest1::i#5 = phi( nest1/nest1::i#0, nest1::@3/nest1::i#1 )
  nest1::j#0 = $64
  to:nest1::@2
nest1::@2: scope:[nest1]  from nest1::@1 nest1::@4
  nest1::i#4 = phi( nest1::@1/nest1::i#5, nest1::@4/nest1::i#3 )
  nest1::j#3 = phi( nest1::@1/nest1::j#0, nest1::@4/nest1::j#1 )
  call nest2
  to:nest1::@4
nest1::@4: scope:[nest1]  from nest1::@2
  nest1::i#3 = phi( nest1::@2/nest1::i#4 )
  nest1::j#2 = phi( nest1::@2/nest1::j#3 )
  nest1::j#1 = -- nest1::j#2
  nest1::$1 = nest1::j#1 > 0
  if(nest1::$1) goto nest1::@2
  to:nest1::@3
nest1::@3: scope:[nest1]  from nest1::@4
  nest1::i#2 = phi( nest1::@4/nest1::i#3 )
  nest1::i#1 = -- nest1::i#2
  nest1::$2 = nest1::i#1 > 0
  if(nest1::$2) goto nest1::@1
  to:nest1::@return
nest1::@return: scope:[nest1]  from nest1::@3
  return 
  to:@return

void nest2()
nest2: scope:[nest2]  from nest1::@2
  nest2::i#0 = $64
  to:nest2::@1
nest2::@1: scope:[nest2]  from nest2 nest2::@3
  nest2::i#4 = phi( nest2/nest2::i#0, nest2::@3/nest2::i#1 )
  nest2::j#0 = $64
  to:nest2::@2
nest2::@2: scope:[nest2]  from nest2::@1 nest2::@2
  nest2::i#3 = phi( nest2::@1/nest2::i#4, nest2::@2/nest2::i#3 )
  nest2::j#2 = phi( nest2::@1/nest2::j#0, nest2::@2/nest2::j#1 )
  *SCREEN = nest2::j#2
  nest2::j#1 = -- nest2::j#2
  nest2::$0 = nest2::j#1 > 0
  if(nest2::$0) goto nest2::@2
  to:nest2::@3
nest2::@3: scope:[nest2]  from nest2::@2
  nest2::i#2 = phi( nest2::@2/nest2::i#3 )
  nest2::i#1 = -- nest2::i#2
  nest2::$1 = nest2::i#1 > 0
  if(nest2::$1) goto nest2::@1
  to:nest2::@return
nest2::@return: scope:[nest2]  from nest2::@3
  return 
  to:@return

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

SYMBOL TABLE SSA
__constant char *SCREEN = (char *)$400
void __start()
void main()
bool main::$1
bool main::$2
char main::i
char main::i#0
char main::i#1
char main::i#2
char main::i#3
char main::i#4
char main::i#5
char main::j
char main::j#0
char main::j#1
char main::j#2
char main::j#3
void nest1()
bool nest1::$1
bool nest1::$2
char nest1::i
char nest1::i#0
char nest1::i#1
char nest1::i#2
char nest1::i#3
char nest1::i#4
char nest1::i#5
char nest1::j
char nest1::j#0
char nest1::j#1
char nest1::j#2
char nest1::j#3
void nest2()
bool nest2::$0
bool nest2::$1
char nest2::i
char nest2::i#0
char nest2::i#1
char nest2::i#2
char nest2::i#3
char nest2::i#4
char nest2::j
char nest2::j#0
char nest2::j#1
char nest2::j#2

Adding number conversion cast (unumber) 0 in main::$1 = main::j#1 > 0
Adding number conversion cast (unumber) 0 in main::$2 = main::i#1 > 0
Adding number conversion cast (unumber) 0 in nest1::$1 = nest1::j#1 > 0
Adding number conversion cast (unumber) 0 in nest1::$2 = nest1::i#1 > 0
Adding number conversion cast (unumber) 0 in nest2::$0 = nest2::j#1 > 0
Adding number conversion cast (unumber) 0 in nest2::$1 = nest2::i#1 > 0
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias main::j#2 = main::j#3 
Alias main::i#2 = main::i#3 main::i#4 
Alias nest1::j#2 = nest1::j#3 
Alias nest1::i#2 = nest1::i#3 nest1::i#4 
Alias nest2::i#2 = nest2::i#3 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values main::i#2 main::i#5
Identical Phi Values nest1::i#2 nest1::i#5
Identical Phi Values nest2::i#2 nest2::i#4
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition main::$1 [7] if(main::j#1>0) goto main::@2
Simple Condition main::$2 [10] if(main::i#1>0) goto main::@1
Simple Condition nest1::$1 [19] if(nest1::j#1>0) goto nest1::@2
Simple Condition nest1::$2 [22] if(nest1::i#1>0) goto nest1::@1
Simple Condition nest2::$0 [31] if(nest2::j#1>0) goto nest2::@2
Simple Condition nest2::$1 [34] if(nest2::i#1>0) goto nest2::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant main::i#0 = $64
Constant main::j#0 = $64
Constant nest1::i#0 = $64
Constant nest1::j#0 = $64
Constant nest2::i#0 = $64
Constant nest2::j#0 = $64
Successful SSA optimization Pass2ConstantIdentification
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
Inlining constant with var siblings main::i#0
Inlining constant with var siblings main::j#0
Inlining constant with var siblings nest1::i#0
Inlining constant with var siblings nest1::j#0
Inlining constant with var siblings nest2::i#0
Inlining constant with var siblings nest2::j#0
Constant inlined main::i#0 = $64
Constant inlined nest2::j#0 = $64
Constant inlined main::j#0 = $64
Constant inlined nest2::i#0 = $64
Constant inlined nest1::j#0 = $64
Constant inlined nest1::i#0 = $64
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@5(between main::@3 and main::@1)
Added new block during phi lifting main::@6(between main::@4 and main::@2)
Added new block during phi lifting nest1::@5(between nest1::@3 and nest1::@1)
Added new block during phi lifting nest1::@6(between nest1::@4 and nest1::@2)
Added new block during phi lifting nest2::@4(between nest2::@3 and nest2::@1)
Added new block during phi lifting nest2::@5(between nest2::@2 and nest2::@2)
Adding NOP phi() at start of main
Adding NOP phi() at start of nest1
Adding NOP phi() at start of nest2
CALL GRAPH
Calls in [main] to nest1:3 
Calls in [nest1] to nest2:14 

Created 6 initial phi equivalence classes
Coalesced [9] main::i#6 = main::i#1
Coalesced [10] main::j#4 = main::j#1
Coalesced [20] nest1::i#6 = nest1::i#1
Coalesced [21] nest1::j#4 = nest1::j#1
Coalesced [31] nest2::i#5 = nest2::i#1
Coalesced [32] nest2::j#3 = nest2::j#1
Coalesced down to 6 phi equivalence classes
Culled Empty Block label main::@5
Culled Empty Block label main::@6
Culled Empty Block label nest1::@5
Culled Empty Block label nest1::@6
Culled Empty Block label nest2::@4
Culled Empty Block label nest2::@5
Adding NOP phi() at start of main
Adding NOP phi() at start of nest1
Adding NOP phi() at start of nest2

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@3
  [1] main::i#5 = phi( main/$64, main::@3/main::i#1 )
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@4
  [2] main::j#2 = phi( main::@1/$64, main::@4/main::j#1 )
  [3] call nest1
  to:main::@4
main::@4: scope:[main]  from main::@2
  [4] main::j#1 = -- main::j#2
  [5] if(main::j#1>0) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@4
  [6] main::i#1 = -- main::i#5
  [7] if(main::i#1>0) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@3
  [8] return 
  to:@return

void nest1()
nest1: scope:[nest1]  from main::@2
  [9] phi()
  to:nest1::@1
nest1::@1: scope:[nest1]  from nest1 nest1::@3
  [10] nest1::i#5 = phi( nest1/$64, nest1::@3/nest1::i#1 )
  to:nest1::@2
nest1::@2: scope:[nest1]  from nest1::@1 nest1::@4
  [11] nest1::j#2 = phi( nest1::@1/$64, nest1::@4/nest1::j#1 )
  [12] call nest2
  to:nest1::@4
nest1::@4: scope:[nest1]  from nest1::@2
  [13] nest1::j#1 = -- nest1::j#2
  [14] if(nest1::j#1>0) goto nest1::@2
  to:nest1::@3
nest1::@3: scope:[nest1]  from nest1::@4
  [15] nest1::i#1 = -- nest1::i#5
  [16] if(nest1::i#1>0) goto nest1::@1
  to:nest1::@return
nest1::@return: scope:[nest1]  from nest1::@3
  [17] return 
  to:@return

void nest2()
nest2: scope:[nest2]  from nest1::@2
  [18] phi()
  to:nest2::@1
nest2::@1: scope:[nest2]  from nest2 nest2::@3
  [19] nest2::i#4 = phi( nest2/$64, nest2::@3/nest2::i#1 )
  to:nest2::@2
nest2::@2: scope:[nest2]  from nest2::@1 nest2::@2
  [20] nest2::j#2 = phi( nest2::@1/$64, nest2::@2/nest2::j#1 )
  [21] *SCREEN = nest2::j#2
  [22] nest2::j#1 = -- nest2::j#2
  [23] if(nest2::j#1>0) goto nest2::@2
  to:nest2::@3
nest2::@3: scope:[nest2]  from nest2::@2
  [24] nest2::i#1 = -- nest2::i#4
  [25] if(nest2::i#1>0) goto nest2::@1
  to:nest2::@return
nest2::@return: scope:[nest2]  from nest2::@3
  [26] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
char main::i
char main::i#1 // 16.5
char main::i#5 // 4.4
char main::j
char main::j#1 // 151.5
char main::j#2 // 101.0
void nest1()
char nest1::i
char nest1::i#1 // 1500001.5
char nest1::i#5 // 400000.4
char nest1::j
char nest1::j#1 // 1.50000015E7
char nest1::j#2 // 1.0000001E7
void nest2()
char nest2::i
char nest2::i#1 // 1.50000000000015E13
char nest2::i#4 // 4.0000000000004E12
char nest2::j
char nest2::j#1 // 1.500000000000015E14
char nest2::j#2 // 1.500000000000015E14

Initial phi equivalence classes
[ main::i#5 main::i#1 ]
[ main::j#2 main::j#1 ]
[ nest1::i#5 nest1::i#1 ]
[ nest1::j#2 nest1::j#1 ]
[ nest2::i#4 nest2::i#1 ]
[ nest2::j#2 nest2::j#1 ]
Complete equivalence classes
[ main::i#5 main::i#1 ]
[ main::j#2 main::j#1 ]
[ nest1::i#5 nest1::i#1 ]
[ nest1::j#2 nest1::j#1 ]
[ nest2::i#4 nest2::i#1 ]
[ nest2::j#2 nest2::j#1 ]
Allocated zp[1]:2 [ nest2::j#2 nest2::j#1 ]
Allocated zp[1]:3 [ nest2::i#4 nest2::i#1 ]
Allocated zp[1]:4 [ nest1::j#2 nest1::j#1 ]
Allocated zp[1]:5 [ nest1::i#5 nest1::i#1 ]
Allocated zp[1]:6 [ main::j#2 main::j#1 ]
Allocated zp[1]:7 [ main::i#5 main::i#1 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp[1]:7 [ main::i#5 main::i#1 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ main::j#2 main::j#1 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:5 [ nest1::i#5 nest1::i#1 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ nest1::j#2 nest1::j#1 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ nest2::i#4 nest2::i#1 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:2 [ nest2::j#2 nest2::j#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [nest2] 300,000,000,000,003: zp[1]:2 [ nest2::j#2 nest2::j#1 ] 19,000,000,000,001.9: zp[1]:3 [ nest2::i#4 nest2::i#1 ] 
Uplift Scope [nest1] 25,000,002.5: zp[1]:4 [ nest1::j#2 nest1::j#1 ] 1,900,001.9: zp[1]:5 [ nest1::i#5 nest1::i#1 ] 
Uplift Scope [main] 252.5: zp[1]:6 [ main::j#2 main::j#1 ] 20.9: zp[1]:7 [ main::i#5 main::i#1 ] 
Uplift Scope [] 

Uplifting [nest2] best 23522231 combination reg byte y [ nest2::j#2 nest2::j#1 ] reg byte x [ nest2::i#4 nest2::i#1 ] 
Uplifting [nest1] best 23472231 combination reg byte a [ nest1::j#2 nest1::j#1 ] zp[1]:5 [ nest1::i#5 nest1::i#1 ] 
Uplifting [main] best 23472231 combination zp[1]:6 [ main::j#2 main::j#1 ] zp[1]:7 [ main::i#5 main::i#1 ] 
Uplifting [] best 23472231 combination 
Attempting to uplift remaining variables inzp[1]:5 [ nest1::i#5 nest1::i#1 ]
Uplifting [nest1] best 23472231 combination zp[1]:5 [ nest1::i#5 nest1::i#1 ] 
Attempting to uplift remaining variables inzp[1]:6 [ main::j#2 main::j#1 ]
Uplifting [main] best 23472231 combination zp[1]:6 [ main::j#2 main::j#1 ] 
Attempting to uplift remaining variables inzp[1]:7 [ main::i#5 main::i#1 ]
Uplifting [main] best 23472231 combination zp[1]:7 [ main::i#5 main::i#1 ] 
Allocated (was zp[1]:5) zp[1]:2 [ nest1::i#5 nest1::i#1 ]
Allocated (was zp[1]:6) zp[1]:3 [ main::j#2 main::j#1 ]
Allocated (was zp[1]:7) zp[1]:4 [ main::i#5 main::i#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="loopnest2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .label SCREEN = $400
.segment Code
  // main
main: {
    .label j = 3
    .label i = 4
    // [1] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [1] phi main::i#5 = $64 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #$64
    sta.z i
    jmp __b1
    // [1] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
  __b1_from___b3:
    // [1] phi main::i#5 = main::i#1 [phi:main::@3->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [2] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [2] phi main::j#2 = $64 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #$64
    sta.z j
    jmp __b2
    // [2] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  __b2_from___b4:
    // [2] phi main::j#2 = main::j#1 [phi:main::@4->main::@2#0] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [3] call nest1
    // [9] phi from main::@2 to nest1 [phi:main::@2->nest1]
  nest1_from___b2:
    jsr nest1
    jmp __b4
    // main::@4
  __b4:
    // [4] main::j#1 = -- main::j#2 -- vbuz1=_dec_vbuz1 
    dec.z j
    // [5] if(main::j#1>0) goto main::@2 -- vbuz1_gt_0_then_la1 
    lda.z j
    bne __b2_from___b4
    jmp __b3
    // main::@3
  __b3:
    // [6] main::i#1 = -- main::i#5 -- vbuz1=_dec_vbuz1 
    dec.z i
    // [7] if(main::i#1>0) goto main::@1 -- vbuz1_gt_0_then_la1 
    lda.z i
    bne __b1_from___b3
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
}
  // nest1
nest1: {
    .label i = 2
    // [10] phi from nest1 to nest1::@1 [phi:nest1->nest1::@1]
  __b1_from_nest1:
    // [10] phi nest1::i#5 = $64 [phi:nest1->nest1::@1#0] -- vbuz1=vbuc1 
    lda #$64
    sta.z i
    jmp __b1
    // [10] phi from nest1::@3 to nest1::@1 [phi:nest1::@3->nest1::@1]
  __b1_from___b3:
    // [10] phi nest1::i#5 = nest1::i#1 [phi:nest1::@3->nest1::@1#0] -- register_copy 
    jmp __b1
    // nest1::@1
  __b1:
    // [11] phi from nest1::@1 to nest1::@2 [phi:nest1::@1->nest1::@2]
  __b2_from___b1:
    // [11] phi nest1::j#2 = $64 [phi:nest1::@1->nest1::@2#0] -- vbuaa=vbuc1 
    lda #$64
    jmp __b2
    // [11] phi from nest1::@4 to nest1::@2 [phi:nest1::@4->nest1::@2]
  __b2_from___b4:
    // [11] phi nest1::j#2 = nest1::j#1 [phi:nest1::@4->nest1::@2#0] -- register_copy 
    jmp __b2
    // nest1::@2
  __b2:
    // [12] call nest2
    // [18] phi from nest1::@2 to nest2 [phi:nest1::@2->nest2]
  nest2_from___b2:
    jsr nest2
    jmp __b4
    // nest1::@4
  __b4:
    // [13] nest1::j#1 = -- nest1::j#2 -- vbuaa=_dec_vbuaa 
    sec
    sbc #1
    // [14] if(nest1::j#1>0) goto nest1::@2 -- vbuaa_gt_0_then_la1 
    cmp #0
    bne __b2_from___b4
    jmp __b3
    // nest1::@3
  __b3:
    // [15] nest1::i#1 = -- nest1::i#5 -- vbuz1=_dec_vbuz1 
    dec.z i
    // [16] if(nest1::i#1>0) goto nest1::@1 -- vbuz1_gt_0_then_la1 
    lda.z i
    bne __b1_from___b3
    jmp __breturn
    // nest1::@return
  __breturn:
    // [17] return 
    rts
}
  // nest2
nest2: {
    // [19] phi from nest2 to nest2::@1 [phi:nest2->nest2::@1]
  __b1_from_nest2:
    // [19] phi nest2::i#4 = $64 [phi:nest2->nest2::@1#0] -- vbuxx=vbuc1 
    ldx #$64
    jmp __b1
    // [19] phi from nest2::@3 to nest2::@1 [phi:nest2::@3->nest2::@1]
  __b1_from___b3:
    // [19] phi nest2::i#4 = nest2::i#1 [phi:nest2::@3->nest2::@1#0] -- register_copy 
    jmp __b1
    // nest2::@1
  __b1:
    // [20] phi from nest2::@1 to nest2::@2 [phi:nest2::@1->nest2::@2]
  __b2_from___b1:
    // [20] phi nest2::j#2 = $64 [phi:nest2::@1->nest2::@2#0] -- vbuyy=vbuc1 
    ldy #$64
    jmp __b2
    // [20] phi from nest2::@2 to nest2::@2 [phi:nest2::@2->nest2::@2]
  __b2_from___b2:
    // [20] phi nest2::j#2 = nest2::j#1 [phi:nest2::@2->nest2::@2#0] -- register_copy 
    jmp __b2
    // nest2::@2
  __b2:
    // [21] *SCREEN = nest2::j#2 -- _deref_pbuc1=vbuyy 
    sty SCREEN
    // [22] nest2::j#1 = -- nest2::j#2 -- vbuyy=_dec_vbuyy 
    dey
    // [23] if(nest2::j#1>0) goto nest2::@2 -- vbuyy_gt_0_then_la1 
    cpy #0
    bne __b2_from___b2
    jmp __b3
    // nest2::@3
  __b3:
    // [24] nest2::i#1 = -- nest2::i#4 -- vbuxx=_dec_vbuxx 
    dex
    // [25] if(nest2::i#1>0) goto nest2::@1 -- vbuxx_gt_0_then_la1 
    cpx #0
    bne __b1_from___b3
    jmp __breturn
    // nest2::@return
  __breturn:
    // [26] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b4
Removing instruction jmp __b3
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b4
Removing instruction jmp __b3
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b2_from___b4 with __b2
Replacing label __b1_from___b3 with __b1
Replacing label __b2_from___b4 with __b2
Replacing label __b1_from___b3 with __b1
Replacing label __b2_from___b2 with __b2
Replacing label __b1_from___b3 with __b1
Removing instruction __b1_from___b3:
Removing instruction __b2_from___b1:
Removing instruction __b2_from___b4:
Removing instruction nest1_from___b2:
Removing instruction __b1_from___b3:
Removing instruction __b2_from___b1:
Removing instruction __b2_from___b4:
Removing instruction nest2_from___b2:
Removing instruction __b1_from___b3:
Removing instruction __b2_from___b1:
Removing instruction __b2_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1_from_main:
Removing instruction __b4:
Removing instruction __b3:
Removing instruction __breturn:
Removing instruction __b1_from_nest1:
Removing instruction __b4:
Removing instruction __b3:
Removing instruction __breturn:
Removing instruction __b1_from_nest2:
Removing instruction __b3:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b1
Removing instruction jmp __b2
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
__constant char *SCREEN = (char *) 1024
void main()
char main::i
char main::i#1 // i zp[1]:4 16.5
char main::i#5 // i zp[1]:4 4.4
char main::j
char main::j#1 // j zp[1]:3 151.5
char main::j#2 // j zp[1]:3 101.0
void nest1()
char nest1::i
char nest1::i#1 // i zp[1]:2 1500001.5
char nest1::i#5 // i zp[1]:2 400000.4
char nest1::j
char nest1::j#1 // reg byte a 1.50000015E7
char nest1::j#2 // reg byte a 1.0000001E7
void nest2()
char nest2::i
char nest2::i#1 // reg byte x 1.50000000000015E13
char nest2::i#4 // reg byte x 4.0000000000004E12
char nest2::j
char nest2::j#1 // reg byte y 1.500000000000015E14
char nest2::j#2 // reg byte y 1.500000000000015E14

zp[1]:4 [ main::i#5 main::i#1 ]
zp[1]:3 [ main::j#2 main::j#1 ]
zp[1]:2 [ nest1::i#5 nest1::i#1 ]
reg byte a [ nest1::j#2 nest1::j#1 ]
reg byte x [ nest2::i#4 nest2::i#1 ]
reg byte y [ nest2::j#2 nest2::j#1 ]


FINAL ASSEMBLER
Score: 13472235

  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="loopnest2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .label SCREEN = $400
.segment Code
  // main
main: {
    .label j = 3
    .label i = 4
    // [1] phi from main to main::@1 [phi:main->main::@1]
    // [1] phi main::i#5 = $64 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #$64
    sta.z i
    // [1] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
    // [1] phi main::i#5 = main::i#1 [phi:main::@3->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // [2] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // [2] phi main::j#2 = $64 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #$64
    sta.z j
    // [2] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
    // [2] phi main::j#2 = main::j#1 [phi:main::@4->main::@2#0] -- register_copy 
    // main::@2
  __b2:
    // nest1()
    // [3] call nest1
    // [9] phi from main::@2 to nest1 [phi:main::@2->nest1]
    jsr nest1
    // main::@4
    // while (--j>0)
    // [4] main::j#1 = -- main::j#2 -- vbuz1=_dec_vbuz1 
    dec.z j
    // [5] if(main::j#1>0) goto main::@2 -- vbuz1_gt_0_then_la1 
    lda.z j
    bne __b2
    // main::@3
    // while (--i>0)
    // [6] main::i#1 = -- main::i#5 -- vbuz1=_dec_vbuz1 
    dec.z i
    // [7] if(main::i#1>0) goto main::@1 -- vbuz1_gt_0_then_la1 
    lda.z i
    bne __b1
    // main::@return
    // }
    // [8] return 
    rts
}
  // nest1
nest1: {
    .label i = 2
    // [10] phi from nest1 to nest1::@1 [phi:nest1->nest1::@1]
    // [10] phi nest1::i#5 = $64 [phi:nest1->nest1::@1#0] -- vbuz1=vbuc1 
    lda #$64
    sta.z i
    // [10] phi from nest1::@3 to nest1::@1 [phi:nest1::@3->nest1::@1]
    // [10] phi nest1::i#5 = nest1::i#1 [phi:nest1::@3->nest1::@1#0] -- register_copy 
    // nest1::@1
  __b1:
    // [11] phi from nest1::@1 to nest1::@2 [phi:nest1::@1->nest1::@2]
    // [11] phi nest1::j#2 = $64 [phi:nest1::@1->nest1::@2#0] -- vbuaa=vbuc1 
    lda #$64
    // [11] phi from nest1::@4 to nest1::@2 [phi:nest1::@4->nest1::@2]
    // [11] phi nest1::j#2 = nest1::j#1 [phi:nest1::@4->nest1::@2#0] -- register_copy 
    // nest1::@2
  __b2:
    // nest2()
    // [12] call nest2
    // [18] phi from nest1::@2 to nest2 [phi:nest1::@2->nest2]
    jsr nest2
    // nest1::@4
    // while (--j>0)
    // [13] nest1::j#1 = -- nest1::j#2 -- vbuaa=_dec_vbuaa 
    sec
    sbc #1
    // [14] if(nest1::j#1>0) goto nest1::@2 -- vbuaa_gt_0_then_la1 
    cmp #0
    bne __b2
    // nest1::@3
    // while (--i>0)
    // [15] nest1::i#1 = -- nest1::i#5 -- vbuz1=_dec_vbuz1 
    dec.z i
    // [16] if(nest1::i#1>0) goto nest1::@1 -- vbuz1_gt_0_then_la1 
    lda.z i
    bne __b1
    // nest1::@return
    // }
    // [17] return 
    rts
}
  // nest2
nest2: {
    // [19] phi from nest2 to nest2::@1 [phi:nest2->nest2::@1]
    // [19] phi nest2::i#4 = $64 [phi:nest2->nest2::@1#0] -- vbuxx=vbuc1 
    ldx #$64
    // [19] phi from nest2::@3 to nest2::@1 [phi:nest2::@3->nest2::@1]
    // [19] phi nest2::i#4 = nest2::i#1 [phi:nest2::@3->nest2::@1#0] -- register_copy 
    // nest2::@1
  __b1:
    // [20] phi from nest2::@1 to nest2::@2 [phi:nest2::@1->nest2::@2]
    // [20] phi nest2::j#2 = $64 [phi:nest2::@1->nest2::@2#0] -- vbuyy=vbuc1 
    ldy #$64
    // [20] phi from nest2::@2 to nest2::@2 [phi:nest2::@2->nest2::@2]
    // [20] phi nest2::j#2 = nest2::j#1 [phi:nest2::@2->nest2::@2#0] -- register_copy 
    // nest2::@2
  __b2:
    // *SCREEN = j
    // [21] *SCREEN = nest2::j#2 -- _deref_pbuc1=vbuyy 
    sty SCREEN
    // while (--j>0)
    // [22] nest2::j#1 = -- nest2::j#2 -- vbuyy=_dec_vbuyy 
    dey
    // [23] if(nest2::j#1>0) goto nest2::@2 -- vbuyy_gt_0_then_la1 
    cpy #0
    bne __b2
    // nest2::@3
    // while (--i>0)
    // [24] nest2::i#1 = -- nest2::i#4 -- vbuxx=_dec_vbuxx 
    dex
    // [25] if(nest2::i#1>0) goto nest2::@1 -- vbuxx_gt_0_then_la1 
    cpx #0
    bne __b1
    // nest2::@return
    // }
    // [26] return 
    rts
}
  // File Data

