#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 getPROCID();
unsigned int GetSoCType() {
  unsigned int CPUtype = 0;
  if ((getPROCID() == 0x02) | (getPROCID() == 0x08) | (getPROCID() == 0x09) |
      (getPROCID() == 0x11)) {
    CPUtype = 1;
  } else if ((getPROCID() == 0x411FC09) | (getPROCID() == 0x412FC09)) {
    CPUtype = 2;
  } else if (getPROCID() == 0x410FC05) {
    CPUtype = 3;
  }
  return CPUtype;
}


x86 assembly (clang, -O0):
<GetSoCType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getPROCID@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getPROCID@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    $0x8,%ecx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getPROCID@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    $0x9,%ecx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getPROCID@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    $0x11,%ecx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     119d <GetSoCType+0x8d>
movl   $0x1,-0x4(%rbp)
jmp    1209 <GetSoCType+0xf9>
mov    $0x0,%al
call   1030 <getPROCID@plt>
cmp    $0x411fc09,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getPROCID@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    $0x412fc09,%ecx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     11e6 <GetSoCType+0xd6>
movl   $0x2,-0x4(%rbp)
jmp    1204 <GetSoCType+0xf4>
mov    $0x0,%al
call   1030 <getPROCID@plt>
cmp    $0x410fc05,%eax
jne    11ff <GetSoCType+0xef>
movl   $0x3,-0x4(%rbp)
jmp    1204 <GetSoCType+0xf4>
jmp    1209 <GetSoCType+0xf9>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetSoCType>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <getPROCID@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <getPROCID@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getPROCID@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <getPROCID@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x2,%r14d
je     118e <GetSoCType+0x7e>
cmp    $0x8,%ebx
je     118e <GetSoCType+0x7e>
cmp    $0x9,%ebp
je     118e <GetSoCType+0x7e>
cmp    $0x11,%ecx
je     118e <GetSoCType+0x7e>
xor    %eax,%eax
call   1030 <getPROCID@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getPROCID@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    $0x411fc09,%ebx
je     118e <GetSoCType+0x7e>
cmp    $0x412fc09,%ecx
je     118e <GetSoCType+0x7e>
xor    %eax,%eax
call   1030 <getPROCID@plt>
xor    %ecx,%ecx
cmp    $0x410fc05,%eax
sete   %cl
lea    (%rcx,%rcx,2),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @GetSoCType() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getPROCID()
%3 = icmp eq i32 %2, 2
%4 = zext i1 %3 to i32
%5 = call i32 (...) @getPROCID()
%6 = icmp eq i32 %5, 8
%7 = zext i1 %6 to i32
%8 = or i32 %4, %7
%9 = call i32 (...) @getPROCID()
%10 = icmp eq i32 %9, 9
%11 = zext i1 %10 to i32
%12 = or i32 %8, %11
%13 = call i32 (...) @getPROCID()
%14 = icmp eq i32 %13, 17
%15 = zext i1 %14 to i32
%16 = or i32 %12, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %0
store i32 1, i32* %1
br label %35
19: ; preds = %0
%20 = call i32 (...) @getPROCID()
%21 = icmp eq i32 %20, 68287497
%22 = zext i1 %21 to i32
%23 = call i32 (...) @getPROCID()
%24 = icmp eq i32 %23, 68353033
%25 = zext i1 %24 to i32
%26 = or i32 %22, %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %19
store i32 2, i32* %1
br label %34
29: ; preds = %19
%30 = call i32 (...) @getPROCID()
%31 = icmp eq i32 %30, 68221957
br i1 %31, label %32, label %33
32: ; preds = %29
store i32 3, i32* %1
br label %33
33: ; preds = %32, %29
br label %34
34: ; preds = %33, %28
br label %35
35: ; preds = %34, %18
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
define i32 @GetSoCType() {
%1 = tail call i32 (...) @getPROCID()
%2 = icmp eq i32 %1, 2
%3 = tail call i32 (...) @getPROCID()
%4 = icmp eq i32 %3, 8
%5 = or i1 %2, %4
%6 = tail call i32 (...) @getPROCID()
%7 = icmp eq i32 %6, 9
%8 = or i1 %5, %7
%9 = tail call i32 (...) @getPROCID()
%10 = icmp eq i32 %9, 17
%11 = or i1 %8, %10
br i1 %11, label %22, label %12
12: ; preds = %0
%13 = tail call i32 (...) @getPROCID()
%14 = icmp eq i32 %13, 68287497
%15 = tail call i32 (...) @getPROCID()
%16 = icmp eq i32 %15, 68353033
%17 = or i1 %14, %16
br i1 %17, label %22, label %18
18: ; preds = %12
%19 = tail call i32 (...) @getPROCID()
%20 = icmp eq i32 %19, 68221957
%21 = select i1 %20, i32 3, i32 0
br label %22
22: ; preds = %18, %12, %0
%23 = phi i32 [ 1, %0 ], [ 2, %12 ], [ %21, %18 ]
ret i32 %23
}