#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 */
scalar_t__ find_full_match(char const *, size_t, char const **);
size_t strlen2(char const *);
int decompile_single_mode(const char *name) {
  static const char *hexa_entries[] = {"dram_baseaddr",
                                       "dram_zq",
                                       "dram_tpr",
                                       "dram_emr",
                                       "g2d_size",
                                       "rtp_press_threshold",
                                       "rtp_sensitive_level",
                                       "ctp_twi_addr",
                                       "csi_twi_addr",
                                       "csi_twi_addr_b",
                                       "tkey_twi_addr",
                                       "lcd_gamma_tbl_",
                                       "gsensor_twi_addr",
                                       NULL};
  size_t l = strlen2(name);
  if (find_full_match(name, l, hexa_entries))
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<decompile_single_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen2@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0x2ef8(%rip),%rdx
call   1030 <find_full_match@plt>
cmp    $0x0,%rax
je     1163 <decompile_single_mode+0x43>
movl   $0x0,-0x4(%rbp)
jmp    116a <decompile_single_mode+0x4a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decompile_single_mode>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen2@plt>
lea    0x2f10(%rip),%rdx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <find_full_match@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@decompile_single_mode.hexa_entries = internal global [14 x i8*] [i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i32 0, i32 0), i8* null]
@.str = [14 x i8] c"dram_baseaddr\00"
@.str.1 = [8 x i8] c"dram_zq\00"
@.str.2 = [9 x i8] c"dram_tpr\00"
@.str.3 = [9 x i8] c"dram_emr\00"
@.str.4 = [9 x i8] c"g2d_size\00"
@.str.5 = [20 x i8] c"rtp_press_threshold\00"
@.str.6 = [20 x i8] c"rtp_sensitive_level\00"
@.str.7 = [13 x i8] c"ctp_twi_addr\00"
@.str.8 = [13 x i8] c"csi_twi_addr\00"
@.str.9 = [15 x i8] c"csi_twi_addr_b\00"
@.str.10 = [14 x i8] c"tkey_twi_addr\00"
@.str.11 = [15 x i8] c"lcd_gamma_tbl_\00"
@.str.12 = [17 x i8] c"gsensor_twi_addr\00"
define i32 @decompile_single_mode(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen2(i8* %5)
store i64 %6, i64* %4
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i64 @find_full_match(i8* %7, i64 %8, i8** getelementptr inbounds ([14 x i8*], [14 x i8*]* @decompile_single_mode.hexa_entries, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %13
12: ; preds = %1
store i32 -1, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@decompile_single_mode.hexa_entries = internal global [14 x i8*] [i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i32 0, i32 0), i8* null]
@.str = [14 x i8] c"dram_baseaddr\00"
@.str.1 = [8 x i8] c"dram_zq\00"
@.str.2 = [9 x i8] c"dram_tpr\00"
@.str.3 = [9 x i8] c"dram_emr\00"
@.str.4 = [9 x i8] c"g2d_size\00"
@.str.5 = [20 x i8] c"rtp_press_threshold\00"
@.str.6 = [20 x i8] c"rtp_sensitive_level\00"
@.str.7 = [13 x i8] c"ctp_twi_addr\00"
@.str.8 = [13 x i8] c"csi_twi_addr\00"
@.str.9 = [15 x i8] c"csi_twi_addr_b\00"
@.str.10 = [14 x i8] c"tkey_twi_addr\00"
@.str.11 = [15 x i8] c"lcd_gamma_tbl_\00"
@.str.12 = [17 x i8] c"gsensor_twi_addr\00"
define i32 @decompile_single_mode(i8* %0) {
%2 = tail call i64 @strlen2(i8* %0)
%3 = tail call i64 @find_full_match(i8* %0, i64 %2, i8** getelementptr inbounds ([14 x i8*], [14 x i8*]* @decompile_single_mode.hexa_entries, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
%5 = sext i1 %4 to i32
ret i32 %5
}