Theoretical and empirical analysis of international trade with heterogeneous firms