// File: eiskalteschatten[P]developersnotebook/src/models/AbstractSqliteModel.cpp
// Function: AbstractSqliteModel::abstract_save_all()
void AbstractSqliteModel::abstract_save_all() {
    try {
        if (!id) {
            insert_new_row();
        }

        std::string set = "";

        for (auto const &column : contents) {
            set.append(column.first);
            set.append("=\"");
            set.append(text_escape(column.second));
            set.append("\",");
        }

        if (set != "") {
            set = set.substr(0, set.size()-1); // Remove the dangling comma

            SqliteConnectionManager connection_manager;

            char *error_message = 0;
            int connection;
            std::string sql = "UPDATE " + table_schema->table_name +
                              " SET " + set +
                              " WHERE id=" + std::to_string(id) + ";";

            connection = sqlite3_exec(connection_manager.get_db(), sql.c_str(), NULL, 0, &error_message);

            if(connection != SQLITE_OK) {
                fprintf(stderr, "SQL error: %s\n", error_message);
                sqlite3_free(error_message);
            }
        }
        else {
            fprintf(stderr, "There are no contents to save!");
        }
    }
    catch(const std::exception& e) {
        fprintf(stderr, "An exception occured while trying to save to the database: %s\n", e.what());
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1c8(%rbp)
cmpl $0x0, 0x58(%rax)
jne 0x22d81
movq -0x1c8(%rbp), %rdi
callq 0x21500
jmp 0x22d6e
jmp 0x22d81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x2323e
leaq -0x39(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0xaf80
movq -0x1d0(%rbp), %rdx
leaq 0x30e86(%rip), %rsi     # 0x53c25
leaq -0x38(%rbp), %rdi
callq 0x10f00
jmp 0x22daa
leaq -0x39(%rbp), %rdi
callq 0xb410
movq -0x1c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x23570
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x19cf0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x235a0
testb $0x1, %al
jne 0x22df2
jmp 0x22ef4
leaq -0x50(%rbp), %rdi
callq 0x19d70
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xae00
jmp 0x22e0e
leaq 0x30d8b(%rip), %rsi     # 0x53ba0
leaq -0x38(%rbp), %rdi
callq 0xaa50
jmp 0x22e20
movq -0x60(%rbp), %rsi
addq $0x20, %rsi
leaq -0xa0(%rbp), %rdi
callq 0xa230
jmp 0x22e36
movq -0x1c8(%rbp), %rsi
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x21fd0
jmp 0x22e4f
leaq -0x38(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xae00
jmp 0x22e5e
leaq -0x80(%rbp), %rdi
callq 0xb430
leaq -0xa0(%rbp), %rdi
callq 0xb430
leaq 0x30d29(%rip), %rsi     # 0x53ba3
leaq -0x38(%rbp), %rdi
callq 0xaa50
jmp 0x22e85
jmp 0x22e87
leaq -0x50(%rbp), %rdi
callq 0x1ab50
jmp 0x22ddc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x39(%rbp), %rdi
callq 0xb410
jmp 0x2323e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x23235
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x22ee3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xb430
leaq -0xa0(%rbp), %rdi
callq 0xb430
jmp 0x23235
leaq 0x30d2a(%rip), %rsi     # 0x53c25
leaq -0x38(%rbp), %rdi
callq 0x19480
movb %al, -0x1d1(%rbp)
jmp 0x22f0c
movb -0x1d1(%rbp), %al
testb $0x1, %al
jne 0x22f1b
jmp 0x23212
leaq -0x38(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0xa530
movq -0x1e0(%rbp), %rsi
movq %rax, %rcx
decq %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0xc0(%rbp), %rdi
callq 0xafc0
jmp 0x22f4a
leaq -0x38(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movq %rsi, -0x1e8(%rbp)
callq 0xa820
movq -0x1e8(%rbp), %rdi
callq 0xb430
leaq -0xc8(%rbp), %rdi
callq 0x1cc70
jmp 0x22f7b
movq -0x1c8(%rbp), %rax
movq $0x0, -0xd0(%rbp)
movq 0x8(%rax), %rdx
leaq 0x30b4c(%rip), %rsi     # 0x53ae4
leaq -0x198(%rbp), %rdi
callq 0x110c0
jmp 0x22fa6
leaq 0x30b3f(%rip), %rdx     # 0x53aec
leaq -0x178(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x10eb0
jmp 0x22fc2
leaq -0x158(%rbp), %rdi
leaq -0x178(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x14a70
jmp 0x22fdb
leaq 0x30b15(%rip), %rdx     # 0x53af7
leaq -0x138(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x10eb0
jmp 0x22ff7
movq -0x1c8(%rbp), %rax
movl 0x58(%rax), %esi
leaq -0x1b8(%rbp), %rdi
callq 0x19050
jmp 0x2300f
leaq -0x118(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x1b8(%rbp), %rdx
callq 0x23350
jmp 0x2302b
leaq 0x30782(%rip), %rdx     # 0x537b4
leaq -0xf8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x10eb0
jmp 0x23047
leaq -0x118(%rbp), %rdi
callq 0xb430
leaq -0x1b8(%rbp), %rdi
callq 0xb430
leaq -0x138(%rbp), %rdi
callq 0xb430
leaq -0x158(%rbp), %rdi
callq 0xb430
leaq -0x178(%rbp), %rdi
callq 0xb430
leaq -0x198(%rbp), %rdi
callq 0xb430
leaq -0xc8(%rbp), %rdi
callq 0x1d940
movq %rax, -0x1f0(%rbp)
jmp 0x230a4
leaq -0xf8(%rbp), %rdi
callq 0xa1d0
movq -0x1f0(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0xd0(%rbp), %r8
movq %rcx, %rdx
callq 0xa0e0
movl %eax, -0x1f4(%rbp)
jmp 0x230d5
movl -0x1f4(%rbp), %eax
movl %eax, -0xd4(%rbp)
cmpl $0x0, -0xd4(%rbp)
je 0x231ea
movq 0x51e8b(%rip), %rax     # 0x74f80
movq (%rax), %rdi
movq -0xd0(%rbp), %rdx
leaq 0x306b0(%rip), %rsi     # 0x537b6
xorl %eax, %eax
callq 0xa320
movq -0xd0(%rbp), %rdi
callq 0xb360
jmp 0x2311b
jmp 0x231ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x23204
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x231c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x231b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x231aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x2319e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x23192
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x118(%rbp), %rdi
callq 0xb430
leaq -0x1b8(%rbp), %rdi
callq 0xb430
leaq -0x138(%rbp), %rdi
callq 0xb430
leaq -0x158(%rbp), %rdi
callq 0xb430
leaq -0x178(%rbp), %rdi
callq 0xb430
leaq -0x198(%rbp), %rdi
callq 0xb430
jmp 0x23204
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0xb430
jmp 0x23204
leaq -0xf8(%rbp), %rdi
callq 0xb430
leaq -0xc8(%rbp), %rdi
callq 0x1ccf0
jmp 0x2322a
leaq -0xc8(%rbp), %rdi
callq 0x1ccf0
jmp 0x23235
movq 0x51d67(%rip), %rax     # 0x74f80
movq (%rax), %rdi
leaq 0x30983(%rip), %rsi     # 0x53ba6
movb $0x0, %al
callq 0xa320
leaq -0x38(%rbp), %rdi
callq 0xb430
jmp 0x23295
leaq -0x38(%rbp), %rdi
callq 0xb430
movl -0x14(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2329e
movq -0x10(%rbp), %rdi
callq 0xa0b0
movq %rax, -0x1c0(%rbp)
movq 0x51d1f(%rip), %rax     # 0x74f80
movq (%rax), %rax
movq %rax, -0x200(%rbp)
movq -0x1c0(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x200(%rbp), %rdi
movq %rax, %rdx
leaq 0x3081c(%rip), %rsi     # 0x53aa5
movb $0x0, %al
callq 0xa320
callq 0xac00
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0xaa00
nopw (%rax,%rax)