4 if /\[start\] (\w+)/ =~ line
6 puts '--------------------------------------------------------------'
11 while line = ARGF.gets
12 if /\[start\] (\w+)/ =~ line
13 puts "\t; # length: #{len}, size: #{size}"
15 stat[name] = [len, size]
18 puts '--------------------------------------------------------------'
25 unless /(\ALM)|(\ALB)|(\A\.)|(\A\/)/ =~ line
27 if /\[length = (\d+)\]/ =~ line
34 if /__NEXT_INSN__/ !~ line && /\[end \] (\w+)/ =~ line
37 puts "!! start with #{name}, but end with #{ename}"
39 stat[ename] = [len, size]
40 puts "\t; # length: #{len}, size: #{size}"
47 stat.sort_by{|a, b| -b[0] * 1000 - a[0]}.each{|a, b|
48 puts "#{a}\t#{b.join("\t")}"
50 puts "total length :\t#{stat.inject(0){|r, e| r+e[1][0]}}"
51 puts "total size :\t#{stat.inject(0){|r, e| r+e[1][1]}}"