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

```asm
<get_operand_regtype_str>:
  endbr64
  push   %r15
  lea    D2(%rip),%r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rsi,%rbp
  xor    %esi,%esi
  push   %rbx
  mov    %rbp,%rdi
  lea    D4(%rip),%rbx
  sub    $0x18,%rsp
  call   <memset@plt>
  mov    $0x1,%eax
  jmp    L60
  nopw   0x0(%rax,%rax,1)
L67:
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%r13d
  call   <strlen@plt>
  mov    %eax,0x8(%rsp)
  test   %r12d,%r12d
  je     L109
  lea    -0x1(%r12),%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  sub    %r13d,%r12d
  mov    %edx,0xc(%rsp)
  call   <strncat@plt>
  mov    0xc(%rsp),%edx
  cmp    %edx,%r13d
  jl     L109
  mov    0x8(%rsp),%ecx
  xor    %r12d,%r12d
  lea    (%rcx,%rdx,1),%eax
  cltq
  movb   $0x0,0x0(%rbp,%rax,1)
  nopl   (%rax)
L109:
  mov    (%rbx),%r15
  add    $0x10,%rbx
  test   %r15,%r15
  je     L52
L88:
  mov    -0x8(%rbx),%eax
L60:
  test   %r14d,%eax
  je     L109
  cmpb   $0x0,0x0(%rbp)
  je     L67
  lea    D25(%rip),%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%r13d
  call   <strlen@plt>
  test   %r12d,%r12d
  jne    L43
  mov    %r15,%rdi
  add    $0x10,%rbx
  call   <strlen@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    -0x10(%rbx),%r15
  test   %r15,%r15
  jne    L88
L52:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L43:
  lea    -0x1(%r12),%edx
  lea    D25(%rip),%rsi
  mov    %rbp,%rdi
  mov    %eax,0xc(%rsp)
  mov    %edx,0x8(%rsp)
  call   <strncat@plt>
  mov    0x8(%rsp),%edx
  cmp    %r13d,%edx
  jg     L63
  mov    0xc(%rsp),%ecx
  mov    %r15,%rdi
  xor    %r12d,%r12d
  add    %ecx,%edx
  movslq %edx,%rdx
  movb   $0x0,0x0(%rbp,%rdx,1)
  call   <strlen@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  jmp    L109
  nopl   0x0(%rax,%rax,1)
L63:
  sub    %r13d,%r12d
  jmp    L67
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D2
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D25
type_guessed: string

tool: D2: reg_gen

tool: D25:  

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);
  }
}
```