#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 */
struct Entry {
  int dummy;
};
typedef int /*<<< orphan*/ stmt;
typedef int /*<<< orphan*/ sqlite3_stmt;
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int SQLITE_DONE;
int SQLITE_OK;
int SQLITE_ROW;
struct Entry *find_entry(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(struct Entry *);
struct Entry *insert_into_list(struct Entry *, struct Entry *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char *, char *, int, char *, int, int,
                           unsigned long long);
int /*<<< orphan*/ sqlite3_close(int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_errmsg(int /*<<< orphan*/ *);
int sqlite3_open(char *, int /*<<< orphan*/ **);
int sqlite3_prepare_v2(int /*<<< orphan*/ *, char *, int, int /*<<< orphan*/ **,
                       char const **);
int sqlite3_step(int /*<<< orphan*/ *);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *,
                          int /*<<< orphan*/);
struct Entry *get_entry_by_number(int country_code, int area_code,
                                  unsigned long long number, int listflag) {
  char *listname = (0x02 == listflag) ? "whitelist" : "blacklist";
  sqlite3 *db;
  char stmt[1024];
  sqlite3_stmt *pp_stmt = 0;
  const char **p_tail = 0;
  int rc;
  struct Entry *p_root = NULL;
  struct Entry *p_entry = NULL;
  rc = sqlite3_open("db/phonefirewall.db", &db);
  if (rc) {
    syslog(LOG_ERR, "[%s] Can't open database: %s", "phone-firewall",
           sqlite3_errmsg(db));
    sqlite3_close(db);
    return NULL;
  }
  sprintf(stmt,
          "SELECT %1$s, %2$s, %3$s, %4$s, %5$s, %6$s FROM %8$s WHERE %2$s like "
          "\'%7$c%9$d%7$c\' AND %3$s like \'%7$c%10$d%7$c\' AND %4$s like "
          "\'%7$c%11$llu%7$c\'",
          "priority", "countrycode", "areacode", "number", "name", "reason", 37,
          listname, country_code, area_code, number);
  rc = sqlite3_prepare_v2(db, stmt, sizeof(stmt), &pp_stmt, p_tail);
  if (rc != SQLITE_OK) {
    syslog(LOG_ERR, "[%s] SQL error: %s", "phone-firewall", sqlite3_errmsg(db));
    sqlite3_close(db);
    return NULL;
  }
  while (rc != SQLITE_DONE) {
    rc = sqlite3_step(pp_stmt);
    if (SQLITE_ROW == rc) {
      if (NULL == (p_entry = find_entry(pp_stmt)))
        break;
      if (NULL == (p_root = insert_into_list(p_root, p_entry)))
        return NULL;
    }
  }
  free(p_entry);
  sqlite3_close(db);
  return p_root;
}


x86 assembly (clang, -O0):
<get_entry_by_number>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x4a8,%rsp
mov    %edi,-0x24(%rbp)
mov    %esi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
mov    -0x34(%rbp),%esi
mov    $0x2,%edx
lea    0xe3e(%rip),%rax
lea    0xe2d(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x458(%rbp)
movq   $0x0,-0x460(%rbp)
movq   $0x0,-0x470(%rbp)
movq   $0x0,-0x478(%rbp)
lea    0xe04(%rip),%rdi
lea    -0x48(%rbp),%rsi
call   1040 <sqlite3_open@plt>
mov    %eax,-0x464(%rbp)
cmpl   $0x0,-0x464(%rbp)
je     1275 <get_entry_by_number+0xd5>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x47c(%rbp)
mov    -0x48(%rbp),%rdi
call   1050 <sqlite3_errmsg@plt>
mov    -0x47c(%rbp),%edi
mov    %eax,%ecx
lea    0xdd5(%rip),%rsi
lea    0xdeb(%rip),%rdx
call   1090 <syslog@plt>
mov    -0x48(%rbp),%rdi
call   1070 <sqlite3_close@plt>
movq   $0x0,-0x20(%rbp)
jmp    1434 <get_entry_by_number+0x294>
lea    -0x450(%rbp),%rdi
mov    -0x40(%rbp),%rbx
mov    -0x24(%rbp),%r11d
mov    -0x28(%rbp),%r10d
mov    -0x30(%rbp),%rax
lea    0xdc1(%rip),%rsi
lea    0xe4b(%rip),%rdx
lea    0xe4d(%rip),%rcx
lea    0xe52(%rip),%r8
lea    0xe54(%rip),%r9
lea    0xe54(%rip),%r15
lea    0xe52(%rip),%r14
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
movl   $0x25,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   10c0 <sprintf@plt>
mov    -0x48(%rbp),%rdi
lea    -0x450(%rbp),%rsi
mov    -0x460(%rbp),%r8
mov    $0x400,%edx
lea    -0x458(%rbp),%rcx
call   10a0 <sqlite3_prepare_v2@plt>
mov    %eax,-0x464(%rbp)
mov    -0x464(%rbp),%eax
mov    0x2ccb(%rip),%rcx
cmp    (%rcx),%eax
je     136e <get_entry_by_number+0x1ce>
mov    0x2c94(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x480(%rbp)
mov    -0x48(%rbp),%rdi
call   1050 <sqlite3_errmsg@plt>
mov    -0x480(%rbp),%edi
mov    %eax,%ecx
lea    0xdca(%rip),%rsi
lea    0xcf2(%rip),%rdx
call   1090 <syslog@plt>
mov    -0x48(%rbp),%rdi
call   1070 <sqlite3_close@plt>
movq   $0x0,-0x20(%rbp)
jmp    1434 <get_entry_by_number+0x294>
jmp    1373 <get_entry_by_number+0x1d3>
mov    -0x464(%rbp),%eax
mov    0x2c58(%rip),%rcx
cmp    (%rcx),%eax
je     1414 <get_entry_by_number+0x274>
mov    -0x458(%rbp),%rdi
call   1060 <sqlite3_step@plt>
mov    %eax,-0x464(%rbp)
mov    0x2c2f(%rip),%rax
mov    (%rax),%eax
cmp    -0x464(%rbp),%eax
jne    140f <get_entry_by_number+0x26f>
mov    -0x458(%rbp),%rdi
call   10b0 <find_entry@plt>
mov    %rax,%rcx
mov    %rcx,-0x478(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    13d5 <get_entry_by_number+0x235>
jmp    1414 <get_entry_by_number+0x274>
mov    -0x470(%rbp),%rdi
mov    -0x478(%rbp),%rsi
call   1080 <insert_into_list@plt>
mov    %rax,%rcx
mov    %rcx,-0x470(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    140a <get_entry_by_number+0x26a>
movq   $0x0,-0x20(%rbp)
jmp    1434 <get_entry_by_number+0x294>
jmp    140f <get_entry_by_number+0x26f>
jmp    1373 <get_entry_by_number+0x1d3>
mov    -0x478(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1070 <sqlite3_close@plt>
mov    -0x470(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4a8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_entry_by_number>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x410,%rsp
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %edi,%r14d
movq   $0x0,0x8(%rsp)
lea    0xe4a(%rip),%rdi
mov    %rsp,%rsi
call   1040 <sqlite3_open@plt>
test   %eax,%eax
je     11f4 <get_entry_by_number+0x54>
mov    0x2de3(%rip),%rax
mov    (%rax),%ebx
mov    (%rsp),%rdi
call   1050 <sqlite3_errmsg@plt>
lea    0xe39(%rip),%rsi
jmp    12b2 <get_entry_by_number+0x112>
cmp    $0x2,%ebp
lea    0xe02(%rip),%rax
lea    0xe05(%rip),%rbp
cmove  %rax,%rbp
sub    $0x8,%rsp
lea    0xefb(%rip),%rax
lea    0xeef(%rip),%r10
lea    0xe32(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xebe(%rip),%rcx
lea    0xec3(%rip),%r8
lea    0xec5(%rip),%r9
lea    0x18(%rsp),%r12
mov    %r12,%rdi
push   %rbx
push   %r15
push   %r14
push   %rbp
push   $0x25
push   %rax
push   %r10
call   10c0 <sprintf@plt>
add    $0x40,%rsp
mov    (%rsp),%rdi
lea    0x8(%rsp),%rcx
mov    %r12,%rsi
mov    $0x400,%edx
xor    %r8d,%r8d
call   10a0 <sqlite3_prepare_v2@plt>
mov    0x2d6e(%rip),%rcx
cmp    (%rcx),%eax
jne    1299 <get_entry_by_number+0xf9>
mov    0x2d53(%rip),%r15
cmp    (%r15),%eax
jne    12e1 <get_entry_by_number+0x141>
xor    %r14d,%r14d
xor    %ebx,%ebx
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    12c5 <get_entry_by_number+0x125>
mov    0x2d20(%rip),%rax
mov    (%rax),%ebx
mov    (%rsp),%rdi
call   1050 <sqlite3_errmsg@plt>
lea    0xe64(%rip),%rsi
lea    0xd8c(%rip),%rdx
mov    %ebx,%edi
mov    %eax,%ecx
call   1090 <syslog@plt>
xor    %r14d,%r14d
mov    (%rsp),%rdi
call   1070 <sqlite3_close@plt>
mov    %r14,%rax
add    $0x410,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ce8(%rip),%r12
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    12f5 <get_entry_by_number+0x155>
nop
cmp    (%r15),%ebp
je     128f <get_entry_by_number+0xef>
mov    0x8(%rsp),%rdi
call   1060 <sqlite3_step@plt>
mov    %eax,%ebp
cmp    %eax,(%r12)
jne    12f0 <get_entry_by_number+0x150>
mov    0x8(%rsp),%rdi
call   10b0 <find_entry@plt>
test   %rax,%rax
je     128d <get_entry_by_number+0xed>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1080 <insert_into_list@plt>
mov    %rax,%r14
test   %rax,%rax
jne    12f0 <get_entry_by_number+0x150>
xor    %r14d,%r14d
jmp    12ce <get_entry_by_number+0x12e>

LLVM IR (-O0):
%struct.Entry = type { i32 }
@.str = [10 x i8] c"whitelist\00"
@.str.1 = [10 x i8] c"blacklist\00"
@.str.2 = [20 x i8] c"db/phonefirewall.db\00"
@LOG_ERR = global i32 0
@.str.3 = [29 x i8] c"[%s] Can't open database: %s\00"
@.str.4 = [15 x i8] c"phone-firewall\00"
@.str.5 = [145 x i8] c"SELECT %1$s, %2$s, %3$s, %4$s, %5$s, %6$s FROM %8$s WHERE %2$s like '%7$c%9$d%7$c' AND %3$s like '%7$c%10$d%7$c' AND %4$s like '%7$c%11$llu%7$c'\00"
@.str.6 = [9 x i8] c"priority\00"
@.str.7 = [12 x i8] c"countrycode\00"
@.str.8 = [9 x i8] c"areacode\00"
@.str.9 = [7 x i8] c"number\00"
@.str.10 = [5 x i8] c"name\00"
@.str.11 = [7 x i8] c"reason\00"
@SQLITE_OK = global i32 0
@.str.12 = [19 x i8] c"[%s] SQL error: %s\00"
@SQLITE_DONE = global i32 0
@SQLITE_ROW = global i32 0
define %struct.Entry* @get_entry_by_number(i32 %0, i32 %1, i64 %2, i32 %3) {
%5 = alloca %struct.Entry*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca [1024 x i8]
%13 = alloca i32*
%14 = alloca i8**
%15 = alloca i32
%16 = alloca %struct.Entry*
%17 = alloca %struct.Entry*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i64 %2, i64* %8
store i32 %3, i32* %9
%18 = load i32, i32* %9
%19 = icmp eq i32 2, %18
%20 = zext i1 %19 to i64
%21 = select i1 %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0)
store i8* %21, i8** %10
store i32* null, i32** %13
store i8** null, i8*** %14
store %struct.Entry* null, %struct.Entry** %16
store %struct.Entry* null, %struct.Entry** %17
%22 = call i32 @sqlite3_open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32** %11)
store i32 %22, i32* %15
%23 = load i32, i32* %15
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %4
%26 = load i32, i32* @LOG_ERR
%27 = load i32*, i32** %11
%28 = call i32 @sqlite3_errmsg(i32* %27)
%29 = call i32 @syslog(i32 %26, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32*, i32** %11
%31 = call i32 @sqlite3_close(i32* %30)
store %struct.Entry* null, %struct.Entry** %5
br label %83
32: ; preds = %4
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%34 = load i8*, i8** %10
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = load i64, i64* %8
%38 = call i32 @sprintf(i8* %33, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 37, i8* %34, i32 %35, i32 %36, i64 %37)
%39 = load i32*, i32** %11
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%41 = load i8**, i8*** %14
%42 = call i32 @sqlite3_prepare_v2(i32* %39, i8* %40, i32 1024, i32** %13, i8** %41)
store i32 %42, i32* %15
%43 = load i32, i32* %15
%44 = load i32, i32* @SQLITE_OK
%45 = icmp ne i32 %43, %44
br i1 %45, label %46, label %53
46: ; preds = %32
%47 = load i32, i32* @LOG_ERR
%48 = load i32*, i32** %11
%49 = call i32 @sqlite3_errmsg(i32* %48)
%50 = call i32 @syslog(i32 %47, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %49)
%51 = load i32*, i32** %11
%52 = call i32 @sqlite3_close(i32* %51)
store %struct.Entry* null, %struct.Entry** %5
br label %83
53: ; preds = %32
br label %54
54: ; preds = %76, %53
%55 = load i32, i32* %15
%56 = load i32, i32* @SQLITE_DONE
%57 = icmp ne i32 %55, %56
br i1 %57, label %58, label %77
58: ; preds = %54
%59 = load i32*, i32** %13
%60 = call i32 @sqlite3_step(i32* %59)
store i32 %60, i32* %15
%61 = load i32, i32* @SQLITE_ROW
%62 = load i32, i32* %15
%63 = icmp eq i32 %61, %62
br i1 %63, label %64, label %76
64: ; preds = %58
%65 = load i32*, i32** %13
%66 = call %struct.Entry* @find_entry(i32* %65)
store %struct.Entry* %66, %struct.Entry** %17
%67 = icmp eq %struct.Entry* null, %66
br i1 %67, label %68, label %69
68: ; preds = %64
br label %77
69: ; preds = %64
%70 = load %struct.Entry*, %struct.Entry** %16
%71 = load %struct.Entry*, %struct.Entry** %17
%72 = call %struct.Entry* @insert_into_list(%struct.Entry* %70, %struct.Entry* %71)
store %struct.Entry* %72, %struct.Entry** %16
%73 = icmp eq %struct.Entry* null, %72
br i1 %73, label %74, label %75
74: ; preds = %69
store %struct.Entry* null, %struct.Entry** %5
br label %83
75: ; preds = %69
br label %76
76: ; preds = %75, %58
br label %54
77: ; preds = %68, %54
%78 = load %struct.Entry*, %struct.Entry** %17
%79 = call i32 @free(%struct.Entry* %78)
%80 = load i32*, i32** %11
%81 = call i32 @sqlite3_close(i32* %80)
%82 = load %struct.Entry*, %struct.Entry** %16
store %struct.Entry* %82, %struct.Entry** %5
br label %83
83: ; preds = %77, %74, %46, %25
%84 = load %struct.Entry*, %struct.Entry** %5
ret %struct.Entry* %84
}

LLVM IR (-O2):
%struct.Entry = type { i32 }
@.str = [10 x i8] c"whitelist\00"
@.str.1 = [10 x i8] c"blacklist\00"
@.str.2 = [20 x i8] c"db/phonefirewall.db\00"
@LOG_ERR = global i32 0
@.str.3 = [29 x i8] c"[%s] Can't open database: %s\00"
@.str.4 = [15 x i8] c"phone-firewall\00"
@.str.5 = [145 x i8] c"SELECT %1$s, %2$s, %3$s, %4$s, %5$s, %6$s FROM %8$s WHERE %2$s like '%7$c%9$d%7$c' AND %3$s like '%7$c%10$d%7$c' AND %4$s like '%7$c%11$llu%7$c'\00"
@.str.6 = [9 x i8] c"priority\00"
@.str.7 = [12 x i8] c"countrycode\00"
@.str.8 = [9 x i8] c"areacode\00"
@.str.9 = [7 x i8] c"number\00"
@.str.10 = [5 x i8] c"name\00"
@.str.11 = [7 x i8] c"reason\00"
@SQLITE_OK = global i32 0
@.str.12 = [19 x i8] c"[%s] SQL error: %s\00"
@SQLITE_DONE = global i32 0
@SQLITE_ROW = global i32 0
define %struct.Entry* @get_entry_by_number(i32 %0, i32 %1, i64 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca [1024 x i8]
%7 = alloca i32*
%8 = bitcast i32** %5 to i8*
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%10 = bitcast i32** %7 to i8*
store i32* null, i32** %7
%11 = call i32 @sqlite3_open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32** %5)
%12 = icmp eq i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %4
%14 = load i32, i32* @LOG_ERR
%15 = load i32*, i32** %5
%16 = call i32 @sqlite3_errmsg(i32* %15)
%17 = call i32 @syslog(i32 %14, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %16)
br label %57
18: ; preds = %4
%19 = icmp eq i32 %3, 2
%20 = select i1 %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0)
%21 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([145 x i8], [145 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 37, i8* %20, i32 %0, i32 %1, i64 %2)
%22 = load i32*, i32** %5
%23 = call i32 @sqlite3_prepare_v2(i32* %22, i8* %9, i32 1024, i32** %7, i8** null)
%24 = load i32, i32* @SQLITE_OK
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %18
%27 = load i32, i32* @SQLITE_DONE
%28 = icmp eq i32 %23, %27
br i1 %28, label %53, label %34
29: ; preds = %18
%30 = load i32, i32* @LOG_ERR
%31 = load i32*, i32** %5
%32 = call i32 @sqlite3_errmsg(i32* %31)
%33 = call i32 @syslog(i32 %30, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %32)
br label %57
34: ; preds = %26, %48
%35 = phi %struct.Entry* [ %50, %48 ], [ null, %26 ]
%36 = phi %struct.Entry* [ %49, %48 ], [ null, %26 ]
%37 = load i32*, i32** %7
%38 = call i32 @sqlite3_step(i32* %37)
%39 = load i32, i32* @SQLITE_ROW
%40 = icmp eq i32 %39, %38
br i1 %40, label %41, label %48
41: ; preds = %34
%42 = load i32*, i32** %7
%43 = call %struct.Entry* @find_entry(i32* %42)
%44 = icmp eq %struct.Entry* %43, null
br i1 %44, label %53, label %45
45: ; preds = %41
%46 = call %struct.Entry* @insert_into_list(%struct.Entry* %36, %struct.Entry* %43)
%47 = icmp eq %struct.Entry* %46, null
br i1 %47, label %61, label %48
48: ; preds = %45, %34
%49 = phi %struct.Entry* [ %46, %45 ], [ %36, %34 ]
%50 = phi %struct.Entry* [ %43, %45 ], [ %35, %34 ]
%51 = load i32, i32* @SQLITE_DONE
%52 = icmp eq i32 %38, %51
br i1 %52, label %53, label %34
53: ; preds = %48, %41, %26
%54 = phi %struct.Entry* [ null, %26 ], [ %36, %41 ], [ %49, %48 ]
%55 = phi %struct.Entry* [ null, %26 ], [ null, %41 ], [ %50, %48 ]
%56 = call i32 @free(%struct.Entry* %55)
br label %57
57: ; preds = %13, %29, %53
%58 = phi %struct.Entry* [ %54, %53 ], [ null, %29 ], [ null, %13 ]
%59 = load i32*, i32** %5
%60 = call i32 @sqlite3_close(i32* %59)
br label %61
61: ; preds = %45, %57
%62 = phi %struct.Entry* [ %58, %57 ], [ null, %45 ]
ret %struct.Entry* %62
}