user: 请将以下的汇编代码转换成C语言代码:

```asm
<sqlite_swap>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  mov    -0x48(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,%rcx
  mov    %rax,%rdx
  lea    D71(%rip),%rax
  mov    %rax,%rsi
  mov    $0x3,%edi
  mov    $0x0,%eax
  call   <logprintf@plt>
  mov    -0x38(%rbp),%rax
  lea    D63(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <database_prepare@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  lea    D58(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <database_prepare@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L217
  cmpq   $0x0,-0x8(%rbp)
  je     L217
  mov    -0x40(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <sqlite3_bind_int@plt>
  test   %rax,%rax
  je     L111
L217:
  lea    D84(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <logprintf@plt>
  mov    $0xffffffff,%eax
  jmp    L91
L111:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_step@plt>
  cmp    $0x80,%eax
  je     L135
  cmp    $0x82,%eax
  je     L191
  jmp    L194
L135:
  mov    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <sqlite3_column_text@plt>
  mov    %rax,%rdi
  call   <common_strdup@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x10(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <sqlite3_column_text@plt>
  mov    %rax,%rdi
  call   <common_strdup@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x10(%rbp),%rax
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <sqlite3_column_text@plt>
  test   %rax,%rax
  je     L210
  mov    -0x10(%rbp),%rax
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <sqlite3_column_text@plt>
  mov    %rax,%rdi
  call   <common_strdup@plt>
  mov    %rax,-0x18(%rbp)
L210:
  cmpq   $0x0,-0x28(%rbp)
  je     L67
  cmpq   $0x0,-0x20(%rbp)
  jne    L215
L67:
  movl   $0x13,-0x2c(%rbp)
  jmp    L215
L191:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdx
  lea    D30(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <logprintf@plt>
  movl   $0x14,-0x2c(%rbp)
  jmp    L174
L194:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_errmsg@plt>
  mov    %rax,%rdx
  lea    D72(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <logprintf@plt>
  jmp    L174
L215:
  nop
L174:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_finalize@plt>
  cmpl   $0x0,-0x2c(%rbp)
  jne    L206
  mov    -0x38(%rbp),%rax
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  lea    D37(%rip),%rsi
  mov    %rax,%rdi
  call   <sqlite3_exec@plt>
  mov    -0x40(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <sqlite_delete_address@plt>
  test   %rax,%rax
  je     L220
  movl   $0x15,-0x2c(%rbp)
L220:
  cmpl   $0x0,-0x2c(%rbp)
  jne    L54
  mov    -0x40(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <sqlite3_bind_int@plt>
  cmp    $0x81,%rax
  jne    L249
  mov    -0x48(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <sqlite3_bind_int@plt>
  cmp    $0x81,%rax
  je     L54
L249:
  movl   $0x16,-0x2c(%rbp)
L54:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_step@plt>
  sub    $0x81,%eax
  cmp    $0x1,%eax
  jbe    L221
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_errmsg@plt>
  mov    %rax,%rdx
  lea    D48(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <logprintf@plt>
  movl   $0x17,-0x2c(%rbp)
  jmp    L178
L221:
  nop
L178:
  cmpl   $0x0,-0x2c(%rbp)
  jne    L219
  mov    -0x18(%rbp),%rdi
  mov    -0x20(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x28(%rbp),%rsi
  mov    -0x38(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <sqlite_add_address_order@plt>
  test   %rax,%rax
  je     L219
  movl   $0x18,-0x2c(%rbp)
L219:
  cmpl   $0x0,-0x2c(%rbp)
  je     L262
  mov    -0x38(%rbp),%rax
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  lea    D18(%rip),%rsi
  mov    %rax,%rdi
  call   <sqlite3_exec@plt>
  jmp    L206
L262:
  mov    -0x38(%rbp),%rax
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  lea    D28(%rip),%rsi
  mov    %rax,%rdi
  call   <sqlite3_exec@plt>
L206:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_finalize@plt>
  cmpq   $0x0,-0x28(%rbp)
  je     L266
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L266:
  cmpq   $0x0,-0x20(%rbp)
  je     L208
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L208:
  cmpq   $0x0,-0x18(%rbp)
  je     L162
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L162:
  mov    -0x2c(%rbp),%eax
L91:
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D71
datatype: string
name: parse_data
arguments: tag: D63
datatype: string
name: parse_data
arguments: tag: D58
datatype: string
name: parse_data
arguments: tag: D84
datatype: string
name: parse_data
arguments: tag: D30
datatype: string
name: parse_data
arguments: tag: D72
datatype: string
name: parse_data
arguments: tag: D37
datatype: string
name: parse_data
arguments: tag: D48
datatype: string
name: parse_data
arguments: tag: D18
datatype: string
name: parse_data
arguments: tag: D28
datatype: string

tool: D71: order1: %d, order2: %d


tool: D63: SELECT address_expression, address_router, address_route FROM addresses WHERE address_order = ?;

tool: D58: UPDATE addresses SET address_order = ? WHERE address_order = ?;

tool: D84: Failed to prepare or bind statement


tool: D30: No expression with order %d


tool: D72: Unhandled failure: %s


tool: D37: BEGIN TRANSACTION

tool: D48: Failed to update address record: %s


tool: D18: ROLLBACK

tool: D28: COMMIT

assistant: ```c
int sqlite_swap(sqlite3 *db, long first, long second) {
  int status = 0;
  char *expression = NULL;
  char *router = NULL;
  char *route = NULL;
  logprintf(3, "order1: %d, order2: %d\n", first, second);
  sqlite3_stmt *fetch = database_prepare(db, "SELECT address_expression, address_router, address_route FROM addresses WHERE address_order = ?;");
  sqlite3_stmt *update = database_prepare(db, "UPDATE addresses SET address_order = ? WHERE address_order = ?;");
  if (!fetch || !update || sqlite3_bind_int(fetch, 1, first)) {
    logprintf(0, "Failed to prepare or bind statement\n");
    return -1;
  }
  switch (sqlite3_step(fetch)) {
  case SQLITE_ROW:
    expression = common_strdup((char *)sqlite3_column_text(fetch, 0));
    router = common_strdup((char *)sqlite3_column_text(fetch, 1));
    if (sqlite3_column_text(fetch, 2)) {
      route = common_strdup((char *)sqlite3_column_text(fetch, 2));
    }
    if (!expression || !router) {
      status = 19;
    }
    break;
  case SQLITE_DONE:
    logprintf(0, "No expression with order %d\n", first);
    status = 20;
    break;
  default:
    logprintf(0, "Unhandled failure: %s\n", sqlite3_errmsg(db));
    break;
  }
  sqlite3_finalize(fetch);
  if (!status) {
    sqlite3_exec(db, "BEGIN TRANSACTION", NULL, NULL, NULL);
    if (sqlite_delete_address(db, first) != 0) {
      status = 21;
    }
    if (!status && (sqlite3_bind_int(update, 1, first) != SQLITE_OK || sqlite3_bind_int(update, 2, second) != SQLITE_OK)) {
      status = 22;
    }
    switch (sqlite3_step(update)) {
    case SQLITE_DONE:
    case SQLITE_OK:
      break;
    default:
      logprintf(0, "Failed to update address record: %s\n", sqlite3_errmsg(db));
      status = 23;
      break;
    }
    if (!status && sqlite_add_address_order(db, expression, second, router, route) != 0) {
      status = 24;
    }
    if (status) {
      sqlite3_exec(db, "ROLLBACK", NULL, NULL, NULL);
    } else {
      sqlite3_exec(db, "COMMIT", NULL, NULL, NULL);
    }
  }
  sqlite3_finalize(update);
  if (expression) {
    free(expression);
  }
  if (router) {
    free(router);
  }
  if (route) {
    free(route);
  }
  return status;
}
```