Programming Project: Translate the following C++ program into Pep/8 assembly language
				and test it on the Pep/8 simulator.  Your testing should be thorough enough to
				convince yourself that the translation has been done correctly and that the program
				has no bugs.  The action of the program should be to read a list of integers from
				input, terminated by -9999 (which is not included in the list).  It should then
				print the list in non-decreasing order on the output, then stop.  The only limit
				on the size of the list should be the number of linked-list nodes that can be
				allocated in memory (without running into the stack... -- for extra credit, calculate
				exactly how large the list can be for your implementation).  Credit will be based on
				both correctness and readability.
				
#include <iostream>
using namespace std;
struct node {
    int data;
    node *next;
};
node *insert(int x, node *head)
{
    if (head == 0 || head->data >= x) {
        node *p = new node;
        p->data = x;
        p->next = head;
        return p;
    } else {
        head->next = insert(x, head->next);
        return head;
    }
}
node *read()
{
    node *result = 0;
    int n;
    cin >> n;
    while (n != -9999) {
        result = insert(n, result);
        cin >> n;
    }
    return result;
}
void write(node *head)
{
    while (head != 0) {
        cout << head->data << endl;
        head = head->next;
    }
}
int main()
{
    write(read());
    return 0;
}