int nvram_get_system_mode(int *opmode) {
  char buf[32] = {0};
  ezplib_get_attr_val("system_mode", 0, "name", buf, 32, 0);
  if (!strcmp(buf, "ap")) {
    *opmode = 1;
  } else if (!strcmp(buf, "normal")) {
    *opmode = 0;
  } else if (!strcmp(buf, "ur")) {
    *opmode = 5;
  } else if (!strcmp(buf, "wisp0")) {
    *opmode = 6;
  } else if (!strcmp(buf, "wisp1")) {
    *opmode = 7;
  } else if (!strcmp(buf, "sta0")) {
    *opmode = 8;
  } else if (!strcmp(buf, "sta1")) {
    *opmode = 9;
  } else {
    do {
      printf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/liutianpingyanxiaoyu/cpe/refs/heads/"
             "master/package/liteon-apps/wlan-middleware/src/mid_common_nvram.c"
             ":%u:%s: "
             "Operation mode got from NVRAM is illegal!!!"
             "\n",
             46, __FUNCTION__);
    } while (0);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<nvram_get_system_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
lea    -0x30(%rbp),%rcx
lea    0xfbf(%rip),%rdi
xor    %r9d,%r9d
lea    0xe8f(%rip),%rdx
mov    $0x20,%r8d
mov    %r9d,%esi
mov    $0x0,%al
call   1030 <ezplib_get_attr_val@plt>
lea    -0x30(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11a9 <nvram_get_system_mode+0x69>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    12e2 <nvram_get_system_mode+0x1a2>
lea    -0x30(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11d1 <nvram_get_system_mode+0x91>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    12dd <nvram_get_system_mode+0x19d>
lea    -0x30(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11f9 <nvram_get_system_mode+0xb9>
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
jmp    12d8 <nvram_get_system_mode+0x198>
lea    -0x30(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1221 <nvram_get_system_mode+0xe1>
mov    -0x10(%rbp),%rax
movl   $0x6,(%rax)
jmp    12d3 <nvram_get_system_mode+0x193>
lea    -0x30(%rbp),%rdi
lea    0xdec(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1249 <nvram_get_system_mode+0x109>
mov    -0x10(%rbp),%rax
movl   $0x7,(%rax)
jmp    12ce <nvram_get_system_mode+0x18e>
lea    -0x30(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1271 <nvram_get_system_mode+0x131>
mov    -0x10(%rbp),%rax
movl   $0x8,(%rax)
jmp    12c9 <nvram_get_system_mode+0x189>
lea    -0x30(%rbp),%rdi
lea    0xda7(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1299 <nvram_get_system_mode+0x159>
mov    -0x10(%rbp),%rax
movl   $0x9,(%rax)
jmp    12c4 <nvram_get_system_mode+0x184>
jmp    129e <nvram_get_system_mode+0x15e>
lea    0xd83(%rip),%rdi
mov    $0x2e,%esi
lea    0xe6b(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12e9 <nvram_get_system_mode+0x1a9>
jmp    12c9 <nvram_get_system_mode+0x189>
jmp    12ce <nvram_get_system_mode+0x18e>
jmp    12d3 <nvram_get_system_mode+0x193>
jmp    12d8 <nvram_get_system_mode+0x198>
jmp    12dd <nvram_get_system_mode+0x19d>
jmp    12e2 <nvram_get_system_mode+0x1a2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvram_get_system_mode>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xfea(%rip),%rdi
lea    0xebd(%rip),%rdx
xor    %ebp,%ebp
mov    %rsp,%rcx
xor    %esi,%esi
mov    $0x20,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
call   1030 <ezplib_get_attr_val@plt>
mov    $0x7061,%eax
xor    (%rsp),%eax
movzbl 0x2(%rsp),%ecx
or     %ax,%cx
je     1203 <nvram_get_system_mode+0xe3>
mov    $0x6d726f6e,%eax
xor    (%rsp),%eax
mov    $0x6c616d,%ecx
xor    0x3(%rsp),%ecx
or     %eax,%ecx
je     120b <nvram_get_system_mode+0xeb>
mov    $0x7275,%eax
xor    (%rsp),%eax
movzbl 0x2(%rsp),%ecx
or     %ax,%cx
je     1213 <nvram_get_system_mode+0xf3>
mov    $0x70736977,%eax
mov    (%rsp),%ecx
xor    %eax,%ecx
movzwl 0x4(%rsp),%edx
xor    $0x30,%edx
or     %ecx,%edx
je     121b <nvram_get_system_mode+0xfb>
xor    (%rsp),%eax
movzwl 0x4(%rsp),%ecx
xor    $0x31,%ecx
or     %eax,%ecx
je     1223 <nvram_get_system_mode+0x103>
mov    $0x30617473,%eax
xor    (%rsp),%eax
movzbl 0x4(%rsp),%ecx
or     %eax,%ecx
je     122b <nvram_get_system_mode+0x10b>
mov    $0x31617473,%eax
xor    (%rsp),%eax
movzbl 0x4(%rsp),%ecx
or     %eax,%ecx
je     1233 <nvram_get_system_mode+0x113>
lea    0xe3f(%rip),%rdi
lea    0xf2c(%rip),%rdx
mov    $0x2e,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%ebp
jmp    123b <nvram_get_system_mode+0x11b>
movl   $0x1,(%rbx)
jmp    123b <nvram_get_system_mode+0x11b>
movl   $0x0,(%rbx)
jmp    1239 <nvram_get_system_mode+0x119>
movl   $0x5,(%rbx)
jmp    1239 <nvram_get_system_mode+0x119>
movl   $0x6,(%rbx)
jmp    1239 <nvram_get_system_mode+0x119>
movl   $0x7,(%rbx)
jmp    1239 <nvram_get_system_mode+0x119>
movl   $0x8,(%rbx)
jmp    1239 <nvram_get_system_mode+0x119>
movl   $0x9,(%rbx)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"system_mode\00"
@.str.1 = [5 x i8] c"name\00"
@.str.2 = [3 x i8] c"ap\00"
@.str.3 = [7 x i8] c"normal\00"
@.str.4 = [3 x i8] c"ur\00"
@.str.5 = [6 x i8] c"wisp0\00"
@.str.6 = [6 x i8] c"wisp1\00"
@.str.7 = [5 x i8] c"sta0\00"
@.str.8 = [5 x i8] c"sta1\00"
@.str.9 = [244 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/liutianpingyanxiaoyu/cpe/refs/heads/master/package/liteon-apps/wlan-middleware/src/mid_common_nvram.c:%u:%s: Operation mode got from NVRAM is illegal!!!\0A\00"
@__FUNCTION__.nvram_get_system_mode = [22 x i8] c"nvram_get_system_mode\00"
define i32 @nvram_get_system_mode(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [32 x i8]
store i32* %0, i32** %3
%5 = bitcast [32 x i8]* %4 to i8*
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%7 = call i32 (i8*, i32, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @ezplib_get_attr_val to i32 (i8*, i32, i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32 32, i32 0)
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %1
%12 = load i32*, i32** %3
store i32 1, i32* %12
br label %59
13: ; preds = %1
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = load i32*, i32** %3
store i32 0, i32* %18
br label %58
19: ; preds = %13
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = load i32*, i32** %3
store i32 5, i32* %24
br label %57
25: ; preds = %19
%26 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = load i32*, i32** %3
store i32 6, i32* %30
br label %56
31: ; preds = %25
%32 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = load i32*, i32** %3
store i32 7, i32* %36
br label %55
37: ; preds = %31
%38 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %37
%42 = load i32*, i32** %3
store i32 8, i32* %42
br label %54
43: ; preds = %37
%44 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%45 = call i32 @strcmp(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %43
%48 = load i32*, i32** %3
store i32 9, i32* %48
br label %53
49: ; preds = %43
br label %50
50: ; preds = %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([244 x i8], [244 x i8]* @.str.9, i64 0, i64 0), i32 46, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.nvram_get_system_mode, i64 0, i64 0))
br label %52
52: ; preds = %50
store i32 -1, i32* %2
br label %60
53: ; preds = %47
br label %54
54: ; preds = %53, %41
br label %55
55: ; preds = %54, %35
br label %56
56: ; preds = %55, %29
br label %57
57: ; preds = %56, %23
br label %58
58: ; preds = %57, %17
br label %59
59: ; preds = %58, %11
store i32 0, i32* %2
br label %60
60: ; preds = %59, %52
%61 = load i32, i32* %2
ret i32 %61
}

LLVM IR (-O2):
@.str = [12 x i8] c"system_mode\00"
@.str.1 = [5 x i8] c"name\00"
@.str.2 = [3 x i8] c"ap\00"
@.str.3 = [7 x i8] c"normal\00"
@.str.4 = [3 x i8] c"ur\00"
@.str.5 = [6 x i8] c"wisp0\00"
@.str.6 = [6 x i8] c"wisp1\00"
@.str.7 = [5 x i8] c"sta0\00"
@.str.8 = [5 x i8] c"sta1\00"
@.str.9 = [244 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/liutianpingyanxiaoyu/cpe/refs/heads/master/package/liteon-apps/wlan-middleware/src/mid_common_nvram.c:%u:%s: Operation mode got from NVRAM is illegal!!!\0A\00"
@__FUNCTION__.nvram_get_system_mode = [22 x i8] c"nvram_get_system_mode\00"
define i32 @nvram_get_system_mode(i32* nocapture writeonly %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = call i32 (i8*, i32, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @ezplib_get_attr_val to i32 (i8*, i32, i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 32, i32 0)
%5 = call i32 @bcmp(i8* dereferenceable(3) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %0
br label %34
8: ; preds = %1
%9 = call i32 @bcmp(i8* dereferenceable(7) %3, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 0, i32* %0
br label %34
12: ; preds = %8
%13 = call i32 @bcmp(i8* dereferenceable(3) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 3)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 5, i32* %0
br label %34
16: ; preds = %12
%17 = call i32 @bcmp(i8* dereferenceable(6) %3, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 6)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 6, i32* %0
br label %34
20: ; preds = %16
%21 = call i32 @bcmp(i8* dereferenceable(6) %3, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i64 6)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 7, i32* %0
br label %34
24: ; preds = %20
%25 = call i32 @bcmp(i8* dereferenceable(5) %3, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i64 5)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 8, i32* %0
br label %34
28: ; preds = %24
%29 = call i32 @bcmp(i8* dereferenceable(5) %3, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i64 5)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %28
store i32 9, i32* %0
br label %34
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([244 x i8], [244 x i8]* @.str.9, i64 0, i64 0), i32 46, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.nvram_get_system_mode, i64 0, i64 0))
br label %34
34: ; preds = %7, %15, %23, %31, %27, %19, %11, %32
%35 = phi i32 [ -1, %32 ], [ 0, %11 ], [ 0, %19 ], [ 0, %27 ], [ 0, %31 ], [ 0, %23 ], [ 0, %15 ], [ 0, %7 ]
ret i32 %35
}