Iraq sentences 40 to death over 2014 massacre