Fixing struct type size struct Person to 17
Fixing struct type size struct Person to 17
Fixing struct type size struct Person to 17
Fixing struct type SIZE_OF struct Person to 17
Fixing struct type SIZE_OF struct Person to 17
Setting struct to load/store in variable affected by address-of (void~) main::$0 ← call print_person &(struct Person) main::jesper 
Setting struct to load/store in variable affected by address-of (void~) main::$1 ← call print_person &(struct Person) main::henriette 
Adding value bulk copy *(&(struct Person) main::jesper) ← memcpy(*(&(const struct Person) $0), struct Person, (const byte) SIZEOF_STRUCT_PERSON)
Adding value bulk copy *(&(struct Person) main::henriette) ← memcpy(*(&(const struct Person) $1), struct Person, (const byte) SIZEOF_STRUCT_PERSON)
Replacing struct member reference *((struct Person*) print_person::person).id with member unwinding reference *((byte*~) print_person::$0)
Replacing struct member reference *((struct Person*) print_person::person).name with member unwinding reference (byte*~) print_person::$1
Replacing struct member reference *((struct Person*) print_person::person).name with member unwinding reference (byte*~) print_person::$2
Warning! Adding boolean cast to non-boolean condition *((byte*~) print_person::$1 + (byte) print_person::i)
Culled Empty Block (label) print_person::@4
Culled Empty Block (label) print_person::@5
Culled Empty Block (label) print_person::@6

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@1

(void()) main()
main: scope:[main]  from @2
  (byte) idx#18 ← phi( @2/(byte) idx#20 )
  *(&(struct Person) main::jesper) ← memcpy(*(&(const struct Person) $0), struct Person, (const byte) SIZEOF_STRUCT_PERSON)
  (struct Person) main::jesper ← struct-unwound {*(&(struct Person) main::jesper)}
  (struct Person*) print_person::person#0 ← &(struct Person) main::jesper
  call print_person 
  to:main::@1
main::@1: scope:[main]  from main
  (byte) idx#10 ← phi( main/(byte) idx#8 )
  (byte) idx#0 ← (byte) idx#10
  *(&(struct Person) main::henriette) ← memcpy(*(&(const struct Person) $1), struct Person, (const byte) SIZEOF_STRUCT_PERSON)
  (struct Person) main::henriette ← struct-unwound {*(&(struct Person) main::henriette)}
  (struct Person*) print_person::person#1 ← &(struct Person) main::henriette
  call print_person 
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte) idx#11 ← phi( main::@1/(byte) idx#8 )
  (byte) idx#1 ← (byte) idx#11
  to:main::@return
main::@return: scope:[main]  from main::@2
  (byte) idx#12 ← phi( main::@2/(byte) idx#1 )
  (byte) idx#2 ← (byte) idx#12
  return 
  to:@return
@1: scope:[]  from @begin
  (byte) idx#3 ← (byte) 0
  to:@2

(void()) print_person((struct Person*) print_person::person)
print_person: scope:[print_person]  from main main::@1
  (byte) idx#13 ← phi( main/(byte) idx#18 main::@1/(byte) idx#0 )
  (struct Person*) print_person::person#2 ← phi( main/(struct Person*) print_person::person#0 main::@1/(struct Person*) print_person::person#1 )
  (byte*~) print_person::$0 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_ID
  *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*~) print_person::$0))
  (byte) idx#4 ← ++ (byte) idx#13
  *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' '
  (byte) idx#5 ← ++ (byte) idx#4
  (byte) print_person::i#0 ← (byte) 0
  to:print_person::@1
print_person::@1: scope:[print_person]  from print_person print_person::@2
  (byte) idx#19 ← phi( print_person/(byte) idx#5 print_person::@2/(byte) idx#6 )
  (byte) print_person::i#2 ← phi( print_person/(byte) print_person::i#0 print_person::@2/(byte) print_person::i#1 )
  (struct Person*) print_person::person#3 ← phi( print_person/(struct Person*) print_person::person#2 print_person::@2/(struct Person*) print_person::person#4 )
  (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#3 + (const byte) OFFSET_STRUCT_PERSON_NAME
  (bool~) print_person::$3 ← (number) 0 != *((byte*~) print_person::$1 + (byte) print_person::i#2)
  if((bool~) print_person::$3) goto print_person::@2
  to:print_person::@3
print_person::@2: scope:[print_person]  from print_person::@1
  (byte) idx#14 ← phi( print_person::@1/(byte) idx#19 )
  (byte) print_person::i#3 ← phi( print_person::@1/(byte) print_person::i#2 )
  (struct Person*) print_person::person#4 ← phi( print_person::@1/(struct Person*) print_person::person#3 )
  (byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#4 + (const byte) OFFSET_STRUCT_PERSON_NAME
  *((const byte*) SCREEN + (byte) idx#14) ← *((byte*~) print_person::$2 + (byte) print_person::i#3)
  (byte) idx#6 ← ++ (byte) idx#14
  (byte) print_person::i#1 ← ++ (byte) print_person::i#3
  to:print_person::@1
print_person::@3: scope:[print_person]  from print_person::@1
  (byte) idx#15 ← phi( print_person::@1/(byte) idx#19 )
  *((const byte*) SCREEN + (byte) idx#15) ← (byte) ' '
  (byte) idx#7 ← ++ (byte) idx#15
  to:print_person::@return
print_person::@return: scope:[print_person]  from print_person::@3
  (byte) idx#16 ← phi( print_person::@3/(byte) idx#7 )
  (byte) idx#8 ← (byte) idx#16
  return 
  to:@return
@2: scope:[]  from @1
  (byte) idx#20 ← phi( @1/(byte) idx#3 )
  call main 
  to:@3
@3: scope:[]  from @2
  (byte) idx#17 ← phi( @2/(byte) idx#2 )
  (byte) idx#9 ← (byte) idx#17
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(const struct Person) $0 = { id: (byte) 4, name: (byte*) "jesper" }
(const struct Person) $1 = { id: (byte) 7, name: (byte*) "henriette" }
(label) @1
(label) @2
(label) @3
(label) @begin
(label) @end
(const byte*) DIGIT[]  = (byte*) "0123456789"
(const byte) OFFSET_STRUCT_PERSON_ID = (byte) 0
(const byte) OFFSET_STRUCT_PERSON_NAME = (byte) 1
(byte) Person::id
(const byte*) Person::name[(number) $10]  = { fill( $10, 0) }
(const byte*) SCREEN = (byte*)(number) $400
(const byte) SIZEOF_STRUCT_PERSON = (byte) $11
(byte) idx
(byte) idx#0
(byte) idx#1
(byte) idx#10
(byte) idx#11
(byte) idx#12
(byte) idx#13
(byte) idx#14
(byte) idx#15
(byte) idx#16
(byte) idx#17
(byte) idx#18
(byte) idx#19
(byte) idx#2
(byte) idx#20
(byte) idx#3
(byte) idx#4
(byte) idx#5
(byte) idx#6
(byte) idx#7
(byte) idx#8
(byte) idx#9
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(struct Person) main::henriette loadstore
(struct Person) main::jesper loadstore
(void()) print_person((struct Person*) print_person::person)
(byte*~) print_person::$0
(byte*~) print_person::$1
(byte*~) print_person::$2
(bool~) print_person::$3
(label) print_person::@1
(label) print_person::@2
(label) print_person::@3
(label) print_person::@return
(byte) print_person::i
(byte) print_person::i#0
(byte) print_person::i#1
(byte) print_person::i#2
(byte) print_person::i#3
(struct Person*) print_person::person
(struct Person*) print_person::person#0
(struct Person*) print_person::person#1
(struct Person*) print_person::person#2
(struct Person*) print_person::person#3
(struct Person*) print_person::person#4

Adding number conversion cast (unumber) 0 in (bool~) print_person::$3 ← (number) 0 != *((byte*~) print_person::$1 + (byte) print_person::i#2)
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) idx#0 = (byte) idx#10 
Alias (byte) idx#1 = (byte) idx#11 (byte) idx#12 (byte) idx#2 
Alias (struct Person*) print_person::person#3 = (struct Person*) print_person::person#4 
Alias (byte) print_person::i#2 = (byte) print_person::i#3 
Alias (byte) idx#14 = (byte) idx#19 (byte) idx#15 
Alias (byte) idx#16 = (byte) idx#7 (byte) idx#8 
Alias (byte) idx#20 = (byte) idx#3 
Alias (byte) idx#17 = (byte) idx#9 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) idx#18 (byte) idx#20
Identical Phi Values (byte) idx#0 (byte) idx#16
Identical Phi Values (byte) idx#1 (byte) idx#16
Identical Phi Values (struct Person*) print_person::person#3 (struct Person*) print_person::person#2
Identical Phi Values (byte) idx#17 (byte) idx#1
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) print_person::$3 [23] if((byte) 0!=*((byte*~) print_person::$1 + (byte) print_person::i#2)) goto print_person::@2
Successful SSA optimization Pass2ConditionalJumpSimplification
Removing C-classic struct-unwound assignment [2] (struct Person) main::jesper ← struct-unwound {*(&(struct Person) main::jesper)}
Removing C-classic struct-unwound assignment [7] (struct Person) main::henriette ← struct-unwound {*(&(struct Person) main::henriette)}
Constant (const struct Person*) print_person::person#0 = &main::jesper
Constant (const struct Person*) print_person::person#1 = &main::henriette
Constant (const byte) idx#20 = 0
Constant (const byte) print_person::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Converting *(pointer+n) to pointer[n] [15] *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*~) print_person::$0))  -- *((byte*)print_person::person#2 + OFFSET_STRUCT_PERSON_ID)
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero (byte*)print_person::person#2 in [14] (byte*~) print_person::$0 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_ID
Simplifying expression containing zero (byte*)print_person::person#2 in [15] *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_ID))
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (byte*~) print_person::$0 and assignment [6] (byte*~) print_person::$0 ← (byte*)(struct Person*) print_person::person#2
Eliminating unused constant (const byte) OFFSET_STRUCT_PERSON_ID
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const struct Person*) print_person::person#0
Inlining constant with var siblings (const struct Person*) print_person::person#1
Inlining constant with var siblings (const byte) print_person::i#0
Inlining constant with var siblings (const byte) idx#20
Constant inlined idx#20 = (byte) 0
Constant inlined print_person::person#0 = &(struct Person) main::jesper
Constant inlined print_person::i#0 = (byte) 0
Constant inlined print_person::person#1 = &(struct Person) main::henriette
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@2
CALL GRAPH
Calls in [] to main:3 
Calls in [main] to print_person:7 print_person:10 

Created 4 initial phi equivalence classes
Coalesced [9] idx#21 ← idx#16
Coalesced [18] idx#22 ← idx#5
Coalesced [29] print_person::i#4 ← print_person::i#1
Coalesced [30] idx#23 ← idx#6
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) @1
Culled Empty Block (label) @3
Culled Empty Block (label) main::@2
Renumbering block @2 to @1
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @1
  [3] phi()

(void()) main()
main: scope:[main]  from @1
  [4] *(&(struct Person) main::jesper) ← memcpy(*(&(const struct Person) $0), struct Person, (const byte) SIZEOF_STRUCT_PERSON)
  [5] call print_person 
  to:main::@1
main::@1: scope:[main]  from main
  [6] *(&(struct Person) main::henriette) ← memcpy(*(&(const struct Person) $1), struct Person, (const byte) SIZEOF_STRUCT_PERSON)
  [7] call print_person 
  to:main::@return
main::@return: scope:[main]  from main::@1
  [8] return 
  to:@return

(void()) print_person((struct Person*) print_person::person)
print_person: scope:[print_person]  from main main::@1
  [9] (byte) idx#13 ← phi( main/(byte) 0 main::@1/(byte) idx#16 )
  [9] (struct Person*) print_person::person#2 ← phi( main/&(struct Person) main::jesper main::@1/&(struct Person) main::henriette )
  [10] *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*)(struct Person*) print_person::person#2))
  [11] (byte) idx#4 ← ++ (byte) idx#13
  [12] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' '
  [13] (byte) idx#5 ← ++ (byte) idx#4
  to:print_person::@1
print_person::@1: scope:[print_person]  from print_person print_person::@2
  [14] (byte) idx#14 ← phi( print_person/(byte) idx#5 print_person::@2/(byte) idx#6 )
  [14] (byte) print_person::i#2 ← phi( print_person/(byte) 0 print_person::@2/(byte) print_person::i#1 )
  [15] (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME
  [16] if((byte) 0!=*((byte*~) print_person::$1 + (byte) print_person::i#2)) goto print_person::@2
  to:print_person::@3
print_person::@3: scope:[print_person]  from print_person::@1
  [17] *((const byte*) SCREEN + (byte) idx#14) ← (byte) ' '
  [18] (byte) idx#16 ← ++ (byte) idx#14
  to:print_person::@return
print_person::@return: scope:[print_person]  from print_person::@3
  [19] return 
  to:@return
print_person::@2: scope:[print_person]  from print_person::@1
  [20] (byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME
  [21] *((const byte*) SCREEN + (byte) idx#14) ← *((byte*~) print_person::$2 + (byte) print_person::i#2)
  [22] (byte) idx#6 ← ++ (byte) idx#14
  [23] (byte) print_person::i#1 ← ++ (byte) print_person::i#2
  to:print_person::@1


VARIABLE REGISTER WEIGHTS
(byte) Person::id
(byte) idx
(byte) idx#13 3.0
(byte) idx#14 6.5
(byte) idx#16 1.0
(byte) idx#4 3.0
(byte) idx#5 4.0
(byte) idx#6 11.0
(void()) main()
(struct Person) main::henriette loadstore
(struct Person) main::jesper loadstore
(void()) print_person((struct Person*) print_person::person)
(byte*~) print_person::$1 22.0
(byte*~) print_person::$2 22.0
(byte) print_person::i
(byte) print_person::i#1 22.0
(byte) print_person::i#2 7.333333333333333
(struct Person*) print_person::person
(struct Person*) print_person::person#2

Initial phi equivalence classes
[ print_person::person#2 ]
[ idx#13 idx#16 ]
[ print_person::i#2 print_person::i#1 ]
[ idx#14 idx#5 idx#6 ]
Added variable idx#4 to live range equivalence class [ idx#4 ]
Added variable print_person::$1 to live range equivalence class [ print_person::$1 ]
Added variable print_person::$2 to live range equivalence class [ print_person::$2 ]
Added variable main::jesper to live range equivalence class [ main::jesper ]
Added variable main::henriette to live range equivalence class [ main::henriette ]
Complete equivalence classes
[ print_person::person#2 ]
[ idx#13 idx#16 ]
[ print_person::i#2 print_person::i#1 ]
[ idx#14 idx#5 idx#6 ]
[ idx#4 ]
[ print_person::$1 ]
[ print_person::$2 ]
[ main::jesper ]
[ main::henriette ]
Allocated zp[2]:2 [ print_person::person#2 ]
Allocated zp[1]:4 [ idx#13 idx#16 ]
Allocated zp[1]:5 [ print_person::i#2 print_person::i#1 ]
Allocated zp[1]:6 [ idx#14 idx#5 idx#6 ]
Allocated zp[1]:7 [ idx#4 ]
Allocated zp[2]:8 [ print_person::$1 ]
Allocated zp[2]:10 [ print_person::$2 ]
Allocated zp[17]:12 [ main::jesper ]
Allocated zp[17]:29 [ main::henriette ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Example of a struct containing an array
// It works on the surface - but illustrates the problem with structs containing arrays treating them like pointers.
// https://gitlab.com/camelot/kickc/issues/314
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_PERSON = $11
  .const OFFSET_STRUCT_PERSON_NAME = 1
  .label idx = 7
  .label idx_1 = 6
  .label idx_2 = 4
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label jesper = $c
    .label henriette = $1d
    // [4] *(&(struct Person) main::jesper) ← memcpy(*(&(const struct Person) $0), struct Person, (const byte) SIZEOF_STRUCT_PERSON) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_PERSON
  !:
    lda __0-1,y
    sta jesper-1,y
    dey
    bne !-
    // [5] call print_person 
    // [9] phi from main to print_person [phi:main->print_person]
  print_person_from_main:
    // [9] phi (byte) idx#13 = (byte) 0 [phi:main->print_person#0] -- vbuz1=vbuc1 
    lda #0
    sta.z idx_2
    // [9] phi (struct Person*) print_person::person#2 = &(struct Person) main::jesper [phi:main->print_person#1] -- pssz1=pssc1 
    lda #<jesper
    sta.z print_person.person
    lda #>jesper
    sta.z print_person.person+1
    jsr print_person
    jmp __b1
    // main::@1
  __b1:
    // [6] *(&(struct Person) main::henriette) ← memcpy(*(&(const struct Person) $1), struct Person, (const byte) SIZEOF_STRUCT_PERSON) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_PERSON
  !:
    lda __1-1,y
    sta henriette-1,y
    dey
    bne !-
    // [7] call print_person 
    // [9] phi from main::@1 to print_person [phi:main::@1->print_person]
  print_person_from___b1:
    // [9] phi (byte) idx#13 = (byte) idx#16 [phi:main::@1->print_person#0] -- register_copy 
    // [9] phi (struct Person*) print_person::person#2 = &(struct Person) main::henriette [phi:main::@1->print_person#1] -- pssz1=pssc1 
    lda #<henriette
    sta.z print_person.person
    lda #>henriette
    sta.z print_person.person+1
    jsr print_person
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
}
  // print_person
// print_person(struct Person* zp(2) person)
print_person: {
    .label __1 = 8
    .label __2 = $a
    .label i = 5
    .label person = 2
    // [10] *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*)(struct Person*) print_person::person#2)) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_(_deref_pbuz2) 
    ldx.z idx_2
    ldy #0
    lda (person),y
    tay
    lda DIGIT,y
    sta SCREEN,x
    // [11] (byte) idx#4 ← ++ (byte) idx#13 -- vbuz1=_inc_vbuz2 
    ldy.z idx_2
    iny
    sty.z idx
    // [12] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' ' -- pbuc1_derefidx_vbuz1=vbuc2 
    lda #' '
    ldy.z idx
    sta SCREEN,y
    // [13] (byte) idx#5 ← ++ (byte) idx#4 -- vbuz1=_inc_vbuz2 
    ldy.z idx
    iny
    sty.z idx_1
    // [14] phi from print_person to print_person::@1 [phi:print_person->print_person::@1]
  __b1_from_print_person:
    // [14] phi (byte) idx#14 = (byte) idx#5 [phi:print_person->print_person::@1#0] -- register_copy 
    // [14] phi (byte) print_person::i#2 = (byte) 0 [phi:print_person->print_person::@1#1] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    jmp __b1
    // print_person::@1
  __b1:
    // [15] (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME -- pbuz1=pbuz2_plus_vbuc1 
    lda #OFFSET_STRUCT_PERSON_NAME
    clc
    adc.z person
    sta.z __1
    lda #0
    adc.z person+1
    sta.z __1+1
    // [16] if((byte) 0!=*((byte*~) print_person::$1 + (byte) print_person::i#2)) goto print_person::@2 -- vbuc1_neq_pbuz1_derefidx_vbuz2_then_la1 
    ldy.z i
    lda (__1),y
    cmp #0
    bne __b2
    jmp __b3
    // print_person::@3
  __b3:
    // [17] *((const byte*) SCREEN + (byte) idx#14) ← (byte) ' ' -- pbuc1_derefidx_vbuz1=vbuc2 
    lda #' '
    ldy.z idx_1
    sta SCREEN,y
    // [18] (byte) idx#16 ← ++ (byte) idx#14 -- vbuz1=_inc_vbuz2 
    ldy.z idx_1
    iny
    sty.z idx_2
    jmp __breturn
    // print_person::@return
  __breturn:
    // [19] return 
    rts
    // print_person::@2
  __b2:
    // [20] (byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME -- pbuz1=pbuz2_plus_vbuc1 
    lda #OFFSET_STRUCT_PERSON_NAME
    clc
    adc.z person
    sta.z __2
    lda #0
    adc.z person+1
    sta.z __2+1
    // [21] *((const byte*) SCREEN + (byte) idx#14) ← *((byte*~) print_person::$2 + (byte) print_person::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuz3 
    ldx.z idx_1
    ldy.z i
    lda (__2),y
    sta SCREEN,x
    // [22] (byte) idx#6 ← ++ (byte) idx#14 -- vbuz1=_inc_vbuz1 
    inc.z idx_1
    // [23] (byte) print_person::i#1 ← ++ (byte) print_person::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [14] phi from print_person::@2 to print_person::@1 [phi:print_person::@2->print_person::@1]
  __b1_from___b2:
    // [14] phi (byte) idx#14 = (byte) idx#6 [phi:print_person::@2->print_person::@1#0] -- register_copy 
    // [14] phi (byte) print_person::i#2 = (byte) print_person::i#1 [phi:print_person::@2->print_person::@1#1] -- register_copy 
    jmp __b1
}
  // File Data
  DIGIT: .text "0123456789"
  .byte 0
  __0: .byte 4
  .text "jesper"
  .byte 0
  .fill 9, 0
  __1: .byte 7
  .text "henriette"
  .byte 0
  .fill 6, 0

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *(&(struct Person) main::jesper) ← memcpy(*(&(const struct Person) $0), struct Person, (const byte) SIZEOF_STRUCT_PERSON) [ main::henriette ] ( main:2 [ main::henriette ] ) always clobbers reg byte a reg byte y 
Statement [6] *(&(struct Person) main::henriette) ← memcpy(*(&(const struct Person) $1), struct Person, (const byte) SIZEOF_STRUCT_PERSON) [ main::henriette idx#16 ] ( main:2 [ main::henriette idx#16 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp[1]:4 [ idx#13 idx#16 ]
Removing always clobbered register reg byte y as potential for zp[1]:4 [ idx#13 idx#16 ]
Statement [10] *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*)(struct Person*) print_person::person#2)) [ main::henriette print_person::person#2 idx#13 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 idx#13 ] main:2::print_person:7 [ main::henriette print_person::person#2 idx#13 ] ) always clobbers reg byte a reg byte y 
Statement [12] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' ' [ main::henriette print_person::person#2 idx#4 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 idx#4 ] main:2::print_person:7 [ main::henriette print_person::person#2 idx#4 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:7 [ idx#4 ]
Statement [15] (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$1 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$1 ] main:2::print_person:7 [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$1 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:5 [ print_person::i#2 print_person::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:6 [ idx#14 idx#5 idx#6 ]
Statement [16] if((byte) 0!=*((byte*~) print_person::$1 + (byte) print_person::i#2)) goto print_person::@2 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] main:2::print_person:7 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] ) always clobbers reg byte a 
Statement [17] *((const byte*) SCREEN + (byte) idx#14) ← (byte) ' ' [ main::henriette idx#14 ] ( main:2::print_person:5 [ main::henriette idx#14 ] main:2::print_person:7 [ main::henriette idx#14 ] ) always clobbers reg byte a 
Statement [20] (byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$2 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$2 ] main:2::print_person:7 [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$2 ] ) always clobbers reg byte a 
Statement [21] *((const byte*) SCREEN + (byte) idx#14) ← *((byte*~) print_person::$2 + (byte) print_person::i#2) [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] main:2::print_person:7 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] ) always clobbers reg byte a 
Statement [4] *(&(struct Person) main::jesper) ← memcpy(*(&(const struct Person) $0), struct Person, (const byte) SIZEOF_STRUCT_PERSON) [ main::henriette ] ( main:2 [ main::henriette ] ) always clobbers reg byte a reg byte y 
Statement [6] *(&(struct Person) main::henriette) ← memcpy(*(&(const struct Person) $1), struct Person, (const byte) SIZEOF_STRUCT_PERSON) [ main::henriette idx#16 ] ( main:2 [ main::henriette idx#16 ] ) always clobbers reg byte a reg byte y 
Statement [10] *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*)(struct Person*) print_person::person#2)) [ main::henriette print_person::person#2 idx#13 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 idx#13 ] main:2::print_person:7 [ main::henriette print_person::person#2 idx#13 ] ) always clobbers reg byte a reg byte y 
Statement [12] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' ' [ main::henriette print_person::person#2 idx#4 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 idx#4 ] main:2::print_person:7 [ main::henriette print_person::person#2 idx#4 ] ) always clobbers reg byte a 
Statement [15] (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$1 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$1 ] main:2::print_person:7 [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$1 ] ) always clobbers reg byte a 
Statement [16] if((byte) 0!=*((byte*~) print_person::$1 + (byte) print_person::i#2)) goto print_person::@2 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] main:2::print_person:7 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] ) always clobbers reg byte a 
Statement [17] *((const byte*) SCREEN + (byte) idx#14) ← (byte) ' ' [ main::henriette idx#14 ] ( main:2::print_person:5 [ main::henriette idx#14 ] main:2::print_person:7 [ main::henriette idx#14 ] ) always clobbers reg byte a 
Statement [20] (byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$2 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$2 ] main:2::print_person:7 [ main::henriette print_person::person#2 print_person::i#2 idx#14 print_person::$2 ] ) always clobbers reg byte a 
Statement [21] *((const byte*) SCREEN + (byte) idx#14) ← *((byte*~) print_person::$2 + (byte) print_person::i#2) [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] ( main:2::print_person:5 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] main:2::print_person:7 [ main::henriette print_person::person#2 print_person::i#2 idx#14 ] ) always clobbers reg byte a 
Potential registers zp[2]:2 [ print_person::person#2 ] : zp[2]:2 , 
Potential registers zp[1]:4 [ idx#13 idx#16 ] : zp[1]:4 , reg byte x , 
Potential registers zp[1]:5 [ print_person::i#2 print_person::i#1 ] : zp[1]:5 , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ idx#14 idx#5 idx#6 ] : zp[1]:6 , reg byte x , reg byte y , 
Potential registers zp[1]:7 [ idx#4 ] : zp[1]:7 , reg byte x , reg byte y , 
Potential registers zp[2]:8 [ print_person::$1 ] : zp[2]:8 , 
Potential registers zp[2]:10 [ print_person::$2 ] : zp[2]:10 , 
Potential registers zp[17]:12 [ main::jesper ] : zp[17]:12 , 
Potential registers zp[17]:29 [ main::henriette ] : zp[17]:29 , 

REGISTER UPLIFT SCOPES
Uplift Scope [print_person] 29.33: zp[1]:5 [ print_person::i#2 print_person::i#1 ] 22: zp[2]:8 [ print_person::$1 ] 22: zp[2]:10 [ print_person::$2 ] 0: zp[2]:2 [ print_person::person#2 ] 
Uplift Scope [] 21.5: zp[1]:6 [ idx#14 idx#5 idx#6 ] 4: zp[1]:4 [ idx#13 idx#16 ] 3: zp[1]:7 [ idx#4 ] 
Uplift Scope [Person] 
Uplift Scope [main] 0: zp[17]:12 [ main::jesper ] 0: zp[17]:29 [ main::henriette ] 

Uplifting [print_person] best 943 combination reg byte y [ print_person::i#2 print_person::i#1 ] zp[2]:8 [ print_person::$1 ] zp[2]:10 [ print_person::$2 ] zp[2]:2 [ print_person::person#2 ] 
Uplifting [] best 853 combination reg byte x [ idx#14 idx#5 idx#6 ] reg byte x [ idx#13 idx#16 ] reg byte x [ idx#4 ] 
Uplifting [Person] best 853 combination 
Uplifting [main] best 853 combination zp[17]:12 [ main::jesper ] zp[17]:29 [ main::henriette ] 
Allocated (was zp[2]:8) zp[2]:4 [ print_person::$1 ]
Allocated (was zp[2]:10) zp[2]:6 [ print_person::$2 ]
Allocated (was zp[17]:12) zp[17]:8 [ main::jesper ]
Allocated (was zp[17]:29) zp[17]:25 [ main::henriette ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Example of a struct containing an array
// It works on the surface - but illustrates the problem with structs containing arrays treating them like pointers.
// https://gitlab.com/camelot/kickc/issues/314
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_PERSON = $11
  .const OFFSET_STRUCT_PERSON_NAME = 1
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label jesper = 8
    .label henriette = $19
    // [4] *(&(struct Person) main::jesper) ← memcpy(*(&(const struct Person) $0), struct Person, (const byte) SIZEOF_STRUCT_PERSON) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_PERSON
  !:
    lda __0-1,y
    sta jesper-1,y
    dey
    bne !-
    // [5] call print_person 
    // [9] phi from main to print_person [phi:main->print_person]
  print_person_from_main:
    // [9] phi (byte) idx#13 = (byte) 0 [phi:main->print_person#0] -- vbuxx=vbuc1 
    ldx #0
    // [9] phi (struct Person*) print_person::person#2 = &(struct Person) main::jesper [phi:main->print_person#1] -- pssz1=pssc1 
    lda #<jesper
    sta.z print_person.person
    lda #>jesper
    sta.z print_person.person+1
    jsr print_person
    jmp __b1
    // main::@1
  __b1:
    // [6] *(&(struct Person) main::henriette) ← memcpy(*(&(const struct Person) $1), struct Person, (const byte) SIZEOF_STRUCT_PERSON) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_PERSON
  !:
    lda __1-1,y
    sta henriette-1,y
    dey
    bne !-
    // [7] call print_person 
    // [9] phi from main::@1 to print_person [phi:main::@1->print_person]
  print_person_from___b1:
    // [9] phi (byte) idx#13 = (byte) idx#16 [phi:main::@1->print_person#0] -- register_copy 
    // [9] phi (struct Person*) print_person::person#2 = &(struct Person) main::henriette [phi:main::@1->print_person#1] -- pssz1=pssc1 
    lda #<henriette
    sta.z print_person.person
    lda #>henriette
    sta.z print_person.person+1
    jsr print_person
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
}
  // print_person
// print_person(struct Person* zp(2) person)
print_person: {
    .label __1 = 4
    .label __2 = 6
    .label person = 2
    // [10] *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*)(struct Person*) print_person::person#2)) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_(_deref_pbuz1) 
    ldy #0
    lda (person),y
    tay
    lda DIGIT,y
    sta SCREEN,x
    // [11] (byte) idx#4 ← ++ (byte) idx#13 -- vbuxx=_inc_vbuxx 
    inx
    // [12] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #' '
    sta SCREEN,x
    // [13] (byte) idx#5 ← ++ (byte) idx#4 -- vbuxx=_inc_vbuxx 
    inx
    // [14] phi from print_person to print_person::@1 [phi:print_person->print_person::@1]
  __b1_from_print_person:
    // [14] phi (byte) idx#14 = (byte) idx#5 [phi:print_person->print_person::@1#0] -- register_copy 
    // [14] phi (byte) print_person::i#2 = (byte) 0 [phi:print_person->print_person::@1#1] -- vbuyy=vbuc1 
    ldy #0
    jmp __b1
    // print_person::@1
  __b1:
    // [15] (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME -- pbuz1=pbuz2_plus_vbuc1 
    lda #OFFSET_STRUCT_PERSON_NAME
    clc
    adc.z person
    sta.z __1
    lda #0
    adc.z person+1
    sta.z __1+1
    // [16] if((byte) 0!=*((byte*~) print_person::$1 + (byte) print_person::i#2)) goto print_person::@2 -- vbuc1_neq_pbuz1_derefidx_vbuyy_then_la1 
    lda (__1),y
    cmp #0
    bne __b2
    jmp __b3
    // print_person::@3
  __b3:
    // [17] *((const byte*) SCREEN + (byte) idx#14) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #' '
    sta SCREEN,x
    // [18] (byte) idx#16 ← ++ (byte) idx#14 -- vbuxx=_inc_vbuxx 
    inx
    jmp __breturn
    // print_person::@return
  __breturn:
    // [19] return 
    rts
    // print_person::@2
  __b2:
    // [20] (byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME -- pbuz1=pbuz2_plus_vbuc1 
    lda #OFFSET_STRUCT_PERSON_NAME
    clc
    adc.z person
    sta.z __2
    lda #0
    adc.z person+1
    sta.z __2+1
    // [21] *((const byte*) SCREEN + (byte) idx#14) ← *((byte*~) print_person::$2 + (byte) print_person::i#2) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuyy 
    lda (__2),y
    sta SCREEN,x
    // [22] (byte) idx#6 ← ++ (byte) idx#14 -- vbuxx=_inc_vbuxx 
    inx
    // [23] (byte) print_person::i#1 ← ++ (byte) print_person::i#2 -- vbuyy=_inc_vbuyy 
    iny
    // [14] phi from print_person::@2 to print_person::@1 [phi:print_person::@2->print_person::@1]
  __b1_from___b2:
    // [14] phi (byte) idx#14 = (byte) idx#6 [phi:print_person::@2->print_person::@1#0] -- register_copy 
    // [14] phi (byte) print_person::i#2 = (byte) print_person::i#1 [phi:print_person::@2->print_person::@1#1] -- register_copy 
    jmp __b1
}
  // File Data
  DIGIT: .text "0123456789"
  .byte 0
  __0: .byte 4
  .text "jesper"
  .byte 0
  .fill 9, 0
  __1: .byte 7
  .text "henriette"
  .byte 0
  .fill 6, 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b3
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction print_person_from_main:
Removing instruction __b1:
Removing instruction print_person_from___b1:
Removing instruction __breturn:
Removing instruction __b1_from_print_person:
Removing instruction __b3:
Removing instruction __breturn:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(const struct Person) $0 = { id: (byte) 4, name: (byte*) "jesper" }
(const struct Person) $1 = { id: (byte) 7, name: (byte*) "henriette" }
(label) @1
(label) @begin
(label) @end
(const byte*) DIGIT[]  = (byte*) "0123456789"
(const byte) OFFSET_STRUCT_PERSON_NAME = (byte) 1
(byte) Person::id
(const byte*) Person::name[(number) $10]  = { fill( $10, 0) }
(const byte*) SCREEN = (byte*) 1024
(const byte) SIZEOF_STRUCT_PERSON = (byte) $11
(byte) idx
(byte) idx#13 reg byte x 3.0
(byte) idx#14 reg byte x 6.5
(byte) idx#16 reg byte x 1.0
(byte) idx#4 reg byte x 3.0
(byte) idx#5 reg byte x 4.0
(byte) idx#6 reg byte x 11.0
(void()) main()
(label) main::@1
(label) main::@return
(struct Person) main::henriette loadstore zp[17]:25
(struct Person) main::jesper loadstore zp[17]:8
(void()) print_person((struct Person*) print_person::person)
(byte*~) print_person::$1 zp[2]:4 22.0
(byte*~) print_person::$2 zp[2]:6 22.0
(label) print_person::@1
(label) print_person::@2
(label) print_person::@3
(label) print_person::@return
(byte) print_person::i
(byte) print_person::i#1 reg byte y 22.0
(byte) print_person::i#2 reg byte y 7.333333333333333
(struct Person*) print_person::person
(struct Person*) print_person::person#2 person zp[2]:2

zp[2]:2 [ print_person::person#2 ]
reg byte x [ idx#13 idx#16 ]
reg byte y [ print_person::i#2 print_person::i#1 ]
reg byte x [ idx#14 idx#5 idx#6 ]
reg byte x [ idx#4 ]
zp[2]:4 [ print_person::$1 ]
zp[2]:6 [ print_person::$2 ]
zp[17]:8 [ main::jesper ]
zp[17]:25 [ main::henriette ]


FINAL ASSEMBLER
Score: 772

  // File Comments
// Example of a struct containing an array
// It works on the surface - but illustrates the problem with structs containing arrays treating them like pointers.
// https://gitlab.com/camelot/kickc/issues/314
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_PERSON = $11
  .const OFFSET_STRUCT_PERSON_NAME = 1
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label jesper = 8
    .label henriette = $19
    // jesper = { 4, "jesper" }
    // [4] *(&(struct Person) main::jesper) ← memcpy(*(&(const struct Person) $0), struct Person, (const byte) SIZEOF_STRUCT_PERSON) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_PERSON
  !:
    lda __0-1,y
    sta jesper-1,y
    dey
    bne !-
    // print_person(&jesper)
    // [5] call print_person 
    // [9] phi from main to print_person [phi:main->print_person]
    // [9] phi (byte) idx#13 = (byte) 0 [phi:main->print_person#0] -- vbuxx=vbuc1 
    ldx #0
    // [9] phi (struct Person*) print_person::person#2 = &(struct Person) main::jesper [phi:main->print_person#1] -- pssz1=pssc1 
    lda #<jesper
    sta.z print_person.person
    lda #>jesper
    sta.z print_person.person+1
    jsr print_person
    // main::@1
    // henriette = { 7, "henriette" }
    // [6] *(&(struct Person) main::henriette) ← memcpy(*(&(const struct Person) $1), struct Person, (const byte) SIZEOF_STRUCT_PERSON) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_PERSON
  !:
    lda __1-1,y
    sta henriette-1,y
    dey
    bne !-
    // print_person(&henriette)
    // [7] call print_person 
    // [9] phi from main::@1 to print_person [phi:main::@1->print_person]
    // [9] phi (byte) idx#13 = (byte) idx#16 [phi:main::@1->print_person#0] -- register_copy 
    // [9] phi (struct Person*) print_person::person#2 = &(struct Person) main::henriette [phi:main::@1->print_person#1] -- pssz1=pssc1 
    lda #<henriette
    sta.z print_person.person
    lda #>henriette
    sta.z print_person.person+1
    jsr print_person
    // main::@return
    // }
    // [8] return 
    rts
}
  // print_person
// print_person(struct Person* zp(2) person)
print_person: {
    .label __1 = 4
    .label __2 = 6
    .label person = 2
    // SCREEN[idx++] = DIGIT[person->id]
    // [10] *((const byte*) SCREEN + (byte) idx#13) ← *((const byte*) DIGIT + *((byte*)(struct Person*) print_person::person#2)) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_(_deref_pbuz1) 
    ldy #0
    lda (person),y
    tay
    lda DIGIT,y
    sta SCREEN,x
    // SCREEN[idx++] = DIGIT[person->id];
    // [11] (byte) idx#4 ← ++ (byte) idx#13 -- vbuxx=_inc_vbuxx 
    inx
    // SCREEN[idx++] = ' '
    // [12] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #' '
    sta SCREEN,x
    // SCREEN[idx++] = ' ';
    // [13] (byte) idx#5 ← ++ (byte) idx#4 -- vbuxx=_inc_vbuxx 
    inx
    // [14] phi from print_person to print_person::@1 [phi:print_person->print_person::@1]
    // [14] phi (byte) idx#14 = (byte) idx#5 [phi:print_person->print_person::@1#0] -- register_copy 
    // [14] phi (byte) print_person::i#2 = (byte) 0 [phi:print_person->print_person::@1#1] -- vbuyy=vbuc1 
    ldy #0
    // print_person::@1
  __b1:
    // for(byte i=0; person->name[i]; i++)
    // [15] (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME -- pbuz1=pbuz2_plus_vbuc1 
    lda #OFFSET_STRUCT_PERSON_NAME
    clc
    adc.z person
    sta.z __1
    lda #0
    adc.z person+1
    sta.z __1+1
    // [16] if((byte) 0!=*((byte*~) print_person::$1 + (byte) print_person::i#2)) goto print_person::@2 -- vbuc1_neq_pbuz1_derefidx_vbuyy_then_la1 
    lda (__1),y
    cmp #0
    bne __b2
    // print_person::@3
    // SCREEN[idx++] = ' '
    // [17] *((const byte*) SCREEN + (byte) idx#14) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #' '
    sta SCREEN,x
    // SCREEN[idx++] = ' ';
    // [18] (byte) idx#16 ← ++ (byte) idx#14 -- vbuxx=_inc_vbuxx 
    inx
    // print_person::@return
    // }
    // [19] return 
    rts
    // print_person::@2
  __b2:
    // SCREEN[idx++] = person->name[i]
    // [20] (byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_NAME -- pbuz1=pbuz2_plus_vbuc1 
    lda #OFFSET_STRUCT_PERSON_NAME
    clc
    adc.z person
    sta.z __2
    lda #0
    adc.z person+1
    sta.z __2+1
    // [21] *((const byte*) SCREEN + (byte) idx#14) ← *((byte*~) print_person::$2 + (byte) print_person::i#2) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuyy 
    lda (__2),y
    sta SCREEN,x
    // SCREEN[idx++] = person->name[i];
    // [22] (byte) idx#6 ← ++ (byte) idx#14 -- vbuxx=_inc_vbuxx 
    inx
    // for(byte i=0; person->name[i]; i++)
    // [23] (byte) print_person::i#1 ← ++ (byte) print_person::i#2 -- vbuyy=_inc_vbuyy 
    iny
    // [14] phi from print_person::@2 to print_person::@1 [phi:print_person::@2->print_person::@1]
    // [14] phi (byte) idx#14 = (byte) idx#6 [phi:print_person::@2->print_person::@1#0] -- register_copy 
    // [14] phi (byte) print_person::i#2 = (byte) print_person::i#1 [phi:print_person::@2->print_person::@1#1] -- register_copy 
    jmp __b1
}
  // File Data
  DIGIT: .text "0123456789"
  .byte 0
  __0: .byte 4
  .text "jesper"
  .byte 0
  .fill 9, 0
  __1: .byte 7
  .text "henriette"
  .byte 0
  .fill 6, 0

