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

```asm
<sdtools_isinelemlist>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <sdtools_strlefttrim@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x24(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  cmpl   $0xffffffff,-0x44(%rbp)
  jne    L38
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  jmp    L84
L38:
  mov    -0x44(%rbp),%eax
  mov    -0x10(%rbp),%rdx
  mov    -0x40(%rbp),%rcx
  sub    %rcx,%rdx
  sub    %edx,%eax
L84:
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <sdtools_strtrimmedlen@plt>
  mov    %eax,-0x20(%rbp)
L85:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <sdtools_strlefttrim@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jne    L65
  mov    $0xffffffff,%eax
  jmp    L115
L65:
  mov    -0x18(%rbp),%rax
  mov    $0x2c,%esi
  mov    %rax,%rdi
  call   <index@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jne    L41
  mov    $0xffffffff,%eax
  jmp    L115
L41:
  cmpq   $0x0,-0x8(%rbp)
  je     L52
  mov    -0x8(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  sub    %rdx,%rax
  mov    %eax,%edx
  jmp    L102
L52:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
L102:
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <sdtools_strtrimmedlen@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jne    L99
  mov    -0x1c(%rbp),%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncasecmp@plt>
  test   %rax,%rax
  jne    L99
  mov    -0x24(%rbp),%eax
  jmp    L115
L99:
  cmpq   $0x0,-0x8(%rbp)
  je     L83
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  jg     L40
  mov    $0xffffffff,%eax
  jmp    L115
L40:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x18(%rbp)
L83:
  addl   $0x1,-0x24(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L85
  mov    $0xffffffff,%eax
L115:
  leave
  ret
```

assistant: ```c
int sdtools_isinelemlist(const char *elemlist, const char *str, int len) {
  char *lefttrimmedstr = sdtools_strlefttrim(str);
  int nstr;
  int cnt = 0;
  char *lefttrimmedelemlist = (char *)elemlist;
  int nelemlist;
  char *indexpos;
  nstr = (len == -1) ? strlen(lefttrimmedstr) : len - (((int)((long)((lefttrimmedstr)) - (long)((str)))) / sizeof(char));
  nstr = sdtools_strtrimmedlen(lefttrimmedstr, nstr);
  do {
    lefttrimmedelemlist = sdtools_strlefttrim(lefttrimmedelemlist);
    if (strlen(lefttrimmedelemlist) == 0)
      return -1;
    indexpos = index(lefttrimmedelemlist, ',');
    if (indexpos == lefttrimmedelemlist)
      return -1;
    nelemlist = sdtools_strtrimmedlen(lefttrimmedelemlist, ((indexpos) ? (((int)((long)((indexpos)) - (long)((lefttrimmedelemlist)))) / sizeof(char)) : strlen(lefttrimmedelemlist)));
    if (nelemlist == nstr && strncasecmp(lefttrimmedelemlist, lefttrimmedstr, nelemlist) == 0) {
      return cnt;
    } else {
      if (indexpos) {
        if (strlen(indexpos) <= 1)
          return -1;
        lefttrimmedelemlist = &indexpos[1];
      }
    }
    cnt++;
  } while (indexpos);
  return -1;
}
```