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

```asm
<wheelSwitchFormat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x160,%rsp
  mov    %rdi,-0x148(%rbp)
  mov    %rsi,-0x150(%rbp)
  mov    %rdx,-0x158(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x120(%rbp)
  movq   $0x0,-0x130(%rbp)
  movw   $0x20,-0x112(%rbp)
  movl   $0x0,-0x134(%rbp)
  mov    -0x150(%rbp),%rax
  movl   $0x6,(%rax)
  mov    -0x158(%rbp),%rax
  movl   $0x2,(%rax)
  mov    -0x148(%rbp),%rax
  mov    D3(%rip),%edx
  movd   %edx,%xmm0
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x120(%rbp)
  cmpq   $0x0,-0x120(%rbp)
  je     L151
  mov    -0x120(%rbp),%rax
  mov    D0(%rip),%edx
  movd   %edx,%xmm0
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x130(%rbp)
L151:
  cmpq   $0x0,-0x120(%rbp)
  je     L140
  cmpq   $0x0,-0x130(%rbp)
  jne    L125
L140:
  lea    -0x110(%rbp),%rax
  lea    D31(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L156
L125:
  movb   $0x0,-0x110(%rbp)
  mov    -0x120(%rbp),%rax
  sub    -0x148(%rbp),%rax
  add    $0x1,%eax
  mov    %eax,%edx
  mov    -0x148(%rbp),%rcx
  lea    -0x110(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
  mov    -0x120(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x128(%rbp)
L190:
  mov    -0x128(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L92
  movb   $0x2b,-0x112(%rbp)
  addq   $0x1,-0x128(%rbp)
  jmp    L190
L92:
  mov    -0x128(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L21
  mov    -0x128(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x23,%al
  je     L21
  mov    -0x128(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  je     L21
  mov    -0x128(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L171
L21:
  addq   $0x1,-0x128(%rbp)
  jmp    L190
L171:
  lea    -0x112(%rbp),%rdx
  lea    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x158(%rbp),%rcx
  mov    -0x150(%rbp),%rdx
  mov    -0x128(%rbp),%rax
  lea    D2(%rip),%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  mov    %eax,-0x134(%rbp)
  cmpl   $0x2,-0x134(%rbp)
  jne    L114
  mov    -0x150(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L71
  mov    -0x150(%rbp),%rax
  movl   $0x6,(%rax)
L71:
  mov    -0x158(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L88
  mov    -0x158(%rbp),%rax
  movl   $0x2,(%rax)
L88:
  mov    -0x150(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x158(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jg     L196
  mov    -0x150(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x1(%rax),%edx
  mov    -0x158(%rbp),%rax
  mov    %edx,(%rax)
L196:
  mov    -0x158(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L156
  mov    -0x158(%rbp),%rax
  movl   $0x0,(%rax)
  jmp    L156
L114:
  cmpl   $0x1,-0x134(%rbp)
  jne    L99
  mov    -0x150(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L112
  mov    -0x150(%rbp),%rax
  movl   $0x6,(%rax)
  mov    -0x158(%rbp),%rax
  movl   $0x2,(%rax)
  jmp    L156
L112:
  mov    -0x158(%rbp),%rax
  movl   $0x0,(%rax)
  jmp    L156
L99:
  mov    -0x150(%rbp),%rax
  movl   $0x6,(%rax)
  mov    -0x158(%rbp),%rax
  movl   $0x2,(%rax)
L156:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L217
  call   <__stack_chk_fail@plt>
L217:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D3
type_guessed: byte[4]
name: retrieve_data
arguments: tag: D0
type_guessed: byte[4]
name: retrieve_data
arguments: tag: D31
type_guessed: string
name: retrieve_data
arguments: tag: D2
type_guessed: string

tool: {"D3": [0x00,0x00,0x14,0x42]}

tool: {"D0": [0x00,0x00,0xcc,0x42]}

tool: D31: % 6.2f

tool: D2: %d.%d

assistant: ```c
void wheelSwitchFormat(char *format, int *width, int *precision) {
  char *percent = NULL, *fpart = NULL, *ad;
  char format_used[255];
  char flag_char[2] = " ";
  int nparsed = 0;
  *width = 6;
  *precision = 2;
  percent = strchr(format, '%');
  if (percent != NULL) {
    fpart = strchr(percent, 'f');
  }
  if (percent == NULL || fpart == NULL) {
    strcpy(format_used, "% 6.2f");
  } else {
    format_used[0] = '\0';
    strncat(format_used, format, percent - format + 1);
    ad = percent + 1;
    while (1) {
      if (*ad == '+') {
        flag_char[0] = '+';
        ad++;
      } else if (*ad == ' ' || *ad == '#' || *ad == '0' || *ad == '-') {
        ad++;
      } else {
        break;
      }
    }
    strcat(format_used, flag_char);
    nparsed = sscanf(ad, "%d.%d", width, precision);
    if (nparsed == 2) {
      if (*width < 0)
        *width = 6;
      if (*precision < 0)
        *precision = 2;
      if (*precision > *width - 1)
        *precision = *width - 1;
      if (*precision < 0)
        *precision = 0;
    } else if (nparsed == 1) {
      if (*width < 0) {
        *width = 6;
        *precision = 2;
      } else {
        *precision = 0;
      }
    } else {
      *width = 6;
      *precision = 2;
    }
  }
}
```