// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/cpu.c
// Function: x86CPUInfo
static int x86CPUInfo(CPUFeature feature) {
  int max_cpuid_value;
  int cpu_info[4];
  int is_intel = 0;

  // get the highest feature value cpuid supports
  GetCPUInfo(cpu_info, 0);
  max_cpuid_value = cpu_info[0];
  if (max_cpuid_value < 1) {
    return 0;
  } else {
    const int VENDOR_ID_INTEL_EBX = 0x756e6547;  // uneG
    const int VENDOR_ID_INTEL_EDX = 0x49656e69;  // Ieni
    const int VENDOR_ID_INTEL_ECX = 0x6c65746e;  // letn
    is_intel = (cpu_info[1] == VENDOR_ID_INTEL_EBX &&
                cpu_info[2] == VENDOR_ID_INTEL_ECX &&
                cpu_info[3] == VENDOR_ID_INTEL_EDX);    // genuine Intel?
  }

  GetCPUInfo(cpu_info, 1);
  if (feature == kSSE2) {
    return !!(cpu_info[3] & (1 << 26));
  }
  if (feature == kSSE3) {
    return !!(cpu_info[2] & (1 << 0));
  }
  if (feature == kSlowSSSE3) {
    if (is_intel && (cpu_info[2] & (1 << 9))) {   // SSSE3?
      return CheckSlowModel(cpu_info[0]);
    }
    return 0;
  }

  if (feature == kSSE4_1) {
    return !!(cpu_info[2] & (1 << 19));
  }
  if (feature == kAVX) {
    // bits 27 (OSXSAVE) & 28 (256-bit AVX)
    if ((cpu_info[2] & 0x18000000) == 0x18000000) {
      // XMM state and YMM state enabled by the OS.
      return (xgetbv() & 0x6) == 0x6;
    }
  }
  if (feature == kAVX2) {
    if (x86CPUInfo(kAVX) && max_cpuid_value >= 7) {
      GetCPUInfo(cpu_info, 7);
      return !!(cpu_info[1] & (1 << 5));
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x149ff0
movl -0x20(%rbp), %eax
movl %eax, -0xc(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x149e65
movl $0x0, -0x4(%rbp)
jmp 0x149fd8
movl $0x756e6547, -0x28(%rbp) # imm = 0x756E6547
movl $0x49656e69, -0x2c(%rbp) # imm = 0x49656E69
movl $0x6c65746e, -0x30(%rbp) # imm = 0x6C65746E
xorl %eax, %eax
cmpl $0x756e6547, -0x1c(%rbp) # imm = 0x756E6547
movb %al, -0x31(%rbp)
jne 0x149ea3
xorl %eax, %eax
cmpl $0x6c65746e, -0x18(%rbp) # imm = 0x6C65746E
movb %al, -0x31(%rbp)
jne 0x149ea3
cmpl $0x49656e69, -0x14(%rbp) # imm = 0x49656E69
sete %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x24(%rbp)
leaq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x149ff0
cmpl $0x0, -0x8(%rbp)
jne 0x149ee1
movl -0x14(%rbp), %eax
andl $0x4000000, %eax        # imm = 0x4000000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x149fd8
cmpl $0x1, -0x8(%rbp)
jne 0x149f04
movl -0x18(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x149fd8
cmpl $0x2, -0x8(%rbp)
jne 0x149f39
cmpl $0x0, -0x24(%rbp)
je 0x149f2d
movl -0x18(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x149f2d
movl -0x20(%rbp), %edi
callq 0x14a040
movl %eax, -0x4(%rbp)
jmp 0x149fd8
movl $0x0, -0x4(%rbp)
jmp 0x149fd8
cmpl $0x3, -0x8(%rbp)
jne 0x149f5b
movl -0x18(%rbp), %eax
andl $0x80000, %eax          # imm = 0x80000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x149fd8
cmpl $0x4, -0x8(%rbp)
jne 0x149f8c
movl -0x18(%rbp), %eax
andl $0x18000000, %eax       # imm = 0x18000000
cmpl $0x18000000, %eax       # imm = 0x18000000
jne 0x149f8a
callq 0x14a0c0
andq $0x6, %rax
cmpq $0x6, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x149fd8
jmp 0x149f8c
cmpl $0x5, -0x8(%rbp)
jne 0x149fd1
movl $0x4, %edi
callq 0x149e30
cmpl $0x0, %eax
je 0x149fcf
cmpl $0x7, -0xc(%rbp)
jl 0x149fcf
leaq -0x20(%rbp), %rdi
movl $0x7, %esi
callq 0x149ff0
movl -0x1c(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x149fd8
jmp 0x149fd1
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)