#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*/ clearLastError();
int getBoardInfo(int, char **);
scalar_t__ strncasecmp(char *, char *, int);
int getBoardType() {
  clearLastError();
  int ret = -1;
  char info[2][32];
  int boardType = getBoardInfo(2, info);
  if (boardType < 1) {
    return ret;
  }
  if (strncasecmp(info[0], "MINI6410", 8) == 0) {
    ret = (6410);
  } else if (strncasecmp(info[0], "MINI210", 7) == 0) {
    ret = (210);
  } else if (strncasecmp(info[0], "TINY4412", 8) == 0) {
    ret = (4412);
  } else if (strncasecmp(info[0], "sun8i", 5) == 0) {
    ret = (68330);
  } else if (strncasecmp(info[0], "NANOPI2", 7) == 0) {
    if (strncasecmp(info[1], "0000", 4) == 0) {
      ret = (44180);
    } else if (strncasecmp(info[1], "0004", 4) == 0) {
      ret = (44184);
    } else if (strncasecmp(info[1], "0005", 4) == 0) {
      ret = (44185);
    } else if (strncasecmp(info[1], "0001", 4) == 0) {
      ret = (44181);
    }
  } else if (strncasecmp(info[0], "NANOPI3", 7) == 0) {
    if (strncasecmp(info[1], "0007", 4) == 0) {
      ret = (68187);
    } else if (strncasecmp(info[1], "0001", 4) == 0) {
      ret = (68181);
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<getBoardType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    $0x0,%al
call   1030 <clearLastError@plt>
movl   $0xffffffff,-0x8(%rbp)
lea    -0x50(%rbp),%rsi
mov    $0x2,%edi
call   1050 <getBoardInfo@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x1,-0x54(%rbp)
jge    116c <getBoardType+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13a3 <getBoardType+0x273>
lea    -0x50(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0x8,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1197 <getBoardType+0x67>
movl   $0x190a,-0x8(%rbp)
jmp    139d <getBoardType+0x26d>
lea    -0x50(%rbp),%rdi
lea    0xe67(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    11c2 <getBoardType+0x92>
movl   $0xd2,-0x8(%rbp)
jmp    1398 <getBoardType+0x268>
lea    -0x50(%rbp),%rdi
lea    0xe44(%rip),%rsi
mov    $0x8,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    11ed <getBoardType+0xbd>
movl   $0x113c,-0x8(%rbp)
jmp    1393 <getBoardType+0x263>
lea    -0x50(%rbp),%rdi
lea    0xe22(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1218 <getBoardType+0xe8>
movl   $0x10aea,-0x8(%rbp)
jmp    138e <getBoardType+0x25e>
lea    -0x50(%rbp),%rdi
lea    0xdfd(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1302 <getBoardType+0x1d2>
lea    -0x50(%rbp),%rdi
add    $0x20,%rdi
lea    0xde2(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1266 <getBoardType+0x136>
movl   $0xac94,-0x8(%rbp)
jmp    12fd <getBoardType+0x1cd>
lea    -0x50(%rbp),%rdi
add    $0x20,%rdi
lea    0xdb8(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1295 <getBoardType+0x165>
movl   $0xac98,-0x8(%rbp)
jmp    12f8 <getBoardType+0x1c8>
lea    -0x50(%rbp),%rdi
add    $0x20,%rdi
lea    0xd8e(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    12c4 <getBoardType+0x194>
movl   $0xac99,-0x8(%rbp)
jmp    12f3 <getBoardType+0x1c3>
lea    -0x50(%rbp),%rdi
add    $0x20,%rdi
lea    0xd64(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    12ee <getBoardType+0x1be>
movl   $0xac95,-0x8(%rbp)
jmp    12f3 <getBoardType+0x1c3>
jmp    12f8 <getBoardType+0x1c8>
jmp    12fd <getBoardType+0x1cd>
jmp    1389 <getBoardType+0x259>
lea    -0x50(%rbp),%rdi
lea    0xd2f(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1384 <getBoardType+0x254>
lea    -0x50(%rbp),%rdi
add    $0x20,%rdi
lea    0xd14(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1350 <getBoardType+0x220>
movl   $0x10a5b,-0x8(%rbp)
jmp    137f <getBoardType+0x24f>
lea    -0x50(%rbp),%rdi
add    $0x20,%rdi
lea    0xcd8(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    137a <getBoardType+0x24a>
movl   $0x10a55,-0x8(%rbp)
jmp    137f <getBoardType+0x24f>
jmp    1384 <getBoardType+0x254>
jmp    1389 <getBoardType+0x259>
jmp    138e <getBoardType+0x25e>
jmp    1393 <getBoardType+0x263>
jmp    1398 <getBoardType+0x268>
jmp    139d <getBoardType+0x26d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBoardType>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
xor    %eax,%eax
call   1030 <clearLastError@plt>
mov    %rsp,%rsi
mov    $0x2,%edi
call   1050 <getBoardInfo@plt>
mov    $0xffffffff,%ebx
test   %eax,%eax
jle    12df <getBoardType+0x1af>
lea    0xea2(%rip),%rsi
mov    %rsp,%rdi
mov    $0x8,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     1232 <getBoardType+0x102>
lea    0xe8e(%rip),%rsi
mov    %rsp,%rdi
mov    $0x7,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     123c <getBoardType+0x10c>
lea    0xe79(%rip),%rsi
mov    %rsp,%rdi
mov    $0x8,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     1246 <getBoardType+0x116>
lea    0xe65(%rip),%rsi
mov    %rsp,%rdi
mov    $0x5,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     1250 <getBoardType+0x120>
lea    0xe4e(%rip),%rsi
mov    %rsp,%rdi
mov    $0x7,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     125a <getBoardType+0x12a>
lea    0xe51(%rip),%rsi
mov    %rsp,%rdi
mov    $0x7,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
jne    12df <getBoardType+0x1af>
lea    0x20(%rsp),%rbx
lea    0xe37(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
mov    $0x10a55,%ebp
test   %rax,%rax
jne    12af <getBoardType+0x17f>
mov    $0x10a5b,%ebx
jmp    12df <getBoardType+0x1af>
mov    $0x190a,%ebx
jmp    12df <getBoardType+0x1af>
mov    $0xd2,%ebx
jmp    12df <getBoardType+0x1af>
mov    $0x113c,%ebx
jmp    12df <getBoardType+0x1af>
mov    $0x10aea,%ebx
jmp    12df <getBoardType+0x1af>
lea    0x20(%rsp),%rbx
lea    0xdc2(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     12cc <getBoardType+0x19c>
lea    0xdae(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     12d3 <getBoardType+0x1a3>
lea    0xd9a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
mov    $0xac95,%ebp
test   %rax,%rax
je     12da <getBoardType+0x1aa>
lea    0xd81(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncasecmp@plt>
neg    %rax
sbb    %ebx,%ebx
or     %ebp,%ebx
jmp    12df <getBoardType+0x1af>
mov    $0xac94,%ebx
jmp    12df <getBoardType+0x1af>
mov    $0xac98,%ebx
jmp    12df <getBoardType+0x1af>
mov    $0xac99,%ebx
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"MINI6410\00"
@.str.1 = [8 x i8] c"MINI210\00"
@.str.2 = [9 x i8] c"TINY4412\00"
@.str.3 = [6 x i8] c"sun8i\00"
@.str.4 = [8 x i8] c"NANOPI2\00"
@.str.5 = [5 x i8] c"0000\00"
@.str.6 = [5 x i8] c"0004\00"
@.str.7 = [5 x i8] c"0005\00"
@.str.8 = [5 x i8] c"0001\00"
@.str.9 = [8 x i8] c"NANOPI3\00"
@.str.10 = [5 x i8] c"0007\00"
define i32 @getBoardType() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x [32 x i8]]
%4 = alloca i32
%5 = call i32 (...) @clearLastError()
store i32 -1, i32* %2
%6 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 0
%7 = bitcast [32 x i8]* %6 to i8**
%8 = call i32 @getBoardInfo(i32 2, i8** %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = load i32, i32* %2
store i32 %12, i32* %1
br label %96
13: ; preds = %0
%14 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 0
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%16 = call i64 @strncasecmp(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 6410, i32* %2
br label %94
19: ; preds = %13
%20 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 0
%21 = getelementptr inbounds [32 x i8], [32 x i8]* %20, i64 0, i64 0
%22 = call i64 @strncasecmp(i8* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 210, i32* %2
br label %93
25: ; preds = %19
%26 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 0
%27 = getelementptr inbounds [32 x i8], [32 x i8]* %26, i64 0, i64 0
%28 = call i64 @strncasecmp(i8* %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 4412, i32* %2
br label %92
31: ; preds = %25
%32 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 0
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %32, i64 0, i64 0
%34 = call i64 @strncasecmp(i8* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %31
store i32 68330, i32* %2
br label %91
37: ; preds = %31
%38 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 0
%39 = getelementptr inbounds [32 x i8], [32 x i8]* %38, i64 0, i64 0
%40 = call i64 @strncasecmp(i8* %39, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 7)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %70
42: ; preds = %37
%43 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 1
%44 = getelementptr inbounds [32 x i8], [32 x i8]* %43, i64 0, i64 0
%45 = call i64 @strncasecmp(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %42
store i32 44180, i32* %2
br label %69
48: ; preds = %42
%49 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 1
%50 = getelementptr inbounds [32 x i8], [32 x i8]* %49, i64 0, i64 0
%51 = call i64 @strncasecmp(i8* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %48
store i32 44184, i32* %2
br label %68
54: ; preds = %48
%55 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 1
%56 = getelementptr inbounds [32 x i8], [32 x i8]* %55, i64 0, i64 0
%57 = call i64 @strncasecmp(i8* %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %54
store i32 44185, i32* %2
br label %67
60: ; preds = %54
%61 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 1
%62 = getelementptr inbounds [32 x i8], [32 x i8]* %61, i64 0, i64 0
%63 = call i64 @strncasecmp(i8* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %60
store i32 44181, i32* %2
br label %66
66: ; preds = %65, %60
br label %67
67: ; preds = %66, %59
br label %68
68: ; preds = %67, %53
br label %69
69: ; preds = %68, %47
br label %90
70: ; preds = %37
%71 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 0
%72 = getelementptr inbounds [32 x i8], [32 x i8]* %71, i64 0, i64 0
%73 = call i64 @strncasecmp(i8* %72, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 7)
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %89
75: ; preds = %70
%76 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 1
%77 = getelementptr inbounds [32 x i8], [32 x i8]* %76, i64 0, i64 0
%78 = call i64 @strncasecmp(i8* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %81
80: ; preds = %75
store i32 68187, i32* %2
br label %88
81: ; preds = %75
%82 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %3, i64 0, i64 1
%83 = getelementptr inbounds [32 x i8], [32 x i8]* %82, i64 0, i64 0
%84 = call i64 @strncasecmp(i8* %83, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %87
86: ; preds = %81
store i32 68181, i32* %2
br label %87
87: ; preds = %86, %81
br label %88
88: ; preds = %87, %80
br label %89
89: ; preds = %88, %70
br label %90
90: ; preds = %89, %69
br label %91
91: ; preds = %90, %36
br label %92
92: ; preds = %91, %30
br label %93
93: ; preds = %92, %24
br label %94
94: ; preds = %93, %18
%95 = load i32, i32* %2
store i32 %95, i32* %1
br label %96
96: ; preds = %94, %11
%97 = load i32, i32* %1
ret i32 %97
}

LLVM IR (-O2):
@.str = [9 x i8] c"MINI6410\00"
@.str.1 = [8 x i8] c"MINI210\00"
@.str.2 = [9 x i8] c"TINY4412\00"
@.str.3 = [6 x i8] c"sun8i\00"
@.str.4 = [8 x i8] c"NANOPI2\00"
@.str.5 = [5 x i8] c"0000\00"
@.str.6 = [5 x i8] c"0004\00"
@.str.7 = [5 x i8] c"0005\00"
@.str.8 = [5 x i8] c"0001\00"
@.str.9 = [8 x i8] c"NANOPI3\00"
@.str.10 = [5 x i8] c"0007\00"
define i32 @getBoardType() {
%1 = alloca [2 x [32 x i8]]
%2 = tail call i32 (...) @clearLastError()
%3 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %1, i64 0, i64 0, i64 0
%4 = bitcast [2 x [32 x i8]]* %1 to i8**
%5 = call i32 @getBoardInfo(i32 2, i8** %4)
%6 = icmp slt i32 %5, 1
br i1 %6, label %45, label %7
7: ; preds = %0
%8 = call i64 @strncasecmp(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%9 = icmp eq i64 %8, 0
br i1 %9, label %45, label %10
10: ; preds = %7
%11 = call i64 @strncasecmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %45, label %13
13: ; preds = %10
%14 = call i64 @strncasecmp(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%15 = icmp eq i64 %14, 0
br i1 %15, label %45, label %16
16: ; preds = %13
%17 = call i64 @strncasecmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%18 = icmp eq i64 %17, 0
br i1 %18, label %45, label %19
19: ; preds = %16
%20 = call i64 @strncasecmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 7)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %1, i64 0, i64 1, i64 0
%24 = call i64 @strncasecmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%25 = icmp eq i64 %24, 0
br i1 %25, label %45, label %26
26: ; preds = %22
%27 = call i64 @strncasecmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%28 = icmp eq i64 %27, 0
br i1 %28, label %45, label %29
29: ; preds = %26
%30 = call i64 @strncasecmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%31 = icmp eq i64 %30, 0
br i1 %31, label %45, label %39
32: ; preds = %19
%33 = call i64 @strncasecmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 7)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %45
35: ; preds = %32
%36 = getelementptr inbounds [2 x [32 x i8]], [2 x [32 x i8]]* %1, i64 0, i64 1, i64 0
%37 = call i64 @strncasecmp(i8* %36, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%38 = icmp eq i64 %37, 0
br i1 %38, label %45, label %39
39: ; preds = %35, %29
%40 = phi i8* [ %23, %29 ], [ %36, %35 ]
%41 = phi i32 [ 44181, %29 ], [ 68181, %35 ]
%42 = call i64 @strncasecmp(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%43 = icmp eq i64 %42, 0
%44 = select i1 %43, i32 %41, i32 -1
br label %45
45: ; preds = %39, %32, %7, %10, %13, %16, %22, %26, %29, %35, %0
%46 = phi i32 [ -1, %0 ], [ -1, %32 ], [ 6410, %7 ], [ 210, %10 ], [ 4412, %13 ], [ 68330, %16 ], [ 44180, %22 ], [ 44184, %26 ], [ 44185, %29 ], [ 68187, %35 ], [ %44, %39 ]
ret i32 %46
}