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

```asm
<twiddler_key>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <twiddler_get_table@plt>
  test   %rax,%rax
  je     L115
  mov    %rax,%rbp
  movslq D5(%rip),%rax
  movzbl %bl,%ebx
  cmp    %rbx,%rax
  ja     L97
  movslq D188(%rip),%r13
L5:
  cmp    %rbx,%r13
  je     L43
  mov    %ebx,D266(%rip)
  xor    %r12d,%r12d
  movl   $0x0,D266(%rip)
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L97:
  mov    D266(%rip),%edx
  test   %edx,%edx
  je     L27
L61:
  mov    %ebx,D291(%rip)
L115:
  xor    %r12d,%r12d
L57:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L43:
  cmp    %r13,%rax
  jb     L84
  cmpl   $0x2,D291(%rip)
  jne    L115
  xor    %esi,%esi
  lea    D98(%rip),%rdi
  mov    $0x1,%r12d
  call   <gettimeofday@plt>
  mov    D7(%rip),%ecx
  sub    D132(%rip),%ecx
  movslq %ecx,%rdx
  mov    D98(%rip),%eax
  sub    D83(%rip),%eax
  sar    $0x1f,%ecx
  imul   $0x10624dd3,%rdx,%rdx
  imul   $0x3e8,%eax,%eax
  sar    $0x26,%rdx
  sub    %ecx,%edx
  add    %edx,%eax
  cmp    $0x1f4,%eax
  jle    L57
  mov    0x0(%rbp,%r13,8),%rdi
  call   <twiddler_use_item@plt>
  jmp    L57
  nopl   0x0(%rax)
L27:
  movl   $0x1,D266(%rip)
  mov    0x0(%rbp,%rax,8),%rdi
  call   <twiddler_use_item@plt>
  movslq D291(%rip),%rax
  cmp    %eax,D58(%rip)
  je     L104
  xor    %esi,%esi
  lea    D98(%rip),%rdi
  movl   $0x1,D291(%rip)
  call   <gettimeofday@plt>
  movslq D291(%rip),%rax
L104:
  mov    %eax,D58(%rip)
  cmp    %rbx,%rax
  ja     L61
  mov    %rax,%r13
  jmp    L5
  nopl   0x0(%rax)
L84:
  xor    %esi,%esi
  lea    D83(%rip),%rdi
  movl   $0x0,D266(%rip)
  call   <gettimeofday@plt>
  mov    D132(%rip),%ecx
  sub    D7(%rip),%ecx
  movslq %ecx,%rdx
  mov    D83(%rip),%eax
  sub    D98(%rip),%eax
  sar    $0x1f,%ecx
  imul   $0x10624dd3,%rdx,%rdx
  imul   $0x3e8,%eax,%eax
  sar    $0x26,%rdx
  sub    %ecx,%edx
  add    %edx,%eax
  cmp    $0x12b,%eax
  jg     L123
  movl   $0x2,D291(%rip)
  mov    $0x1,%r12d
  mov    %r13d,D58(%rip)
  jmp    L57
  cs nopw 0x0(%rax,%rax,1)
L123:
  xor    %esi,%esi
  lea    D98(%rip),%rdi
  movl   $0x1,D291(%rip)
  mov    $0x1,%r12d
  mov    %r13d,D58(%rip)
  call   <gettimeofday@plt>
  jmp    L57
```

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;
}
```