#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 */
typedef int /*<<< orphan*/ azKeywords;

/* Variables and functions */
int /*<<< orphan*/ isalpha(int);
scalar_t__ isdigit(int);
char *sqlite3_mprintf(char *, ...);
int sqlite3_stricmp(char const *, char const *);
char *safeId(const char *zId) {
  static const char *azKeywords[] = {
      "ABORT",        "ACTION",       "ADD",
      "AFTER",        "ALL",          "ALTER",
      "ANALYZE",      "AND",          "AS",
      "ASC",          "ATTACH",       "AUTOINCREMENT",
      "BEFORE",       "BEGIN",        "BETWEEN",
      "BY",           "CASCADE",      "CASE",
      "CAST",         "CHECK",        "COLLATE",
      "COLUMN",       "COMMIT",       "CONFLICT",
      "CONSTRAINT",   "CREATE",       "CROSS",
      "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
      "DATABASE",     "DEFAULT",      "DEFERRABLE",
      "DEFERRED",     "DELETE",       "DESC",
      "DETACH",       "DISTINCT",     "DROP",
      "EACH",         "ELSE",         "END",
      "ESCAPE",       "EXCEPT",       "EXCLUSIVE",
      "EXISTS",       "EXPLAIN",      "FAIL",
      "FOR",          "FOREIGN",      "FROM",
      "FULL",         "GLOB",         "GROUP",
      "HAVING",       "IF",           "IGNORE",
      "IMMEDIATE",    "IN",           "INDEX",
      "INDEXED",      "INITIALLY",    "INNER",
      "INSERT",       "INSTEAD",      "INTERSECT",
      "INTO",         "IS",           "ISNULL",
      "JOIN",         "KEY",          "LEFT",
      "LIKE",         "LIMIT",        "MATCH",
      "NATURAL",      "NO",           "NOT",
      "NOTNULL",      "NULL",         "OF",
      "OFFSET",       "ON",           "OR",
      "ORDER",        "OUTER",        "PLAN",
      "PRAGMA",       "PRIMARY",      "QUERY",
      "RAISE",        "RECURSIVE",    "REFERENCES",
      "REGEXP",       "REINDEX",      "RELEASE",
      "RENAME",       "REPLACE",      "RESTRICT",
      "RIGHT",        "ROLLBACK",     "ROW",
      "SAVEPOINT",    "SELECT",       "SET",
      "TABLE",        "TEMP",         "TEMPORARY",
      "THEN",         "TO",           "TRANSACTION",
      "TRIGGER",      "UNION",        "UNIQUE",
      "UPDATE",       "USING",        "VACUUM",
      "VALUES",       "VIEW",         "VIRTUAL",
      "WHEN",         "WHERE",        "WITH",
      "WITHOUT",
  };
  int lwr, upr, mid, c, i, x;
  if (zId[0] == 0)
    return sqlite3_mprintf("\"\"");
  for (i = x = 0; (c = zId[i]) != 0; i++) {
    if (!isalpha(c) && c != '_') {
      if (i > 0 && isdigit(c)) {
        x++;
      } else {
        return sqlite3_mprintf("\"%w\"", zId);
      }
    }
  }
  if (x)
    return sqlite3_mprintf("%s", zId);
  lwr = 0;
  upr = sizeof(azKeywords) / sizeof(azKeywords[0]) - 1;
  while (lwr <= upr) {
    mid = (lwr + upr) / 2;
    c = sqlite3_stricmp(azKeywords[mid], zId);
    if (c == 0)
      return sqlite3_mprintf("\"%w\"", zId);
    if (c < 0) {
      lwr = mid + 1;
    } else {
      upr = mid - 1;
    }
  }
  return sqlite3_mprintf("%s", zId);
}


x86 assembly (clang, -O0):
<safeId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    2173 <safeId+0x33>
lea    0x11bd(%rip),%rdi
mov    $0x0,%al
call   2060 <sqlite3_mprintf@plt>
mov    %rax,-0x8(%rbp)
jmp    22dd <safeId+0x19d>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
je     2211 <safeId+0xd1>
mov    -0x20(%rbp),%edi
call   2040 <isalpha@plt>
cmp    $0x0,%eax
jne    21fe <safeId+0xbe>
cmpl   $0x5f,-0x20(%rbp)
je     21fe <safeId+0xbe>
cmpl   $0x0,-0x24(%rbp)
jle    21de <safeId+0x9e>
mov    -0x20(%rbp),%edi
call   2030 <isdigit@plt>
cmp    $0x0,%rax
je     21de <safeId+0x9e>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    21f9 <safeId+0xb9>
mov    -0x10(%rbp),%rsi
lea    0x113a(%rip),%rdi
mov    $0x0,%al
call   2060 <sqlite3_mprintf@plt>
mov    %rax,-0x8(%rbp)
jmp    22dd <safeId+0x19d>
jmp    21fe <safeId+0xbe>
jmp    2203 <safeId+0xc3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    2181 <safeId+0x41>
cmpl   $0x0,-0x28(%rbp)
je     2236 <safeId+0xf6>
mov    -0x10(%rbp),%rsi
lea    0x1102(%rip),%rdi
mov    $0x0,%al
call   2060 <sqlite3_mprintf@plt>
mov    %rax,-0x8(%rbp)
jmp    22dd <safeId+0x19d>
movl   $0x0,-0x14(%rbp)
movl   $0x7b,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     22c7 <safeId+0x187>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rcx
lea    0x2de4(%rip),%rax
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rsi
call   2050 <sqlite3_stricmp@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    22a1 <safeId+0x161>
mov    -0x10(%rbp),%rsi
lea    0x1092(%rip),%rdi
mov    $0x0,%al
call   2060 <sqlite3_mprintf@plt>
mov    %rax,-0x8(%rbp)
jmp    22dd <safeId+0x19d>
cmpl   $0x0,-0x20(%rbp)
jge    22b9 <safeId+0x179>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    22c2 <safeId+0x182>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    2244 <safeId+0x104>
mov    -0x10(%rbp),%rsi
lea    0x1056(%rip),%rdi
mov    $0x0,%al
call   2060 <sqlite3_mprintf@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safeId>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    (%rdi),%bl
test   %bl,%bl
je     11a3 <safeId+0x63>
mov    %rdi,%r14
xor    %r15d,%r15d
mov    $0x1,%ebp
jmp    116d <safeId+0x2d>
nopl   0x0(%rax,%rax,1)
movzbl (%r14,%rbp,1),%ebx
add    $0x1,%rbp
test   %bl,%bl
je     11b9 <safeId+0x79>
movsbl %bl,%r12d
mov    %r12d,%edi
call   1040 <isalpha@plt>
test   %eax,%eax
jne    1160 <safeId+0x20>
cmp    $0x5f,%bl
je     1160 <safeId+0x20>
cmp    $0x1,%rbp
je     121c <safeId+0xdc>
mov    %r12d,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     121c <safeId+0xdc>
add    $0x1,%r15d
jmp    1160 <safeId+0x20>
lea    0x1366(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <sqlite3_mprintf@plt>
test   %r15d,%r15d
je     11c7 <safeId+0x87>
lea    0x1353(%rip),%rdi
jmp    1223 <safeId+0xe3>
xor    %r12d,%r12d
mov    $0x7b,%ebx
lea    0xe2a(%rip),%r15
jmp    11ea <safeId+0xaa>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
mov    %ebp,%ebx
cmp    %ebx,%r12d
jg     11be <safeId+0x7e>
lea    (%rbx,%r12,1),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
movslq %ebp,%rax
movslq (%r15,%rax,4),%rdi
add    %r15,%rdi
mov    %r14,%rsi
call   1050 <sqlite3_stricmp@plt>
test   %eax,%eax
je     121c <safeId+0xdc>
jns    11e0 <safeId+0xa0>
add    $0x1,%ebp
mov    %ebp,%r12d
cmp    %ebx,%r12d
jle    11ea <safeId+0xaa>
jmp    11be <safeId+0x7e>
lea    0x12f0(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <sqlite3_mprintf@plt>

LLVM IR (-O0):
@safeId.azKeywords = internal global [124 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.33, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.35, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.36, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.37, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.38, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.39, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.40, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.41, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.42, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.43, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.44, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.45, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.46, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.47, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.48, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.49, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.50, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.51, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.52, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.53, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.54, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.55, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.56, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.57, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.58, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.59, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.60, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.61, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.62, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.63, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.64, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.65, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.66, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.67, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.68, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.69, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.70, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.71, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.72, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.73, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.74, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.75, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.76, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.77, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.78, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.79, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.80, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.81, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.82, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.83, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.84, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.85, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.86, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.87, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.88, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.89, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.90, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.91, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.92, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.93, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.94, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.95, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.96, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.97, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.98, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.99, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.100, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.101, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.102, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.103, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.104, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.105, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.106, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.107, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.108, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.109, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.110, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.111, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.112, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.113, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.114, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.115, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.116, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.117, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.118, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.119, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.120, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.121, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.122, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.123, i32 0, i32 0)]
@.str = [6 x i8] c"ABORT\00"
@.str.1 = [7 x i8] c"ACTION\00"
@.str.2 = [4 x i8] c"ADD\00"
@.str.3 = [6 x i8] c"AFTER\00"
@.str.4 = [4 x i8] c"ALL\00"
@.str.5 = [6 x i8] c"ALTER\00"
@.str.6 = [8 x i8] c"ANALYZE\00"
@.str.7 = [4 x i8] c"AND\00"
@.str.8 = [3 x i8] c"AS\00"
@.str.9 = [4 x i8] c"ASC\00"
@.str.10 = [7 x i8] c"ATTACH\00"
@.str.11 = [14 x i8] c"AUTOINCREMENT\00"
@.str.12 = [7 x i8] c"BEFORE\00"
@.str.13 = [6 x i8] c"BEGIN\00"
@.str.14 = [8 x i8] c"BETWEEN\00"
@.str.15 = [3 x i8] c"BY\00"
@.str.16 = [8 x i8] c"CASCADE\00"
@.str.17 = [5 x i8] c"CASE\00"
@.str.18 = [5 x i8] c"CAST\00"
@.str.19 = [6 x i8] c"CHECK\00"
@.str.20 = [8 x i8] c"COLLATE\00"
@.str.21 = [7 x i8] c"COLUMN\00"
@.str.22 = [7 x i8] c"COMMIT\00"
@.str.23 = [9 x i8] c"CONFLICT\00"
@.str.24 = [11 x i8] c"CONSTRAINT\00"
@.str.25 = [7 x i8] c"CREATE\00"
@.str.26 = [6 x i8] c"CROSS\00"
@.str.27 = [13 x i8] c"CURRENT_DATE\00"
@.str.28 = [13 x i8] c"CURRENT_TIME\00"
@.str.29 = [18 x i8] c"CURRENT_TIMESTAMP\00"
@.str.30 = [9 x i8] c"DATABASE\00"
@.str.31 = [8 x i8] c"DEFAULT\00"
@.str.32 = [11 x i8] c"DEFERRABLE\00"
@.str.33 = [9 x i8] c"DEFERRED\00"
@.str.34 = [7 x i8] c"DELETE\00"
@.str.35 = [5 x i8] c"DESC\00"
@.str.36 = [7 x i8] c"DETACH\00"
@.str.37 = [9 x i8] c"DISTINCT\00"
@.str.38 = [5 x i8] c"DROP\00"
@.str.39 = [5 x i8] c"EACH\00"
@.str.40 = [5 x i8] c"ELSE\00"
@.str.41 = [4 x i8] c"END\00"
@.str.42 = [7 x i8] c"ESCAPE\00"
@.str.43 = [7 x i8] c"EXCEPT\00"
@.str.44 = [10 x i8] c"EXCLUSIVE\00"
@.str.45 = [7 x i8] c"EXISTS\00"
@.str.46 = [8 x i8] c"EXPLAIN\00"
@.str.47 = [5 x i8] c"FAIL\00"
@.str.48 = [4 x i8] c"FOR\00"
@.str.49 = [8 x i8] c"FOREIGN\00"
@.str.50 = [5 x i8] c"FROM\00"
@.str.51 = [5 x i8] c"FULL\00"
@.str.52 = [5 x i8] c"GLOB\00"
@.str.53 = [6 x i8] c"GROUP\00"
@.str.54 = [7 x i8] c"HAVING\00"
@.str.55 = [3 x i8] c"IF\00"
@.str.56 = [7 x i8] c"IGNORE\00"
@.str.57 = [10 x i8] c"IMMEDIATE\00"
@.str.58 = [3 x i8] c"IN\00"
@.str.59 = [6 x i8] c"INDEX\00"
@.str.60 = [8 x i8] c"INDEXED\00"
@.str.61 = [10 x i8] c"INITIALLY\00"
@.str.62 = [6 x i8] c"INNER\00"
@.str.63 = [7 x i8] c"INSERT\00"
@.str.64 = [8 x i8] c"INSTEAD\00"
@.str.65 = [10 x i8] c"INTERSECT\00"
@.str.66 = [5 x i8] c"INTO\00"
@.str.67 = [3 x i8] c"IS\00"
@.str.68 = [7 x i8] c"ISNULL\00"
@.str.69 = [5 x i8] c"JOIN\00"
@.str.70 = [4 x i8] c"KEY\00"
@.str.71 = [5 x i8] c"LEFT\00"
@.str.72 = [5 x i8] c"LIKE\00"
@.str.73 = [6 x i8] c"LIMIT\00"
@.str.74 = [6 x i8] c"MATCH\00"
@.str.75 = [8 x i8] c"NATURAL\00"
@.str.76 = [3 x i8] c"NO\00"
@.str.77 = [4 x i8] c"NOT\00"
@.str.78 = [8 x i8] c"NOTNULL\00"
@.str.79 = [5 x i8] c"NULL\00"
@.str.80 = [3 x i8] c"OF\00"
@.str.81 = [7 x i8] c"OFFSET\00"
@.str.82 = [3 x i8] c"ON\00"
@.str.83 = [3 x i8] c"OR\00"
@.str.84 = [6 x i8] c"ORDER\00"
@.str.85 = [6 x i8] c"OUTER\00"
@.str.86 = [5 x i8] c"PLAN\00"
@.str.87 = [7 x i8] c"PRAGMA\00"
@.str.88 = [8 x i8] c"PRIMARY\00"
@.str.89 = [6 x i8] c"QUERY\00"
@.str.90 = [6 x i8] c"RAISE\00"
@.str.91 = [10 x i8] c"RECURSIVE\00"
@.str.92 = [11 x i8] c"REFERENCES\00"
@.str.93 = [7 x i8] c"REGEXP\00"
@.str.94 = [8 x i8] c"REINDEX\00"
@.str.95 = [8 x i8] c"RELEASE\00"
@.str.96 = [7 x i8] c"RENAME\00"
@.str.97 = [8 x i8] c"REPLACE\00"
@.str.98 = [9 x i8] c"RESTRICT\00"
@.str.99 = [6 x i8] c"RIGHT\00"
@.str.100 = [9 x i8] c"ROLLBACK\00"
@.str.101 = [4 x i8] c"ROW\00"
@.str.102 = [10 x i8] c"SAVEPOINT\00"
@.str.103 = [7 x i8] c"SELECT\00"
@.str.104 = [4 x i8] c"SET\00"
@.str.105 = [6 x i8] c"TABLE\00"
@.str.106 = [5 x i8] c"TEMP\00"
@.str.107 = [10 x i8] c"TEMPORARY\00"
@.str.108 = [5 x i8] c"THEN\00"
@.str.109 = [3 x i8] c"TO\00"
@.str.110 = [12 x i8] c"TRANSACTION\00"
@.str.111 = [8 x i8] c"TRIGGER\00"
@.str.112 = [6 x i8] c"UNION\00"
@.str.113 = [7 x i8] c"UNIQUE\00"
@.str.114 = [7 x i8] c"UPDATE\00"
@.str.115 = [6 x i8] c"USING\00"
@.str.116 = [7 x i8] c"VACUUM\00"
@.str.117 = [7 x i8] c"VALUES\00"
@.str.118 = [5 x i8] c"VIEW\00"
@.str.119 = [8 x i8] c"VIRTUAL\00"
@.str.120 = [5 x i8] c"WHEN\00"
@.str.121 = [6 x i8] c"WHERE\00"
@.str.122 = [5 x i8] c"WITH\00"
@.str.123 = [8 x i8] c"WITHOUT\00"
@.str.124 = [3 x i8] c"\22\22\00"
@.str.125 = [5 x i8] c"\22%w\22\00"
@.str.126 = [3 x i8] c"%s\00"
define i8* @safeId(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %3
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %1
%16 = call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.124, i64 0, i64 0))
store i8* %16, i8** %2
br label %91
17: ; preds = %1
store i32 0, i32* %9
store i32 0, i32* %8
br label %18
18: ; preds = %48, %17
%19 = load i8*, i8** %3
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
store i32 %24, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %51
26: ; preds = %18
%27 = load i32, i32* %7
%28 = call i32 @isalpha(i32 %27)
%29 = icmp ne i32 %28, 0
br i1 %29, label %47, label %30
30: ; preds = %26
%31 = load i32, i32* %7
%32 = icmp ne i32 %31, 95
br i1 %32, label %33, label %47
33: ; preds = %30
%34 = load i32, i32* %8
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %7
%38 = call i64 @isdigit(i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %46
43: ; preds = %36, %33
%44 = load i8*, i8** %3
%45 = call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.125, i64 0, i64 0), i8* %44)
store i8* %45, i8** %2
br label %91
46: ; preds = %40
br label %47
47: ; preds = %46, %30, %26
br label %48
48: ; preds = %47
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %18
51: ; preds = %18
%52 = load i32, i32* %9
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i8*, i8** %3
%56 = call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.126, i64 0, i64 0), i8* %55)
store i8* %56, i8** %2
br label %91
57: ; preds = %51
store i32 0, i32* %4
store i32 123, i32* %5
br label %58
58: ; preds = %87, %57
%59 = load i32, i32* %4
%60 = load i32, i32* %5
%61 = icmp sle i32 %59, %60
br i1 %61, label %62, label %88
62: ; preds = %58
%63 = load i32, i32* %4
%64 = load i32, i32* %5
%65 = add nsw i32 %63, %64
%66 = sdiv i32 %65, 2
store i32 %66, i32* %6
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [124 x i8*], [124 x i8*]* @safeId.azKeywords, i64 0, i64 %68
%70 = load i8*, i8** %69
%71 = load i8*, i8** %3
%72 = call i32 @sqlite3_stricmp(i8* %70, i8* %71)
store i32 %72, i32* %7
%73 = load i32, i32* %7
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %62
%76 = load i8*, i8** %3
%77 = call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.125, i64 0, i64 0), i8* %76)
store i8* %77, i8** %2
br label %91
78: ; preds = %62
%79 = load i32, i32* %7
%80 = icmp slt i32 %79, 0
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %4
br label %87
84: ; preds = %78
%85 = load i32, i32* %6
%86 = sub nsw i32 %85, 1
store i32 %86, i32* %5
br label %87
87: ; preds = %84, %81
br label %58
88: ; preds = %58
%89 = load i8*, i8** %3
%90 = call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.126, i64 0, i64 0), i8* %89)
store i8* %90, i8** %2
br label %91
91: ; preds = %88, %75, %54, %43, %15
%92 = load i8*, i8** %2
ret i8* %92
}

LLVM IR (-O2):
@reltable.safeId = internal unnamed_addr constant [124 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.5 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.6 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.10 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.11 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.12 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.13 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.14 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.15 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.16 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.17 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.18 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.19 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.20 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.21 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.22 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.23 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.24 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.25 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.26 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.27 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.28 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.29 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.30 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.32 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.33 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.34 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.35 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.36 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.37 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.38 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.39 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.40 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.41 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.42 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.43 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.44 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.45 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.46 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.47 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.48 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.49 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.50 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.51 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.52 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.53 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.54 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.55 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.56 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.57 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.58 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.59 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.60 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.61 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.62 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.63 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.64 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.65 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.66 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.67 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.68 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.69 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.70 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.71 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.72 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.73 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.74 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.75 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.76 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.77 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.78 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.79 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.80 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.81 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.82 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.83 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.84 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.85 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.86 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.87 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.88 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.89 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.90 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.91 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.92 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.93 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.94 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.95 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.96 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.97 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.98 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.99 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.100 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.101 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.102 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.103 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.104 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.105 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.106 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.107 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.108 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.109 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.110 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.111 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.112 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.113 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.114 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.115 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.116 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.117 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.118 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.119 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.120 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.121 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.122 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.123 to i64), i64 ptrtoint ([124 x i32]* @reltable.safeId to i64)) to i32)]
@.str = [6 x i8] c"ABORT\00"
@.str.1 = [7 x i8] c"ACTION\00"
@.str.2 = [4 x i8] c"ADD\00"
@.str.3 = [6 x i8] c"AFTER\00"
@.str.4 = [4 x i8] c"ALL\00"
@.str.5 = [6 x i8] c"ALTER\00"
@.str.6 = [8 x i8] c"ANALYZE\00"
@.str.7 = [4 x i8] c"AND\00"
@.str.8 = [3 x i8] c"AS\00"
@.str.9 = [4 x i8] c"ASC\00"
@.str.10 = [7 x i8] c"ATTACH\00"
@.str.11 = [14 x i8] c"AUTOINCREMENT\00"
@.str.12 = [7 x i8] c"BEFORE\00"
@.str.13 = [6 x i8] c"BEGIN\00"
@.str.14 = [8 x i8] c"BETWEEN\00"
@.str.15 = [3 x i8] c"BY\00"
@.str.16 = [8 x i8] c"CASCADE\00"
@.str.17 = [5 x i8] c"CASE\00"
@.str.18 = [5 x i8] c"CAST\00"
@.str.19 = [6 x i8] c"CHECK\00"
@.str.20 = [8 x i8] c"COLLATE\00"
@.str.21 = [7 x i8] c"COLUMN\00"
@.str.22 = [7 x i8] c"COMMIT\00"
@.str.23 = [9 x i8] c"CONFLICT\00"
@.str.24 = [11 x i8] c"CONSTRAINT\00"
@.str.25 = [7 x i8] c"CREATE\00"
@.str.26 = [6 x i8] c"CROSS\00"
@.str.27 = [13 x i8] c"CURRENT_DATE\00"
@.str.28 = [13 x i8] c"CURRENT_TIME\00"
@.str.29 = [18 x i8] c"CURRENT_TIMESTAMP\00"
@.str.30 = [9 x i8] c"DATABASE\00"
@.str.31 = [8 x i8] c"DEFAULT\00"
@.str.32 = [11 x i8] c"DEFERRABLE\00"
@.str.33 = [9 x i8] c"DEFERRED\00"
@.str.34 = [7 x i8] c"DELETE\00"
@.str.35 = [5 x i8] c"DESC\00"
@.str.36 = [7 x i8] c"DETACH\00"
@.str.37 = [9 x i8] c"DISTINCT\00"
@.str.38 = [5 x i8] c"DROP\00"
@.str.39 = [5 x i8] c"EACH\00"
@.str.40 = [5 x i8] c"ELSE\00"
@.str.41 = [4 x i8] c"END\00"
@.str.42 = [7 x i8] c"ESCAPE\00"
@.str.43 = [7 x i8] c"EXCEPT\00"
@.str.44 = [10 x i8] c"EXCLUSIVE\00"
@.str.45 = [7 x i8] c"EXISTS\00"
@.str.46 = [8 x i8] c"EXPLAIN\00"
@.str.47 = [5 x i8] c"FAIL\00"
@.str.48 = [4 x i8] c"FOR\00"
@.str.49 = [8 x i8] c"FOREIGN\00"
@.str.50 = [5 x i8] c"FROM\00"
@.str.51 = [5 x i8] c"FULL\00"
@.str.52 = [5 x i8] c"GLOB\00"
@.str.53 = [6 x i8] c"GROUP\00"
@.str.54 = [7 x i8] c"HAVING\00"
@.str.55 = [3 x i8] c"IF\00"
@.str.56 = [7 x i8] c"IGNORE\00"
@.str.57 = [10 x i8] c"IMMEDIATE\00"
@.str.58 = [3 x i8] c"IN\00"
@.str.59 = [6 x i8] c"INDEX\00"
@.str.60 = [8 x i8] c"INDEXED\00"
@.str.61 = [10 x i8] c"INITIALLY\00"
@.str.62 = [6 x i8] c"INNER\00"
@.str.63 = [7 x i8] c"INSERT\00"
@.str.64 = [8 x i8] c"INSTEAD\00"
@.str.65 = [10 x i8] c"INTERSECT\00"
@.str.66 = [5 x i8] c"INTO\00"
@.str.67 = [3 x i8] c"IS\00"
@.str.68 = [7 x i8] c"ISNULL\00"
@.str.69 = [5 x i8] c"JOIN\00"
@.str.70 = [4 x i8] c"KEY\00"
@.str.71 = [5 x i8] c"LEFT\00"
@.str.72 = [5 x i8] c"LIKE\00"
@.str.73 = [6 x i8] c"LIMIT\00"
@.str.74 = [6 x i8] c"MATCH\00"
@.str.75 = [8 x i8] c"NATURAL\00"
@.str.76 = [3 x i8] c"NO\00"
@.str.77 = [4 x i8] c"NOT\00"
@.str.78 = [8 x i8] c"NOTNULL\00"
@.str.79 = [5 x i8] c"NULL\00"
@.str.80 = [3 x i8] c"OF\00"
@.str.81 = [7 x i8] c"OFFSET\00"
@.str.82 = [3 x i8] c"ON\00"
@.str.83 = [3 x i8] c"OR\00"
@.str.84 = [6 x i8] c"ORDER\00"
@.str.85 = [6 x i8] c"OUTER\00"
@.str.86 = [5 x i8] c"PLAN\00"
@.str.87 = [7 x i8] c"PRAGMA\00"
@.str.88 = [8 x i8] c"PRIMARY\00"
@.str.89 = [6 x i8] c"QUERY\00"
@.str.90 = [6 x i8] c"RAISE\00"
@.str.91 = [10 x i8] c"RECURSIVE\00"
@.str.92 = [11 x i8] c"REFERENCES\00"
@.str.93 = [7 x i8] c"REGEXP\00"
@.str.94 = [8 x i8] c"REINDEX\00"
@.str.95 = [8 x i8] c"RELEASE\00"
@.str.96 = [7 x i8] c"RENAME\00"
@.str.97 = [8 x i8] c"REPLACE\00"
@.str.98 = [9 x i8] c"RESTRICT\00"
@.str.99 = [6 x i8] c"RIGHT\00"
@.str.100 = [9 x i8] c"ROLLBACK\00"
@.str.101 = [4 x i8] c"ROW\00"
@.str.102 = [10 x i8] c"SAVEPOINT\00"
@.str.103 = [7 x i8] c"SELECT\00"
@.str.104 = [4 x i8] c"SET\00"
@.str.105 = [6 x i8] c"TABLE\00"
@.str.106 = [5 x i8] c"TEMP\00"
@.str.107 = [10 x i8] c"TEMPORARY\00"
@.str.108 = [5 x i8] c"THEN\00"
@.str.109 = [3 x i8] c"TO\00"
@.str.110 = [12 x i8] c"TRANSACTION\00"
@.str.111 = [8 x i8] c"TRIGGER\00"
@.str.112 = [6 x i8] c"UNION\00"
@.str.113 = [7 x i8] c"UNIQUE\00"
@.str.114 = [7 x i8] c"UPDATE\00"
@.str.115 = [6 x i8] c"USING\00"
@.str.116 = [7 x i8] c"VACUUM\00"
@.str.117 = [7 x i8] c"VALUES\00"
@.str.118 = [5 x i8] c"VIEW\00"
@.str.119 = [8 x i8] c"VIRTUAL\00"
@.str.120 = [5 x i8] c"WHEN\00"
@.str.121 = [6 x i8] c"WHERE\00"
@.str.122 = [5 x i8] c"WITH\00"
@.str.123 = [8 x i8] c"WITHOUT\00"
@.str.124 = [3 x i8] c"\22\22\00"
@.str.125 = [5 x i8] c"\22%w\22\00"
@.str.126 = [3 x i8] c"%s\00"
define i8* @safeId(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.124, i64 0, i64 0))
br label %55
6: ; preds = %1, %24
%7 = phi i64 [ %26, %24 ], [ 0, %1 ]
%8 = phi i8 [ %28, %24 ], [ %2, %1 ]
%9 = phi i32 [ %25, %24 ], [ 0, %1 ]
%10 = sext i8 %8 to i32
%11 = tail call i32 @isalpha(i32 %10)
%12 = icmp eq i32 %11, 0
%13 = icmp ne i8 %8, 95
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %15, label %24
15: ; preds = %6
%16 = icmp eq i64 %7, 0
br i1 %16, label %22, label %17
17: ; preds = %15
%18 = tail call i64 @isdigit(i32 %10)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = add nsw i32 %9, 1
br label %24
22: ; preds = %17, %15
%23 = tail call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.125, i64 0, i64 0), i8* %0)
br label %55
24: ; preds = %6, %20
%25 = phi i32 [ %21, %20 ], [ %9, %6 ]
%26 = add nuw i64 %7, 1
%27 = getelementptr inbounds i8, i8* %0, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %6
30: ; preds = %24
%31 = icmp eq i32 %25, 0
br i1 %31, label %34, label %32
32: ; preds = %30
%33 = tail call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.126, i64 0, i64 0), i8* %0)
br label %55
34: ; preds = %30, %46
%35 = phi i32 [ %51, %46 ], [ 123, %30 ]
%36 = phi i32 [ %50, %46 ], [ 0, %30 ]
%37 = add nsw i32 %35, %36
%38 = sdiv i32 %37, 2
%39 = sext i32 %38 to i64
%40 = shl i64 %39, 2
%41 = call i8* @llvm.load.relative.i64(i8* bitcast ([124 x i32]* @reltable.safeId to i8*), i64 %40)
%42 = tail call i32 @sqlite3_stricmp(i8* %41, i8* %0)
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %34
%45 = tail call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.125, i64 0, i64 0), i8* %0)
br label %55
46: ; preds = %34
%47 = icmp slt i32 %42, 0
%48 = add nsw i32 %38, 1
%49 = add nsw i32 %38, -1
%50 = select i1 %47, i32 %48, i32 %36
%51 = select i1 %47, i32 %35, i32 %49
%52 = icmp sgt i32 %50, %51
br i1 %52, label %53, label %34
53: ; preds = %46
%54 = tail call i8* (i8*, ...) @sqlite3_mprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.126, i64 0, i64 0), i8* %0)
br label %55
55: ; preds = %53, %44, %32, %22, %4
%56 = phi i8* [ %5, %4 ], [ %23, %22 ], [ %33, %32 ], [ %45, %44 ], [ %54, %53 ]
ret i8* %56
}