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

```asm
<twiddler_key>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <twiddler_get_table@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L76
  mov    $0x0,%eax
  jmp    L93
L76:
  andq   $0xff,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    D233(%rip),%eax
  cltq
  cmp    %rax,-0x18(%rbp)
  jae    L52
  mov    D226(%rip),%eax
  test   %eax,%eax
  jne    L52
  mov    D226(%rip),%eax
  add    $0x1,%eax
  mov    %eax,D72(%rip)
  mov    D233(%rip),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <twiddler_use_item@plt>
  mov    D72(%rip),%edx
  mov    D233(%rip),%eax
  cmp    %eax,%edx
  je     L122
  movl   $0x1,D100(%rip)
  mov    $0x0,%esi
  lea    D98(%rip),%rax
  mov    %rax,%rdi
  call   <gettimeofday@plt>
L122:
  mov    D233(%rip),%eax
  mov    %eax,D249(%rip)
L52:
  mov    D233(%rip),%eax
  cltq
  cmp    %rax,-0x18(%rbp)
  jae    L70
  mov    -0x18(%rbp),%rax
  mov    %eax,D249(%rip)
  mov    $0x0,%eax
  jmp    L93
L70:
  mov    D249(%rip),%eax
  cltq
  cmp    %rax,-0x18(%rbp)
  je     L98
  movl   $0x0,D72(%rip)
  mov    -0x18(%rbp),%rax
  mov    %eax,D249(%rip)
  mov    $0x0,%eax
  jmp    L93
L98:
  mov    D249(%rip),%eax
  cltq
  cmp    %rax,-0x18(%rbp)
  jbe    L134
  movl   $0x0,D72(%rip)
  mov    $0x0,%esi
  lea    D249(%rip),%rax
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    D249(%rip),%eax
  mov    D98(%rip),%edx
  sub    %edx,%eax
  imul   $0x3e8,%eax,%ecx
  mov    D247(%rip),%eax
  mov    D62(%rip),%edx
  sub    %edx,%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  add    %ecx,%eax
  cmp    $0x12b,%eax
  jg     L1
  mov    $0x2,%eax
  jmp    L60
L1:
  mov    $0x1,%eax
L60:
  mov    %eax,D70(%rip)
  mov    -0x18(%rbp),%rax
  mov    %eax,D70(%rip)
  mov    D70(%rip),%eax
  cmp    $0x1,%eax
  jne    L46
  mov    $0x0,%esi
  lea    D98(%rip),%rax
  mov    %rax,%rdi
  call   <gettimeofday@plt>
L46:
  mov    $0x1,%eax
  jmp    L93
L134:
  mov    D70(%rip),%eax
  cmp    $0x2,%eax
  jne    L163
  mov    $0x0,%esi
  lea    D98(%rip),%rax
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    D98(%rip),%eax
  mov    D249(%rip),%edx
  sub    %edx,%eax
  imul   $0x3e8,%eax,%ecx
  mov    D62(%rip),%eax
  mov    D247(%rip),%edx
  sub    %edx,%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  add    %ecx,%eax
  cmp    $0x1f4,%eax
  jle    L143
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <twiddler_use_item@plt>
L143:
  mov    $0x1,%eax
  jmp    L93
L163:
  mov    $0x0,%eax
L93:
  leave
  ret
```

assistant: ```c
int twiddler_key(unsigned long message) {
  char **table = twiddler_get_table(message);
  char *val;
  static int last_message;
  static int marked;
  static struct timeval tv1, tv2;
  static int nclick, last_pressed;
  if (!table)
    return 0;
  message &= 0xff;
  val = table[message];
  if ((message < last_message) && !marked) {
    marked++;
    twiddler_use_item(table[last_message]);
    if (last_pressed != last_message) {
      nclick = 1;
      (gettimeofday(&tv1, (struct timezone *)NULL));
    }
    last_pressed = last_message;
  }
  if (message < last_message) {
    last_message = message;
    return 0;
  }
  if (message != last_pressed) {
    marked = 0;
    last_message = message;
    return 0;
  }
  if (message > last_message) {
    marked = 0;
    (gettimeofday(&tv2, (struct timezone *)NULL));
    nclick = 1 + (((tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec) / 1000) < 300);
    last_message = message;
    if (nclick == 1)
      (gettimeofday(&tv1, (struct timezone *)NULL));
    return 1;
  }
  if (nclick == 2) {
    (gettimeofday(&tv1, (struct timezone *)NULL));
    if (((tv1.tv_sec - tv2.tv_sec) * 1000 + (tv1.tv_usec - tv2.tv_usec) / 1000) > 500)
      twiddler_use_item(table[message]);
    return 1;
  }
  return 0;
}
```