#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int cpu_family(unsigned int);
int cpu_model(unsigned int);
int cpu_stepping(unsigned int);
unsigned int cpuid_signature();
int /*<<< orphan*/ cpuid_vendor(char *);
void workaround_nehalem_aaj79(unsigned *ebx) {
  unsigned eax;
  if (!cpuid_vendor("GenuineIntel"))
    return;
  eax = cpuid_signature();
  if (cpu_family(eax) != 6 || cpu_model(eax) != 26 || cpu_stepping(eax) > 4)
    return;
  *ebx |= (1 << 2);
}


x86 assembly (clang, -O0):
<workaround_nehalem_aaj79>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
call   1030 <cpuid_vendor@plt>
cmp    $0x0,%eax
jne    1176 <workaround_nehalem_aaj79+0x26>
jmp    11c3 <workaround_nehalem_aaj79+0x73>
mov    $0x0,%al
call   1040 <cpuid_signature@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <cpu_family@plt>
cmp    $0x6,%eax
jne    11b3 <workaround_nehalem_aaj79+0x63>
mov    -0xc(%rbp),%edi
call   1070 <cpu_model@plt>
cmp    $0x1a,%eax
jne    11b3 <workaround_nehalem_aaj79+0x63>
mov    -0xc(%rbp),%edi
call   1050 <cpu_stepping@plt>
cmp    $0x4,%eax
jle    11b8 <workaround_nehalem_aaj79+0x68>
jmp    11c3 <workaround_nehalem_aaj79+0x73>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<workaround_nehalem_aaj79>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xea3(%rip),%rdi
call   1030 <cpuid_vendor@plt>
test   %eax,%eax
je     1196 <workaround_nehalem_aaj79+0x46>
xor    %eax,%eax
call   1040 <cpuid_signature@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <cpu_family@plt>
cmp    $0x6,%eax
jne    1196 <workaround_nehalem_aaj79+0x46>
mov    %ebp,%edi
call   1070 <cpu_model@plt>
cmp    $0x1a,%eax
jne    1196 <workaround_nehalem_aaj79+0x46>
mov    %ebp,%edi
call   1050 <cpu_stepping@plt>
cmp    $0x4,%eax
jg     1196 <workaround_nehalem_aaj79+0x46>
orb    $0x4,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"GenuineIntel\00"
define void @workaround_nehalem_aaj79(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = call i32 @cpuid_vendor(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
br label %25
7: ; preds = %1
%8 = call i32 (...) @cpuid_signature()
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @cpu_family(i32 %9)
%11 = icmp ne i32 %10, 6
br i1 %11, label %20, label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = call i32 @cpu_model(i32 %13)
%15 = icmp ne i32 %14, 26
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = call i32 @cpu_stepping(i32 %17)
%19 = icmp sgt i32 %18, 4
br i1 %19, label %20, label %21
20: ; preds = %16, %12, %7
br label %25
21: ; preds = %16
%22 = load i32*, i32** %2
%23 = load i32, i32* %22
%24 = or i32 %23, 4
store i32 %24, i32* %22
br label %25
25: ; preds = %21, %20, %6
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"GenuineIntel\00"
define void @workaround_nehalem_aaj79(i32* nocapture %0) {
%2 = tail call i32 @cpuid_vendor(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = tail call i32 (...) @cpuid_signature()
%6 = tail call i32 @cpu_family(i32 %5)
%7 = icmp eq i32 %6, 6
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = tail call i32 @cpu_model(i32 %5)
%10 = icmp eq i32 %9, 26
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = tail call i32 @cpu_stepping(i32 %5)
%13 = icmp sgt i32 %12, 4
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %0
%16 = or i32 %15, 4
store i32 %16, i32* %0
br label %17
17: ; preds = %4, %8, %11, %1, %14
ret void
}