#!/usr/bin/perl -w

open OPENOCD,"<openocdthumb.txt";
open RADARE,"<radare2thumb.txt";

print "<html><body><h1>ARM Thumb mode decompilation competition</h1>";
print "<table border='1'><tr><td>mode</td><td>Hex</td><td colspan='2'>OpenOCD</td><td colspan='2'>Radare2</td></tr>";
foreach(0 .. 65535)
{
  my $op=<OPENOCD>;
  my $ra=<RADARE>;
  my $mode="thumb";
  my $hex=$1 if($op=~m/^\w+ (\w+)/);
  my ($op1,$op2)=($1,$2) if($op=~m/^\w+ \w+ ([^ ]*)\s*(.*)/);
  my ($ra1,$ra2)=($1,$2) if($ra=~m/^\w+ \w+ ([^ ]*)\s*(.*)/);
  print "<tr><td>$mode</td><td>hex</td><td>$op1</td><td>$op2</td><td>$ra1</td><td>$ra2</td></tr>";

}
print "</table>";
print "</body></html>";
