#!/usr/bin/perl -w

use POSIX;

while (<>) {
    chomp;
    s/\s+/ /g;
    if (/>>> ([0-9a-f]+) @@@ ([0-9a-f]+) [*][*][*] ([0-9a-f]+) \/\/\/ ([0-9a-f]+)/i) {
	my ($op1, $op2, $prod, $quot) = ($1, $2, $3, $4);
	$op1 = oct("0x".$op1);
	$op2 = oct("0x".$op2);
	$prod = oct("0x".$prod);
	$quot = oct("0x".$quot);

	my $c_prod = $op1 * $op2;
	my $c_quot = floor($op2 ? ($op1 / $op2) : ~0);

	print $_;

	if ($c_prod != $prod) {
	    printf " (!%d (%08X))",$c_prod, $c_prod;
	} else {
	    print " (ok)";
	}
	if ($c_quot != $quot) {
	    printf " (!%d (%08X))",$c_quot, $c_quot;
	} else {
	    print " (ok)";
	}
	print "\n";
    } else {
	print "$_\n";
    }
}


