https://github.com/bitcoin/bitcoin/blob/5f0c6a7b0e47e03f848dc992d37fe209dd9c6975/src/crypto/sha256.cpp#L183

This checks whether the CPU supports SSE4. It should also check if the OS supports SSE4. See this [StackOverflow answer](https://stackoverflow.com/a/22521619/6557621).
{
    static const unsigned char pad[64] = {0x80};
    unsigned char sizedesc[8];
    WriteBE64(sizedesc, bytes << 3);
    Write(pad, 1 + ((119 - (bytes % 64)) % 64));
    Write(sizedesc, 8);
    WriteBE32(hash, s[0]);
    WriteBE32(hash + 4, s[1]);
    WriteBE32(hash + 8, s[2]);
    WriteBE32(hash + 12, s[3]);
    WriteBE32(hash + 16, s[4]);
    WriteBE32(hash + 20, s[5]);
    WriteBE32(hash + 24, s[6]);
    WriteBE32(hash + 28, s[7]);
}
CSHA256& CSHA256::Reset()
{
    bytes = 0;
    sha256::Initialize(s);
    return *this;
}
void SHA256D64(unsigned char* out, const unsigned char* in, size_t blocks)