#include <cstdint>
#include <iostream>
using namespace std;
int rdrand64_step(uint64_t* rand)
{
unsigned char ok;
asm volatile("rdrand %0; setc %1"
: "=r"(*rand), "=qm"(ok));
return (int)ok;
}
int main()
{
uint64_t x;
int res = rdrand64_step(&x);
cout << res << ' ' << x << '\n';
}内嵌汇编(x