#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*/ _get_cpuinfo_cpu_type(char *, int, char *);
unsigned long strtoul(char *, char **, int /*<<< orphan*/);
int cpu_info_number(char *name, unsigned long *number) {
  char buf[100];
  char *end;
  if (!_get_cpuinfo_cpu_type(buf, sizeof buf, name))
    return 0;
  *number = strtoul(buf, &end, 0);
  return end > buf;
}


x86 assembly (clang, -O0):
<cpu_info_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x64,%esi
call   1040 <_get_cpuinfo_cpu_type@plt>
cmp    $0x0,%eax
jne    115a <cpu_info_number+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    118f <cpu_info_number+0x6f>
lea    -0x80(%rbp),%rdi
lea    -0x88(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtoul@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x88(%rbp),%rax
lea    -0x80(%rbp),%rcx
cmp    %rcx,%rax
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_info_number>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
mov    %rdi,%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <_get_cpuinfo_cpu_type@plt>
test   %eax,%eax
je     1161 <cpu_info_number+0x41>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1030 <strtoul@plt>
mov    %rax,(%r14)
xor    %eax,%eax
cmp    %rbx,0x8(%rsp)
seta   %al
jmp    1163 <cpu_info_number+0x43>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @cpu_info_number(i8* %0, i64* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca [100 x i8]
%7 = alloca i8*
store i8* %0, i8** %4
store i64* %1, i64** %5
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = call i32 @_get_cpuinfo_cpu_type(i8* %8, i32 100, i8* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %2
store i32 0, i32* %3
br label %21
13: ; preds = %2
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%15 = call i64 @strtoul(i8* %14, i8** %7, i32 0)
%16 = load i64*, i64** %5
store i64 %15, i64* %16
%17 = load i8*, i8** %7
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%19 = icmp ugt i8* %17, %18
%20 = zext i1 %19 to i32
store i32 %20, i32* %3
br label %21
21: ; preds = %13, %12
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @cpu_info_number(i8* %0, i64* nocapture writeonly %1) {
%3 = alloca [100 x i8]
%4 = alloca i8*
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = bitcast i8** %4 to i8*
%7 = call i32 @_get_cpuinfo_cpu_type(i8* %5, i32 100, i8* %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = call i64 @strtoul(i8* %5, i8** %4, i32 0)
store i64 %10, i64* %1
%11 = load i8*, i8** %4
%12 = icmp ugt i8* %11, %5
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %2, %9
%15 = phi i32 [ %13, %9 ], [ 0, %2 ]
ret i32 %15
}