user: Please show me the C implementation that matches the assembly code listed below:

```asm
<inputsetup_menu>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edx,%ebx
  add    $0xffffffffffffff80,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x78(%rsp)
  lea    D68(%rip),%rax
  lea    0x6f(%rsp),%r12
  lea    0x74(%rsp),%rdi
  movq   $0x0,0x50(%rsp)
  movb   $0x0,0x77(%rsp)
  lea    0xc(%rsp),%r13
  movl   $0x0,0xc(%rsp)
  mov    %rax,0x10(%rsp)
  lea    D51(%rip),%rax
  mov    %rax,0x18(%rsp)
  lea    D3(%rip),%rax
  mov    %rax,0x20(%rsp)
  lea    D57(%rip),%rax
  mov    %rax,0x28(%rsp)
  lea    D0(%rip),%rax
  mov    %rax,0x30(%rsp)
  lea    D27(%rip),%rax
  mov    %rax,0x38(%rsp)
  lea    D70(%rip),%rax
  mov    %rax,0x40(%rsp)
  lea    D66(%rip),%rax
  mov    %rax,0x48(%rsp)
  lea    D35(%rip),%rax
  mov    %rax,0x58(%rsp)
  lea    D19(%rip),%rax
  mov    %rax,0x60(%rsp)
  movabs $0x77636120746f5220,%rax
  mov    %rax,0x6f(%rsp)
  xor    %eax,%eax
  call   <spellword@plt>
  mov    %r12,0x50(%rsp)
  mov    0xc(%rsp),%edx
  mov    %ebp,%ecx
  lea    0x10(%rsp),%r12
  xor    %r9d,%r9d
  mov    %ebx,%r8d
  mov    $0x6,%esi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <drawmenu@plt>
  lea    0xc(%rbp),%ecx
  lea    0x40(%rsp),%rdi
  xor    %r9d,%r9d
  mov    %ebx,%r8d
  mov    $0xffffffff,%edx
  mov    $0x5,%esi
  xor    %eax,%eax
  call   <drawmenu@plt>
L49:
  mov    %ebx,%edx
  mov    %ebp,%esi
  xor    %edi,%edi
  xor    %eax,%eax
  call   <inp_printkeys@plt>
  mov    0xc(%rsp),%edx
  mov    %ebx,%esi
  mov    %ebp,%edi
  xor    %eax,%eax
  call   <inp_setcurs@plt>
  mov    $0xffffffff,%edi
  mov    %eax,%r14d
  xor    %eax,%eax
  call   <refreshwin@plt>
  mov    0xc(%rsp),%edi
  xor    %eax,%eax
  call   <inp_keypr@plt>
  xor    %edi,%edi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <setkeymapping@plt>
  mov    0xc(%rsp),%ecx
  cmp    $0x3,%eax
  jne    L18
  test   %ecx,%ecx
  jne    L18
  mov    $0x4,%eax
L6:
  movslq %ecx,%rdx
  mov    %ecx,%esi
  push   %rax
  mov    %r14d,%r8d
  imul   $0x2aaaaaab,%rdx,%rdx
  sar    $0x1f,%esi
  push   $0x0
  mov    %r12,%rdi
  xor    %eax,%eax
  shr    $0x20,%rdx
  sub    %esi,%edx
  mov    $0xb,%esi
  lea    (%rdx,%rdx,2),%edx
  add    %edx,%edx
  sub    %edx,%ecx
  mov    %r13,%rdx
  lea    (%rcx,%rbx,1),%r9d
  mov    $0x6,%ecx
  call   <handle_menuitem_2cols@plt>
  pop    %rdx
  pop    %rcx
  cmp    $0x2,%eax
  je     L44
  cmp    $0x3,%eax
  je     L38
  test   %eax,%eax
  jne    L49
L44:
  mov    0x78(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  sub    $0xffffffffffffff80,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L18:
  cmp    $0x4,%eax
  jne    L6
  cmp    $0xa,%ecx
  jne    L6
  mov    0x60(%rsp),%rdi
  xor    %esi,%esi
  xor    %eax,%eax
  call   <printmenuitem@plt>
  mov    %ebx,%esi
  mov    %ebp,%edi
  xor    %edx,%edx
  xor    %eax,%eax
  movl   $0x0,0xc(%rsp)
  call   <inp_setcurs@plt>
  mov    0x10(%rsp),%rdi
  mov    $0x1,%esi
  xor    %eax,%eax
  call   <printmenuitem@plt>
  jmp    L49
  nopl   0x0(%rax,%rax,1)
L38:
  mov    0xc(%rsp),%edx
  mov    %ebx,%esi
  mov    %ebp,%edi
  xor    %eax,%eax
  call   <inp_setcurs@plt>
  movslq 0xc(%rsp),%rax
  mov    $0x1,%esi
  mov    0x10(%rsp,%rax,8),%rdi
  xor    %eax,%eax
  call   <printmenuitem@plt>
  jmp    L49
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D68
type_infered: string
name: parse_data
arguments: data_label: D51
type_infered: string
name: parse_data
arguments: data_label: D3
type_infered: string
name: parse_data
arguments: data_label: D57
type_infered: string
name: parse_data
arguments: data_label: D0
type_infered: string
name: parse_data
arguments: data_label: D27
type_infered: string
name: parse_data
arguments: data_label: D70
type_infered: string
name: parse_data
arguments: data_label: D66
type_infered: string
name: parse_data
arguments: data_label: D35
type_infered: string
name: parse_data
arguments: data_label: D19
type_infered: string

tool: D68:  Up

tool: D51: Dwn

tool: D3: Lft

tool: D57: Rgt

tool: D0:   A

tool: D27:   B

tool: D70:  Rotate 

tool: D66:  Rot cw 

tool: D35: Harddrop

tool: D19: Softdrop

assistant: ```c
void inputsetup_menu(int pl, int x, int y) {
  const char *menu[11] = {" Up", "Dwn", "Lft", "Rgt", "  A", "  B", " Rotate ", " Rot cw ", (void *)0, "Harddrop", "Softdrop"};
  char rot_acw[9] = " Rot acw";
  int dev = 0;
  int i = 0;
  int xx, k;
  spellword(rot_acw + 5);
  menu[8] = rot_acw;
  drawmenu(menu, 6, i, x, y, (void *)0);
  drawmenu(menu + 6, 5, -1, x + 12, y, (void *)0);
  while (1) {
    inp_printkeys(dev, x, y);
    xx = inp_setcurs(x, y, i);
    refreshwin(-1);
    k = setkeymapping(dev, inp_keypr(i));
    if (k == 3 && !i)
      k = 4;
    else if (k == 4 && i == 10) {
      printmenuitem(menu[10], 0);
      inp_setcurs(x, y, i = 0);
      printmenuitem(menu[0], 1);
      continue;
    }
    switch (handle_menuitem_2cols(menu, 11, &i, 6, xx, y + i % 6, (void *)0, k)) {
    case 0:
    case 2:
      return;
    case 3:
      inp_setcurs(x, y, i);
      printmenuitem(menu[i], 1);
    }
  }
}
```