#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 Connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Database_close(struct Connection *);
int /*<<< orphan*/ Database_create(struct Connection *, size_t, size_t);
int /*<<< orphan*/ Database_delete(struct Connection *, int);
int /*<<< orphan*/ Database_find_by_email(struct Connection *, char *);
int /*<<< orphan*/ Database_find_by_name(struct Connection *, char *);
int /*<<< orphan*/ Database_get(struct Connection *, int);
int /*<<< orphan*/ Database_list(struct Connection *);
struct Connection *Database_open(char *, char);
int /*<<< orphan*/ Database_set(struct Connection *, int, char *, char *);
int /*<<< orphan*/ Database_write(struct Connection *);
int atoi(char *);
int /*<<< orphan*/ die(char *, struct Connection *);
int /*<<< orphan*/ id_in_bounds(int, struct Connection *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 3)
    die("USAGE: ex17 <dbfile> <action> [action params]", NULL);
  char *filename = argv[1];
  char action = argv[2][0];
  struct Connection *conn = Database_open(filename, action);
  int id = 0;
  switch (action) {
  case 'c':
    if (argc != 5)
      die("Need row_count, max_string_length to create", conn);
    size_t max_rows = (size_t)(atoi(argv[3]));
    size_t max_str_len = (size_t)(atoi(argv[4]));
    Database_create(conn, max_rows, max_str_len);
    Database_write(conn);
    break;
  case 'g':
    id = atoi(argv[3]);
    id_in_bounds(id, conn);
    if (argc != 4)
      die("Need an id to get", conn);
    Database_get(conn, id);
    break;
  case 's':
    id = atoi(argv[3]);
    id_in_bounds(id, conn);
    if (argc != 6)
      die("Need id, name, email to set", conn);
    Database_set(conn, id, argv[4], argv[5]);
    Database_write(conn);
    break;
  case 'd':
    id = atoi(argv[3]);
    id_in_bounds(id, conn);
    if (argc != 4)
      die("Need id to delete", conn);
    Database_delete(conn, id);
    Database_write(conn);
    break;
  case 'l':
    Database_list(conn);
    break;
  case 'f':
    if (argc != 5)
      die("Need find_field [name or email], search_string", conn);
    if (strcmp(argv[3], "name") == 0) {
      Database_find_by_name(conn, argv[4]);
    } else if (strcmp(argv[3], "email") == 0) {
      Database_find_by_email(conn, argv[4]);
    }
    break;
  default:
    die("Invalid action, only: c=create, g=get, s=set, d=del, l=list f=find",
        conn);
  }
  Database_close(conn);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1210 <main+0x30>
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   10c0 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rdi
movsbl -0x19(%rbp),%esi
call   10f0 <Database_open@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffff9d,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x10,%eax
ja     1454 <main+0x274>
mov    -0x48(%rbp),%rax
lea    0xd9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x5,-0x8(%rbp)
je     1285 <main+0xa5>
mov    -0x28(%rbp),%rsi
lea    0xdf2(%rip),%rdi
call   10c0 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
cltq
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10d0 <atoi@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1090 <Database_create@plt>
mov    -0x28(%rbp),%rdi
call   1030 <Database_write@plt>
jmp    1464 <main+0x284>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1080 <id_in_bounds@plt>
cmpl   $0x4,-0x8(%rbp)
je     1300 <main+0x120>
mov    -0x28(%rbp),%rsi
lea    0xda3(%rip),%rdi
call   10c0 <die@plt>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   10e0 <Database_get@plt>
jmp    1464 <main+0x284>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1080 <id_in_bounds@plt>
cmpl   $0x6,-0x8(%rbp)
je     1347 <main+0x167>
mov    -0x28(%rbp),%rsi
lea    0xd6e(%rip),%rdi
call   10c0 <die@plt>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rcx
call   10b0 <Database_set@plt>
mov    -0x28(%rbp),%rdi
call   1030 <Database_write@plt>
jmp    1464 <main+0x284>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1080 <id_in_bounds@plt>
cmpl   $0x4,-0x8(%rbp)
je     13a7 <main+0x1c7>
mov    -0x28(%rbp),%rsi
lea    0xd2a(%rip),%rdi
call   10c0 <die@plt>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   10a0 <Database_delete@plt>
mov    -0x28(%rbp),%rdi
call   1030 <Database_write@plt>
jmp    1464 <main+0x284>
mov    -0x28(%rbp),%rdi
call   1050 <Database_list@plt>
jmp    1464 <main+0x284>
cmpl   $0x5,-0x8(%rbp)
je     13e9 <main+0x209>
mov    -0x28(%rbp),%rsi
lea    0xcfa(%rip),%rdi
call   10c0 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd15(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    141c <main+0x23c>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
call   1070 <Database_find_by_name@plt>
jmp    144f <main+0x26f>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xce7(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    144a <main+0x26a>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
call   1040 <Database_find_by_email@plt>
jmp    144f <main+0x26f>
jmp    1464 <main+0x284>
mov    -0x28(%rbp),%rsi
lea    0xcb9(%rip),%rdi
call   10c0 <die@plt>
mov    -0x28(%rbp),%rdi
call   1100 <Database_close@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r12d
cmp    $0x2,%edi
jg     1201 <main+0x21>
lea    0xe4a(%rip),%rdi
xor    %esi,%esi
call   10c0 <die@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rax
movsbl (%rax),%ebp
mov    %ebp,%esi
call   10f0 <Database_open@plt>
mov    %rax,%r14
add    $0xffffff9d,%ebp
cmp    $0x10,%ebp
ja     12a8 <main+0xc8>
lea    0xdd7(%rip),%rax
movslq (%rax,%rbp,4),%rcx
add    %rax,%rcx
jmp    *%rcx
cmp    $0x5,%r12d
je     1247 <main+0x67>
lea    0xe33(%rip),%rdi
mov    %r14,%rsi
call   10c0 <die@plt>
mov    0x18(%rbx),%rdi
call   10d0 <atoi@plt>
movslq %eax,%rbp
mov    0x20(%rbx),%rdi
call   10d0 <atoi@plt>
movslq %eax,%rdx
mov    %r14,%rdi
mov    %rbp,%rsi
call   1090 <Database_create@plt>
jmp    1392 <main+0x1b2>
mov    0x18(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r14,%rsi
call   1080 <id_in_bounds@plt>
cmp    $0x4,%r12d
je     1299 <main+0xb9>
lea    0xe3b(%rip),%rdi
mov    %r14,%rsi
call   10c0 <die@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   10a0 <Database_delete@plt>
jmp    1392 <main+0x1b2>
lea    0xe69(%rip),%rdi
mov    %r14,%rsi
call   10c0 <die@plt>
jmp    139a <main+0x1ba>
cmp    $0x5,%r12d
je     12d1 <main+0xf1>
lea    0xe15(%rip),%rdi
mov    %r14,%rsi
call   10c0 <die@plt>
mov    0x18(%rbx),%rbp
lea    0xe31(%rip),%rsi
mov    %rbp,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     13ad <main+0x1cd>
lea    0xe1f(%rip),%rsi
mov    %rbp,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
jne    139a <main+0x1ba>
mov    0x20(%rbx),%rsi
mov    %r14,%rdi
call   1040 <Database_find_by_email@plt>
jmp    139a <main+0x1ba>
mov    0x18(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r14,%rsi
call   1080 <id_in_bounds@plt>
cmp    $0x4,%r12d
je     133e <main+0x15e>
lea    0xd68(%rip),%rdi
mov    %r14,%rsi
call   10c0 <die@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   10e0 <Database_get@plt>
jmp    139a <main+0x1ba>
mov    %r14,%rdi
call   1050 <Database_list@plt>
jmp    139a <main+0x1ba>
mov    0x18(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%r15d
mov    %eax,%edi
mov    %r14,%rsi
call   1080 <id_in_bounds@plt>
cmp    $0x6,%r12d
je     137f <main+0x19f>
lea    0xd39(%rip),%rdi
mov    %r14,%rsi
call   10c0 <die@plt>
mov    0x20(%rbx),%rdx
mov    0x28(%rbx),%rcx
mov    %r14,%rdi
mov    %r15d,%esi
call   10b0 <Database_set@plt>
mov    %r14,%rdi
call   1030 <Database_write@plt>
mov    %r14,%rdi
call   1100 <Database_close@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x20(%rbx),%rsi
mov    %r14,%rdi
call   1070 <Database_find_by_name@plt>
jmp    139a <main+0x1ba>

LLVM IR (-O0):
%struct.Connection = type { i32 }
@.str = [46 x i8] c"USAGE: ex17 <dbfile> <action> [action params]\00"
@.str.1 = [44 x i8] c"Need row_count, max_string_length to create\00"
@.str.2 = [18 x i8] c"Need an id to get\00"
@.str.3 = [28 x i8] c"Need id, name, email to set\00"
@.str.4 = [18 x i8] c"Need id to delete\00"
@.str.5 = [47 x i8] c"Need find_field [name or email], search_string\00"
@.str.6 = [5 x i8] c"name\00"
@.str.7 = [6 x i8] c"email\00"
@.str.8 = [67 x i8] c"Invalid action, only: c=create, g=get, s=set, d=del, l=list f=find\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8
%8 = alloca %struct.Connection*
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @die(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), %struct.Connection* null)
br label %16
16: ; preds = %14, %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
store i8* %19, i8** %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
store i8 %24, i8* %7
%25 = load i8*, i8** %6
%26 = load i8, i8* %7
%27 = call %struct.Connection* @Database_open(i8* %25, i8 signext %26)
store %struct.Connection* %27, %struct.Connection** %8
store i32 0, i32* %9
%28 = load i8, i8* %7
%29 = sext i8 %28 to i32
switch i32 %29, label %149 [
i32 99, label %30
i32 103, label %53
i32 115, label %70
i32 100, label %95
i32 108, label %114
i32 102, label %117
]
30: ; preds = %16
%31 = load i32, i32* %4
%32 = icmp ne i32 %31, 5
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load %struct.Connection*, %struct.Connection** %8
%35 = call i32 @die(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), %struct.Connection* %34)
br label %36
36: ; preds = %33, %30
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = call i32 @atoi(i8* %39)
%41 = sext i32 %40 to i64
store i64 %41, i64* %10
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 4
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
%46 = sext i32 %45 to i64
store i64 %46, i64* %11
%47 = load %struct.Connection*, %struct.Connection** %8
%48 = load i64, i64* %10
%49 = load i64, i64* %11
%50 = call i32 @Database_create(%struct.Connection* %47, i64 %48, i64 %49)
%51 = load %struct.Connection*, %struct.Connection** %8
%52 = call i32 @Database_write(%struct.Connection* %51)
br label %152
53: ; preds = %16
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 3
%56 = load i8*, i8** %55
%57 = call i32 @atoi(i8* %56)
store i32 %57, i32* %9
%58 = load i32, i32* %9
%59 = load %struct.Connection*, %struct.Connection** %8
%60 = call i32 @id_in_bounds(i32 %58, %struct.Connection* %59)
%61 = load i32, i32* %4
%62 = icmp ne i32 %61, 4
br i1 %62, label %63, label %66
63: ; preds = %53
%64 = load %struct.Connection*, %struct.Connection** %8
%65 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %struct.Connection* %64)
br label %66
66: ; preds = %63, %53
%67 = load %struct.Connection*, %struct.Connection** %8
%68 = load i32, i32* %9
%69 = call i32 @Database_get(%struct.Connection* %67, i32 %68)
br label %152
70: ; preds = %16
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 3
%73 = load i8*, i8** %72
%74 = call i32 @atoi(i8* %73)
store i32 %74, i32* %9
%75 = load i32, i32* %9
%76 = load %struct.Connection*, %struct.Connection** %8
%77 = call i32 @id_in_bounds(i32 %75, %struct.Connection* %76)
%78 = load i32, i32* %4
%79 = icmp ne i32 %78, 6
br i1 %79, label %80, label %83
80: ; preds = %70
%81 = load %struct.Connection*, %struct.Connection** %8
%82 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), %struct.Connection* %81)
br label %83
83: ; preds = %80, %70
%84 = load %struct.Connection*, %struct.Connection** %8
%85 = load i32, i32* %9
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 4
%88 = load i8*, i8** %87
%89 = load i8**, i8*** %5
%90 = getelementptr inbounds i8*, i8** %89, i64 5
%91 = load i8*, i8** %90
%92 = call i32 @Database_set(%struct.Connection* %84, i32 %85, i8* %88, i8* %91)
%93 = load %struct.Connection*, %struct.Connection** %8
%94 = call i32 @Database_write(%struct.Connection* %93)
br label %152
95: ; preds = %16
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 3
%98 = load i8*, i8** %97
%99 = call i32 @atoi(i8* %98)
store i32 %99, i32* %9
%100 = load i32, i32* %9
%101 = load %struct.Connection*, %struct.Connection** %8
%102 = call i32 @id_in_bounds(i32 %100, %struct.Connection* %101)
%103 = load i32, i32* %4
%104 = icmp ne i32 %103, 4
br i1 %104, label %105, label %108
105: ; preds = %95
%106 = load %struct.Connection*, %struct.Connection** %8
%107 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), %struct.Connection* %106)
br label %108
108: ; preds = %105, %95
%109 = load %struct.Connection*, %struct.Connection** %8
%110 = load i32, i32* %9
%111 = call i32 @Database_delete(%struct.Connection* %109, i32 %110)
%112 = load %struct.Connection*, %struct.Connection** %8
%113 = call i32 @Database_write(%struct.Connection* %112)
br label %152
114: ; preds = %16
%115 = load %struct.Connection*, %struct.Connection** %8
%116 = call i32 @Database_list(%struct.Connection* %115)
br label %152
117: ; preds = %16
%118 = load i32, i32* %4
%119 = icmp ne i32 %118, 5
br i1 %119, label %120, label %123
120: ; preds = %117
%121 = load %struct.Connection*, %struct.Connection** %8
%122 = call i32 @die(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), %struct.Connection* %121)
br label %123
123: ; preds = %120, %117
%124 = load i8**, i8*** %5
%125 = getelementptr inbounds i8*, i8** %124, i64 3
%126 = load i8*, i8** %125
%127 = call i32 @strcmp(i8* %126, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%128 = icmp eq i32 %127, 0
br i1 %128, label %129, label %135
129: ; preds = %123
%130 = load %struct.Connection*, %struct.Connection** %8
%131 = load i8**, i8*** %5
%132 = getelementptr inbounds i8*, i8** %131, i64 4
%133 = load i8*, i8** %132
%134 = call i32 @Database_find_by_name(%struct.Connection* %130, i8* %133)
br label %148
135: ; preds = %123
%136 = load i8**, i8*** %5
%137 = getelementptr inbounds i8*, i8** %136, i64 3
%138 = load i8*, i8** %137
%139 = call i32 @strcmp(i8* %138, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%140 = icmp eq i32 %139, 0
br i1 %140, label %141, label %147
141: ; preds = %135
%142 = load %struct.Connection*, %struct.Connection** %8
%143 = load i8**, i8*** %5
%144 = getelementptr inbounds i8*, i8** %143, i64 4
%145 = load i8*, i8** %144
%146 = call i32 @Database_find_by_email(%struct.Connection* %142, i8* %145)
br label %147
147: ; preds = %141, %135
br label %148
148: ; preds = %147, %129
br label %152
149: ; preds = %16
%150 = load %struct.Connection*, %struct.Connection** %8
%151 = call i32 @die(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.8, i64 0, i64 0), %struct.Connection* %150)
br label %152
152: ; preds = %149, %148, %114, %108, %83, %66, %36
%153 = load %struct.Connection*, %struct.Connection** %8
%154 = call i32 @Database_close(%struct.Connection* %153)
ret i32 0
}

LLVM IR (-O2):
%struct.Connection = type { i32 }
@.str = [46 x i8] c"USAGE: ex17 <dbfile> <action> [action params]\00"
@.str.1 = [44 x i8] c"Need row_count, max_string_length to create\00"
@.str.2 = [18 x i8] c"Need an id to get\00"
@.str.3 = [28 x i8] c"Need id, name, email to set\00"
@.str.4 = [18 x i8] c"Need id to delete\00"
@.str.5 = [47 x i8] c"Need find_field [name or email], search_string\00"
@.str.6 = [5 x i8] c"name\00"
@.str.7 = [6 x i8] c"email\00"
@.str.8 = [67 x i8] c"Invalid action, only: c=create, g=get, s=set, d=del, l=list f=find\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @die(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), %struct.Connection* null)
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = tail call %struct.Connection* @Database_open(i8* %8, i8 signext %11)
%13 = sext i8 %11 to i32
switch i32 %13, label %87 [
i32 99, label %14
i32 103, label %29
i32 115, label %39
i32 100, label %54
i32 108, label %65
i32 102, label %67
]
14: ; preds = %6
%15 = icmp eq i32 %0, 5
br i1 %15, label %18, label %16
16: ; preds = %14
%17 = tail call i32 @die(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), %struct.Connection* %12)
br label %18
18: ; preds = %16, %14
%19 = getelementptr inbounds i8*, i8** %1, i64 3
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %1, i64 4
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
%26 = sext i32 %25 to i64
%27 = tail call i32 @Database_create(%struct.Connection* %12, i64 %22, i64 %26)
%28 = tail call i32 @Database_write(%struct.Connection* %12)
br label %89
29: ; preds = %6
%30 = getelementptr inbounds i8*, i8** %1, i64 3
%31 = load i8*, i8** %30
%32 = tail call i32 @atoi(i8* %31)
%33 = tail call i32 @id_in_bounds(i32 %32, %struct.Connection* %12)
%34 = icmp eq i32 %0, 4
br i1 %34, label %37, label %35
35: ; preds = %29
%36 = tail call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %struct.Connection* %12)
br label %37
37: ; preds = %35, %29
%38 = tail call i32 @Database_get(%struct.Connection* %12, i32 %32)
br label %89
39: ; preds = %6
%40 = getelementptr inbounds i8*, i8** %1, i64 3
%41 = load i8*, i8** %40
%42 = tail call i32 @atoi(i8* %41)
%43 = tail call i32 @id_in_bounds(i32 %42, %struct.Connection* %12)
%44 = icmp eq i32 %0, 6
br i1 %44, label %47, label %45
45: ; preds = %39
%46 = tail call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), %struct.Connection* %12)
br label %47
47: ; preds = %45, %39
%48 = getelementptr inbounds i8*, i8** %1, i64 4
%49 = load i8*, i8** %48
%50 = getelementptr inbounds i8*, i8** %1, i64 5
%51 = load i8*, i8** %50
%52 = tail call i32 @Database_set(%struct.Connection* %12, i32 %42, i8* %49, i8* %51)
%53 = tail call i32 @Database_write(%struct.Connection* %12)
br label %89
54: ; preds = %6
%55 = getelementptr inbounds i8*, i8** %1, i64 3
%56 = load i8*, i8** %55
%57 = tail call i32 @atoi(i8* %56)
%58 = tail call i32 @id_in_bounds(i32 %57, %struct.Connection* %12)
%59 = icmp eq i32 %0, 4
br i1 %59, label %62, label %60
60: ; preds = %54
%61 = tail call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), %struct.Connection* %12)
br label %62
62: ; preds = %60, %54
%63 = tail call i32 @Database_delete(%struct.Connection* %12, i32 %57)
%64 = tail call i32 @Database_write(%struct.Connection* %12)
br label %89
65: ; preds = %6
%66 = tail call i32 @Database_list(%struct.Connection* %12)
br label %89
67: ; preds = %6
%68 = icmp eq i32 %0, 5
br i1 %68, label %71, label %69
69: ; preds = %67
%70 = tail call i32 @die(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), %struct.Connection* %12)
br label %71
71: ; preds = %69, %67
%72 = getelementptr inbounds i8*, i8** %1, i64 3
%73 = load i8*, i8** %72
%74 = tail call i32 @strcmp(i8* dereferenceable(1) %73, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %71
%77 = getelementptr inbounds i8*, i8** %1, i64 4
%78 = load i8*, i8** %77
%79 = tail call i32 @Database_find_by_name(%struct.Connection* %12, i8* %78)
br label %89
80: ; preds = %71
%81 = tail call i32 @strcmp(i8* dereferenceable(1) %73, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %89
83: ; preds = %80
%84 = getelementptr inbounds i8*, i8** %1, i64 4
%85 = load i8*, i8** %84
%86 = tail call i32 @Database_find_by_email(%struct.Connection* %12, i8* %85)
br label %89
87: ; preds = %6
%88 = tail call i32 @die(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.8, i64 0, i64 0), %struct.Connection* %12)
br label %89
89: ; preds = %76, %83, %80, %87, %65, %62, %47, %37, %18
%90 = tail call i32 @Database_close(%struct.Connection* %12)
ret i32 0
}