strspn.ssa (1348B)
1 # the C strspn function generated by scc 2 3 export function w $strspn_(l %s1.81.val,l %s2.82.val) 4 { 5 @.64 6 %s1.81 =l alloc8 8 7 %s2.82 =l alloc8 8 8 %n.83 =l alloc4 4 9 %c.84 =l alloc4 4 10 %p.85 =l alloc8 8 11 storel %s1.81.val,%s1.81 12 storel %s2.82.val,%s2.82 13 storew 0,%n.83 14 jmp @.27 15 @.28 16 %.39 =l loadl %s2.82 17 storel %.39,%p.85 18 jmp @.29 19 @.30 20 @.31 21 %.40 =l loadl %p.85 22 %.41 =l add %.40,1 23 storel %.41,%p.85 24 @.29 25 %.43 =l loadl %p.85 26 %.44 =w loadsb %.43 27 %.45 =w extsb %.44 28 %.46 =w cnew %.45,0 29 jnz %.46,@.42,@.36 30 @.42 31 %.47 =l loadl %p.85 32 %.48 =w loadsb %.47 33 %.49 =w extsb %.48 34 %.50 =w loadsw %c.84 35 %.51 =w cnew %.49,%.50 36 jnz %.51,@.30,@.36 37 @.36 38 @.32 39 %.52 =l loadl %p.85 40 %.53 =w loadsb %.52 41 %.54 =w extsb %.53 42 %.55 =w cnew %.54,0 43 jnz %.55,@.33,@.37 44 @.37 45 jmp @.34 46 @.33 47 @.35 48 %.56 =w loaduw %n.83 49 %.57 =w add %.56,1 50 storew %.57,%n.83 51 @.27 52 %.58 =l loadl %s1.81 53 %.59 =l add %.58,1 54 storel %.59,%s1.81 55 %.60 =w loadsb %.58 56 %.61 =w extsb %.60 57 storew %.61,%c.84 58 %.62 =w cnew %.61,0 59 jnz %.62,@.28,@.38 60 @.38 61 @.34 62 %.63 =w loaduw %n.83 63 ret %.63 64 } 65 66 # >>> driver 67 # extern unsigned strspn_(const char *, const char *); 68 # int main() { 69 # return !( 70 # strspn_("", "abc") == 0 && 71 # strspn_("abc", "") == 0 && 72 # strspn_("abc", "bac") == 3 && 73 # strspn_("xabc", "bac") == 0 && 74 # strspn_("axbc", "bca") == 1 75 # ); 76 # } 77 # <<<