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

```asm
<optionValueGet>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    (%rsi),%ebx
  mov    %rdi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  cmp    %eax,%ebx
  jge    L168
  movslq (%r12),%rsi
  mov    0x8(%rsp),%rbx
  movl   $0xffffffff,0x14(%rsp)
  lea    (%rbx,%rsi,1),%rcx
  mov    %rsi,%rax
  mov    %esi,%edi
  movzbl (%rcx),%edx
  test   %dl,%dl
  je     L168
  cmp    $0x2c,%dl
  je     L168
  test   %ebp,%ebp
  jne    L62
  lea    0x1(%rbx,%rsi,1),%r15
  mov    %rcx,%r14
  mov    %esi,%ebx
  mov    %r15,%r13
  sub    %rcx,%r13
  jmp    L125
  nopl   0x0(%rax,%rax,1)
L234:
  movslq (%r12),%rax
  cmp    %ebx,%eax
  jl     L168
L29:
  movzbl (%r15),%edx
  lea    0x1(%rbx),%esi
  add    %r13,%r14
  add    $0x1,%r15
  test   %dl,%dl
  je     L150
  cmp    $0x2c,%dl
  je     L150
  mov    %esi,%ebx
L125:
  cmp    %ebx,%eax
  je     L78
L183:
  test   %ebp,%ebp
  je     L234
  movsbl (%r14),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L168
  movslq (%r12),%rax
  jmp    L29
  nopl   (%rax)
L78:
  movsbl %dl,%edi
  call   <tolower@plt>
  cmp    $0x78,%al
  jne    L183
  movsbl (%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L183
  movslq (%r12),%rax
  mov    $0x1,%ebp
  jmp    L29
  nopl   (%rax)
L150:
  mov    $0xffffffff,%r8d
  sub    %eax,%esi
  je     L244
  cmp    $0x1,%esi
  je     L133
  mov    0x8(%rsp),%rcx
  lea    0x14(%rsp),%rdx
  lea    D0(%rip),%rsi
  lea    0x1(%rcx,%rax,1),%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L168
  mov    0x14(%rsp),%r8d
  cmp    $0x7f,%r8d
  ja     L168
  movzbl (%r14),%edx
  add    $0x2,%ebx
  xor    %eax,%eax
  test   %dl,%dl
  cmove  %eax,%ebx
  mov    %ebx,(%r12)
  nopl   0x0(%rax,%rax,1)
L244:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L269
  add    $0x28,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L19:
  movsbl 0x0(%rbp),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L116
  nopl   0x0(%rax)
L168:
  mov    $0xffffffff,%r8d
  jmp    L244
L133:
  mov    0x8(%rsp),%rcx
  add    $0x2,%ebx
  movzbl (%rcx,%rax,1),%r8d
  xor    %eax,%eax
  test   %dl,%dl
  cmove  %eax,%ebx
  mov    %ebx,(%r12)
  jmp    L244
L62:
  lea    0x1(%rbx,%rsi,1),%rbp
  mov    %esi,%ebx
  jmp    L37
  nopl   0x0(%rax,%rax,1)
L213:
  movslq %edi,%rax
  cmp    %ebx,%edi
  jl     L168
  movzbl 0x0(%rbp),%edx
  mov    %rbp,%r14
  lea    0x1(%rbx),%esi
  add    $0x1,%rbp
  test   %dl,%dl
  je     L150
  cmp    $0x2c,%dl
  je     L150
  mov    %esi,%ebx
L37:
  cmp    %edi,%ebx
  jne    L213
  movsbl %dl,%edi
  call   <tolower@plt>
  cmp    $0x78,%al
  je     L19
L116:
  mov    (%r12),%edi
  jmp    L213
L269:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D0
datatype: string

tool: D0: %x

assistant: ```c
char optionValueGet(char *option, int *index, int cOnly) {
  if (*index >= strlen(option))
    return -1;
  int i = *index;
  int hex = 0;
  unsigned int value = (unsigned int)-1;
  for (; option[i] && option[i] != ','; i++) {
    if (i == *index && tolower(option[i]) == 'x' && isxdigit(option[i + 1])) {
      if (cOnly)
        return -1;
      hex = 1;
      continue;
    }
    if (hex && !isxdigit(option[i]))
      return -1;
    if (!hex && i > *index)
      return -1;
  }
  switch ((i - *index)) {
  case 1:
    value = option[*index];
    break;
  case 0:
    return -1;
  default:
    if (sscanf(&option[*index + 1], "%x", &value) != 1)
      return -1;
    if (value > 0x7f)
      return -1;
    break;
  }
  if (option[i])
    *index = i + 1;
  else
    *index = 0;
  return (char)value;
}
```