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

```asm
<extract_input_string>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    %eax,%r14d
  cmp    0x0(%r13),%bpl
  je     L118
  mov    $0x1,%ebp
  test   %eax,%eax
  jns    L110
  jmp    L69
  nop
L16:
  add    $0x1,%rbp
  lea    -0x1(%rbp),%eax
  cmp    %eax,%r14d
  jl     L138
L110:
  mov    %ebp,%r8d
  cmp    %bl,0x0(%r13,%rbp,1)
  jne    L16
  lea    0x1(%rbp),%ebx
  lea    0x2(%r8),%r9d
  add    $0x1,%rbp
  movslq %ebx,%r10
L20:
  cmp    %r8d,%r14d
  jne    L15
  mov    %r13,%rcx
  mov    %r15d,%edx
  mov    $0x1,%edi
  mov    %r9d,0xc(%rsp)
  lea    D1(%rip),%rsi
  mov    %r10,(%rsp)
  mov    %r8d,0x8(%rsp)
  call   <err@plt>
  mov    0xc(%rsp),%r9d
  mov    (%rsp),%r10
  mov    0x8(%rsp),%r8d
L15:
  movzbl 0x0(%r13,%r10,1),%eax
  cmp    $0xa,%al
  setne  %dl
  cmp    $0x2c,%al
  setne  %al
  test   %al,%dl
  je     L18
  cmp    %ebx,%r14d
  jl     L18
  lea    0x1(%rbx),%eax
  cltq
  cs nopw 0x0(%rax,%rax,1)
L67:
  movzbl 0x0(%r13,%rax,1),%ecx
  mov    %eax,%edi
  cmp    $0xa,%cl
  setne  %dl
  cmp    $0x2c,%cl
  setne  %cl
  and    %ecx,%edx
  cmp    %eax,%r14d
  setge  %cl
  add    $0x1,%rax
  test   %cl,%dl
  jne    L67
  lea    0x1(%rdi),%r9d
  sub    %r8d,%edi
  lea    -0x1(%rdi),%r14d
  movslq %r14d,%rbx
L42:
  mov    %r9d,(%r12)
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L21
L4:
  lea    0x0(%r13,%rbp,1),%rsi
  mov    %r14d,%edx
  mov    %r12,%rdi
  call   <strncpy@plt>
  movb   $0x0,(%r12,%rbx,1)
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L138:
  lea    0x1(%r8),%ebx
  lea    0x2(%r8),%r9d
  movslq %ebx,%r10
  jmp    L15
L21:
  mov    %r13,%rcx
  mov    %r14d,%edx
  mov    $0x1,%edi
  lea    D18(%rip),%rsi
  call   <err@plt>
  jmp    L4
L18:
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  mov    $0x1,%edi
  jmp    L42
L118:
  mov    $0x2,%r9d
  mov    $0x1,%ebp
  mov    $0x1,%ebx
  xor    %r8d,%r8d
  mov    $0x1,%r10d
  jmp    L20
L69:
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  mov    $0x1,%edi
  mov    $0x2,%r9d
  jmp    L42
```

tool_calls: name: retrieve_data
arguments: data_label: D1
type_infered: string
name: retrieve_data
arguments: data_label: D18
type_infered: string

tool: D1: unrecognized input string in read_platform_properties for index = %d, string = %s

tool: D18: extract_input_string failled to malloc return string of length %d for processing %s

assistant: ```c
char *extract_input_string(char *instr, char key, int index, int *next) {
  int i, j, k, len;
  char *ret_string;
  len = strlen(instr);
  i = 0;
  while ((instr[i] != key) && (i <= len))
    i++;
  if (i == len)
    err(1, "unrecognized input string in read_platform_properties for index = %d, string = %s", index, instr);
  j = i + 1;
  while ((instr[j] != '\n') && (instr[j] != ',') && (j <= len))
    j++;
  *next = j + 1;
  len = j - i - 1;
  ret_string = malloc(len + 1);
  if (ret_string == NULL)
    err(1, "extract_input_string failled to malloc return string of length %d for processing %s", len, instr);
  strncpy(ret_string, &instr[i + 1], len);
  ret_string[len] = '\0';
  return ret_string;
}
```