#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 stat {
  long st_mtime;
  int /*<<< orphan*/ st_ino;
};
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ clean_string(char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ join_strings(char **, int, char *, char *, ...);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/, ...);
int /*<<< orphan*/ sqlite3_exec(int /*<<< orphan*/ *, char *,
                                int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                char **);
int /*<<< orphan*/ sqlite3_free(char *);
int /*<<< orphan*/ sqlite3_get_table(int /*<<< orphan*/ *, char *, char ***,
                                     int *, int *, char **);
int /*<<< orphan*/ sscanf(char *, char *, long *);
int exists_in_db(sqlite3 **db, char *path, char *latest_backup_root,
                 struct stat stats, char **old_path) {
  char *error;
  char *query;
  char *values;
  char *where;
  char **dati;
  char *inode_str;
  int row_number, col_number;
  long old_mtime;
  values = (char *)malloc(5000 * sizeof(char));
  where = (char *)malloc(500 * sizeof(char));
  inode_str = (char *)malloc(50 * sizeof(char));
  sprintf(inode_str, "%ld", stats.st_ino);
  clean_string(&path);
  join_strings(&query, 3, "SELECT path, mtime FROM file WHERE inode='",
               inode_str, "'");
  sqlite3_get_table(*db, query, &dati, &row_number, &col_number, &error);
  if (error != NULL) {
    printf("SQLite SELECT error: %s\n", error);
    sqlite3_free(error);
    exit(-1);
  }
  free(query);
  if (row_number == 0) {
    sprintf(values, "'%ld', '%s', '%ld'", stats.st_ino, path, stats.st_mtime);
    join_strings(&query, 3, "INSERT INTO file (inode, path, mtime) VALUES (",
                 values, ")");
    free(values);
    sqlite3_exec(*db, query, NULL, NULL, &error);
    if (error != NULL) {
      printf("SQLite INSERT error:\n%s\n%s\n", query, error);
      sqlite3_free(error);
      free(query);
      exit(-1);
    }
    free(query);
    return !1;
  } else {
    sscanf(dati[3], "%ld", &old_mtime);
    join_strings(old_path, 2, latest_backup_root, dati[2]);
    join_strings(&query, 5, "UPDATE file SET path = '", path,
                 "' WHERE inode = '", inode_str, "'");
    sqlite3_exec(*db, query, NULL, NULL, &error);
    free(query);
    if (error != NULL) {
      printf("SQLite UPDATE error: %s\n", error);
      sqlite3_free(error);
      exit(-1);
    }
    if (stats.st_mtime == old_mtime)
      return 1;
    else
      return !1;
  }
}


x86 assembly (clang, -O0):
<exists_in_db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x10(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    $0x1388,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    $0x1f4,%edi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    $0x32,%edi
call   1080 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xdf5(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x28(%rbp),%rdi
call   1060 <clean_string@plt>
mov    -0x68(%rbp),%rcx
lea    -0x48(%rbp),%rdi
mov    $0x3,%esi
lea    0xdd5(%rip),%rdx
lea    0xe9b(%rip),%r8
mov    $0x0,%al
call   10a0 <join_strings@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    -0x6c(%rbp),%rcx
lea    -0x70(%rbp),%r8
lea    -0x40(%rbp),%r9
call   1070 <sqlite3_get_table@plt>
cmpq   $0x0,-0x40(%rbp)
je     128d <exists_in_db+0xdd>
mov    -0x40(%rbp),%rsi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <sqlite3_free@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x6c(%rbp)
jne    1355 <exists_in_db+0x1a5>
mov    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xd92(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x50(%rbp),%rcx
lea    -0x48(%rbp),%rdi
mov    $0x3,%esi
lea    0xd8a(%rip),%rdx
lea    0xdb2(%rip),%r8
mov    $0x0,%al
call   10a0 <join_strings@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x40(%rbp),%r8
mov    %rcx,%rdx
call   1040 <sqlite3_exec@plt>
cmpq   $0x0,-0x40(%rbp)
je     1340 <exists_in_db+0x190>
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <sqlite3_free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    142f <exists_in_db+0x27f>
mov    -0x60(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xc9c(%rip),%rsi
lea    -0x78(%rbp),%rdx
call   1090 <sscanf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x60(%rbp),%rax
mov    0x10(%rax),%rcx
mov    $0x2,%esi
mov    $0x0,%al
call   10a0 <join_strings@plt>
mov    -0x28(%rbp),%rcx
mov    -0x68(%rbp),%r9
lea    -0x48(%rbp),%rdi
mov    $0x5,%esi
lea    0xd07(%rip),%rdx
lea    0xd19(%rip),%r8
lea    0xd22(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   10a0 <join_strings@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x40(%rbp),%r8
mov    %rcx,%rdx
call   1040 <sqlite3_exec@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x40(%rbp)
je     140e <exists_in_db+0x25e>
mov    -0x40(%rbp),%rsi
lea    0xcdf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <sqlite3_free@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
mov    -0x18(%rbp),%rax
cmp    -0x78(%rbp),%rax
jne    1428 <exists_in_db+0x278>
movl   $0x1,-0x4(%rbp)
jmp    142f <exists_in_db+0x27f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exists_in_db>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x40(%rsp)
mov    %r8d,%r14d
mov    %rcx,0x30(%rsp)
mov    %rdx,%r12
mov    %rdi,%r13
mov    %rsi,0x20(%rsp)
mov    $0x1388,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    $0x1f4,%edi
call   1080 <malloc@plt>
mov    $0x32,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
lea    0xdff(%rip),%rsi
mov    %rax,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   10c0 <sprintf@plt>
lea    0x20(%rsp),%rdi
call   1060 <clean_string@plt>
lea    0xde5(%rip),%rdx
lea    0xeab(%rip),%r15
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
mov    %rbp,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   10a0 <join_strings@plt>
mov    0x0(%r13),%rdi
mov    0x10(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x2c(%rsp),%rcx
lea    0x54(%rsp),%r8
lea    0x18(%rsp),%r9
call   1070 <sqlite3_get_table@plt>
mov    0x18(%rsp),%rsi
test   %rsi,%rsi
jne    13ae <exists_in_db+0x1fe>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
cmpl   $0x0,0x2c(%rsp)
je     1325 <exists_in_db+0x175>
mov    0x38(%rsp),%rax
mov    0x18(%rax),%rdi
lea    0xd6e(%rip),%rsi
lea    0x48(%rsp),%rdx
call   1090 <sscanf@plt>
mov    0x38(%rsp),%rax
mov    0x10(%rax),%rcx
mov    0x40(%rsp),%rdi
mov    $0x2,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   10a0 <join_strings@plt>
mov    0x20(%rsp),%rcx
mov    %r15,(%rsp)
lea    0xddf(%rip),%rdx
lea    0xdf1(%rip),%r8
lea    0x10(%rsp),%rdi
mov    $0x5,%esi
mov    %rbp,%r9
xor    %eax,%eax
call   10a0 <join_strings@plt>
mov    0x0(%r13),%rdi
mov    0x10(%rsp),%rsi
lea    0x18(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <sqlite3_exec@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rsi
test   %rsi,%rsi
jne    13b7 <exists_in_db+0x207>
xor    %ebp,%ebp
mov    0x30(%rsp),%rax
cmp    %rax,0x48(%rsp)
sete   %bpl
jmp    139d <exists_in_db+0x1ed>
mov    0x20(%rsp),%rcx
lea    0xd17(%rip),%rsi
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    %r14d,%edx
mov    0x30(%rsp),%r8
xor    %eax,%eax
call   10c0 <sprintf@plt>
lea    0xd0f(%rip),%rdx
lea    0xd37(%rip),%r8
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   10a0 <join_strings@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x0(%r13),%rdi
mov    0x10(%rsp),%rsi
lea    0x18(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <sqlite3_exec@plt>
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rsi
test   %rdx,%rdx
jne    13d9 <exists_in_db+0x229>
mov    %rsi,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc7a(%rip),%rdi
jmp    13be <exists_in_db+0x20e>
lea    0xd15(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%rdi
call   10b0 <sqlite3_free@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
lea    0xcac(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%rdi
call   10b0 <sqlite3_free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i64, i32 }
@.str = [4 x i8] c"%ld\00"
@.str.1 = [43 x i8] c"SELECT path, mtime FROM file WHERE inode='\00"
@.str.2 = [2 x i8] c"'\00"
@.str.3 = [25 x i8] c"SQLite SELECT error: %s\0A\00"
@.str.4 = [19 x i8] c"'%ld', '%s', '%ld'\00"
@.str.5 = [47 x i8] c"INSERT INTO file (inode, path, mtime) VALUES (\00"
@.str.6 = [2 x i8] c")\00"
@.str.7 = [28 x i8] c"SQLite INSERT error:\0A%s\0A%s\0A\00"
@.str.8 = [25 x i8] c"UPDATE file SET path = '\00"
@.str.9 = [18 x i8] c"' WHERE inode = '\00"
@.str.10 = [25 x i8] c"SQLite UPDATE error: %s\0A\00"
define i32 @exists_in_db(i32** %0, i8* %1, i8* %2, i64 %3, i32 %4, i8** %5) {
%7 = alloca i32
%8 = alloca %struct.stat
%9 = alloca i32**
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8**
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8**
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i64
%22 = bitcast %struct.stat* %8 to { i64, i32 }*
%23 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %22, i32 0, i32 0
store i64 %3, i64* %23
%24 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %22, i32 0, i32 1
store i32 %4, i32* %24
store i32** %0, i32*** %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i8** %5, i8*** %12
%25 = call i64 @malloc(i32 5000)
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %15
%27 = call i64 @malloc(i32 500)
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %16
%29 = call i64 @malloc(i32 50)
%30 = inttoptr i64 %29 to i8*
store i8* %30, i8** %18
%31 = load i8*, i8** %18
%32 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%33 = load i32, i32* %32
%34 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = call i32 @clean_string(i8** %10)
%36 = load i8*, i8** %18
%37 = call i32 (i8**, i32, i8*, i8*, ...) @join_strings(i8** %14, i32 3, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32**, i32*** %9
%39 = load i32*, i32** %38
%40 = load i8*, i8** %14
%41 = call i32 @sqlite3_get_table(i32* %39, i8* %40, i8*** %17, i32* %19, i32* %20, i8** %13)
%42 = load i8*, i8** %13
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %50
44: ; preds = %6
%45 = load i8*, i8** %13
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %45)
%47 = load i8*, i8** %13
%48 = call i32 @sqlite3_free(i8* %47)
%49 = call i32 @exit(i32 -1)
unreachable
50: ; preds = %6
%51 = load i8*, i8** %14
%52 = call i32 @free(i8* %51)
%53 = load i32, i32* %19
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %85
55: ; preds = %50
%56 = load i8*, i8** %15
%57 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%58 = load i32, i32* %57
%59 = load i8*, i8** %10
%60 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%61 = load i64, i64* %60
%62 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %56, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %58, i8* %59, i64 %61)
%63 = load i8*, i8** %15
%64 = call i32 (i8**, i32, i8*, i8*, ...) @join_strings(i8** %14, i32 3, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%65 = load i8*, i8** %15
%66 = call i32 @free(i8* %65)
%67 = load i32**, i32*** %9
%68 = load i32*, i32** %67
%69 = load i8*, i8** %14
%70 = call i32 @sqlite3_exec(i32* %68, i8* %69, i32* null, i32* null, i8** %13)
%71 = load i8*, i8** %13
%72 = icmp ne i8* %71, null
br i1 %72, label %73, label %82
73: ; preds = %55
%74 = load i8*, i8** %14
%75 = load i8*, i8** %13
%76 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %74, i8* %75)
%77 = load i8*, i8** %13
%78 = call i32 @sqlite3_free(i8* %77)
%79 = load i8*, i8** %14
%80 = call i32 @free(i8* %79)
%81 = call i32 @exit(i32 -1)
unreachable
82: ; preds = %55
%83 = load i8*, i8** %14
%84 = call i32 @free(i8* %83)
store i32 0, i32* %7
br label %120
85: ; preds = %50
%86 = load i8**, i8*** %17
%87 = getelementptr inbounds i8*, i8** %86, i64 3
%88 = load i8*, i8** %87
%89 = call i32 @sscanf(i8* %88, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %21)
%90 = load i8**, i8*** %12
%91 = load i8*, i8** %11
%92 = load i8**, i8*** %17
%93 = getelementptr inbounds i8*, i8** %92, i64 2
%94 = load i8*, i8** %93
%95 = call i32 (i8**, i32, i8*, i8*, ...) @join_strings(i8** %90, i32 2, i8* %91, i8* %94)
%96 = load i8*, i8** %10
%97 = load i8*, i8** %18
%98 = call i32 (i8**, i32, i8*, i8*, ...) @join_strings(i8** %14, i32 5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %96, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %97, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%99 = load i32**, i32*** %9
%100 = load i32*, i32** %99
%101 = load i8*, i8** %14
%102 = call i32 @sqlite3_exec(i32* %100, i8* %101, i32* null, i32* null, i8** %13)
%103 = load i8*, i8** %14
%104 = call i32 @free(i8* %103)
%105 = load i8*, i8** %13
%106 = icmp ne i8* %105, null
br i1 %106, label %107, label %113
107: ; preds = %85
%108 = load i8*, i8** %13
%109 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8* %108)
%110 = load i8*, i8** %13
%111 = call i32 @sqlite3_free(i8* %110)
%112 = call i32 @exit(i32 -1)
unreachable
113: ; preds = %85
%114 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%115 = load i64, i64* %114
%116 = load i64, i64* %21
%117 = icmp eq i64 %115, %116
br i1 %117, label %118, label %119
118: ; preds = %113
store i32 1, i32* %7
br label %120
119: ; preds = %113
store i32 0, i32* %7
br label %120
120: ; preds = %119, %118, %82
%121 = load i32, i32* %7
ret i32 %121
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [43 x i8] c"SELECT path, mtime FROM file WHERE inode='\00"
@.str.2 = [2 x i8] c"'\00"
@.str.3 = [25 x i8] c"SQLite SELECT error: %s\0A\00"
@.str.4 = [19 x i8] c"'%ld', '%s', '%ld'\00"
@.str.5 = [47 x i8] c"INSERT INTO file (inode, path, mtime) VALUES (\00"
@.str.6 = [2 x i8] c")\00"
@.str.7 = [28 x i8] c"SQLite INSERT error:\0A%s\0A%s\0A\00"
@.str.8 = [25 x i8] c"UPDATE file SET path = '\00"
@.str.9 = [18 x i8] c"' WHERE inode = '\00"
@.str.10 = [25 x i8] c"SQLite UPDATE error: %s\0A\00"
define i32 @exists_in_db(i32** nocapture %0, i8* %1, i8* %2, i64 %3, i32 %4, i8** %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8**
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
store i8* %1, i8** %7
%14 = bitcast i8** %8 to i8*
%15 = bitcast i8** %9 to i8*
%16 = bitcast i8*** %10 to i8*
%17 = bitcast i32* %11 to i8*
%18 = bitcast i32* %12 to i8*
%19 = bitcast i64* %13 to i8*
%20 = tail call i64 @malloc(i32 5000)
%21 = inttoptr i64 %20 to i8*
%22 = tail call i64 @malloc(i32 500)
%23 = tail call i64 @malloc(i32 50)
%24 = inttoptr i64 %23 to i8*
%25 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %24, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%26 = call i32 @clean_string(i8** %7)
%27 = call i32 (i8**, i32, i8*, i8*, ...) @join_strings(i8** %9, i32 3, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32*, i32** %0
%29 = load i8*, i8** %9
%30 = call i32 @sqlite3_get_table(i32* %28, i8* %29, i8*** %10, i32* %11, i32* %12, i8** %8)
%31 = load i8*, i8** %8
%32 = icmp eq i8* %31, null
br i1 %32, label %38, label %33
33: ; preds = %6
%34 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %31)
%35 = load i8*, i8** %8
%36 = call i32 @sqlite3_free(i8* %35)
%37 = call i32 @exit(i32 -1)
unreachable
38: ; preds = %6
%39 = load i8*, i8** %9
%40 = call i32 @free(i8* %39)
%41 = load i32, i32* %11
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %63
43: ; preds = %38
%44 = load i8*, i8** %7
%45 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %21, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %4, i8* %44, i64 %3)
%46 = call i32 (i8**, i32, i8*, i8*, ...) @join_strings(i8** %9, i32 3, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%47 = call i32 @free(i8* %21)
%48 = load i32*, i32** %0
%49 = load i8*, i8** %9
%50 = call i32 @sqlite3_exec(i32* %48, i8* %49, i32* null, i32* null, i8** %8)
%51 = load i8*, i8** %8
%52 = icmp eq i8* %51, null
%53 = load i8*, i8** %9
br i1 %52, label %61, label %54
54: ; preds = %43
%55 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %53, i8* %51)
%56 = load i8*, i8** %8
%57 = call i32 @sqlite3_free(i8* %56)
%58 = load i8*, i8** %9
%59 = call i32 @free(i8* %58)
%60 = call i32 @exit(i32 -1)
unreachable
61: ; preds = %43
%62 = call i32 @free(i8* %53)
br label %90
63: ; preds = %38
%64 = load i8**, i8*** %10
%65 = getelementptr inbounds i8*, i8** %64, i64 3
%66 = load i8*, i8** %65
%67 = call i32 @sscanf(i8* %66, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %13)
%68 = load i8**, i8*** %10
%69 = getelementptr inbounds i8*, i8** %68, i64 2
%70 = load i8*, i8** %69
%71 = call i32 (i8**, i32, i8*, i8*, ...) @join_strings(i8** %5, i32 2, i8* %2, i8* %70)
%72 = load i8*, i8** %7
%73 = call i32 (i8**, i32, i8*, i8*, ...) @join_strings(i8** %9, i32 5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %72, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%74 = load i32*, i32** %0
%75 = load i8*, i8** %9
%76 = call i32 @sqlite3_exec(i32* %74, i8* %75, i32* null, i32* null, i8** %8)
%77 = load i8*, i8** %9
%78 = call i32 @free(i8* %77)
%79 = load i8*, i8** %8
%80 = icmp eq i8* %79, null
br i1 %80, label %86, label %81
81: ; preds = %63
%82 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8* %79)
%83 = load i8*, i8** %8
%84 = call i32 @sqlite3_free(i8* %83)
%85 = call i32 @exit(i32 -1)
unreachable
86: ; preds = %63
%87 = load i64, i64* %13
%88 = icmp eq i64 %87, %3
%89 = zext i1 %88 to i32
br label %90
90: ; preds = %86, %61
%91 = phi i32 [ 0, %61 ], [ %89, %86 ]
ret i32 %91
}