# GCC/Clang 内建函数声明
# 所有函数均为仅声明（t.State 等价于 CExtern | CExport），由编译器/运行时提供实现
import t


# ============================================================
# 随机数生成 (RDRAND / RDSEED)
# ============================================================

def __builtin_ia32_rdrand16_step(p: t.CUInt16T | t.CPtr) -> t.CInt | t.State: pass
def __builtin_ia32_rdrand32_step(p: t.CUInt32T | t.CPtr) -> t.CInt | t.State: pass
def __builtin_ia32_rdrand64_step(p: t.CUInt64T | t.CPtr) -> t.CInt | t.State: pass
def __builtin_ia32_rdseed16_step(p: t.CUInt16T | t.CPtr) -> t.CInt | t.State: pass
def __builtin_ia32_rdseed32_step(p: t.CUInt32T | t.CPtr) -> t.CInt | t.State: pass
def __builtin_ia32_rdseed64_step(p: t.CUInt64T | t.CPtr) -> t.CInt | t.State: pass


# ============================================================
# 时间戳计数器 (RDTSC / RDTSCP)
# ============================================================

def __builtin_ia32_rdtsc() -> t.CUInt64T | t.State: pass
def __builtin_ia32_rdtscp(p: t.CUInt32T | t.CPtr) -> t.CUInt64T | t.State: pass
def __builtin_ia32_rdpmc(counter: t.CUInt32T) -> t.CUInt64T | t.State: pass


# ============================================================
# CPUID
# ============================================================

def __builtin_ia32_cpuid(level: t.CUInt32T, a: t.CUInt32T | t.CPtr, b: t.CUInt32T | t.CPtr, c: t.CUInt32T | t.CPtr, d: t.CUInt32T | t.CPtr) -> t.CUInt32T | t.State: pass
def __builtin_ia32_cpuid_count(level: t.CUInt32T, count: t.CUInt32T, a: t.CUInt32T | t.CPtr, b: t.CUInt32T | t.CPtr, c: t.CUInt32T | t.CPtr, d: t.CUInt32T | t.CPtr) -> t.CUInt32T | t.State: pass


# ============================================================
# 内存屏障 (Fence)
# ============================================================

def __builtin_ia32_lfence() -> t.State: pass
def __builtin_ia32_mfence() -> t.State: pass
def __builtin_ia32_sfence() -> t.State: pass
def __builtin_ia32_pause() -> t.State: pass


# ============================================================
# 位操作 (POPCNT / BSF / BSR / TZCNT / LZCNT / BEXTR / PDEP / PEXT / ANDN)
# ============================================================

def __builtin_ia32_popcntsi(x: t.CUInt32T) -> t.CInt | t.State: pass
def __builtin_ia32_popcntdi(x: t.CUInt64T) -> t.CInt | t.State: pass
def __builtin_ia32_popcntqi(x: t.CUInt64T) -> t.CInt | t.State: pass

def __builtin_ia32_bsfsi(src: t.CUInt32T, dst: t.CUInt32T | t.CPtr) -> t.CInt | t.State: pass
def __builtin_ia32_bsrsi(src: t.CUInt32T, dst: t.CUInt32T | t.CPtr) -> t.CInt | t.State: pass
def __builtin_ia32_bsfqi(src: t.CUInt64T, dst: t.CUInt64T | t.CPtr) -> t.CInt | t.State: pass
def __builtin_ia32_bsrqi(src: t.CUInt64T, dst: t.CUInt64T | t.CPtr) -> t.CInt | t.State: pass

def __builtin_ia32_tzcntsi(x: t.CUInt32T) -> t.CUInt32T | t.State: pass
def __builtin_ia32_tzcntdi(x: t.CUInt64T) -> t.CUInt64T | t.State: pass
def __builtin_ia32_lzcntsi(x: t.CUInt32T) -> t.CUInt32T | t.State: pass
def __builtin_ia32_lzcntdi(x: t.CUInt64T) -> t.CUInt64T | t.State: pass

def __builtin_ia32_bextrsi(src: t.CUInt32T, start: t.CUInt32T, len: t.CUInt32T) -> t.CUInt32T | t.State: pass
def __builtin_ia32_bextrdi(src: t.CUInt64T, start: t.CUInt32T, len: t.CUInt32T) -> t.CUInt64T | t.State: pass

def __builtin_ia32_pdep_si(src: t.CUInt32T, mask: t.CUInt32T) -> t.CUInt32T | t.State: pass
def __builtin_ia32_pext_si(src: t.CUInt32T, mask: t.CUInt32T) -> t.CUInt32T | t.State: pass
def __builtin_ia32_pdep_di(src: t.CUInt64T, mask: t.CUInt64T) -> t.CUInt64T | t.State: pass
def __builtin_ia32_pext_di(src: t.CUInt64T, mask: t.CUInt64T) -> t.CUInt64T | t.State: pass

def __builtin_ia32_andn_si(a: t.CUInt32T, b: t.CUInt32T) -> t.CUInt32T | t.State: pass
def __builtin_ia32_andn_di(a: t.CUInt64T, b: t.CUInt64T) -> t.CUInt64T | t.State: pass


# ============================================================
# 字节序交换 (BSWAP)
# ============================================================

def __builtin_bswap16(x: t.CUInt16T) -> t.CUInt16T | t.State: pass
def __builtin_bswap32(x: t.CUInt32T) -> t.CUInt32T | t.State: pass
def __builtin_bswap64(x: t.CUInt64T) -> t.CUInt64T | t.State: pass


# ============================================================
# 缓存操作 (Cache)
# ============================================================

def __builtin_ia32_clflush(p: t.CConst | t.CPtr) -> t.State: pass
def __builtin_ia32_clflushopt(p: t.CConst | t.CPtr) -> t.State: pass
def __builtin_ia32_clwb(p: t.CConst | t.CPtr) -> t.State: pass
def __builtin_ia32_clzero() -> t.State: pass


# ============================================================
# 预取 (Prefetch)
# ============================================================

def __builtin_prefetch(addr: t.CConst | t.CPtr, rw: t.CInt = 0, locality: t.CInt = 3) -> t.State: pass
def __builtin_ia32_prefetch0(p: t.CChar | t.CConst | t.CPtr) -> t.State: pass
def __builtin_ia32_prefetch1(p: t.CChar | t.CConst | t.CPtr) -> t.State: pass
def __builtin_ia32_prefetch2(p: t.CChar | t.CConst | t.CPtr) -> t.State: pass
def __builtin_ia32_prefetchnta(p: t.CChar | t.CConst | t.CPtr) -> t.State: pass


# ============================================================
# 非临时存储 (Non-Temporal Store)
# ============================================================

def __builtin_ia32_movnti(p: t.CUInt32T | t.CPtr, val: t.CUInt32T) -> t.State: pass
def __builtin_ia32_movnti64(p: t.CUInt64T | t.CPtr, val: t.CUInt64T) -> t.State: pass
def __builtin_ia32_movntdq(p: t.CPtr, val: t.CPtr) -> t.State: pass
def __builtin_ia32_movntps(p: t.CFloat | t.CPtr, val: t.CFloat) -> t.State: pass
def __builtin_ia32_movntpd(p: t.CDouble | t.CPtr, val: t.CDouble) -> t.State: pass


# ============================================================
# I/O 端口操作 (Port I/O)
# ============================================================

def __builtin_ia32_inb(port: t.CUInt16T) -> t.CUInt8T | t.State: pass
def __builtin_ia32_inw(port: t.CUInt16T) -> t.CUInt16T | t.State: pass
def __builtin_ia32_inl(port: t.CUInt16T) -> t.CUInt32T | t.State: pass
def __builtin_ia32_outb(val: t.CUInt8T, port: t.CUInt16T) -> t.State: pass
def __builtin_ia32_outw(val: t.CUInt16T, port: t.CUInt16T) -> t.State: pass
def __builtin_ia32_outl(val: t.CUInt32T, port: t.CUInt16T) -> t.State: pass


# ============================================================
# 模型特定寄存器 (MSR)
# ============================================================

def __builtin_ia32_rdmsr(msr: t.CUInt32T, val: t.CUInt64T | t.CPtr) -> t.State: pass
def __builtin_ia32_wrmsr(msr: t.CUInt32T, val: t.CUInt64T) -> t.State: pass


# ============================================================
# 系统指令 (System)
# ============================================================

def __builtin_ia32_hlt() -> t.State: pass
def __builtin_ia32_invd() -> t.State: pass
def __builtin_ia32_wbinvd() -> t.State: pass
def __builtin_ia32_invlpg(p: t.CPtr) -> t.State: pass
def __builtin_ia32_clts() -> t.State: pass
def __builtin_ia32_cli() -> t.State: pass
def __builtin_ia32_sti() -> t.State: pass
def __builtin_ia32_int3() -> t.State: pass
def __builtin_ia32_int(n: t.CUInt8T) -> t.State: pass
def __builtin_ia32_ud2() -> t.State: pass


# ============================================================
# 描述符表 (GDT / IDT / LDT / TR)
# ============================================================

def __builtin_ia32_lgdt(p: t.CPtr) -> t.State: pass
def __builtin_ia32_sgdt(p: t.CPtr) -> t.State: pass
def __builtin_ia32_lidt(p: t.CPtr) -> t.State: pass
def __builtin_ia32_sidt(p: t.CPtr) -> t.State: pass
def __builtin_ia32_lldt(sel: t.CUInt32T) -> t.State: pass
def __builtin_ia32_sldt(p: t.CPtr) -> t.State: pass
def __builtin_ia32_ltr(sel: t.CUInt32T) -> t.State: pass
def __builtin_ia32_str(p: t.CPtr) -> t.State: pass


# ============================================================
# 控制寄存器 (CR / MSW)
# ============================================================

def __builtin_ia32_lmsw(val: t.CUInt32T) -> t.State: pass
def __builtin_ia32_smsw(p: t.CPtr) -> t.State: pass


# ============================================================
# 监控等待 (MONITOR / MWAIT)
# ============================================================

def __builtin_ia32_monitor(p: t.CPtr, extensions: t.CUInt32T, hints: t.CUInt32T) -> t.State: pass
def __builtin_ia32_mwait(extensions: t.CUInt32T, hints: t.CUInt32T) -> t.State: pass


# ============================================================
# XSAVE 状态操作
# ============================================================

def __builtin_ia32_xsave(p: t.CPtr, mask: t.CUInt64T) -> t.State: pass
def __builtin_ia32_xrstor(p: t.CConst | t.CPtr, mask: t.CUInt64T) -> t.State: pass
def __builtin_ia32_xsaveopt(p: t.CPtr, mask: t.CUInt64T) -> t.State: pass
def __builtin_ia32_xsavec(p: t.CPtr, mask: t.CUInt64T) -> t.State: pass
def __builtin_ia32_xrstors(p: t.CConst | t.CPtr, mask: t.CUInt64T) -> t.State: pass
def __builtin_ia32_xsaves(p: t.CPtr, mask: t.CUInt64T) -> t.State: pass


# ============================================================
# 通用内建函数 (Generic Builtins)
# ============================================================

def __builtin_expect(exp: t.CLong, c: t.CLong) -> t.CLong | t.State: pass
def __builtin_unreachable() -> t.State: pass
def __builtin_trap() -> t.State: pass
def __builtin_abort() -> t.State: pass
def __builtin_assume_aligned(addr: t.CConst | t.CPtr, align: t.CSizeT, *args) -> t.CPtr | t.State: pass
def __builtin_constant_p(expr: t.CVoid) -> t.CInt | t.State: pass
def __builtin_types_compatible_p(t1: t.CVoid, t2: t.CVoid) -> t.CInt | t.State: pass
def __builtin_choose_expr(const_exp: t.CUInt32T, exp1: t.CVoid, exp2: t.CVoid) -> t.CPtr | t.State: pass
def __builtin_offsetof(typ: t.CVoid, member: t.CVoid) -> t.CSizeT | t.State: pass
def __builtin_function_start(func: t.CPtr) -> t.CPtr | t.State: pass


# ============================================================
# 可变参数 (VaList)
# ============================================================

def __builtin_va_start(va: t.CPtr, *args) -> t.State: pass
def __builtin_va_end(va: t.CPtr) -> t.State: pass
def __builtin_va_arg(va: t.CPtr, typ: t.CVoid) -> t.State: pass
def __builtin_va_copy(dst: t.CPtr, src: t.CConst | t.CPtr) -> t.State: pass


# ============================================================
# 栈与调用信息 (Stack / Frame)
# ============================================================

def __builtin_return_address(level: t.CUInt32T) -> t.CPtr | t.State: pass
def __builtin_frame_address(level: t.CUInt32T) -> t.CPtr | t.State: pass
def __builtin_alloca(size: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin_alloca_with_align(size: t.CSizeT, alignment: t.CSizeT) -> t.CPtr | t.State: pass


# ============================================================
# 内存操作 (Memory)
# ============================================================

def __builtin_memcpy(dst: t.CPtr, src: t.CConst | t.CPtr, n: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin_memset(s: t.CPtr, c: t.CInt, n: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin_memmove(dst: t.CPtr, src: t.CConst | t.CPtr, n: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin_memcmp(s1: t.CConst | t.CPtr, s2: t.CConst | t.CPtr, n: t.CSizeT) -> t.CInt | t.State: pass
def __builtin_mempcpy(dst: t.CPtr, src: t.CConst | t.CPtr, n: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin_memchr(s: t.CConst | t.CPtr, c: t.CInt, n: t.CSizeT) -> t.CPtr | t.State: pass


# ============================================================
# 字符串操作 (String)
# ============================================================

def __builtin_strcpy(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr) -> t.CChar | t.CPtr | t.State: pass
def __builtin_strncpy(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr, n: t.CSizeT) -> t.CChar | t.CPtr | t.State: pass
def __builtin_strcat(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr) -> t.CChar | t.CPtr | t.State: pass
def __builtin_strncat(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr, n: t.CSizeT) -> t.CChar | t.CPtr | t.State: pass
def __builtin_strlen(s: t.CChar | t.CConst | t.CPtr) -> t.CSizeT | t.State: pass
def __builtin_strcmp(s1: t.CChar | t.CConst | t.CPtr, s2: t.CChar | t.CConst | t.CPtr) -> t.CInt | t.State: pass
def __builtin_strncmp(s1: t.CChar | t.CConst | t.CPtr, s2: t.CChar | t.CConst | t.CPtr, n: t.CSizeT) -> t.CInt | t.State: pass
def __builtin_strchr(s: t.CChar | t.CConst | t.CPtr, c: t.CInt) -> t.CChar | t.CPtr | t.State: pass
def __builtin_strrchr(s: t.CChar | t.CConst | t.CPtr, c: t.CInt) -> t.CChar | t.CPtr | t.State: pass
def __builtin_strstr(haystack: t.CChar | t.CConst | t.CPtr, needle: t.CChar | t.CConst | t.CPtr) -> t.CChar | t.CPtr | t.State: pass


# ============================================================
# 数学内建函数 (Math)
# ============================================================

def __builtin_sqrt(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_sqrtf(x: t.CFloat) -> t.CFloat | t.State: pass
def __builtin_sqrtl(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_pow(x: t.CDouble, y: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_powf(x: t.CFloat, y: t.CFloat) -> t.CFloat | t.State: pass
def __builtin_sin(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_sinf(x: t.CFloat) -> t.CFloat | t.State: pass
def __builtin_cos(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_cosf(x: t.CFloat) -> t.CFloat | t.State: pass
def __builtin_tan(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_tanf(x: t.CFloat) -> t.CFloat | t.State: pass
def __builtin_atan(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_atan2(y: t.CDouble, x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_exp(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_log(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_log2(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_log10(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_fabs(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_fabsf(x: t.CFloat) -> t.CFloat | t.State: pass
def __builtin_abs(x: t.CInt) -> t.CInt | t.State: pass
def __builtin_labs(x: t.CLong) -> t.CLong | t.State: pass
def __builtin_llabs(x: t.CInt64T) -> t.CInt64T | t.State: pass
def __builtin_fma(x: t.CDouble, y: t.CDouble, z: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_fmod(x: t.CDouble, y: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_floor(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_ceil(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_trunc(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_round(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_nearbyint(x: t.CDouble) -> t.CDouble | t.State: pass
def __builtin_rint(x: t.CDouble) -> t.CDouble | t.State: pass


# ============================================================
# 位计数内建函数 (Bit Counting)
# ============================================================

def __builtin_ffs(x: t.CUInt32T) -> t.CInt | t.State: pass
def __builtin_clz(x: t.CUInt32T) -> t.CInt | t.State: pass
def __builtin_ctz(x: t.CUInt32T) -> t.CInt | t.State: pass
def __builtin_popcount(x: t.CUInt32T) -> t.CInt | t.State: pass
def __builtin_parity(x: t.CUInt32T) -> t.CInt | t.State: pass

def __builtin_ffsl(x: t.CULong) -> t.CInt | t.State: pass
def __builtin_clzl(x: t.CULong) -> t.CInt | t.State: pass
def __builtin_ctzl(x: t.CULong) -> t.CInt | t.State: pass
def __builtin_popcountl(x: t.CULong) -> t.CInt | t.State: pass
def __builtin_parityl(x: t.CULong) -> t.CInt | t.State: pass

def __builtin_ffsll(x: t.CUInt64T) -> t.CInt | t.State: pass
def __builtin_clzll(x: t.CUInt64T) -> t.CInt | t.State: pass
def __builtin_ctzll(x: t.CUInt64T) -> t.CInt | t.State: pass
def __builtin_popcountll(x: t.CUInt64T) -> t.CInt | t.State: pass
def __builtin_parityll(x: t.CUInt64T) -> t.CInt | t.State: pass


# ============================================================
# 对象大小检查 (Object size check)
# ============================================================

def __builtin_object_size(ptr: t.CConst | t.CPtr, typ: t.CInt) -> t.CSizeT | t.State: pass
def __builtin_dynamic_object_size(ptr: t.CConst | t.CPtr, typ: t.CInt) -> t.CSizeT | t.State: pass

def __builtin___memcpy_chk(dst: t.CPtr, src: t.CConst | t.CPtr, n: t.CSizeT, objsize: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin___memmove_chk(dst: t.CPtr, src: t.CConst | t.CPtr, n: t.CSizeT, objsize: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin___memset_chk(s: t.CPtr, c: t.CInt, n: t.CSizeT, objsize: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin___mempcpy_chk(dst: t.CPtr, src: t.CConst | t.CPtr, n: t.CSizeT, objsize: t.CSizeT) -> t.CPtr | t.State: pass
def __builtin___strcpy_chk(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr, objsize: t.CSizeT) -> t.CChar | t.CPtr | t.State: pass
def __builtin___strncpy_chk(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr, n: t.CSizeT, objsize: t.CSizeT) -> t.CChar | t.CPtr | t.State: pass
def __builtin___strcat_chk(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr, objsize: t.CSizeT) -> t.CChar | t.CPtr | t.State: pass
def __builtin___strncat_chk(dst: t.CChar | t.CPtr, src: t.CChar | t.CConst | t.CPtr, n: t.CSizeT, objsize: t.CSizeT) -> t.CChar | t.CPtr | t.State: pass
def __builtin___snprintf_chk(s: t.CChar | t.CPtr, maxlen: t.CSizeT, flag: t.CInt, slen: t.CSizeT, fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.State: pass
def __builtin___sprintf_chk(s: t.CChar | t.CPtr, flag: t.CInt, slen: t.CSizeT, fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.State: pass


# ============================================================
# 浮点分类 (FP Classification)
# ============================================================

def __builtin_isnan(x: t.CDouble) -> t.CInt | t.State: pass
def __builtin_isinf(x: t.CDouble) -> t.CInt | t.State: pass
def __builtin_isinf_sign(x: t.CDouble) -> t.CInt | t.State: pass
def __builtin_isfinite(x: t.CDouble) -> t.CInt | t.State: pass
def __builtin_isnormal(x: t.CDouble) -> t.CInt | t.State: pass
def __builtin_signbit(x: t.CDouble) -> t.CInt | t.State: pass
def __builtin_isgreater(x: t.CDouble, y: t.CDouble) -> t.CInt | t.State: pass
def __builtin_isgreaterequal(x: t.CDouble, y: t.CDouble) -> t.CInt | t.State: pass
def __builtin_isless(x: t.CDouble, y: t.CDouble) -> t.CInt | t.State: pass
def __builtin_islessequal(x: t.CDouble, y: t.CDouble) -> t.CInt | t.State: pass
def __builtin_islessgreater(x: t.CDouble, y: t.CDouble) -> t.CInt | t.State: pass
def __builtin_isunordered(x: t.CDouble, y: t.CDouble) -> t.CInt | t.State: pass


# ============================================================
# 特殊值 (Special Values)
# ============================================================

def __builtin_nan(s: t.CChar | t.CConst | t.CPtr) -> t.CDouble | t.State: pass
def __builtin_nanf(s: t.CChar | t.CConst | t.CPtr) -> t.CFloat | t.State: pass
def __builtin_nanl(s: t.CChar | t.CConst | t.CPtr) -> t.CDouble | t.State: pass
def __builtin_nans(s: t.CChar | t.CConst | t.CPtr) -> t.CDouble | t.State: pass
def __builtin_nansf(s: t.CChar | t.CConst | t.CPtr) -> t.CFloat | t.State: pass
def __builtin_inf() -> t.CDouble | t.State: pass
def __builtin_inff() -> t.CFloat | t.State: pass
def __builtin_infl() -> t.CDouble | t.State: pass
def __builtin_huge_val() -> t.CDouble | t.State: pass
def __builtin_huge_valf() -> t.CFloat | t.State: pass
def __builtin_huge_vall() -> t.CDouble | t.State: pass
def __builtin_inf_sign() -> t.CInt | t.State: pass


# ============================================================
# 类型转换与溢出检查 (Overflow)
# ============================================================

def __builtin_add_overflow(a: t.CUInt64T, b: t.CUInt64T, res: t.CUInt64T | t.CPtr) -> t.CBool | t.State: pass
def __builtin_sub_overflow(a: t.CUInt64T, b: t.CUInt64T, res: t.CUInt64T | t.CPtr) -> t.CBool | t.State: pass
def __builtin_mul_overflow(a: t.CUInt64T, b: t.CUInt64T, res: t.CUInt64T | t.CPtr) -> t.CBool | t.State: pass
def __builtin_sadd_overflow(a: t.CInt64T, b: t.CInt64T, res: t.CInt64T | t.CPtr) -> t.CBool | t.State: pass
def __builtin_ssub_overflow(a: t.CInt64T, b: t.CInt64T, res: t.CInt64T | t.CPtr) -> t.CBool | t.State: pass
def __builtin_smul_overflow(a: t.CInt64T, b: t.CInt64T, res: t.CInt64T | t.CPtr) -> t.CBool | t.State: pass
def __builtin_uadd_overflow(a: t.CUInt64T, b: t.CUInt64T, res: t.CUInt64T | t.CPtr) -> t.CBool | t.State: pass
def __builtin_usub_overflow(a: t.CUInt64T, b: t.CUInt64T, res: t.CUInt64T | t.CPtr) -> t.CBool | t.State: pass
def __builtin_umul_overflow(a: t.CUInt64T, b: t.CUInt64T, res: t.CUInt64T | t.CPtr) -> t.CBool | t.State: pass


# ============================================================
# MMX / SSE 状态
# ============================================================

def __builtin_ia32_emms() -> t.State: pass
def __builtin_ia32_femms() -> t.State: pass


# ============================================================
# 排队指令 (ENQCMD)
# ============================================================

def __builtin_ia32_enqcmd(dst: t.CPtr, src: t.CConst | t.CPtr) -> t.CBool | t.State: pass
def __builtin_ia32_enqcmds(dst: t.CPtr, src: t.CConst | t.CPtr) -> t.CBool | t.State: pass


# ============================================================
# 用户级等待 (UMWAIT / UMONITOR / TPAUSE)
# ============================================================

def __builtin_ia32_umonitor(p: t.CPtr) -> t.State: pass
def __builtin_ia32_umwait(extensions: t.CUInt32T, counter: t.CUInt64T) -> t.CUInt8T | t.State: pass
def __builtin_ia32_tpause(extensions: t.CUInt32T, counter: t.CUInt64T) -> t.CUInt8T | t.State: pass


# ============================================================
# 访问控制 (CLAC / STAC)
# ============================================================

def __builtin_ia32_clac() -> t.State: pass
def __builtin_ia32_stac() -> t.State: pass


# ============================================================
# TLB 无效化 (INVLPG 变体)
# ============================================================

def __builtin_ia32_invlpgb(aux: t.CUInt64T, pcid: t.CUInt64T) -> t.State: pass
def __builtin_ia32_tlbsync() -> t.State: pass
