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

```asm
<gilparse>:
  endbr64
  push   %r15
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  lea    D22(%rip),%r13
  push   %r12
  mov    %r14d,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0xe8,%rsp
  mov    %rdx,0x48(%rsp)
  lea    0x60(%rsp),%r15
  lea    0x80(%rsp),%rbp
  mov    %rdi,0x10(%rsp)
  mov    %rsi,0x38(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  mov    %rbx,%rsi
  lea    D42(%rip),%rdi
  xor    %ebx,%ebx
  mov    %eax,0x8(%rsp)
  xor    %eax,%eax
  call   <plintf@plt>
  lea    0x58(%rsp),%rsi
  lea    0x54(%rsp),%rdi
  xor    %eax,%eax
  mov    %rsi,0x20(%rsp)
  lea    0xa0(%rsp),%rdx
  lea    0x5c(%rsp),%rsi
  mov    %rdi,0x18(%rsp)
  mov    %rsi,0x28(%rsp)
  mov    %rdx,0x30(%rsp)
  jmp    L39
  nop
L12:
  movslq %eax,%rcx
  add    $0x1,%eax
  mov    %dl,0xa0(%rsp,%rcx,1)
L3:
  add    $0x1,%rbx
L39:
  mov    0x10(%rsp),%rdi
  mov    %ebx,0x4(%rsp)
  movzbl (%rdi,%rbx,1),%edx
  cmp    $0x2c,%dl
  je     L83
  cmp    %ebx,0x8(%rsp)
  jg     L12
L83:
  mov    0x20(%rsp),%r8
  mov    0x18(%rsp),%rcx
  cltq
  mov    %r15,%rsi
  mov    0x28(%rsp),%rdx
  mov    0x30(%rsp),%rdi
  movb   $0x0,0xa0(%rsp,%rax,1)
  call   <g_namelist@plt>
  test   %rax,%rax
  je     L27
  mov    0x5c(%rsp),%r14d
  test   %r14d,%r14d
  jne    L40
  lea    D13(%rip),%rdi
  xor    %eax,%eax
  mov    %r15,%rsi
  call   <plintf@plt>
  mov    %r15,%rdi
  call   <get_var_index@plt>
  test   %eax,%eax
  js     L90
  mov    0x38(%rsp),%rsi
  movslq %r12d,%rdx
  add    $0x1,%r12d
  mov    %eax,(%rsi,%rdx,4)
L107:
  mov    0x4(%rsp),%edx
  cmp    %edx,0x8(%rsp)
  jle    L156
L53:
  xor    %eax,%eax
  jmp    L3
  nopw   0x0(%rax,%rax,1)
L40:
  mov    0x54(%rsp),%edx
  mov    0x58(%rsp),%ecx
  xor    %eax,%eax
  mov    %r15,%rsi
  lea    D15(%rip),%rdi
  call   <plintf@plt>
  mov    0x54(%rsp),%eax
  mov    0x58(%rsp),%edx
  sub    %eax,%edx
  mov    %edx,0xc(%rsp)
  js     L107
  mov    0x38(%rsp),%rdi
  movslq %r12d,%rdx
  xor    %r14d,%r14d
  add    $0x1,%r12d
  mov    %rbx,0x40(%rsp)
  mov    %eax,%ecx
  mov    %r14,%rbx
  mov    %r12d,%r14d
  lea    (%rdi,%rdx,4),%rdx
  mov    %rdx,%r12
  jmp    L160
  xchg   %ax,%ax
L66:
  mov    %eax,(%r12,%rbx,4)
  lea    (%r14,%rbx,1),%eax
  add    $0x1,%rbx
  cmp    %ebx,0xc(%rsp)
  jl     L149
  mov    0x54(%rsp),%ecx
L160:
  add    %ebx,%ecx
  mov    %rbp,%rdi
  mov    %r15,%rdx
  mov    %r13,%rsi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <get_var_index@plt>
  test   %eax,%eax
  jns    L66
  mov    %rbp,%rsi
  lea    D40(%rip),%rdi
  xor    %eax,%eax
  xor    %r12d,%r12d
  call   <plintf@plt>
L137:
  mov    0xd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L54
  add    $0xe8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L149:
  mov    0x40(%rsp),%rbx
  mov    0x4(%rsp),%edx
  mov    %eax,%r12d
  cmp    %edx,0x8(%rsp)
  jg     L53
L156:
  mov    0x48(%rsp),%rax
  mov    %r12d,(%rax)
  mov    $0x1,%r12d
  jmp    L137
  cs nopw 0x0(%rax,%rax,1)
L27:
  mov    0x10(%rsp),%rsi
  lea    D30(%rip),%rdi
  xor    %r12d,%r12d
  call   <printf@plt>
  jmp    L137
L90:
  mov    %r15,%rsi
  lea    D40(%rip),%rdi
  xor    %eax,%eax
  mov    %r14d,%r12d
  call   <plintf@plt>
  jmp    L137
L54:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D22
type: string
name: read_data
arguments: data_label: D42
type: string
name: read_data
arguments: data_label: D13
type: string
name: read_data
arguments: data_label: D15
type: string
name: read_data
arguments: data_label: D40
type: string
name: read_data
arguments: data_label: D30
type: string

tool: D22: %s%d

tool: D42: s=|%s|

tool: D13: added %s


tool: D15: added %s{%d-%d}


tool: D40: No such name %s


tool: D30: Bad gillespie list %s


assistant: ```c
int gilparse(char *s, int *ind, int *nn) {
  int i = 0, n = strlen(s);
  char piece[50], b[20], bn[25], c;
  int i1, i2, jp = 0, f;
  int k = 0, iv;
  int id, m;
  plintf("s=|%s|", s);
  while (1) {
    c = s[i];
    if (c == ',' || i > (n - 1)) {
      piece[jp] = 0;
      if (g_namelist(piece, b, &f, &i1, &i2) == 0) {
        printf("Bad gillespie list %s\n", s);
        return 0;
      }
      if (f == 0) {
        plintf("added %s\n", b);
        iv = get_var_index(b);
        if (iv < 0) {
          plintf("No such name %s\n", b);
          return 0;
        }
        ind[k] = iv;
        k++;
      } else {
        plintf("added %s{%d-%d}\n", b, i1, i2);
        m = i2 - i1 + 1;
        for (id = 0; id < m; id++) {
          sprintf(bn, "%s%d", b, id + i1);
          iv = get_var_index(bn);
          if (iv < 0) {
            plintf("No such name %s\n", bn);
            return 0;
          }
          ind[k] = iv;
          k++;
        }
      }
      if (i > (n - 1)) {
        *nn = k;
        return 1;
      }
      jp = 0;
    } else {
      piece[jp] = c;
      jp++;
    }
    i++;
  }
  *nn = k;
  return 1;
}
```