#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cctype>

using namespace std;

string
readline(ifstream & fin) 
{
   string ret;
   char ch;
   ch = fin.get();
   while(fin) {
      if(ch == '\r' || ch == '\n') {
         break;
      }
      ret += ch;
      ch = fin.get();
   }
   return ret;
}

string
trim(const string & str)
{
   string ret;
   char ch;
   int i = 0;
   while(isspace(str[i])) {
      i++;
   }
   while(i < str.size()) {
      ch = str[i];
      ret += ch;
      i++;
   }
   return ret;
}

int
main(int argc, char ** argv)
{
   if(argc != 2) {
      cerr << "usage: " << argv[0] << " <file>.asm" << endl;
      exit(1);
   }
   ifstream fin(argv[1], ios::in);
   if(fin) {
      cout << "[BITS 16]" << endl;
      cout << "[org 100h]" << endl << endl;
      cout << "[section .text]" << endl << endl;
      string temp;
      while(fin >> temp >> temp) {
         temp = readline(fin);
         cout << '\t' << trim(temp) << endl << flush;
      }
      fin.close();
   }
   return 0;
}
