/tmp/cc5W6W1g.s:63: Error: no such instruction: `vpermq ymm1,ymm1,0x39'
GNU assembler is too old as well, unfortunately. It doesn't know what 'vpermq' is -- that's an AVX2 instruction.
Same goes for other instructions it doesn't know about.
GNU assembler is part of binutils. Try installing newer version of binutils.
I know for sure that binutils 2.25 supports it, but some earlier versions likely will too.