user: Translate the below assembly code into C programming language:

```asm
<build_string>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  je     L93
  movzbl (%rdi),%eax
  mov    %rdi,%rbp
  xor    %r13d,%r13d
  test   %al,%al
  je     L193
  cmpb   $0x0,(%rcx)
  jne    L377
  test   %rsi,%rsi
  je     L85
  test   %rdx,%rdx
  setne  %cl
  cmp    %rdx,%rsi
  jb     L575
  test   %cl,%cl
  jne    L240
L575:
  mov    $0x1,%edx
  nopl   0x0(%rax)
L348:
  mov    %al,(%rbx)
  movzbl 0x0(%rbp,%rdx,1),%eax
  add    $0x1,%rbx
  mov    %edx,%r13d
  test   %al,%al
  je     L243
  add    $0x1,%rdx
  cmp    %rbx,%r12
  ja     L348
  test   %cl,%cl
  je     L348
L240:
  lea    D4(%rip),%rdi
  mov    $0xffffffff,%r13d
  call   <puts@plt>
L193:
  add    $0x18,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L93:
  test   %rsi,%rsi
  je     L28
  test   %rdx,%rdx
  setne  %sil
  cmp    %rdx,%rbx
  jb     L311
  test   %sil,%sil
  jne    L240
L311:
  mov    $0x55,%edx
  lea    D3(%rip),%rax
  mov    $0x4e,%ecx
  jmp    L668
  nopl   (%rax)
L493:
  cmp    %rbx,%r12
  ja     L200
  test   %sil,%sil
  jne    L240
L200:
  mov    %edx,%ecx
  movzbl 0x1(%rax),%edx
L668:
  add    $0x1,%rbx
  add    $0x1,%rax
  mov    %cl,-0x1(%rbx)
  test   %dl,%dl
  jne    L493
L534:
  mov    $0xc,%r13d
  jmp    L193
L85:
  xor    %r13d,%r13d
  nopw   0x0(%rax,%rax,1)
L326:
  add    $0x1,%rbp
  movsbl %al,%edi
  add    $0x1,%r13d
  call   <putchar@plt>
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  jne    L326
  nopl   0x0(%rax,%rax,1)
L243:
  movswl %r13w,%r13d
  jmp    L193
  nopl   0x0(%rax)
L377:
  mov    %rcx,%rdi
  mov    %r8d,0xc(%rsp)
  call   <atoi@plt>
  movzbl 0x0(%rbp),%ecx
  mov    0xc(%rsp),%r8d
  mov    %eax,%r15d
  test   %cl,%cl
  je     L419
  mov    $0x1,%esi
  mov    %rbp,%rdx
  sub    %ebp,%esi
  mov    %esi,%r13d
  xchg   %ax,%ax
L382:
  lea    0x0(%r13,%rdx,1),%r14d
  add    $0x1,%rdx
  cmpb   $0x0,(%rdx)
  jne    L382
  cmp    %r14w,%ax
  jg     L605
  test   %rbx,%rbx
  je     L19
  test   %r12,%r12
  setne  %dl
  cmp    %r12,%rbx
  jb     L483
  test   %dl,%dl
  jne    L240
L483:
  mov    $0x1,%eax
  nopl   0x0(%rax)
L334:
  mov    %cl,(%rbx)
  movzbl 0x0(%rbp,%rax,1),%ecx
  add    $0x1,%rbx
  movswl %ax,%r13d
  test   %cl,%cl
  je     L193
  add    $0x1,%rax
  cmp    %rbx,%r12
  ja     L334
  test   %dl,%dl
  je     L334
  jmp    L240
  nopl   0x0(%rax)
L19:
  lea    0x0(%r13,%rbp,1),%ebx
  movsbl %cl,%edi
  add    $0x1,%rbp
  call   <putchar@plt>
  movzbl 0x0(%rbp),%ecx
  test   %cl,%cl
  jne    L19
  movswl %bx,%r13d
  jmp    L193
  nopw   0x0(%rax,%rax,1)
L605:
  cmp    $0x2,%r8d
  je     L316
  test   %rbx,%rbx
  je     L258
  test   %r12,%r12
  setne  %dil
  cmp    %r12,%rbx
  jb     L396
  test   %dil,%dil
  jne    L240
L396:
  mov    $0x1,%edx
  nopl   0x0(%rax)
L337:
  mov    %cl,(%rbx)
  movzbl 0x0(%rbp,%rdx,1),%ecx
  add    $0x1,%rbx
  mov    %edx,%esi
  test   %cl,%cl
  je     L250
  add    $0x1,%rdx
  cmp    %rbx,%r12
  ja     L337
  test   %dil,%dil
  je     L337
  jmp    L240
L419:
  test   %ax,%ax
  jle    L193
  xor    %r14d,%r14d
  xor    %esi,%esi
  cmp    $0x2,%r8d
  jne    L250
L316:
  xor    %r13d,%r13d
  nopl   0x0(%rax,%rax,1)
L106:
  mov    %r13d,%eax
  lea    0x1(%rax),%edx
  mov    %edx,%r13d
  test   %rbx,%rbx
  je     L96
  test   %r12,%r12
  setne  %cl
  cmp    %r12,%rbx
  jb     L429
  test   %cl,%cl
  jne    L240
L429:
  sub    $0x1,%r15d
  add    $0x1,%rbx
  movb   $0x20,-0x1(%rbx)
  cmp    %r14w,%r15w
  jg     L106
  movzbl 0x0(%rbp),%esi
  test   %sil,%sil
  je     L15
  add    $0x2,%eax
  cmp    %rbx,%r12
  ja     L665
  test   %cl,%cl
  jne    L240
L665:
  sub    %ebx,%eax
  xchg   %ax,%ax
L539:
  lea    (%rax,%rbx,1),%r13d
  add    $0x1,%rbp
  add    $0x1,%rbx
  mov    %sil,-0x1(%rbx)
  movzbl 0x0(%rbp),%esi
  test   %sil,%sil
  je     L243
  cmp    %rbx,%r12
  ja     L539
  test   %cl,%cl
  je     L539
  jmp    L240
L250:
  lea    0x1(%rsi,%rax,1),%esi
  nop
L99:
  mov    %esi,%r13d
  sub    %r15d,%r13d
  test   %rbx,%rbx
  je     L259
  test   %r12,%r12
  je     L634
  cmp    %r12,%rbx
  jae    L240
L634:
  sub    $0x1,%r15d
  add    $0x1,%rbx
  movb   $0x20,-0x1(%rbx)
  cmp    %r14w,%r15w
  jg     L99
  jmp    L243
L28:
  lea    D3(%rip),%rbx
  mov    $0x4e,%edi
  nopl   0x0(%rax)
L627:
  call   <putchar@plt>
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L627
  jmp    L534
L258:
  mov    %rbp,%rbx
  nopw   0x0(%rax,%rax,1)
L566:
  add    $0x1,%rbx
  movsbl %cl,%edi
  call   <putchar@plt>
  movzbl (%rbx),%ecx
  lea    0x1(%rbx),%r13d
  sub    %ebp,%r13d
  test   %cl,%cl
  jne    L566
L259:
  lea    -0x1(%r15,%r13,1),%r15d
  jmp    L222
  nopl   0x0(%rax)
L374:
  add    $0x1,%r13d
L222:
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    %r15d,%eax
  sub    %r13d,%eax
  cmp    %r14w,%ax
  jg     L374
  jmp    L243
L96:
  lea    -0x1(%r13,%r15,1),%r15d
  jmp    L140
  xchg   %ax,%ax
L469:
  add    $0x1,%r13d
L140:
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    %r15d,%eax
  sub    %r13d,%eax
  cmp    %ax,%r14w
  jl     L469
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  je     L243
  sub    %ebp,%r13d
  lea    0x1(%r13),%ebx
L60:
  lea    (%rbx,%rbp,1),%r13d
  movsbl %al,%edi
  add    $0x1,%rbp
  call   <putchar@plt>
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  jne    L60
  jmp    L243
L15:
  movswl %dx,%r13d
  jmp    L193
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D4
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D3
type_guessed: string

tool: D4: s_printf buffer overflow

tool: D3: NULL_POINTER

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