#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 sockaddr_storage {
  int dummy;
};
struct sockaddr {
  int dummy;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  int /*<<< orphan*/ ai_flags;
};
typedef int /*<<< orphan*/ sqlite3;
typedef int socklen_t;
typedef int /*<<< orphan*/ remote_address;
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AI_PASSIVE;
int EXIT_SUCCESS;
int /*<<< orphan*/ SOCK_STREAM;
int SQLITE_OK;
int accept(int, struct sockaddr *, int *);
int bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ createTable(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int getaddrinfo(int /*<<< orphan*/ *, char *, struct addrinfo *,
                struct addrinfo **);
int /*<<< orphan*/ insertAddress(int /*<<< orphan*/ *,
                                 struct sockaddr_storage *);
char *ipToString(struct sockaddr_storage *);
int listen(int, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sqlite3_close(int /*<<< orphan*/ *);
char *sqlite3_errmsg(int /*<<< orphan*/ *);
int sqlite3_open(char *, int /*<<< orphan*/ **);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  sqlite3 *database;
  int result = sqlite3_open("database.sqlite", &database);
  if (result == SQLITE_OK) {
    createTable(database);
    struct addrinfo hints;
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_INET;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_flags = AI_PASSIVE;
    struct addrinfo *address;
    if (getaddrinfo(NULL, "12345", &hints, &address) == -1) {
    } else {
      int sock = socket(address->ai_family, address->ai_socktype,
                        address->ai_protocol);
      if (sock == -1) {
        fputs("Failed to create socket.\n", stderr);
      } else {
        if (bind(sock, address->ai_addr, address->ai_addrlen) == -1) {
          fputs("Failed to bind socket to port.\n", stderr);
        } else if (listen(sock, 16) == -1) {
          fputs("Failed to listen to socket.\n", stderr);
        } else {
          while (true) {
            struct sockaddr_storage remote_address;
            socklen_t remote_address_size = sizeof(remote_address);
            int remote = accept(sock, (struct sockaddr *)&remote_address,
                                &remote_address_size);
            if (remote == -1) {
              fputs("Failed to accept remote connection.\n", stderr);
            } else {
              char *address_string = ipToString(&remote_address);
              printf("Received connection from %s\n", address_string);
              insertAddress(database, &remote_address);
              free(address_string);
              close(remote);
            }
          }
        }
        close(sock);
      }
      freeaddrinfo(address);
    }
    sqlite3_close(database);
  } else {
    const char *error = sqlite3_errmsg(database);
    fprintf(stderr, "SQLite encountered an error: %s\n", error);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xdc3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <sqlite3_open@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2d85(%rip),%rcx
cmp    (%rcx),%eax
jne    140e <main+0x1ee>
mov    -0x18(%rbp),%rdi
call   1110 <createTable@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
mov    0x2d65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd6d(%rip),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1120 <getaddrinfo@plt>
cmp    $0xffffffff,%eax
jne    12be <main+0x9e>
jmp    1400 <main+0x1e0>
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x40(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%edx
call   1140 <socket@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0xffffffff,-0x44(%rbp)
jne    12ff <main+0xdf>
mov    0x2cdc(%rip),%rax
mov    (%rax),%esi
lea    0xd21(%rip),%rdi
call   1070 <fputs@plt>
jmp    13f7 <main+0x1d7>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1337 <main+0x117>
mov    0x2ca4(%rip),%rax
mov    (%rax),%esi
lea    0xd03(%rip),%rdi
call   1070 <fputs@plt>
jmp    13ef <main+0x1cf>
mov    -0x44(%rbp),%edi
mov    $0x10,%esi
call   10d0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1367 <main+0x147>
mov    0x2c74(%rip),%rax
mov    (%rax),%esi
lea    0xcf3(%rip),%rdi
call   1070 <fputs@plt>
jmp    13ea <main+0x1ca>
jmp    136c <main+0x14c>
movl   $0x4,-0x4c(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   1100 <accept@plt>
mov    %eax,-0x50(%rbp)
cmpl   $0xffffffff,-0x50(%rbp)
jne    13aa <main+0x18a>
mov    0x2c31(%rip),%rax
mov    (%rax),%esi
lea    0xccd(%rip),%rdi
call   1070 <fputs@plt>
jmp    13e5 <main+0x1c5>
lea    -0x48(%rbp),%rdi
call   1050 <ipToString@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xcd0(%rip),%rdi
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   10f0 <insertAddress@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%edi
call   1090 <close@plt>
jmp    136c <main+0x14c>
jmp    13ef <main+0x1cf>
mov    -0x44(%rbp),%edi
call   1090 <close@plt>
mov    -0x40(%rbp),%rdi
call   1130 <freeaddrinfo@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <sqlite3_close@plt>
jmp    1434 <main+0x214>
mov    -0x18(%rbp),%rdi
call   10a0 <sqlite3_errmsg@plt>
mov    %rax,-0x60(%rbp)
mov    0x2ba6(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%rdx
lea    0xc80(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x2b7d(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xdcb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <sqlite3_open@plt>
mov    0x2d92(%rip),%rcx
mov    0x8(%rsp),%rdi
cmp    (%rcx),%eax
jne    1386 <main+0x166>
call   1110 <createTable@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2d40(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x34(%rsp)
lea    0xd76(%rip),%rsi
mov    %rsp,%rcx
xor    %edi,%edi
mov    %rbx,%rdx
call   1120 <getaddrinfo@plt>
cmp    $0xffffffff,%eax
je     13eb <main+0x1cb>
mov    (%rsp),%rax
mov    0x10(%rax),%edi
mov    0x8(%rax),%edx
mov    0xc(%rax),%esi
call   1140 <socket@plt>
cmp    $0xffffffff,%eax
je     13a5 <main+0x185>
mov    %eax,%r13d
mov    (%rsp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %r13d,%edi
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
je     13bc <main+0x19c>
mov    %r13d,%edi
mov    $0x10,%esi
call   10d0 <listen@plt>
cmp    $0xffffffff,%eax
je     13c5 <main+0x1a5>
lea    0x18(%rsp),%rbx
lea    0x14(%rsp),%r14
lea    0xd83(%rip),%r12
jmp    1335 <main+0x115>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2ca1(%rip),%rax
mov    (%rax),%esi
lea    0xd3d(%rip),%rdi
call   1070 <fputs@plt>
movl   $0x4,0x14(%rsp)
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1100 <accept@plt>
cmp    $0xffffffff,%eax
je     1320 <main+0x100>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <ipToString@plt>
mov    %rax,%r15
mov    %r12,%rdi
mov    %rax,%rsi
call   1060 <printf@plt>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   10f0 <insertAddress@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %ebp,%edi
call   1090 <close@plt>
jmp    1335 <main+0x115>
call   10a0 <sqlite3_errmsg@plt>
mov    0x2c36(%rip),%rcx
mov    (%rcx),%edi
lea    0xd14(%rip),%rsi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
jmp    13f5 <main+0x1d5>
mov    0x2c1c(%rip),%rax
mov    (%rax),%esi
lea    0xc61(%rip),%rdi
call   1070 <fputs@plt>
jmp    13e2 <main+0x1c2>
lea    0xc6d(%rip),%rdi
jmp    13cc <main+0x1ac>
lea    0xc84(%rip),%rdi
mov    0x2bf5(%rip),%rax
mov    (%rax),%esi
call   1070 <fputs@plt>
mov    %r13d,%edi
call   1090 <close@plt>
mov    (%rsp),%rdi
call   1130 <freeaddrinfo@plt>
mov    0x8(%rsp),%rdi
call   10c0 <sqlite3_close@plt>
mov    0x2bbc(%rip),%rax
mov    (%rax),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [16 x i8] c"database.sqlite\00"
@SQLITE_OK = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.1 = [6 x i8] c"12345\00"
@.str.2 = [26 x i8] c"Failed to create socket.\0A\00"
@stderr = global i32 0
@.str.3 = [32 x i8] c"Failed to bind socket to port.\0A\00"
@.str.4 = [29 x i8] c"Failed to listen to socket.\0A\00"
@.str.5 = [37 x i8] c"Failed to accept remote connection.\0A\00"
@.str.6 = [29 x i8] c"Received connection from %s\0A\00"
@.str.7 = [33 x i8] c"SQLite encountered an error: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca %struct.addrinfo
%9 = alloca %struct.addrinfo*
%10 = alloca i32
%11 = alloca %struct.sockaddr_storage
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = call i32 @sqlite3_open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32** %6)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = load i32, i32* @SQLITE_OK
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %100
20: ; preds = %2
%21 = load i32*, i32** %6
%22 = call i32 @createTable(i32* %21)
%23 = call i32 @memset(%struct.addrinfo* %8, i32 0, i32 24)
%24 = load i32, i32* @AF_INET
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 4
store i32 %24, i32* %25
%26 = load i32, i32* @SOCK_STREAM
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 3
store i32 %26, i32* %27
%28 = load i32, i32* @AI_PASSIVE
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 5
store i32 %28, i32* %29
%30 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %8, %struct.addrinfo** %9)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %33
32: ; preds = %20
br label %97
33: ; preds = %20
%34 = load %struct.addrinfo*, %struct.addrinfo** %9
%35 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i32 0, i32 4
%36 = load i32, i32* %35
%37 = load %struct.addrinfo*, %struct.addrinfo** %9
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %37, i32 0, i32 3
%39 = load i32, i32* %38
%40 = load %struct.addrinfo*, %struct.addrinfo** %9
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i32 0, i32 2
%42 = load i32, i32* %41
%43 = call i32 @socket(i32 %36, i32 %39, i32 %42)
store i32 %43, i32* %10
%44 = load i32, i32* %10
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %49
46: ; preds = %33
%47 = load i32, i32* @stderr
%48 = call i32 @fputs(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %94
49: ; preds = %33
%50 = load i32, i32* %10
%51 = load %struct.addrinfo*, %struct.addrinfo** %9
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %51, i32 0, i32 1
%53 = load i32, i32* %52
%54 = load %struct.addrinfo*, %struct.addrinfo** %9
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i32 0, i32 0
%56 = load i32, i32* %55
%57 = call i32 @bind(i32 %50, i32 %53, i32 %56)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %62
59: ; preds = %49
%60 = load i32, i32* @stderr
%61 = call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %60)
br label %91
62: ; preds = %49
%63 = load i32, i32* %10
%64 = call i32 @listen(i32 %63, i32 16)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %67)
br label %90
69: ; preds = %62
br label %70
70: ; preds = %69, %89
store i32 4, i32* %12
%71 = load i32, i32* %10
%72 = bitcast %struct.sockaddr_storage* %11 to %struct.sockaddr*
%73 = call i32 @accept(i32 %71, %struct.sockaddr* %72, i32* %12)
store i32 %73, i32* %13
%74 = load i32, i32* %13
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %79
76: ; preds = %70
%77 = load i32, i32* @stderr
%78 = call i32 @fputs(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %77)
br label %89
79: ; preds = %70
%80 = call i8* @ipToString(%struct.sockaddr_storage* %11)
store i8* %80, i8** %14
%81 = load i8*, i8** %14
%82 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %81)
%83 = load i32*, i32** %6
%84 = call i32 @insertAddress(i32* %83, %struct.sockaddr_storage* %11)
%85 = load i8*, i8** %14
%86 = call i32 @free(i8* %85)
%87 = load i32, i32* %13
%88 = call i32 @close(i32 %87)
br label %89
89: ; preds = %79, %76
br label %70
90: ; preds = %66
br label %91
91: ; preds = %90, %59
%92 = load i32, i32* %10
%93 = call i32 @close(i32 %92)
br label %94
94: ; preds = %91, %46
%95 = load %struct.addrinfo*, %struct.addrinfo** %9
%96 = call i32 @freeaddrinfo(%struct.addrinfo* %95)
br label %97
97: ; preds = %94, %32
%98 = load i32*, i32** %6
%99 = call i32 @sqlite3_close(i32* %98)
br label %106
100: ; preds = %2
%101 = load i32*, i32** %6
%102 = call i8* @sqlite3_errmsg(i32* %101)
store i8* %102, i8** %15
%103 = load i32, i32* @stderr
%104 = load i8*, i8** %15
%105 = call i32 @fprintf(i32 %103, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %104)
br label %106
106: ; preds = %100, %97
%107 = load i32, i32* @EXIT_SUCCESS
ret i32 %107
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [16 x i8] c"database.sqlite\00"
@SQLITE_OK = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.1 = [6 x i8] c"12345\00"
@.str.2 = [26 x i8] c"Failed to create socket.\0A\00"
@stderr = global i32 0
@.str.3 = [32 x i8] c"Failed to bind socket to port.\0A\00"
@.str.4 = [29 x i8] c"Failed to listen to socket.\0A\00"
@.str.5 = [37 x i8] c"Failed to accept remote connection.\0A\00"
@.str.6 = [29 x i8] c"Received connection from %s\0A\00"
@.str.7 = [33 x i8] c"SQLite encountered an error: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32*
%4 = alloca %struct.addrinfo
%5 = alloca %struct.addrinfo*
%6 = alloca %struct.sockaddr_storage
%7 = alloca i32
%8 = bitcast i32** %3 to i8*
%9 = call i32 @sqlite3_open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32** %3)
%10 = load i32, i32* @SQLITE_OK
%11 = icmp eq i32 %9, %10
%12 = load i32*, i32** %3
br i1 %11, label %13, label %79
13: ; preds = %2
%14 = call i32 @createTable(i32* %12)
%15 = bitcast %struct.addrinfo* %4 to i8*
%16 = call i32 @memset(%struct.addrinfo* %4, i32 0, i32 24)
%17 = load i32, i32* @AF_INET
%18 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 4
store i32 %17, i32* %18
%19 = load i32, i32* @SOCK_STREAM
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 3
store i32 %19, i32* %20
%21 = load i32, i32* @AI_PASSIVE
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 5
store i32 %21, i32* %22
%23 = bitcast %struct.addrinfo** %5 to i8*
%24 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %4, %struct.addrinfo** %5)
%25 = icmp eq i32 %24, -1
br i1 %25, label %76, label %26
26: ; preds = %13
%27 = load %struct.addrinfo*, %struct.addrinfo** %5
%28 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 4
%29 = load i32, i32* %28
%30 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 3
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i64 0, i32 2
%33 = load i32, i32* %32
%34 = call i32 @socket(i32 %29, i32 %31, i32 %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %39
36: ; preds = %26
%37 = load i32, i32* @stderr
%38 = call i32 @fputs(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %37)
br label %73
39: ; preds = %26
%40 = load %struct.addrinfo*, %struct.addrinfo** %5
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 1
%42 = load i32, i32* %41
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 0
%44 = load i32, i32* %43
%45 = call i32 @bind(i32 %34, i32 %42, i32 %44)
%46 = icmp eq i32 %45, -1
br i1 %46, label %68, label %47
47: ; preds = %39
%48 = call i32 @listen(i32 %34, i32 16)
%49 = icmp eq i32 %48, -1
br i1 %49, label %68, label %50
50: ; preds = %47
%51 = bitcast %struct.sockaddr_storage* %6 to i8*
%52 = bitcast i32* %7 to i8*
%53 = bitcast %struct.sockaddr_storage* %6 to %struct.sockaddr*
br label %54
54: ; preds = %50, %67
store i32 4, i32* %7
%55 = call i32 @accept(i32 %34, %struct.sockaddr* %53, i32* %7)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = call i32 @fputs(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %58)
br label %67
60: ; preds = %54
%61 = call i8* @ipToString(%struct.sockaddr_storage* %6)
%62 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %61)
%63 = load i32*, i32** %3
%64 = call i32 @insertAddress(i32* %63, %struct.sockaddr_storage* %6)
%65 = call i32 @free(i8* %61)
%66 = call i32 @close(i32 %55)
br label %67
67: ; preds = %60, %57
br label %54
68: ; preds = %47, %39
%69 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), %39 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), %47 ]
%70 = load i32, i32* @stderr
%71 = call i32 @fputs(i8* %69, i32 %70)
%72 = call i32 @close(i32 %34)
br label %73
73: ; preds = %68, %36
%74 = load %struct.addrinfo*, %struct.addrinfo** %5
%75 = call i32 @freeaddrinfo(%struct.addrinfo* %74)
br label %76
76: ; preds = %13, %73
%77 = load i32*, i32** %3
%78 = call i32 @sqlite3_close(i32* %77)
br label %83
79: ; preds = %2
%80 = call i8* @sqlite3_errmsg(i32* %12)
%81 = load i32, i32* @stderr
%82 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %80)
br label %83
83: ; preds = %79, %76
%84 = load i32, i32* @EXIT_SUCCESS
ret i32 %84
}