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

```asm
<change_adapter_status>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %rdx,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D37(%rip),%rsi
  call   <mg_get_var@plt>
  mov    %rax,%r12
  lea    D14(%rip),%rsi
  mov    %rbx,%rdi
  call   <mg_get_var@plt>
  mov    %rax,%rbp
  lea    D46(%rip),%rsi
  mov    %rbx,%rdi
  call   <mg_get_var@plt>
  mov    %rax,%r13
  movl   $0x0,0x14(%rsp)
  test   %r12,%r12
  setne  %dl
  test   %rbp,%rbp
  setne  %al
  test   %al,%dl
  je     L143
  test   %r13,%r13
  jne    L87
L143:
  test   %r12,%r12
  je     L128
L38:
  mov    %r12,%rdi
  call   <free@plt>
L128:
  test   %rbp,%rbp
  je     L11
  mov    %rbp,%rdi
  call   <free@plt>
L11:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L64
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L87:
  lea    0x14(%rsp),%rdx
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <squirrel_get_interface_status@plt>
  mov    %eax,0xc(%rsp)
  lea    D0(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  mov    $0xffffffff,%r15d
  test   %rax,%rax
  jne    L79
L19:
  cmpl   $0x0,0xc(%rsp)
  jne    L116
  lea    D70(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L10
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <launch_thread@plt>
  mov    %r15d,%ecx
  mov    $0x1,%edx
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <squirrel_set_interface_status@plt>
  mov    %r15d,%edx
  lea    D11(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <mg_printf@plt>
  jmp    L38
L79:
  movsbl 0x0(%rbp),%edi
  call   <isdigit@plt>
  mov    $0x0,%r15d
  test   %rax,%rax
  je     L19
  mov    %rbp,%rdi
  call   <atoi@plt>
  mov    %eax,%r15d
  jmp    L19
L116:
  lea    D70(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L41
  cmp    %r15d,0x14(%rsp)
  jne    L35
L10:
  lea    D6(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <mg_printf@plt>
  jmp    L38
L41:
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <squirrel_set_interface_status@plt>
  lea    D9(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <mg_printf@plt>
  jmp    L38
L35:
  mov    %r15d,%ecx
  mov    $0x1,%edx
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <squirrel_set_interface_status@plt>
  mov    %r15d,%edx
  lea    D99(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <mg_printf@plt>
  jmp    L38
L64:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D37
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D14
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D46
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D0
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D70
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D11
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D6
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D9
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D99
type_guessed: string

tool: D37: status

tool: D14: channel

tool: D46: if

tool: D0: scan

tool: D70: monitor

tool: D11: <b>Turned on adapter, channel %u</b>


tool: D6: <b>Nothing changed</b>


tool: D9: <b>Turned off adapter</b>


tool: D99: <b>Changed channel to %u</b>


assistant: ```c
void change_adapter_status(struct mg_connection *c, const struct mg_request_info *ri, void *user_data) {
  struct Squirrel *squirrel = (struct Squirrel *)user_data;
  char *status = mg_get_var(c, "status");
  char *channel = mg_get_var(c, "channel");
  char *adapter_name = mg_get_var(c, "if");
  unsigned interface_channel = 0;
  if (status && channel && adapter_name) {
    unsigned is_running = squirrel_get_interface_status(squirrel, adapter_name, &interface_channel);
    unsigned new_channel;
    if (strcmp(channel, "scan") == 0)
      new_channel = (unsigned)-1;
    else if (isdigit(channel[0]))
      new_channel = atoi(channel);
    else
      new_channel = 0;
    if (is_running && strcmp(status, "monitor") != 0) {
      squirrel_set_interface_status(squirrel, adapter_name, 0, 0);
      mg_printf(c, "<b>Turned off adapter</b>\n");
    } else if (!is_running && strcmp(status, "monitor") == 0) {
      launch_thread(squirrel, adapter_name);
      squirrel_set_interface_status(squirrel, adapter_name, 1, new_channel);
      mg_printf(c, "<b>Turned on adapter, channel %u</b>\n", new_channel);
    } else if (is_running && interface_channel != new_channel) {
      squirrel_set_interface_status(squirrel, adapter_name, 1, new_channel);
      mg_printf(c, "<b>Changed channel to %u</b>\n", new_channel);
    } else
      mg_printf(c, "<b>Nothing changed</b>\n");
  }
  if (status)
    free(status);
  if (channel)
    free(channel);
}
```