user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<build_string>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8d,-0x34(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L22
  lea    D8(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L387
L406:
  cmpq   $0x0,-0x20(%rbp)
  je     L464
  cmpq   $0x0,-0x28(%rbp)
  je     L241
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L241
  lea    D73(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L235
L241:
  mov    -0x8(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L387
L464:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <putchar@plt>
L387:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L406
  mov    $0xc,%eax
  jmp    L235
L22:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L51
  mov    $0x0,%eax
  jmp    L235
L51:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L530
  movw   $0x0,-0xa(%rbp)
  jmp    L394
L398:
  cmpq   $0x0,-0x20(%rbp)
  je     L250
  cmpq   $0x0,-0x28(%rbp)
  je     L580
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L580
  lea    D73(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L235
L580:
  mov    -0x18(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L188
L250:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <putchar@plt>
L188:
  movzwl -0xa(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0xa(%rbp)
L394:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L398
  movswl -0xa(%rbp),%eax
  jmp    L235
L530:
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %ax,-0xe(%rbp)
  movw   $0x0,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L569
L411:
  movzwl -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0xc(%rbp)
  addq   $0x1,-0x8(%rbp)
L569:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L411
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movw   $0x0,-0xa(%rbp)
  movzwl -0xe(%rbp),%eax
  cmp    -0xc(%rbp),%ax
  jle    L33
  cmpl   $0x2,-0x34(%rbp)
  jne    L556
  jmp    L114
L101:
  movzwl -0xa(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0xa(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L528
  cmpq   $0x0,-0x28(%rbp)
  je     L225
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L225
  lea    D73(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L235
L225:
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movb   $0x20,(%rax)
  jmp    L419
L528:
  mov    $0x20,%edi
  call   <putchar@plt>
L419:
  movzwl -0xe(%rbp),%eax
  sub    $0x1,%eax
  mov    %ax,-0xe(%rbp)
L114:
  movzwl -0xe(%rbp),%eax
  cmp    -0xc(%rbp),%ax
  jg     L101
  jmp    L331
L400:
  movzwl -0xa(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0xa(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L347
  cmpq   $0x0,-0x28(%rbp)
  je     L155
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L155
  lea    D73(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L235
L155:
  mov    -0x8(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L331
L347:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <putchar@plt>
L331:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L400
  jmp    L109
L581:
  movzwl -0xa(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0xa(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L24
  cmpq   $0x0,-0x28(%rbp)
  je     L423
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L423
  lea    D73(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L235
L423:
  mov    -0x8(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L556
L24:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <putchar@plt>
L556:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L581
  jmp    L546
L127:
  movzwl -0xa(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0xa(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L477
  cmpq   $0x0,-0x28(%rbp)
  je     L305
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L305
  lea    D73(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L235
L305:
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movb   $0x20,(%rax)
  jmp    L457
L477:
  mov    $0x20,%edi
  call   <putchar@plt>
L457:
  movzwl -0xe(%rbp),%eax
  sub    $0x1,%eax
  mov    %ax,-0xe(%rbp)
L546:
  movzwl -0xe(%rbp),%eax
  cmp    -0xc(%rbp),%ax
  jg     L127
  jmp    L109
L404:
  movzwl -0xa(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0xa(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L523
  cmpq   $0x0,-0x28(%rbp)
  je     L395
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L395
  lea    D73(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L235
L395:
  mov    -0x8(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L33
L523:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <putchar@plt>
L33:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L404
L109:
  movswl -0xa(%rbp),%eax
L235:
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D8
datatype: string
name: read_data
arguments: tag: D73
datatype: string

tool: D8: NULL_POINTER

tool: D73: s_printf buffer overflow

assistant: ```c
int build_string(char *src, char *dest, char *bufend, char *hdr, int sign) {
  char *cp1;
  short minsize, i, j;
  if (!src) {
    cp1 = "NULL_POINTER";
    while (*cp1) {
      if (dest) {
        if (bufend && (dest >= bufend)) {
          puts("s_printf buffer overflow");
          return (-1);
        }
        *dest++ = *cp1++;
      } else {
        putchar(*cp1++);
      };
    }
    return (12);
  }
  if (!*src)
    return (0);
  if (!hdr[0]) {
    j = 0;
    while (*src) {
      if (dest) {
        if (bufend && (dest >= bufend)) {
          puts("s_printf buffer overflow");
          return (-1);
        }
        *dest++ = *src++;
      } else {
        putchar(*src++);
      };
      j++;
    }
    return (j);
  }
  minsize = (short)atoi(hdr);
  i = 0;
  cp1 = (char *)src;
  while (*cp1) {
    i++;
    cp1++;
  }
  cp1 = (char *)src;
  j = 0;
  if (minsize > i) {
    if (sign == 2) {
      while (minsize > i) {
        j++;
        if (dest) {
          if (bufend && (dest >= bufend)) {
            puts("s_printf buffer overflow");
            return (-1);
          }
          *dest++ = ' ';
        } else {
          if (' ')
            putchar(' ');
        };
        minsize--;
      }
      while (*cp1) {
        j++;
        if (dest) {
          if (bufend && (dest >= bufend)) {
            puts("s_printf buffer overflow");
            return (-1);
          }
          *dest++ = *cp1++;
        } else {
          putchar(*cp1++);
        };
      }
    } else {
      while (*cp1) {
        j++;
        if (dest) {
          if (bufend && (dest >= bufend)) {
            puts("s_printf buffer overflow");
            return (-1);
          }
          *dest++ = *cp1++;
        } else {
          putchar(*cp1++);
        };
      }
      while (minsize > i) {
        j++;
        if (dest) {
          if (bufend && (dest >= bufend)) {
            puts("s_printf buffer overflow");
            return (-1);
          }
          *dest++ = ' ';
        } else {
          if (' ')
            putchar(' ');
        };
        minsize--;
      }
    }
  } else {
    while (*cp1) {
      j++;
      if (dest) {
        if (bufend && (dest >= bufend)) {
          puts("s_printf buffer overflow");
          return (-1);
        }
        *dest++ = *cp1++;
      } else {
        putchar(*cp1++);
      };
    }
  }
  return (j);
}
```