Study shows how Islamic State built arsenal in Middle East