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

```asm
<hputm>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  mov    %rsi,%rdi
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  mov    %rax,%rbx
  cmp    $0x7,%eax
  jne    L83
  mov    $0x7,%edx
  lea    D17(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %eax,%edx
  test   %eax,%eax
  jne    L113
L134:
  lea    0x2c(%rsp),%rax
  movl   $0x1,0x4(%rsp)
  mov    $0x2,%ebx
  mov    %rax,0x8(%rsp)
  jmp    L104
L113:
  mov    $0x7,%edx
  lea    D8(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  mov    %eax,%edx
  test   %eax,%eax
  je     L134
L83:
  lea    0x2c(%rsp),%rax
  lea    0x1(%rbx),%rdx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  mov    %rax,0x8(%rsp)
  call   <memcpy@plt>
  cmp    $0x7,%rbx
  je     L135
  movl   $0x0,0x4(%rsp)
  mov    %ebx,%edx
  add    $0x2,%ebx
L104:
  mov    %r12,%rdi
  mov    %edx,0x18(%rsp)
  movslq %ebx,%rbx
  call   <strlen@plt>
  mov    0x8(%rsp),%rsi
  mov    %rax,%rbp
  mov    %eax,%r15d
  lea    0x34(%rsp),%rax
  mov    %rax,%r13
  mov    %rax,%rdi
  mov    %rax,0x10(%rsp)
  call   <strcpy@plt>
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    $0x5f,%edx
  mov    %dx,0x0(%r13,%rax,1)
  movb   $0x0,0x34(%rsp,%rbx,1)
  test   %ebp,%ebp
  jle    L132
  mov    0x18(%rsp),%edx
  xor    %ebx,%ebx
  lea    0x41(%rsp),%rbp
  lea    0x40(%rsp),%r13
  movl   $0x31,(%rsp)
  add    $0x1,%edx
  movslq %edx,%rax
  mov    %rax,0x18(%rsp)
  mov    %r14,%rax
  mov    %r15d,%r14d
  mov    %rax,%r15
  jmp    L185
  nopw   0x0(%rax,%rax,1)
L155:
  test   $0x4,%al
  jne    L216
  test   %eax,%eax
  je     L146
  movzbl (%r12),%ecx
  mov    %cl,0x0(%rbp)
  test   $0x2,%al
  jne    L34
L146:
  add    %rdx,%r12
  lea    0x1(%rax),%ecx
  lea    0x2(%rax),%edx
  cmp    $0x7,%r14d
  jle    L142
L172:
  mov    0x4(%rsp),%eax
  movslq %ecx,%rcx
  movslq %edx,%rdx
  movb   $0x27,0x40(%rsp,%rcx,1)
  movb   $0x0,0x40(%rsp,%rdx,1)
  test   %eax,%eax
  je     L106
  mov    0x8(%rsp),%rsi
  xor    %eax,%eax
  mov    %r13,%rdx
  mov    %r15,%rdi
  call   <hputc@plt>
  test   %eax,%eax
  jne    L154
L207:
  add    $0x1,%ebx
  cmp    $0x43,%r14d
  jle    L54
  sub    $0x43,%r14d
L185:
  mov    $0x43,%eax
  movb   $0x27,0x40(%rsp)
  cmp    %eax,%r14d
  cmovle %r14d,%eax
  movslq %eax,%rdx
  cmp    $0x8,%eax
  jb     L155
  mov    (%r12),%rcx
  lea    0x48(%rsp),%rdi
  mov    %rcx,0x0(%rbp)
  mov    %eax,%ecx
  mov    -0x8(%r12,%rcx,1),%rsi
  mov    %rsi,-0x8(%rbp,%rcx,1)
  mov    %rbp,%rcx
  mov    %r12,%rsi
  add    %rdx,%r12
  sub    %rdi,%rcx
  lea    0x2(%rax),%edx
  sub    %rcx,%rsi
  add    %eax,%ecx
  shr    $0x3,%ecx
  rep movsq %ds:(%rsi),%es:(%rdi)
  lea    0x1(%rax),%ecx
  cmp    $0x7,%r14d
  jg     L172
L142:
  mov    $0x7,%edx
  movslq %ecx,%rcx
  mov    $0x20,%esi
  sub    %eax,%edx
  lea    0x0(%r13,%rcx,1),%rdi
  add    $0x1,%rdx
  call   <memset@plt>
  mov    $0xa,%edx
  mov    $0x9,%ecx
  jmp    L172
L135:
  movb   $0x0,0x32(%rsp)
  mov    $0x8,%ebx
  mov    $0x6,%edx
  movl   $0x0,0x4(%rsp)
  jmp    L104
  nopl   0x0(%rax,%rax,1)
L106:
  mov    (%rsp),%eax
  mov    0x18(%rsp),%rdi
  mov    %r13,%rdx
  mov    0x10(%rsp),%rsi
  mov    %al,0x34(%rsp,%rdi,1)
  add    $0x1,%eax
  mov    %r15,%rdi
  mov    %eax,(%rsp)
  xor    %eax,%eax
  call   <hputc@plt>
  test   %eax,%eax
  je     L207
L154:
  mov    0x98(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L41
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L216:
  mov    (%r12),%ecx
  mov    %ecx,0x0(%rbp)
  mov    %eax,%ecx
  mov    -0x4(%r12,%rcx,1),%esi
  mov    %esi,-0x4(%rbp,%rcx,1)
  jmp    L146
L54:
  mov    %ebx,%eax
  jmp    L154
L34:
  mov    %eax,%ecx
  movzwl -0x2(%r12,%rcx,1),%esi
  mov    %si,-0x2(%rbp,%rcx,1)
  jmp    L146
L132:
  xor    %eax,%eax
  jmp    L154
L41:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D17
data_type: string
name: parse_data
arguments: tag: D8
data_type: string

tool: D17: COMMENT

tool: D8: HISTORY

assistant: ```c
int hputm(hstring, keyword, cval)
char *hstring;
char *keyword;
char *cval;
{
  int lroot = 0, lcv, i, ii, nkw, lkw, lval;
  int comment = 0;
  char keyroot[8], newkey[12], *v, value[80];
  char squot = 39;
  lkw = strlen(keyword);
  if (lkw == 7 && (strncmp(keyword, "COMMENT", 7) == 0 || strncmp(keyword, "HISTORY", 7) == 0))
    comment = 1;
  else {
    comment = 0;
    strcpy(keyroot, keyword);
    lroot = strlen(keyroot);
    if (lroot > 6) {
      keyroot[6] = (char)0;
      lroot = 6;
    }
  }
  ii = '1';
  nkw = 0;
  lcv = strlen(cval);
  strcpy(newkey, keyroot);
  strcat(newkey, "_");
  newkey[lroot + 2] = (char)0;
  v = cval;
  while (lcv > 0) {
    if (lcv > 67)
      lval = 67;
    else
      lval = lcv;
    value[0] = squot;
    for (i = 1; i <= lval; i++)
      value[i] = *v++;
    if (lval < 8) {
      for (i = lval + 1; i < 9; i++)
        value[i] = ' ';
      lval = 8;
    }
    value[lval + 1] = squot;
    value[lval + 2] = (char)0;
    if (comment)
      i = hputc(hstring, keyroot, value);
    else {
      newkey[lroot + 1] = ii;
      ii++;
      i = hputc(hstring, newkey, value);
    }
    if (i != 0)
      return (i);
    nkw++;
    if (lcv > 67)
      lcv = lcv - 67;
    else
      break;
  }
  return (nkw);
}
```