The profit and the planned listing mark a significant reversal for the firm that spent the past few years cutting costs and laying off staff as venture funding dried up after the Covid pandemic.