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

```asm
<build_string>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,%rbx
  mov    %rdx,%rbp
  test   %rdi,%rdi
  je     L526
  mov    %rdi,%r15
  mov    %r8d,%r12d
  movzbl (%rdi),%edx
  mov    $0x0,%eax
  test   %dl,%dl
  je     L575
  cmpb   $0x0,(%rcx)
  jne    L66
  add    $0x1,%r15
  mov    %r15,%r13
  mov    $0x1,%r12d
  jmp    L430
L526:
  lea    D28(%rip),%r12
  mov    $0x4e,%edi
  jmp    L364
L129:
  mov    %r12,%r13
  mov    %dil,(%rbx)
  lea    0x1(%rbx),%rbx
L277:
  movzbl 0x0(%r13),%edi
  add    $0x1,%r12
  test   %dil,%dil
  je     L507
L364:
  test   %rbx,%rbx
  je     L164
  test   %rbp,%rbp
  je     L129
  cmp    %rbx,%rbp
  ja     L129
  lea    D54(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L575
L164:
  mov    %r12,%r13
  movsbl %dil,%edi
  call   <putchar@plt>
  jmp    L277
L507:
  mov    $0xc,%eax
  jmp    L575
L1:
  mov    %r13,%r14
  mov    %dl,(%rbx)
  lea    0x1(%rbx),%rbx
L41:
  mov    %r12d,%eax
  sub    %r15d,%eax
  add    %r13d,%eax
  movzbl (%r14),%edx
  add    $0x1,%r13
  test   %dl,%dl
  je     L109
L430:
  test   %rbx,%rbx
  je     L165
  test   %rbp,%rbp
  je     L1
  cmp    %rbx,%rbp
  ja     L1
  lea    D54(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L575
L165:
  mov    %r13,%r14
  movsbl %dl,%edi
  call   <putchar@plt>
  jmp    L41
L109:
  cwtl
L575:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L66:
  mov    %rcx,%rdi
  call   <atoi@plt>
  mov    %rax,%r14
  movzbl (%r15),%edi
  test   %dil,%dil
  je     L167
  mov    %r15,%rax
  mov    $0x1,%edx
  sub    %r15d,%edx
L61:
  lea    (%rdx,%rax,1),%r13d
  add    $0x1,%rax
  cmpb   $0x0,(%rax)
  jne    L61
  cmp    %r13w,%r14w
  jg     L9
  lea    0x1(%r15),%rax
  mov    %rax,%r13
  mov    $0x1,%r15d
  sub    %eax,%r15d
  jmp    L244
L284:
  movb   $0x20,(%rbx)
  lea    0x1(%rbx),%rbx
L281:
  mov    %r14d,%eax
  sub    (%rsp),%ax
  cmp    %r13w,%ax
  jle    L454
L245:
  lea    0x1(%r12),%eax
  mov    %ax,(%rsp)
  mov    %eax,%r12d
  test   %rbx,%rbx
  je     L112
  test   %rbp,%rbp
  je     L284
  cmp    %rbx,%rbp
  ja     L284
  lea    D54(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L575
L112:
  mov    $0x20,%edi
  call   <putchar@plt>
  jmp    L281
L454:
  movzbl (%r15),%eax
  test   %al,%al
  je     L168
  add    $0x1,%r15
  jmp    L511
L298:
  mov    %r15,%r13
  mov    %al,(%rbx)
  lea    0x1(%rbx),%rbx
L568:
  movzbl 0x0(%r13),%eax
  add    $0x1,%r15
  test   %al,%al
  je     L168
L511:
  add    $0x1,%r12d
  test   %rbx,%rbx
  je     L334
  test   %rbp,%rbp
  je     L298
  cmp    %rbx,%rbp
  ja     L298
  lea    D54(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L575
L334:
  mov    %r15,%r13
  movsbl %al,%edi
  call   <putchar@plt>
  jmp    L568
L571:
  mov    %r12,(%rsp)
  mov    %dil,(%rbx)
  lea    0x1(%rbx),%rbx
L159:
  mov    (%rsp),%rax
  movzbl (%rax),%edi
  add    $0x1,%r12
  test   %dil,%dil
  je     L604
L468:
  movzwl 0xe(%rsp),%eax
  lea    (%rax,%r12,1),%r15d
  test   %rbx,%rbx
  je     L382
  test   %rbp,%rbp
  je     L571
  cmp    %rbx,%rbp
  ja     L571
  lea    D54(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L575
L382:
  mov    %r12,(%rsp)
  movsbl %dil,%edi
  call   <putchar@plt>
  jmp    L159
L608:
  movb   $0x20,(%rbx)
  lea    0x1(%rbx),%rbx
L586:
  mov    %r14d,%eax
  sub    (%rsp),%ax
  add    %r15d,%eax
  cmp    %ax,%r13w
  jge    L168
L203:
  lea    0x1(%r12),%eax
  mov    %ax,(%rsp)
  mov    %eax,%r12d
  test   %rbx,%rbx
  je     L512
  test   %rbp,%rbp
  je     L608
  cmp    %rbx,%rbp
  ja     L608
  lea    D54(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L575
L512:
  mov    $0x20,%edi
  call   <putchar@plt>
  jmp    L586
L401:
  mov    %r13,%r14
  mov    %dil,(%rbx)
  lea    0x1(%rbx),%rbx
L57:
  movzbl (%r14),%edi
  add    $0x1,%r13
  test   %dil,%dil
  je     L168
L244:
  lea    (%r15,%r13,1),%r12d
  test   %rbx,%rbx
  je     L510
  test   %rbp,%rbp
  je     L401
  cmp    %rbx,%rbp
  ja     L401
  lea    D54(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L575
L510:
  mov    %r13,%r14
  movsbl %dil,%edi
  call   <putchar@plt>
  jmp    L57
L167:
  test   %ax,%ax
  jle    L397
  mov    $0x0,%r13d
  cmp    $0x2,%r12d
  jne    L356
L253:
  mov    $0x0,%r12d
  jmp    L245
L397:
  mov    $0x0,%r12d
L168:
  movswl %r12w,%eax
  jmp    L575
L9:
  cmp    $0x2,%r12d
  je     L253
  add    $0x1,%r15
  mov    %r15,%r12
  mov    $0x1,%eax
  sub    %r15d,%eax
  mov    %ax,0xe(%rsp)
  jmp    L468
L356:
  mov    $0x0,%r15d
L604:
  mov    %r15d,%r12d
  jmp    L203
```

tool_calls: name: extract_symbolic_data
arguments: tag: D28
type: string
name: extract_symbolic_data
arguments: tag: D54
type: string

tool: D28: ULL_POINTER

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