Would you rather live in a tiny cage stuffed with other people, doing nothing during your short life except eating, or living with a tribe in a jungle/savannah (more or less our natural habitat) ? Remeber you'd not be teached anything, learn no language and wouldn't experience much about the world (its richness) -- the cage is your entire reality. I'd very much prefer the jungle. For the free animal the gruesome death is just an episode to a rich life of hunting, fleeing, nurturing, seeing nature, communcating with others; for the caged one the painless death is just an end to a joyless existence.
That said, I think there are kinds of acceptable compromises... not extremely intensive farming seems reasonable to me. Again, dependent on their ability to experience the world. Chicken seem to have less cognitive experience then cows, for example, so it should be acceptable to not spend as much per individual in controlling their environemnt.
And this line of reasoning suggests a (ethically delicate, but interesting) solution: Should we select (breed) animals for lower cognition, thus making factoring farming acceptable? (or equivalently making acceptable farming practices more efficient) It seems logical. If the animal ultimately has no brain (as weird as that sounds), in principle there doesn't seem to be much difference from lab-growing meat.