user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<vga_mode>:
  endbr64
  push   %rbx
  sub    $0x20,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rdi
  call   <FS460_get_vga_mode@plt>
  test   %eax,%eax
  jne    L149
  lea    0x10(%rsp),%rdi
  call   <FS460_get_available_vga_modes@plt>
  test   %eax,%eax
  jne    L152
  cmpq   $0x0,0x10(%rsp)
  jne    L5
L36:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L124
  add    $0x20,%rsp
  pop    %rbx
  ret
L149:
  mov    %eax,%esi
  lea    D35(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L36
L152:
  mov    %eax,%esi
  lea    D51(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L36
L5:
  lea    D54(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L12
  mov    0x8(%rsp),%rax
  mov    0x10(%rsp),%rcx
L141:
  add    %rax,%rax
  mov    $0x1,%edx
  cmove  %rdx,%rax
  test   %rax,%rcx
  je     L141
  mov    %rax,0x8(%rsp)
L21:
  mov    0x8(%rsp),%rdi
  call   <FS460_set_vga_mode@plt>
  test   %eax,%eax
  je     L147
  mov    %eax,%esi
  lea    D34(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L36
L12:
  lea    D56(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L173
  mov    0x8(%rsp),%rax
  mov    0x10(%rsp),%rcx
  mov    $0x80000000,%edx
L144:
  shr    %rax
  cmove  %rdx,%rax
  test   %rax,%rcx
  je     L144
  mov    %rax,0x8(%rsp)
  jmp    L21
L173:
  lea    D20(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L21
  lea    D17(%rip),%rdi
  call   <puts@plt>
  jmp    L36
L147:
  lea    0x8(%rsp),%rdi
  call   <FS460_get_vga_mode@plt>
  test   %eax,%eax
  je     L60
  mov    %eax,%esi
  lea    D86(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L36
L60:
  mov    0x8(%rsp),%rdi
  call   <str_VgaMode@plt>
  mov    %rax,%rsi
  lea    D79(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L36
L124:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D35
data_type: string
name: parse_data
arguments: data_label: D51
data_type: string
name: parse_data
arguments: data_label: D54
data_type: string
name: parse_data
arguments: data_label: D34
data_type: string
name: parse_data
arguments: data_label: D56
data_type: string
name: parse_data
arguments: data_label: D20
data_type: string
name: parse_data
arguments: data_label: D17
data_type: string
name: parse_data
arguments: data_label: D86
data_type: string
name: parse_data
arguments: data_label: D79
data_type: string

tool: D35: error %u getting vga mode.


tool: D51: error %u getting available vga modes.


tool: D54: +

tool: D34: error %u setting vga mode.


tool: D56: -

tool: 

tool: D17: Invalid command.

tool: D86: error %u getting vga mode after set.


tool: D79:   vga mode=%s


assistant: ```c
void vga_mode(char *mod) {
  int err;
  unsigned long vga_mode, available_vga_modes;
  err = FS460_get_vga_mode(&vga_mode);
  if (err) {
    printf("error %u getting vga mode.\n", err);
    return;
  }
  err = FS460_get_available_vga_modes(&available_vga_modes);
  if (err) {
    printf("error %u getting available vga modes.\n", err);
    return;
  }
  if (available_vga_modes) {
    if (0 == strcmp(mod, "+")) {
      do {
        vga_mode <<= 1;
        if (!vga_mode)
          vga_mode = 1;
      } while (!(vga_mode & available_vga_modes));
    } else if (0 == strcmp(mod, "-")) {
      do {
        vga_mode >>= 1;
        if (!vga_mode)
          vga_mode = 0x80000000;
      } while (!(vga_mode & available_vga_modes));
    } else if (0 == strcmp(mod, "")) {
    } else {
      printf("Invalid command.\n");
      return;
    }
    err = FS460_set_vga_mode(vga_mode);
    if (err)
      printf("error %u setting vga mode.\n", err);
    else {
      err = FS460_get_vga_mode(&vga_mode);
      if (err)
        printf("error %u getting vga mode after set.\n", err);
      else
        printf("  vga mode=%s\n", str_VgaMode(vga_mode));
    }
  }
}
```