user: Please show me the C implementation that matches the assembly code listed below:

```asm
<db_initialization>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x40(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  lea    D24(%rip),%rcx
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <join_strings@plt>
  mov    -0x40(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  lea    D4(%rip),%rcx
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <join_strings@plt>
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <file_exists@plt>
  test   %rax,%rax
  je     L23
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <unlink@plt>
L23:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <file_exists@plt>
  test   %rax,%rax
  je     L49
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  lea    -0x14(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x14(%rbp),%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <file_copy@plt>
L49:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x28(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <sqlite3_open@plt>
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    -0x10(%rbp),%rdx
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  lea    D30(%rip),%rsi
  mov    %rax,%rdi
  call   <sqlite3_exec@plt>
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  je     L25
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_free@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L25:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    -0x10(%rbp),%rdx
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  lea    D23(%rip),%rsi
  mov    %rax,%rdi
  call   <sqlite3_exec@plt>
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  je     L14
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_free@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L14:
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L8
  call   <__stack_chk_fail@plt>
L8:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D24
data_type: string
name: retrieve_data
arguments: data_tag: D4
data_type: string
name: retrieve_data
arguments: data_tag: D30
data_type: string
name: retrieve_data
arguments: data_tag: D10
data_type: string
name: retrieve_data
arguments: data_tag: D23
data_type: string

tool: D24: mnemon.db

tool: D4: _mnemon.db

tool: D30: CREATE TABLE IF NOT EXISTS file ( inode INT NOT NULL PRIMARY KEY, path TEXT NOT NULL, mtime VARCHAR(255) NOT NULL )

tool: D10: %s


tool: D23: CREATE TABLE IF NOT EXISTS backup ( timestamp INT NOT NULL PRIMARY KEY, directory VARCHAR(255) NOT NULL, total_files INT NOT NULL, total_bytes INT NOT NULL, added_files INT NOT NULL, added_bytes INT NOT NULL )

assistant: ```c
int db_initialization(sqlite3 **db, char **db_filename, char **db_temp_filename, char *path) {
  char *error;
  struct stat stats;
  join_strings(db_filename, 2, path, "mnemon.db");
  join_strings(db_temp_filename, 2, path, "_mnemon.db");
  if (file_exists(*db_temp_filename))
    unlink(*db_temp_filename);
  if (file_exists(*db_filename)) {
    stat(*db_filename, &stats);
    file_copy(*db_filename, *db_temp_filename, stats);
  }
  sqlite3_open(*db_temp_filename, db);
  sqlite3_exec(*db, "CREATE TABLE IF NOT EXISTS file ( inode INT NOT NULL PRIMARY KEY, path TEXT NOT NULL, mtime VARCHAR(255) NOT NULL )", NULL, NULL, &error);
  if (error != NULL) {
    printf("%s\n", error);
    sqlite3_free(error);
    exit(-1);
  }
  sqlite3_exec(*db, "CREATE TABLE IF NOT EXISTS backup ( timestamp INT NOT NULL PRIMARY KEY, directory VARCHAR(255) NOT NULL, total_files INT NOT NULL, total_bytes INT NOT NULL, added_files INT NOT NULL, added_bytes INT NOT NULL )", NULL, NULL, &error);
  if (error != NULL) {
    printf("%s\n", error);
    sqlite3_free(error);
    exit(-1);
  }
  return 0;
}
```