#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*/ genVersionFile(char *, int /*<<< orphan*/);
scalar_t__ getCPUinfo(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
scalar_t__ stristr(char *, char *);
int /*<<< orphan*/ strlen(char *);
int verifyLicenseCPU(char *compareName) {
  char cpuinfo[2048];
  char snBuf[256];
  snprintf(snBuf, 256, "Licensed cpuid:%s\nLicensed date:unlimited\n",
           compareName);
  genVersionFile(snBuf, strlen(snBuf));
  if (getCPUinfo(cpuinfo, 2048) > 0) {
    if (stristr(cpuinfo, compareName)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<verifyLicenseCPU>:
push   %rbp
mov    %rsp,%rbp
sub    $0x920,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x910(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x100,%esi
lea    0xe8a(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x910(%rbp),%rax
mov    %rax,-0x918(%rbp)
lea    -0x910(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x918(%rbp),%rdi
mov    %eax,%esi
call   1070 <genVersionFile@plt>
lea    -0x810(%rbp),%rdi
mov    $0x800,%esi
call   1060 <getCPUinfo@plt>
cmp    $0x0,%rax
jle    11e9 <verifyLicenseCPU+0x99>
lea    -0x810(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <stristr@plt>
cmp    $0x0,%rax
je     11e4 <verifyLicenseCPU+0x94>
movl   $0x1,-0x4(%rbp)
jmp    11f0 <verifyLicenseCPU+0xa0>
jmp    11e9 <verifyLicenseCPU+0x99>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x920,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifyLicenseCPU>:
push   %r14
push   %rbx
sub    $0x908,%rsp
mov    %rdi,%r14
lea    0xe9c(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%rcx
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <genVersionFile@plt>
lea    0x100(%rsp),%rdi
mov    $0x800,%esi
call   1060 <getCPUinfo@plt>
test   %rax,%rax
jle    11bd <verifyLicenseCPU+0x6d>
lea    0x100(%rsp),%rdi
mov    %r14,%rsi
call   1030 <stristr@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    11bf <verifyLicenseCPU+0x6f>
xor    %eax,%eax
add    $0x908,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Licensed cpuid:%s\0ALicensed date:unlimited\0A\00"
define i32 @verifyLicenseCPU(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [2048 x i8]
%5 = alloca [256 x i8]
store i8* %0, i8** %3
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = call i32 @snprintf(i8* %6, i32 256, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @genVersionFile(i8* %9, i32 %11)
%13 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%14 = call i64 @getCPUinfo(i8* %13, i32 2048)
%15 = icmp sgt i64 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %1
%17 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%18 = load i8*, i8** %3
%19 = call i64 @stristr(i8* %17, i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
store i32 1, i32* %2
br label %24
22: ; preds = %16
br label %23
23: ; preds = %22, %1
store i32 0, i32* %2
br label %24
24: ; preds = %23, %21
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [43 x i8] c"Licensed cpuid:%s\0ALicensed date:unlimited\0A\00"
define i32 @verifyLicenseCPU(i8* %0) {
%2 = alloca [2048 x i8]
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 256, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = call i32 @strlen(i8* %5)
%8 = call i32 @genVersionFile(i8* %5, i32 %7)
%9 = call i64 @getCPUinfo(i8* %4, i32 2048)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = call i64 @stristr(i8* %4, i8* %0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11, %1
br label %15
15: ; preds = %11, %14
%16 = phi i32 [ 0, %14 ], [ 1, %11 ]
ret i32 %16
}