// File: eiskalteschatten[P]developersnotebook/src/models/AbstractSqliteModel.cpp
// Function: AbstractSqliteModel::select_query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void AbstractSqliteModel::select_query(std::string sql) {
    try {
        SqliteConnectionManager connection_manager;

        int connection;
        sqlite3_stmt *stmt;

        connection = sqlite3_prepare_v2(connection_manager.get_db(), sql.c_str(), -1, &stmt, NULL);

        if(connection != SQLITE_OK) {
            fprintf(stderr, "SQL error: %s\n", sqlite3_errmsg(connection_manager.get_db()));
        }

        while ((connection = sqlite3_step(stmt)) == SQLITE_ROW) {
            tableRowMap row;

            for (int i = 0; i < sqlite3_column_count(stmt); i++) {
                std::string column_name = std::string(reinterpret_cast<const char*>(sqlite3_column_name(stmt, i)));
                std::string column_text = std::string(reinterpret_cast<const char*>(sqlite3_column_text(stmt, i)));
                row[column_name]        = column_text;
            }

            full_table.push_back(row);
        }

        sqlite3_finalize(stmt);

        fill_model();
    }
    catch(const std::exception& e) {
        fprintf(stderr, "An exception occured while trying to set up the database: %s\n", e.what());
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rsi, -0xd0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x1cc70
jmp 0x22440
leaq -0x18(%rbp), %rdi
callq 0x1d940
movq %rax, -0xd8(%rbp)
jmp 0x22452
movq -0xd0(%rbp), %rdi
callq 0xa1d0
movq -0xd8(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %r8d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq -0x30(%rbp), %rcx
callq 0xacb0
movl %eax, -0xdc(%rbp)
jmp 0x22483
movl -0xdc(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x2250a
movq 0x52ae7(%rip), %rax     # 0x74f80
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x1d940
movq %rax, -0xe8(%rbp)
jmp 0x224b5
movq -0xe8(%rbp), %rdi
callq 0xb2e0
movq %rax, -0xf8(%rbp)
jmp 0x224ca
movq -0xf8(%rbp), %rdx
movq -0xf0(%rbp), %rdi
leaq 0x312d7(%rip), %rsi     # 0x537b6
movb $0x0, %al
callq 0xa320
jmp 0x2250a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x22739
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x22730
jmp 0x2250c
movq -0x30(%rbp), %rdi
callq 0xa440
movl %eax, -0xfc(%rbp)
jmp 0x2251d
movl -0xfc(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x64, %eax
jne 0x22709
leaq -0x60(%rbp), %rdi
callq 0x19360
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x104(%rbp)
movq -0x30(%rbp), %rdi
callq 0xb060
movl %eax, -0x100(%rbp)
jmp 0x22559
movl -0x104(%rbp), %eax
movl -0x100(%rbp), %ecx
cmpl %ecx, %eax
jge 0x226da
movq -0x30(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0xaaa0
movq %rax, -0x110(%rbp)
jmp 0x22582
leaq -0x89(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xaf80
movq -0x110(%rbp), %rsi
movq -0x118(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0x10f00
jmp 0x225b1
leaq -0x89(%rbp), %rdi
callq 0xb410
movq -0x30(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0xa150
movq %rax, -0x120(%rbp)
jmp 0x225d2
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0xaf80
movq -0x120(%rbp), %rsi
movq -0x128(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
callq 0x10f00
jmp 0x22601
leaq -0xb1(%rbp), %rdi
callq 0xb410
leaq -0x60(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x23420
movq %rax, -0x130(%rbp)
jmp 0x22626
movq -0x130(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xb240
jmp 0x2263b
leaq -0xb0(%rbp), %rdi
callq 0xb430
leaq -0x88(%rbp), %rdi
callq 0xb430
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2253f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x226fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x89(%rbp), %rdi
callq 0xb410
jmp 0x226fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x226cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xb1(%rbp), %rdi
callq 0xb410
jmp 0x226cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xb430
leaq -0x88(%rbp), %rdi
callq 0xb430
jmp 0x226fe
movq -0xc8(%rbp), %rdi
addq $0x40, %rdi
leaq -0x60(%rbp), %rsi
callq 0x23500
jmp 0x226f0
leaq -0x60(%rbp), %rdi
callq 0x19460
jmp 0x2250c
leaq -0x60(%rbp), %rdi
callq 0x19460
jmp 0x22730
movq -0x30(%rbp), %rdi
callq 0xad50
jmp 0x22714
movq -0xc8(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
jmp 0x22725
leaq -0x18(%rbp), %rdi
callq 0x1ccf0
jmp 0x22790
leaq -0x18(%rbp), %rdi
callq 0x1ccf0
movl -0x24(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x22799
movq -0x20(%rbp), %rdi
callq 0xa0b0
movq %rax, -0xc0(%rbp)
movq 0x52824(%rip), %rax     # 0x74f80
movq (%rax), %rax
movq %rax, -0x138(%rbp)
movq -0xc0(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x138(%rbp), %rdi
movq %rax, %rdx
leaq 0x31062(%rip), %rsi     # 0x537e6
movb $0x0, %al
callq 0xa320
callq 0xac00
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0xaa00
nopw %cs:(%rax,%rax)