user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%r12d
  mov    %rsi,%rbx
  cmp    $0x2,%edi
  jle    L138
  mov    0x10(%rsi),%rax
  movzbl (%rax),%r13d
  movsbl %r13b,%esi
  mov    0x8(%rbx),%rdi
  call   <Database_open@plt>
  mov    %rax,%rbp
  mov    $0x0,%r14d
  cmp    $0x3,%r12d
  jg     L81
L12:
  sub    $0x63,%r13d
  cmp    $0x10,%r13b
  ja     L102
  movzbl %r13b,%r13d
  lea    D79(%rip),%rdx
  movslq (%rdx,%r13,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
L138:
  lea    D26(%rip),%rdi
  call   <die@plt>
  mov    0x10(%rbx),%rax
  movzbl (%rax),%r13d
  movsbl %r13b,%esi
  mov    0x8(%rbx),%rdi
  call   <Database_open@plt>
  mov    %rax,%rbp
  sub    $0x63,%r13d
  cmp    $0x10,%r13b
  ja     L102
  movzbl %r13b,%r13d
  lea    D65(%rip),%rdx
  movslq (%rdx,%r13,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
L81:
  mov    0x18(%rbx),%rdi
  call   <atoi@plt>
  mov    %eax,%r14d
  cmp    $0x63,%eax
  jle    L12
  lea    D23(%rip),%rdi
  call   <die@plt>
  jmp    L12
  mov    %rbp,%rdi
  call   <Database_create@plt>
  mov    %rbp,%rdi
  call   <Database_write@plt>
L86:
  mov    %rbp,%rdi
  call   <Database_close@plt>
  mov    $0x0,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  mov    $0x0,%r14d
  cmp    $0x4,%r12d
  jne    L83
L159:
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <Database_get@plt>
  jmp    L86
L83:
  lea    D29(%rip),%rdi
  call   <die@plt>
  jmp    L159
  mov    $0x0,%r14d
  cmp    $0x6,%r12d
  jne    L115
L1:
  mov    0x28(%rbx),%rcx
  mov    0x20(%rbx),%rdx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <Database_set@plt>
  mov    %rbp,%rdi
  call   <Database_write@plt>
  jmp    L86
L115:
  lea    D67(%rip),%rdi
  call   <die@plt>
  jmp    L1
  cmp    $0x4,%r12d
  jne    L114
L57:
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <Database_delete@plt>
  mov    %rbp,%rdi
  call   <Database_write@plt>
  jmp    L86
  mov    $0x0,%r14d
L114:
  lea    D57(%rip),%rdi
  call   <die@plt>
  jmp    L57
  mov    %rbp,%rdi
  call   <Database_list@plt>
  jmp    L86
L102:
  lea    D16(%rip),%rdi
  call   <die@plt>
  jmp    L86
```

tool_calls: name: read_data
arguments: label: D26
type_guessed: string
name: read_data
arguments: label: D23
type_guessed: string
name: read_data
arguments: label: D29
type_guessed: string
name: read_data
arguments: label: D67
type_guessed: string
name: read_data
arguments: label: D57
type_guessed: string
name: read_data
arguments: label: D16
type_guessed: string

tool: D26: USAGE: ex17 <dbfile> <action> [action params]

tool: D23: There's not that many records.

tool: D29: Need an ID to get.

tool: D67: Need ID, name and email to set.

tool: D57: Need an ID to delete.

tool: D16: Invalid action, only c=create, g=get, s=set, d=del, l=list.

assistant: ```c
int main(int argc, char *argv[]) {
  if (argc < 3) {
    die("USAGE: ex17 <dbfile> <action> [action params]");
  }
  char *filename = argv[1];
  char action = argv[2][0];
  struct Connection *conn = Database_open(filename, action);
  int id = 0;
  if (argc > 3) {
    id = atoi(argv[3]);
  }
  if (id >= 100) {
    die("There's not that many records.");
  }
  switch (action) {
  case 'c':
    Database_create(conn);
    Database_write(conn);
    break;
  case 'g':
    if (argc != 4) {
      die("Need an ID to get.");
    }
    Database_get(conn, id);
    break;
  case 's':
    if (argc != 6) {
      die("Need ID, name and email to set.");
    }
    Database_set(conn, id, argv[4], argv[5]);
    Database_write(conn);
    break;
  case 'd':
    if (argc != 4) {
      die("Need an ID to delete.");
    }
    Database_delete(conn, id);
    Database_write(conn);
    break;
  case 'l':
    Database_list(conn);
    break;
  default:
    die("Invalid action, only c=create, g=get, s=set, d=del, l=list.");
  }
  Database_close(conn);
  return 0;
}
```