user: 请将以下的汇编代码转换成C语言代码:

```asm
<set_operation_mode>:
  endbr64
  lea    D13(%rip),%rax
  test   %edx,%edx
  lea    D18(%rip),%rcx
  push   %r14
  mov    %rax,%r8
  push   %r13
  lea    D28(%rip),%r13
  cmove  %rcx,%r8
  test   %esi,%esi
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  cmovne %rax,%rcx
  mov    %edx,%ebp
  test   %edi,%edi
  push   %rbx
  lea    D57(%rip),%rax
  lea    D92(%rip),%rdx
  mov    %esi,%ebx
  cmovne %rax,%rdx
  mov    %r13,%rsi
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  cmp    $0x1,%ebp
  ja     L99
  lea    D59(%rip),%r14
  cmp    $0x1,%ebx
  ja     L58
  xor    %eax,%eax
  mov    %ebp,%esi
  mov    %r12d,%edi
  call   <wait_for_bridge_setup@plt>
  cmp    %ebx,%ebp
  jne    L85
L63:
  test   %ebp,%ebp
  je     L24
L45:
  cmp    $0x1,%ebp
  jne    L25
  mov    $0x1,%esi
  mov    %r12d,%edi
  xor    %eax,%eax
  call   <set_opmode_sta@plt>
L29:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L85:
  test   %ebp,%ebp
  jne    L45
  mov    %r12d,%edi
  xor    %esi,%esi
  xor    %eax,%eax
  call   <set_opmode_ap@plt>
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L58:
  mov    $0x132,%esi
  mov    %r14,%rdi
  xor    %eax,%eax
  mov    %r13,%rdx
  call   <printf@plt>
  xor    %eax,%eax
  mov    %ebp,%esi
  mov    %r12d,%edi
  call   <wait_for_bridge_setup@plt>
  cmp    %ebx,%ebp
  je     L63
  jmp    L85
  nopl   0x0(%rax)
L99:
  lea    D59(%rip),%r14
  xor    %eax,%eax
  mov    %r13,%rdx
  mov    $0x131,%esi
  mov    %r14,%rdi
  call   <printf@plt>
  cmp    $0x1,%ebx
  ja     L58
  mov    %ebp,%esi
  mov    %r12d,%edi
  xor    %eax,%eax
  call   <wait_for_bridge_setup@plt>
L25:
  lea    D64(%rip),%rdi
  call   <puts@plt>
  pop    %rbx
  mov    $0xffffffff,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L24:
  lea    D6(%rip),%rdi
  xor    %eax,%eax
  call   <nvram_safe_get@plt>
  mov    %eax,%edi
  xor    %eax,%eax
  call   <atoi@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L29
  nopl   0x0(%rax)
L83:
  mov    %ebp,%esi
  mov    %r12d,%edi
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <set_ap_security@plt>
  cmp    %ebp,%ebx
  jne    L83
  jmp    L29
```

tool_calls: name: unpack_data
arguments: data_label: D13
data_type: string
name: unpack_data
arguments: data_label: D18
data_type: string
name: unpack_data
arguments: data_label: D28
data_type: string
name: unpack_data
arguments: data_label: D57
data_type: string
name: unpack_data
arguments: data_label: D92
data_type: string
name: unpack_data
arguments: data_label: D12
data_type: string
name: unpack_data
arguments: data_label: D59
data_type: string
name: unpack_data
arguments: data_label: D64
data_type: string
name: unpack_data
arguments: data_label: D6
data_type: string

tool: D13: WLAN_MODE_STA

tool: D18: WLAN_MODE_AP

tool: D28: set_operation_mode

tool: D57: RADIO_5G

tool: D92: RADIO_2G

tool: D12: %s(%s, %s, %s)


tool: D59: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/liutianpingyanxiaoyu/cpe/refs/heads/master/package/liteon-apps/wlan-middleware/src/mid_func.c:%u:%s: Error:Such wlan mode is not supported currently


tool: D64: Error:Such wlan mode is not supported current, please check it

tool: D6: wlv_rule_max

assistant: ```c
int set_operation_mode(int radio, int mode_prev, int mode_curr) {
  int ssid_num = 0;
  int i;
  printf("%s(%s, %s, %s)\r\n", __FUNCTION__, radio == 0 ? "RADIO_2G" : "RADIO_5G", mode_prev == 0 ? "WLAN_MODE_AP" : "WLAN_MODE_STA", mode_curr == 0 ? "WLAN_MODE_AP" : "WLAN_MODE_STA");
  do {
    if (!((0 == mode_curr) || (1 == mode_curr)))
      printf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/liutianpingyanxiaoyu/cpe/refs/heads/master/package/liteon-apps/wlan-middleware/src/mid_func.c"
             ":%u:%s: "
             "Error:Such wlan mode is not supported currently"
             "\n",
             305, __FUNCTION__);
  } while (0);
  do {
    if (!((0 == mode_prev) || (1 == mode_prev)))
      printf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/liutianpingyanxiaoyu/cpe/refs/heads/master/package/liteon-apps/wlan-middleware/src/mid_func.c"
             ":%u:%s: "
             "Error:Such wlan mode is not supported currently"
             "\n",
             306, __FUNCTION__);
  } while (0);
  wait_for_bridge_setup(radio, mode_curr);
  if ((mode_prev == mode_curr) && (mode_curr == 0)) {
    ssid_num = atoi(nvram_safe_get("wlv_rule_max"));
    for (i = 0; i < ssid_num; i++) {
      set_ap_security(radio, i);
    }
    return 0;
  }
  switch (mode_curr) {
  case 0:
    set_opmode_ap(radio, mode_curr);
    break;
  case 1:
    set_opmode_sta(radio, mode_curr);
    break;
  default:
    printf("Error:Such wlan mode is not supported current, please check it\n");
    return -1;
  }
  return 0;
}
```