Well if its a '72 340, 8.5:1CR which is not stated you got a job on your hands to get 400hp.....if earlier 68>'71 your at 10:1ish?....even then I can't see 400hp without working the heads to flow at least 240>250cfm with a good v/job etc., get the heads flowed once ported then you can pick a cam that suits the figures keeping duration sensible as suggested above for good CP.
My old 1971 340 motor with stock just cleaned up T/A 2.02 heads, .590" solid cam, Holley SD intake, 2" spacer, 850DP and race 1.3/4" hdrs made a real world 365hp at the track.....ran 108mph at 3550lbs, it could've been better but we didn't have machine shops everywhere to blueprint everything then. 400hp is not as easy many say with stock parts, even with "modern" cams! The heads are the key, the rest needs to match giving consideration to use, get into 270+cfm heads and then yes your there and then some at 340ci...my2c
And regarding making 400hp with a stock 340, this is what it took for 1 guy, from a post from another site>
1969 Barracuda FB 340 +.060 ...12.5 to 1 TRW, stock rods, X heads with 2.02 installed. MP .590 cam, Holley strip dominator with 750 DP, MP electronic distributor with MSD 6AL, Hooker 1 3/4 Headers,
904 trans with Tranzact Brake, Turbo Action 8 inch Converter flashed to 4800 rpm, 5.13 gears with M/T 14 x 32 slicks. Car weight with Driver 2700 lbs.
10.90 @ 121 at Bakersfield in 1990 = 412hp