#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 /*<<< orphan*/ cpu_get(int *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
void test_sse42_enable() {
  int cpuinfo[4];
  int sse42 = 0;
  cpu_get(cpuinfo, 1);
  sse42 = cpuinfo[2] & (1 << 20) || 0;
  if (sse42)
    puts("SSE4.2 Test...\n OK SSE 4.2 instruction enable !\n");
  else {
    puts("SSE4.2 Not enabled\n your CPU need SSE 4.2 instruction to run this "
         "programm\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<test_sse42_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <cpu_get@plt>
mov    -0x8(%rbp),%ecx
and    $0x100000,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
jne    116e <test_sse42_enable+0x3e>
xor    %eax,%eax
mov    %al,-0x15(%rbp)
jmp    116e <test_sse42_enable+0x3e>
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1194 <test_sse42_enable+0x64>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
jmp    11a7 <test_sse42_enable+0x77>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sse42_enable>:
sub    $0x18,%rsp
mov    %rsp,%rdi
mov    $0x1,%esi
call   1040 <cpu_get@plt>
testb  $0x10,0xa(%rsp)
je     1159 <test_sse42_enable+0x29>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
add    $0x18,%rsp
ret
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"SSE4.2 Test...\0A OK SSE 4.2 instruction enable !\0A\00"
@.str.1 = [76 x i8] c"SSE4.2 Not enabled\0A your CPU need SSE 4.2 instruction to run this programm\0A\00"
define void @test_sse42_enable() {
%1 = alloca [4 x i32]
%2 = alloca i32
store i32 0, i32* %2
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @cpu_get(i32* %3, i32 1)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%6 = load i32, i32* %5
%7 = and i32 %6, 1048576
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %0
br label %10
10: ; preds = %9, %0
%11 = phi i1 [ true, %0 ], [ false, %9 ]
%12 = zext i1 %11 to i32
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %20
17: ; preds = %10
%18 = call i32 @puts(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"SSE4.2 Test...\0A OK SSE 4.2 instruction enable !\0A\00"
@.str.1 = [76 x i8] c"SSE4.2 Not enabled\0A your CPU need SSE 4.2 instruction to run this programm\0A\00"
define void @test_sse42_enable() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @cpu_get(i32* %3, i32 1)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%6 = load i32, i32* %5
%7 = and i32 %6, 1048576
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
ret void
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 0)
unreachable
}