#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_revision(char *);
scalar_t__ strcmp(char *, char *);
int get_rpi_revision(void) {
  char revision[1024] = {'\0'};
  if (get_cpuinfo_revision(revision) == NULL)
    return -1;
  if ((strcmp(revision, "0002") == 0) || (strcmp(revision, "1000002") == 0) ||
      (strcmp(revision, "0003") == 0) || (strcmp(revision, "1000003") == 0))
    return 1;
  else if ((strcmp(revision, "0004") == 0) ||
           (strcmp(revision, "1000004") == 0) ||
           (strcmp(revision, "0005") == 0) ||
           (strcmp(revision, "1000005") == 0) ||
           (strcmp(revision, "0006") == 0) ||
           (strcmp(revision, "1000006") == 0))
    return 2;
  else if ((strcmp(revision, "a01041") == 0) ||
           (strcmp(revision, "a21041") == 0))
    return 3;
  else
    return 4;
}


x86 assembly (clang, -O0):
<get_rpi_revision>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
lea    -0x410(%rbp),%rdi
call   1050 <get_cpuinfo_revision@plt>
cmp    $0x0,%rax
jne    1170 <get_rpi_revision+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    12f7 <get_rpi_revision+0x1c7>
lea    -0x410(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11e4 <get_rpi_revision+0xb4>
lea    -0x410(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11e4 <get_rpi_revision+0xb4>
lea    -0x410(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11e4 <get_rpi_revision+0xb4>
lea    -0x410(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f0 <get_rpi_revision+0xc0>
movl   $0x1,-0x4(%rbp)
jmp    12f7 <get_rpi_revision+0x1c7>
lea    -0x410(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     129e <get_rpi_revision+0x16e>
lea    -0x410(%rbp),%rdi
lea    0xdf5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     129e <get_rpi_revision+0x16e>
lea    -0x410(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     129e <get_rpi_revision+0x16e>
lea    -0x410(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     129e <get_rpi_revision+0x16e>
lea    -0x410(%rbp),%rdi
lea    0xdb1(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     129e <get_rpi_revision+0x16e>
lea    -0x410(%rbp),%rdi
lea    0xd91(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12aa <get_rpi_revision+0x17a>
movl   $0x2,-0x4(%rbp)
jmp    12f7 <get_rpi_revision+0x1c7>
lea    -0x410(%rbp),%rdi
lea    0xd70(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     12e4 <get_rpi_revision+0x1b4>
lea    -0x410(%rbp),%rdi
lea    0xd5a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12f0 <get_rpi_revision+0x1c0>
movl   $0x3,-0x4(%rbp)
jmp    12f7 <get_rpi_revision+0x1c7>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rpi_revision>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %rbx,%rdi
call   1050 <get_cpuinfo_revision@plt>
test   %rax,%rax
je     1276 <get_rpi_revision+0x146>
lea    0xea1(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xe81(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xe74(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xe59(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xe4c(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
mov    $0x2,%ebx
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xe2c(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xe1f(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xe08(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xdff(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xde8(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127b <get_rpi_revision+0x14b>
lea    0xddc(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1286 <get_rpi_revision+0x156>
lea    0xdcf(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcmp@plt>
cmp    $0x1,%rax
mov    $0x4,%ebx
sbb    $0x0,%ebx
jmp    127b <get_rpi_revision+0x14b>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x400,%rsp
pop    %rbx
ret
mov    $0x3,%ebx
jmp    127b <get_rpi_revision+0x14b>

LLVM IR (-O0):
@.str = [5 x i8] c"0002\00"
@.str.1 = [8 x i8] c"1000002\00"
@.str.2 = [5 x i8] c"0003\00"
@.str.3 = [8 x i8] c"1000003\00"
@.str.4 = [5 x i8] c"0004\00"
@.str.5 = [8 x i8] c"1000004\00"
@.str.6 = [5 x i8] c"0005\00"
@.str.7 = [8 x i8] c"1000005\00"
@.str.8 = [5 x i8] c"0006\00"
@.str.9 = [8 x i8] c"1000006\00"
@.str.10 = [7 x i8] c"a01041\00"
@.str.11 = [7 x i8] c"a21041\00"
define i32 @get_rpi_revision() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = bitcast [1024 x i8]* %2 to i8*
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32* @get_cpuinfo_revision(i8* %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 -1, i32* %1
br label %60
8: ; preds = %0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %8
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %24, label %16
16: ; preds = %12
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20, %16, %12, %8
store i32 1, i32* %1
br label %60
25: ; preds = %20
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %49, label %29
29: ; preds = %25
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %49, label %33
33: ; preds = %29
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %49, label %37
37: ; preds = %33
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %49, label %41
41: ; preds = %37
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %41
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %45, %41, %37, %33, %29, %25
store i32 2, i32* %1
br label %60
50: ; preds = %45
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %58, label %54
54: ; preds = %50
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %54, %50
store i32 3, i32* %1
br label %60
59: ; preds = %54
store i32 4, i32* %1
br label %60
60: ; preds = %59, %58, %49, %24, %7
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str = [5 x i8] c"0002\00"
@.str.1 = [8 x i8] c"1000002\00"
@.str.2 = [5 x i8] c"0003\00"
@.str.3 = [8 x i8] c"1000003\00"
@.str.4 = [5 x i8] c"0004\00"
@.str.5 = [8 x i8] c"1000004\00"
@.str.6 = [5 x i8] c"0005\00"
@.str.7 = [8 x i8] c"1000005\00"
@.str.8 = [5 x i8] c"0006\00"
@.str.9 = [8 x i8] c"1000006\00"
@.str.10 = [7 x i8] c"a01041\00"
@.str.11 = [7 x i8] c"a21041\00"
define i32 @get_rpi_revision() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32* @get_cpuinfo_revision(i8* %2)
%4 = icmp eq i32* %3, null
br i1 %4, label %42, label %5
5: ; preds = %0
%6 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %42, label %8
8: ; preds = %5
%9 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %42, label %11
11: ; preds = %8
%12 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %42, label %14
14: ; preds = %11
%15 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %42, label %17
17: ; preds = %14
%18 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %42, label %20
20: ; preds = %17
%21 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %42, label %23
23: ; preds = %20
%24 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %42, label %26
26: ; preds = %23
%27 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %42, label %29
29: ; preds = %26
%30 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %42, label %32
32: ; preds = %29
%33 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %42, label %35
35: ; preds = %32
%36 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %35
%39 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
%41 = select i1 %40, i32 3, i32 4
br label %42
42: ; preds = %38, %35, %17, %20, %23, %26, %29, %32, %5, %8, %11, %14, %0
%43 = phi i32 [ -1, %0 ], [ 1, %14 ], [ 1, %11 ], [ 1, %8 ], [ 1, %5 ], [ 2, %32 ], [ 2, %29 ], [ 2, %26 ], [ 2, %23 ], [ 2, %20 ], [ 2, %17 ], [ 3, %35 ], [ %41, %38 ]
ret i32 %43
}