user: Converte this assembly snippet into its equivalent C code:

```asm
<wheelSwitchFormat>:
  endbr64
  push   %r14
  mov    $0x20,%ecx
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  sub    $0x120,%rsp
  movss  D13(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  xor    %eax,%eax
  movl   $0x6,(%rsi)
  movl   $0x2,(%rdx)
  mov    %cx,0xe(%rsp)
  call   <strchr@plt>
  test   %rax,%rax
  je     L146
  movss  D12(%rip),%xmm0
  mov    %rax,%rdi
  mov    %rax,%rbx
  call   <strchr@plt>
  test   %rax,%rax
  je     L146
  mov    %rbx,%rdx
  lea    0x10(%rsp),%r14
  mov    %r13,%rsi
  movb   $0x0,0x10(%rsp)
  sub    %r13,%rdx
  mov    %r14,%rdi
  add    $0x1,%edx
  call   <strncat@plt>
  lea    0x2(%rbx),%rax
  movabs $0x1200900000000,%rcx
  nopl   0x0(%rax,%rax,1)
L22:
  movzbl -0x1(%rax),%edx
  lea    -0x1(%rax),%r13
  cmp    $0x2b,%dl
  je     L119
  cmp    $0x30,%dl
  ja     L55
  bt     %rdx,%rcx
  jb     L21
L55:
  lea    0xe(%rsp),%rsi
  mov    %r14,%rdi
  call   <strcat@plt>
  mov    %rbp,%rcx
  mov    %r12,%rdx
  mov    %r13,%rdi
  lea    D25(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x2,%eax
  je     L44
  cmp    $0x1,%eax
  je     L83
L60:
  movl   $0x6,(%r12)
  movl   $0x2,0x0(%rbp)
  jmp    L150
  nopl   0x0(%rax)
L119:
  movb   $0x2b,0xe(%rsp)
L21:
  add    $0x1,%rax
  jmp    L22
  nopl   0x0(%rax,%rax,1)
L146:
  lea    0x10(%rsp),%rdi
  lea    D8(%rip),%rsi
  call   <strcpy@plt>
L150:
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L125
  add    $0x120,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L44:
  mov    (%r12),%eax
  test   %eax,%eax
  jns    L85
  movl   $0x6,(%r12)
  mov    $0x6,%eax
L85:
  mov    0x0(%rbp),%edx
  test   %edx,%edx
  jns    L101
  movl   $0x2,0x0(%rbp)
  mov    (%r12),%eax
  mov    $0x2,%edx
L101:
  cmp    %eax,%edx
  jl     L150
  sub    $0x1,%eax
  mov    %eax,0x0(%rbp)
  jns    L150
L144:
  movl   $0x0,0x0(%rbp)
  jmp    L150
  nopl   0x0(%rax)
L83:
  mov    (%r12),%eax
  test   %eax,%eax
  jns    L144
  jmp    L60
L125:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D13
datatype: byte[4]
name: parse_data
arguments: tag: D12
datatype: byte[4]
name: parse_data
arguments: tag: D25
datatype: string
name: parse_data
arguments: tag: D8
datatype: string

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

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

tool: D25: %d.%d

tool: D8: % 6.2f

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;
    }
  }
}
```