user: 请将以下的汇编代码转换成C语言代码:

```asm
<set_str>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movb   $0xa,-0x25(%rbp)
  movb   $0x0,-0x26(%rbp)
  movq   $0x0,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L139
  mov    $0x0,%eax
  jmp    L136
L139:
  movl   $0x0,-0x24(%rbp)
  jmp    L144
L111:
  lea    -0x26(%rbp),%rax
  mov    %rax,%rsi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x24(%rbp),%edx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x26(%rbp),%eax
  mov    %al,(%rdx)
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  sete   %dl
  movzbl -0x26(%rbp),%eax
  cmp    %al,-0x25(%rbp)
  setne  %al
  and    %edx,%eax
  test   %al,%al
  je     L29
  mov    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L38
  mov    $0x0,%eax
  jmp    L136
L38:
  movl   $0x0,-0x1c(%rbp)
  jmp    L35
L147:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x1c(%rbp)
L35:
  mov    -0x1c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jle    L147
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x34(%rbp),%eax
  add    %eax,%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L63
  mov    $0x0,%eax
  jmp    L136
L63:
  movl   $0x0,-0x1c(%rbp)
  jmp    L92
L68:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x1c(%rbp)
L92:
  mov    -0x1c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jle    L68
  shll   -0x34(%rbp)
  movb   $0x0,-0x26(%rbp)
L29:
  addl   $0x1,-0x24(%rbp)
L144:
  movzbl -0x26(%rbp),%eax
  cmp    %al,-0x25(%rbp)
  jne    L111
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  cmpq   $0x0,-0x18(%rbp)
  jne    L106
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L106:
  mov    -0x10(%rbp),%rax
L136:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L13
  call   <__stack_chk_fail@plt>
L13:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D5
type: string

tool: D5: %c

assistant: ```c
char *set_str(int length) {
  unsigned int i, size;
  char end = 10, in = 0, *aux = 0, *str;
  size = sizeof(char *) * length;
  str = malloc(size);
  if (str == 0)
    return 0;
  for (i = 0; in != end; i++) {
    scanf("%c", &in);
    str[i] = in;
    if ((i == length) & (in != end)) {
      int j;
      aux = malloc(size);
      if (aux == 0)
        return 0;
      for (j = 0; j <= length; j++)
        aux[j] = str[j];
      free(str);
      size = sizeof(char *) * (length * 2);
      str = malloc(size);
      if (str == 0)
        return 0;
      for (j = 0; j <= length; j++)
        str[j] = aux[j];
      length *= 2;
      in = 0;
    }
  }
  str[i - 1] = 0;
  if (aux == 0)
    free(aux);
  return str;
}
```