modified for x86_64.