user: Translate the below assembly code into C programming language:

```asm
<getkey>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <getachar@plt>
  test   %eax,%eax
  js     L812
  cmp    $0x1b,%eax
  jg     L1080
  ja     L812
  mov    %eax,%edx
  lea    D23(%rip),%rcx
  movslq (%rcx,%rdx,4),%rdx
  add    %rcx,%rdx
  notrack jmp *%rdx
  mov    $0x10b,%eax
  jmp    L812
L1080:
  cmp    $0x7f,%eax
  je     L1099
  cmp    $0xe0,%eax
  jne    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  sub    $0xf,%eax
  cmp    $0xd1,%eax
  ja     L880
  mov    %eax,%eax
  lea    D29(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0x101,%eax
  jmp    L812
  lea    0x4(%rsp),%rsi
  mov    %rsp,%rdi
  call   <get_modifier_keys@plt>
  mov    $0x11e,%eax
  cmpl   $0x0,(%rsp)
  jne    L812
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff7,%eax
  add    $0x115,%eax
  jmp    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  cmp    $0x4f,%eax
  je     L641
  cmp    $0x5b,%eax
  je     L212
  cmp    $0x1b,%eax
  mov    $0xfff,%eax
  mov    $0x102,%edx
  cmove  %edx,%eax
  jmp    L812
L641:
  mov    $0x0,%eax
  call   <getachar@plt>
  sub    $0x46,%eax
  cmp    $0xe,%eax
  ja     L625
  mov    %eax,%eax
  lea    D21(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0x109,%eax
  jmp    L812
  mov    $0x125,%eax
  jmp    L812
  mov    $0x126,%eax
  jmp    L812
  mov    $0x127,%eax
  jmp    L812
  mov    $0x128,%eax
  jmp    L812
  mov    $0x129,%eax
  jmp    L812
L625:
  mov    $0xfff,%eax
  jmp    L812
L212:
  lea    0x4(%rsp),%rsi
  mov    %rsp,%rdi
  call   <get_modifier_keys@plt>
  mov    $0x0,%eax
  call   <getachar@plt>
  cmp    $0x31,%eax
  je     L572
L267:
  sub    $0x31,%eax
  cmp    $0x2a,%eax
  ja     L508
  mov    %eax,%eax
  lea    D20(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
L572:
  mov    $0x0,%eax
  call   <getachar@plt>
  cmp    $0x39,%eax
  je     L268
  jle    L628
  cmp    $0x3b,%eax
  je     L1226
  cmp    $0x7e,%eax
  jne    L974
  cmpl   $0x0,(%rsp)
  je     L229
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff9,%eax
  add    $0x123,%eax
  jmp    L812
L628:
  cmp    $0x35,%eax
  je     L750
  cmp    $0x37,%eax
  jne    L425
  mov    $0x0,%eax
  call   <getachar@plt>
  cmp    $0x7e,%eax
  mov    $0x12a,%eax
  mov    $0xfff,%edx
  cmovne %edx,%eax
  jmp    L812
L425:
  mov    $0xfff,%eax
  jmp    L812
L974:
  mov    $0xfff,%eax
  jmp    L812
L750:
  mov    $0x0,%eax
  call   <getachar@plt>
  cmp    $0x7e,%eax
  mov    $0x129,%eax
  mov    $0xfff,%edx
  cmovne %edx,%eax
  jmp    L812
L1226:
  mov    $0x0,%eax
  call   <getachar@plt>
  cmp    $0x7e,%eax
  je     L1153
  cmp    $0x32,%eax
  je     L763
  cmp    $0x35,%eax
  jne    L445
  movl   $0x1,0x4(%rsp)
  jmp    L945
L763:
  movl   $0x1,(%rsp)
L945:
  mov    $0x0,%eax
  call   <getachar@plt>
  jmp    L267
L445:
  cmp    $0x36,%eax
  jne    L945
  movl   $0x1,0x4(%rsp)
  movl   $0x1,(%rsp)
  jmp    L945
L268:
  mov    $0x0,%eax
  call   <getachar@plt>
  cmp    $0x7e,%eax
  mov    $0x12c,%eax
  mov    $0xfff,%edx
  cmovne %edx,%eax
  jmp    L812
L229:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x113,%eax
  jmp    L812
L508:
  mov    $0xfff,%eax
  jmp    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  mov    %eax,%edx
  mov    $0xfff,%eax
  cmp    $0x7e,%edx
  jne    L812
  cmpl   $0x0,(%rsp)
  je     L1168
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff9,%eax
  add    $0x123,%eax
  jmp    L812
L1168:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x113,%eax
  jmp    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  mov    %eax,%edx
  cmp    $0x31,%eax
  je     L305
  mov    $0x103,%eax
  cmp    $0x7e,%edx
  je     L812
  mov    $0xfff,%eax
  cmp    $0x30,%edx
  jne    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  mov    $0x12d,%eax
  jmp    L812
L305:
  mov    $0x0,%eax
  call   <getachar@plt>
  mov    $0x12e,%eax
  jmp    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  cmp    $0x7e,%eax
  mov    $0x104,%eax
  mov    $0xfff,%edx
  cmovne %edx,%eax
  jmp    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  mov    %eax,%edx
  mov    $0xfff,%eax
  cmp    $0x7e,%edx
  jne    L812
  cmpl   $0x0,(%rsp)
  je     L881
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff9,%eax
  add    $0x124,%eax
  jmp    L812
L881:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x114,%eax
  jmp    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  mov    %eax,%edx
  mov    $0xfff,%eax
  cmp    $0x7e,%edx
  jne    L812
  cmpl   $0x1,(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff3,%eax
  add    $0x11a,%eax
  jmp    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  mov    %eax,%edx
  mov    $0xfff,%eax
  cmp    $0x7e,%edx
  jne    L812
  cmpl   $0x1,(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff3,%eax
  add    $0x11b,%eax
  jmp    L812
  cmpl   $0x0,(%rsp)
  je     L419
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff7,%eax
  add    $0x121,%eax
  jmp    L812
L419:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x111,%eax
  jmp    L812
  cmpl   $0x0,(%rsp)
  je     L135
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff7,%eax
  add    $0x122,%eax
  jmp    L812
L135:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x112,%eax
  jmp    L812
  cmpl   $0x0,(%rsp)
  je     L687
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff7,%eax
  add    $0x120,%eax
  jmp    L812
L687:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x110,%eax
  jmp    L812
  cmpl   $0x0,(%rsp)
  je     L214
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff7,%eax
  add    $0x11f,%eax
  jmp    L812
L214:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x10f,%eax
  jmp    L812
  cmpl   $0x0,(%rsp)
  je     L236
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff9,%eax
  add    $0x124,%eax
  jmp    L812
L236:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x114,%eax
  jmp    L812
  cmpl   $0x0,(%rsp)
  je     L1202
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff9,%eax
  add    $0x123,%eax
  jmp    L812
L1202:
  cmpl   $0x1,0x4(%rsp)
  sbb    %eax,%eax
  and    $0xfffffff6,%eax
  add    $0x113,%eax
  jmp    L812
  mov    $0x0,%eax
  call   <getachar@plt>
  mov    %eax,%edx
  mov    $0x127,%eax
  cmp    $0x43,%edx
  je     L812
  mov    $0x129,%eax
  cmp    $0x45,%edx
  je     L812
  cmp    $0x41,%edx
  mov    $0xfff,%eax
  mov    $0x125,%edx
  cmove  %edx,%eax
  jmp    L812
  mov    $0x125,%eax
  jmp    L812
  mov    $0x127,%eax
  jmp    L812
  mov    $0x129,%eax
  jmp    L812
  mov    $0x109,%eax
  jmp    L812
  mov    $0x107,%eax
  jmp    L812
  mov    $0x10d,%eax
  jmp    L812
  mov    $0x105,%eax
  jmp    L812
  mov    $0x106,%eax
  jmp    L812
  mov    $0x10a,%eax
  jmp    L812
  mov    $0x108,%eax
  jmp    L812
  mov    $0x10e,%eax
  jmp    L812
  mov    $0x103,%eax
  jmp    L812
  mov    $0x104,%eax
  jmp    L812
  mov    $0x10f,%eax
  jmp    L812
  mov    $0x110,%eax
  jmp    L812
  mov    $0x114,%eax
  jmp    L812
  mov    $0x113,%eax
  jmp    L812
  mov    $0x111,%eax
  jmp    L812
  mov    $0x112,%eax
  jmp    L812
  mov    $0x115,%eax
  jmp    L812
  mov    $0x118,%eax
  jmp    L812
  mov    $0x11c,%eax
  jmp    L812
  mov    $0x11d,%eax
  jmp    L812
  mov    $0x11a,%eax
  jmp    L812
  mov    $0x116,%eax
  jmp    L812
  mov    $0x117,%eax
  jmp    L812
  mov    $0x119,%eax
  jmp    L812
  mov    $0x11b,%eax
  jmp    L812
  mov    $0x11f,%eax
  jmp    L812
  mov    $0x120,%eax
  jmp    L812
  mov    $0x121,%eax
  jmp    L812
  mov    $0x122,%eax
  jmp    L812
  mov    $0x123,%eax
  jmp    L812
  mov    $0x124,%eax
  jmp    L812
L880:
  mov    $0xfff,%eax
  jmp    L812
L1099:
  mov    $0x101,%eax
L812:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L38
  add    $0x18,%rsp
  ret
  mov    $0x10a,%eax
  jmp    L812
L1153:
  mov    $0x12b,%eax
  jmp    L812
  mov    $0x11e,%eax
  jmp    L812
  mov    $0x11e,%eax
  jmp    L812
L38:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int getkey(void) {
  int ch, shift, ctrl;
  ch = getachar();
  if (ch < 0)
    return ch;
  switch (ch) {
  case 0x08:
    return 0x101;
  case 0x09:
    get_modifier_keys(&shift, &ctrl);
    if (shift)
      return 0x11E;
    if (ctrl)
      return 0x115;
    return 0x10C;
  case 0x0D:
    return 0x10B;
  case 0x0A:
    return 0x10B;
  case 0x1B:
    ch = getachar();
    switch (ch) {
    case 0x1B:
      return 0x102;
    case 0x4F:
      ch = getachar();
      switch (ch) {
      case 0x46:
        return 0x10A;
      case 0x48:
        return 0x109;
      case 0x50:
        return 0x125;
      case 0x51:
        return 0x126;
      case 0x52:
        return 0x127;
      case 0x53:
        return 0x128;
      case 0x54:
        return 0x129;
      default:
        return 0xFFF;
      }
      break;
    case 0x5B:
      get_modifier_keys(&shift, &ctrl);
      ch = getachar();
      if (ch == 0x31) {
        ch = getachar();
        switch (ch) {
        case 0x35:
          return getachar() == 0x7E ? 0x129 : 0xFFF;
        case 0x37:
          return getachar() == 0x7E ? 0x12a : 0xFFF;
        case 0x3B:
          ch = getachar();
          if (ch == 0x7E)
            return 0x12b;
          if (ch == 0x32)
            shift = 1;
          if (ch == 0x35)
            ctrl = 1;
          if (ch == 0x36)
            shift = ctrl = 1;
          ch = getachar();
          break;
        case 0x39:
          return getachar() == 0x7E ? 0x12c : 0xFFF;
        case 0x7E:
          if (shift && ctrl)
            return 0x123;
          if (shift)
            return 0x11C;
          if (ctrl)
            return 0x113;
          return 0x109;
        default:
          return 0xFFF;
        }
      }
      switch (ch) {
      case 0x31:
        ch = getachar();
        if (ch != 0x7E)
          return 0xFFF;
        if (shift && ctrl)
          return 0x123;
        if (shift)
          return 0x11C;
        if (ctrl)
          return 0x113;
        return 0x109;
      case 0x32:
        ch = getachar();
        switch (ch) {
        case 0x30:
          ch = getachar();
          return 0x12d;
        case 0x31:
          ch = getachar();
          return 0x12e;
        case 0x7E:
          return 0x103;
        default:
          break;
        }
        return 0xFFF;
      case 0x33:
        return getachar() == 0x7E ? 0x104 : 0xFFF;
      case 0x34:
        if (getachar() != 0x7E)
          return 0xFFF;
        if (shift && ctrl)
          return 0x124;
        if (shift)
          return 0x11D;
        if (ctrl)
          return 0x114;
        return 0x10A;
      case 0x35:
        if (getachar() != 0x7E)
          return 0xFFF;
        if (shift)
          return 0x11A;
        return 0x10D;
      case 0x36:
        if (getachar() != 0x7E)
          return 0xFFF;
        if (shift)
          return 0x11B;
        return 0x10E;
      case 0x41:
        if (shift && ctrl)
          return 0x121;
        if (shift)
          return 0x118;
        if (ctrl)
          return 0x111;
        return 0x107;
      case 0x42:
        if (shift && ctrl)
          return 0x122;
        if (shift)
          return 0x119;
        if (ctrl)
          return 0x112;
        return 0x108;
      case 0x43:
        if (shift && ctrl)
          return 0x120;
        if (shift)
          return 0x117;
        if (ctrl)
          return 0x110;
        return 0x106;
      case 0x44:
        if (shift && ctrl)
          return 0x11F;
        if (shift)
          return 0x116;
        if (ctrl)
          return 0x10F;
        return 0x105;
      case 0x46:
        if (shift && ctrl)
          return 0x124;
        if (shift)
          return 0x11D;
        if (ctrl)
          return 0x114;
        return 0x10A;
      case 0x48:
        if (shift && ctrl)
          return 0x123;
        if (shift)
          return 0x11C;
        if (ctrl)
          return 0x113;
        return 0x109;
      case 0x5A:
        return 0x11E;
      case 0x5B:
        ch = getachar();
        switch (ch) {
        case 0x41:
          return 0x125;
        case 0x43:
          return 0x127;
        case 0x45:
          return 0x129;
        }
        return 0xFFF;
      default:
        return 0xFFF;
      }
      break;
    default:
      return 0xFFF;
    }
    break;
  case 0x00:
  case 0xE0:
    ch = getachar();
    switch (ch) {
    case 0x0F:
      return 0x11E;
    case 0x3B:
      return 0x125;
    case 0x3D:
      return 0x127;
    case 0x3F:
      return 0x129;
    case 0x47:
      return 0x109;
    case 0x48:
      return 0x107;
    case 0x49:
      return 0x10D;
    case 0x4B:
      return 0x105;
    case 0x4D:
      return 0x106;
    case 0x4F:
      return 0x10A;
    case 0x50:
      return 0x108;
    case 0x51:
      return 0x10E;
    case 0x52:
      return 0x103;
    case 0x53:
      return 0x104;
    case 0x73:
      return 0x10F;
    case 0x74:
      return 0x110;
    case 0x75:
      return 0x114;
    case 0x77:
      return 0x113;
    case 0x8D:
      return 0x111;
    case 0x91:
      return 0x112;
    case 0x94:
      return 0x115;
    case 0xB8:
      return 0x118;
    case 0xB7:
      return 0x11C;
    case 0xBF:
      return 0x11D;
    case 0xB9:
      return 0x11A;
    case 0xBB:
      return 0x116;
    case 0xBD:
      return 0x117;
    case 0xC0:
      return 0x119;
    case 0xC1:
      return 0x11B;
    case 0xDB:
      return 0x11F;
    case 0xDD:
      return 0x120;
    case 0xD8:
      return 0x121;
    case 0xE0:
      return 0x122;
    case 0xD7:
      return 0x123;
    case 0xDF:
      return 0x124;
    default:
      return 0xFFF;
    }
    break;
  case 0x7F:
    return 0x101;
  default:
    return ch;
  }
}
```