I think Alma prepared his speech in advance. At the very least, if he did not, he would have caused it to be written down afterwards. It is possible he had scribes recording his words since he was the presiding high priest, just as King Benjamin had his speech recorded. Alma was also the current record keeper, so he knew the value and the importance of keeping records. There will not be in the Book of Mormon another speaker like Alma.
We have—as we encounter, Alma 5, Alma 7, Alma 9, 12, 13 to Alma 30, 32, 33—the words of Alma speaking 21 chapters of original material. This is impressive, and maybe his lawyering and recordkeeping combined to help him. He was very, very conscientious as a record keeper, and I think he wrote these speeches himself. I do not think he had a ghostwriter doing it. We do not know how much of this was said to him by the spirit. He may have had an outline. He may have had some ideas. He may have also given talks like this in smaller settings. Then he unleashed a lot of questions.
I think he sensed that the people of Zarahemla were a very tricky audience to work with. He knew that they were in a dilemma (Alma 7:3), and so he certainly came prepared. One of the things about teaching with the spirit, is that we tend to over-prepare, but we know that the Lord is not going to prompt us to use everything that we have prepared. Alma may have had a hundred questions, and then these are the fifty that he ended up using. Fifty may be just a coincidental number. He is keeping the large plates—the small plates are full—and every year he is putting some kind of a record in as to what he did. If he was writing on metal, you know he would have wanted to inscribe very carefully. By that time, he had probably polished it to have the speech the way he would have wanted it to go down for eternity. It is interesting to think about how that all might have come about.
It is also interesting that Mormon chose to include this speech in Alma’s own words. It does not appear that he abridged Alma’s inaugural speech as High Priest. Like King Benjamin’s speech, Alma 5 is a jewel. It stands the tests of time.