If a program could program itself?.... (AI)

Here's the real kicker of a question: If the program could write itself, what would it write itself to do? What function would it accomplish?