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

```asm
<MainMenu>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x120,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
L24:
  lea    D103(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D54(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D91(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D70(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <LeddarGetKey@plt>
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %eax,-0x114(%rbp)
  mov    -0x114(%rbp),%eax
  sub    $0x1b,%eax
  cmp    $0x36,%eax
  ja     L24
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D100(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D100(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0x0,%edi
  call   <ConnectMenu@plt>
  jmp    L59
  mov    $0x1,%edi
  call   <ConnectMenu@plt>
  jmp    L59
  lea    -0x110(%rbp),%rax
  mov    $0xff,%edx
  mov    %rax,%rsi
  lea    D83(%rip),%rax
  mov    %rax,%rdi
  call   <ListSensors@plt>
  lea    -0x110(%rbp),%rax
  mov    $0xff,%edx
  mov    %rax,%rsi
  lea    D117(%rip),%rax
  mov    %rax,%rdi
  call   <ListSensors@plt>
  jmp    L59
  mov    $0x0,%eax
  call   <ReplayMenu@plt>
  jmp    L59
  mov    $0x0,%eax
  call   <ConfigureRecordingMenu@plt>
  jmp    L59
  lea    D81(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L54
  jmp    L72
L59:
  jmp    L24
L72:
  call   <__stack_chk_fail@plt>
L54:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D103
type: string
name: retrieve_data
arguments: tag: D54
type: string
name: retrieve_data
arguments: tag: D61
type: string
name: retrieve_data
arguments: tag: D91
type: string
name: retrieve_data
arguments: tag: D1
type: string
name: retrieve_data
arguments: tag: D70
type: string
name: retrieve_data
arguments: tag: D28
type: string
name: retrieve_data
arguments: tag: D83
type: string
name: retrieve_data
arguments: tag: D117
type: string
name: retrieve_data
arguments: tag: D81
type: string

tool: D103: 

Main Menu

tool: D54:   1. Connect

tool: D61:   2. Connect to single USB sensor

tool: D91:   3. List Sensors

tool: D1:   4. Replay Record

tool: D70:   5. Configure Recording

tool: D28:   6. Quit

tool: D83: USB

tool: D117: SERIAL

tool: D81: 
*** Goodbye! ***

assistant: ```c
void MainMenu(void) {
  for (;;) {
    int lChoice;
    puts("\n\nMain Menu");
    puts("  1. Connect");
    puts("  2. Connect to single USB sensor");
    puts("  3. List Sensors");
    puts("  4. Replay Record");
    puts("  5. Configure Recording");
    puts("  6. Quit");
    lChoice = toupper(LeddarGetKey());
    switch (lChoice) {
    case '1':
      ConnectMenu(0);
      break;
    case '2':
      ConnectMenu(1);
      break;
    case '3': {
      char lAddresses[256];
      ListSensors("USB", lAddresses, 255);
      ListSensors("SERIAL", lAddresses, 255);
      break;
    }
    case '4':
      ReplayMenu();
      break;
    case '5':
      ConfigureRecordingMenu();
      break;
    case '6':
    case 'Q':
    case 27:
      puts("\n*** Goodbye! ***");
      return;
    }
  }
}
```