diff --git a/src/libFLAC/cpu.c b/src/libFLAC/cpu.c
index 383f823..136b5a7 100644
--- a/src/libFLAC/cpu.c
+++ b/src/libFLAC/cpu.c
@@ -565,6 +565,11 @@ void FLAC__cpu_info_x86(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx)
 {
 #if defined _MSC_VER || defined __INTEL_COMPILER
 	int cpuinfo[4];
+	__cpuid(cpuinfo, 0);
+	if(cpuinfo[0] < 1) {
+		*flags_ecx = *flags_edx = 0;
+		return;
+	}
 	__cpuid(cpuinfo, 1);
 	*flags_ecx = cpuinfo[2];
 	*flags_edx = cpuinfo[3];
diff --git a/src/libFLAC/ia32/cpu_asm.nasm b/src/libFLAC/ia32/cpu_asm.nasm
index c73ae02..289d86c 100644
--- a/src/libFLAC/ia32/cpu_asm.nasm
+++ b/src/libFLAC/ia32/cpu_asm.nasm
@@ -47,7 +47,6 @@ cglobal FLAC__cpu_info_extended_amd_asm_ia32
 ;
 
 cident FLAC__cpu_have_cpuid_asm_ia32
-	push	ebx
 	pushfd
 	pop	eax
 	mov	edx, eax
@@ -56,14 +55,11 @@ cident FLAC__cpu_have_cpuid_asm_ia32
 	popfd
 	pushfd
 	pop	eax
-	cmp	eax, edx
-	jz	.no_cpuid
-	mov	eax, 1
-	jmp	.end
-.no_cpuid:
-	xor	eax, eax
-.end:
-	pop	ebx
+	xor	eax, edx
+	and	eax, 0x00200000
+	shr	eax, 0x15
+	push	edx
+	popfd
 	ret
 
 ; **********************************************************************
@@ -79,6 +75,10 @@ cident FLAC__cpu_info_asm_ia32
 	call	FLAC__cpu_have_cpuid_asm_ia32
 	test	eax, eax
 	jz	.no_cpuid
+	mov	eax, 0
+	cpuid
+	cmp	eax, 1
+	jb	.no_cpuid
 	mov	eax, 1
 	cpuid
 	mov	ebx, [esp + 8]
