--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+no warnings 'portable';
+
+my @mem;
+
+my ($andm, $orm);
+while (<>) {
+ chomp;
+ if (/mask = (\S+)/) {
+ ($orm, $andm) = ($1, $1);
+ $andm =~ s/X/1/g; $andm = oct "0b$andm";
+ $orm =~ s/X/0/g; $orm = oct "0b$orm";
+ print "andm=$andm\n orm=$orm\n";
+ next;
+ }
+ if (/mem\[(\d+)\] = (\d+)/) {
+ $mem[$1] = ($2 | $orm) & $andm;
+ print "mem[$1] = $2 => $mem[$1]\n";
+ }
+}
+
+my $sum;
+for (@mem) { $sum += $_ if defined $_ };
+print "Sum=$sum\n";