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

```asm
<get_operand_regtype_str>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%r14d
  mov    %rsi,%r12
  mov    %edx,%r13d
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  lea    D5(%rip),%rbx
  lea    D23(%rip),%rbp
  jmp    L105
L54:
  lea    D36(%rip),%rdi
  call   <strlen@plt>
  mov    %eax,0x8(%rsp)
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,0xc(%rsp)
  test   %r13d,%r13d
  jne    L34
L46:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    $0x0,%r13d
L103:
  add    $0x10,%rbx
  mov    -0x8(%rbx),%rbp
  test   %rbp,%rbp
  je     L28
L105:
  mov    %r14d,%eax
  and    (%rbx),%eax
  je     L103
  cmpb   $0x0,(%r12)
  jne    L54
L0:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,0x8(%rsp)
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,0xc(%rsp)
  test   %r13d,%r13d
  je     L103
  lea    -0x1(%r13),%r15d
  mov    %r15d,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strncat@plt>
  mov    0x8(%rsp),%ecx
  sub    %ecx,%r13d
  cmp    %r15d,%ecx
  jl     L103
  mov    0xc(%rsp),%eax
  add    %r15d,%eax
  cltq
  movb   $0x0,(%r12,%rax,1)
  mov    $0x0,%r13d
  jmp    L103
L34:
  lea    -0x1(%r13),%r15d
  mov    %r15d,%edx
  lea    D36(%rip),%rsi
  mov    %r12,%rdi
  call   <strncat@plt>
  cmp    %r15d,0x8(%rsp)
  jl     L48
  mov    0xc(%rsp),%eax
  add    %r15d,%eax
  cltq
  movb   $0x0,(%r12,%rax,1)
  jmp    L46
L48:
  sub    0x8(%rsp),%r13d
  jmp    L0
L28:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: data_label: D23
data_type: string
name: parse_data
arguments: data_label: D36
data_type: string

tool: D23: reg_gen

tool: D36:  

assistant: ```c
void get_operand_regtype_str(int regtype, char *str, int len) {
  static struct {
    const char *name;
    int value;
  } operand_regtypes[] = {
      {"reg_gen", 0x00001}, {"reg_in", 0x00002}, {"reg_out", 0x00004}, {"reg_local", 0x00008}, {"reg_fpu", 0x00010}, {"reg_seg", 0x00020}, {"reg_simd", 0x00040}, {"reg_sys", 0x00080}, {"reg_sp", 0x00100}, {"reg_fp", 0x00200}, {"reg_pc", 0x00400}, {"reg_retaddr", 0x00800}, {"reg_cond", 0x01000}, {"reg_zero", 0x02000}, {"reg_ret", 0x04000}, {"reg_src", 0x10000}, {"reg_dest", 0x20000}, {"reg_count", 0x40000}, {NULL, 0},
  };
  unsigned int i;
  memset(str, 0, len);
  for (i = 0; operand_regtypes[i].name; i++) {
    if (!(regtype & operand_regtypes[i].value))
      continue;
    if (str[0]) {
      do {
        int _i = strlen(" "), _blen = strlen(str), _len = len - 1;
        if (len) {
          strncat(str, " ", _len);
          if (_len <= _i) {
            str[_blen + _len] = '\0';
            len = 0;
          } else {
            len -= _i;
          }
        }
      } while (0);
    }
    do {
      int _i = strlen(operand_regtypes[i].name), _blen = strlen(str), _len = len - 1;
      if (len) {
        strncat(str, operand_regtypes[i].name, _len);
        if (_len <= _i) {
          str[_blen + _len] = '\0';
          len = 0;
        } else {
          len -= _i;
        }
      }
    } while (0);
  }
}
```