user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<display_game_menu>:
  endbr64
  push   %r15
  lea    D26(%rip),%r15
  push   %r14
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0x38,%rsp
  movzbl 0x78(%rsp),%eax
  mov    %ecx,0x14(%rsp)
  movzbl 0x70(%rsp),%ecx
  mov    %r8d,0x18(%rsp)
  mov    %al,0x13(%rsp)
  mov    0x80(%rsp),%r14
  mov    %cl,0x12(%rsp)
  mov    0x98(%rsp),%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movsbl %r9b,%eax
  movl   $0x0,0x24(%rsp)
  mov    %eax,0xc(%rsp)
  movsbl %cl,%eax
  movb   $0x0,0x23(%rsp)
  mov    %eax,0x1c(%rsp)
  jmp    L40
  nopl   0x0(%rax)
L17:
  cmpl   $0x1,0x88(%rsp)
  je     L94
L87:
  xor    %eax,%eax
  call   <_flushall@plt>
  mov    %r15,%rdi
  call   <system@plt>
  mov    0x90(%rsp),%esi
  mov    0x24(%rsp),%edi
  mov    %ebx,%edx
  call   <is_valid_item@plt>
  test   %eax,%eax
  jne    L86
L40:
  mov    0xc(%rsp),%ecx
  xor    %eax,%eax
  mov    %ebp,%r8d
  mov    %r12d,%edx
  mov    %r13d,%esi
  lea    D47(%rip),%rdi
  call   <printf@plt>
  cmpb   $0x30,0x12(%rsp)
  je     L4
  mov    0x14(%rsp),%edx
  mov    0x1c(%rsp),%esi
  lea    D8(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L4:
  movzbl 0x13(%rsp),%eax
  cmp    $0x30,%al
  je     L63
  mov    0x18(%rsp),%edx
  movsbl %al,%esi
  lea    D8(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L63:
  lea    D53(%rip),%rdi
  call   <puts@plt>
  mov    %r14,%rsi
  lea    D4(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x88(%rsp),%eax
  test   %eax,%eax
  jne    L17
  xor    %eax,%eax
  lea    0x24(%rsp),%rsi
  lea    D33(%rip),%rdi
  call   <scanf@plt>
  test   %eax,%eax
  jne    L87
L31:
  lea    -0x1(%rbx),%eax
  mov    %eax,0x24(%rsp)
  jmp    L87
L94:
  xor    %eax,%eax
  lea    0x23(%rsp),%rsi
  lea    D60(%rip),%rdi
  call   <scanf@plt>
  test   %eax,%eax
  je     L31
  movsbl 0x23(%rsp),%edi
  call   <char_convert@plt>
  mov    %eax,0x24(%rsp)
  jmp    L87
  nopw   0x0(%rax,%rax,1)
L86:
  mov    0x24(%rsp),%eax
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L55
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L55:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D26
type_infered: string
name: read_data
arguments: tag: D47
type_infered: string
name: read_data
arguments: tag: D8
type_infered: string
name: read_data
arguments: tag: D53
type_infered: string
name: read_data
arguments: tag: D4
type_infered: string
name: read_data
arguments: tag: D33
type_infered: string
name: read_data
arguments: tag: D60
type_infered: string

tool: D26: cls

tool: D47: Question #%d: %d %c %d

tool: D8:  %c %d

tool: D53:  = ?

tool: D4: %s



tool: D33:  %d

tool: D60:  %c

assistant: ```c
int display_game_menu(int questions, int term1, int term2, int term3, int term4, char operand1, char operand2, char operand3, char menu_items[], int menu_type, int num_items, int min_items) {
  int option = 0, error_check = 0;
  char char_option = '\0';
  do {
    printf("Question #%d: %d %c %d", questions, term1, operand1, term2);
    if (operand2 != '0') {
      printf(" %c %d", operand2, term3);
    }
    if (operand3 != '0') {
      printf(" %c %d", operand3, term4);
    }
    printf(" = ?\n");
    printf("%s\n\n", menu_items);
    if (menu_type == 0) {
      error_check = scanf(" %d", &option);
      if (!error_check) {
        option = min_items - 1;
      }
    } else if (menu_type == 1) {
      error_check = scanf(" %c", &char_option);
      if (!error_check) {
        option = min_items - 1;
      } else {
        option = char_convert(char_option);
      }
    }
    _flushall();
    system("cls");
  } while (!is_valid_item(option, num_items, min_items));
  return option;
}
```