#!/usr/bin/perl -sw
use strict;

$::identfier = 'main' if (!defined($::identfier));
$::size = '' if (!defined($::size));

printf "const unsigned char %s[%s]\n", $::identfier, $::size;
print "__attribute__ (( aligned(16), section(\".text\") )) =\n";
my $last_line = "{\n";
while(<>)
{
  print $last_line;
  chomp;
  my $code = (split())[1];
  my $dump = '0x' . substr($code, 0, 2);
  for(my $i = 2; $i < length($code); $i += 2)
  {
    $dump .= ',0x' . substr($code, $i, 2);
  }
  $dump .= ',';
  s/\s+[^\s]*\s+/: /;
  $last_line = sprintf("  %-30s /* %-30s */\n", $dump, $_);
}
$last_line =~ s/, /  /;
print $last_line . "};\n";
