user: Please show me the C implementation that matches the assembly code listed below:

```asm
<i_Xs_conv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %esi,0xc(%rsp)
  mov    %rdx,%r12
  mov    %rdx,%rdi
  call   <jelio_buffer_peekc@plt>
  mov    %eax,%edi
  mov    $0x0,%ebp
  jmp    L171
L54:
  mov    %r12,%rdi
  call   <jelio_buffer_getc@plt>
  add    $0x1,%ebp
  mov    %r12,%rdi
  call   <jelio_buffer_peekc@plt>
  mov    %eax,%edi
L171:
  call   <char_isspace@plt>
  test   %rax,%rax
  jne    L54
  mov    $0x0,%r14d
  cmpl   $0x0,0xc(%rsp)
  jle    L150
  add    $0x1,%ebp
  movl   $0x0,0x8(%rsp)
  mov    $0x0,%r15d
  jmp    L38
L97:
  mov    %ebp,%r14d
  cmpl   $0x0,0x8(%rsp)
  je     L168
  cmp    $0x9,%eax
  ja     L142
  lea    0x1(%r13),%rax
  add    0x0(%r13),%bl
  sub    $0x30,%ebx
L172:
  mov    %bl,0x0(%r13)
  add    $0x1,%r15d
  mov    %rax,%r13
  movl   $0x0,0x8(%rsp)
L36:
  mov    %r12,%rdi
  call   <jelio_buffer_getc@plt>
  add    $0x1,%ebp
  cmp    0xc(%rsp),%r15d
  jge    L150
L38:
  lea    -0x1(%rbp),%r14d
  mov    %r12,%rdi
  call   <jelio_buffer_peekc@plt>
  mov    %eax,%ebx
  cmp    $0xffffffff,%eax
  je     L150
  mov    %eax,%edi
  call   <char_isspace@plt>
  test   %rax,%rax
  jne    L150
  lea    -0x30(%rbx),%eax
  lea    -0x61(%rbx),%edx
  cmp    $0x9,%eax
  jbe    L97
  cmp    $0x5,%edx
  jbe    L97
  lea    -0x41(%rbx),%eax
  cmp    $0x5,%eax
  ja     L150
  mov    %ebp,%r14d
  cmpl   $0x0,0x8(%rsp)
  jne    L84
L19:
  sub    $0x37,%ebx
  shl    $0x4,%ebx
  mov    %bl,0x0(%r13)
  movl   $0x1,0x8(%rsp)
  jmp    L36
L142:
  cmp    $0x5,%edx
  ja     L84
  lea    0x1(%r13),%rax
  add    0x0(%r13),%bl
  sub    $0x57,%ebx
  jmp    L172
L84:
  lea    0x1(%r13),%rax
  add    0x0(%r13),%bl
  sub    $0x37,%ebx
  jmp    L172
L168:
  cmp    $0x9,%eax
  ja     L69
  shl    $0x4,%ebx
  mov    %bl,0x0(%r13)
  movl   $0x1,0x8(%rsp)
  jmp    L36
L69:
  cmp    $0x5,%edx
  ja     L19
  sub    $0x57,%ebx
  shl    $0x4,%ebx
  mov    %bl,0x0(%r13)
  movl   $0x1,0x8(%rsp)
  jmp    L36
L150:
  mov    %r14d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int i_Xs_conv(void *value, int n, void *inbuf) {
  struct jelio_buf *jb = inbuf;
  unsigned char *sval = value;
  unsigned int c;
  int count = 0;
  int scount = 0;
  int flag = 0;
  for (c = jelio_buffer_peekc(jb); char_isspace(c); c = jelio_buffer_peekc(jb)) {
    jelio_buffer_getc(jb);
    count++;
  }
  if (n < 1)
    return 0;
  while (1) {
    if (scount >= n)
      break;
    c = jelio_buffer_peekc(jb);
    if (c == -1 || char_isspace(c))
      break;
    if ((c < '0' || c > '9') && (c < 'a' || c > 'f') && (c < 'A' || c > 'F'))
      break;
    count++;
    if (flag) {
      if (c >= '0' && c <= '9')
        *sval++ += (c - '0');
      else {
        if (c >= 'a' && c <= 'f')
          *sval++ += (c - 'a' + 10);
        else
          *sval++ += (c - 'A' + 10);
      }
      scount++;
      flag = 0;
    } else {
      if (c >= '0' && c <= '9')
        *sval = (c - '0') << 4;
      else {
        if (c >= 'a' && c <= 'f')
          *sval = (c - 'a' + 10) << 4;
        else
          *sval = (c - 'A' + 10) << 4;
      }
      flag = 1;
    }
    jelio_buffer_getc(jb);
  }
  return count;
}
```