user: What would the C source look like for the assembly code provided here?

```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     L62
  movzbl (%rdi),%eax
  mov    %rdi,%rbp
  xor    %r13d,%r13d
  test   %al,%al
  je     L120
  cmpb   $0x0,(%rcx)
  jne    L367
  test   %rsi,%rsi
  je     L116
  test   %rdx,%rdx
  setne  %cl
  cmp    %rdx,%rsi
  jb     L462
  test   %cl,%cl
  jne    L48
L462:
  mov    $0x1,%edx
  nopl   0x0(%rax)
L619:
  mov    %al,(%rbx)
  movzbl 0x0(%rbp,%rdx,1),%eax
  add    $0x1,%rbx
  mov    %edx,%r13d
  test   %al,%al
  je     L166
  add    $0x1,%rdx
  cmp    %rbx,%r12
  ja     L619
  test   %cl,%cl
  je     L619
L48:
  lea    D7(%rip),%rdi
  mov    $0xffffffff,%r13d
  call   <puts@plt>
L120:
  add    $0x18,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L62:
  test   %rsi,%rsi
  je     L44
  test   %rdx,%rdx
  setne  %sil
  cmp    %rdx,%rbx
  jb     L673
  test   %sil,%sil
  jne    L48
L673:
  mov    $0x55,%edx
  lea    D5(%rip),%rax
  mov    $0x4e,%ecx
  jmp    L318
  nopl   (%rax)
L102:
  cmp    %rbx,%r12
  ja     L370
  test   %sil,%sil
  jne    L48
L370:
  mov    %edx,%ecx
  movzbl 0x1(%rax),%edx
L318:
  add    $0x1,%rbx
  add    $0x1,%rax
  mov    %cl,-0x1(%rbx)
  test   %dl,%dl
  jne    L102
L400:
  mov    $0xc,%r13d
  jmp    L120
L116:
  xor    %r13d,%r13d
  nopw   0x0(%rax,%rax,1)
L95:
  add    $0x1,%rbp
  movsbl %al,%edi
  add    $0x1,%r13d
  call   <putchar@plt>
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  jne    L95
  nopl   0x0(%rax,%rax,1)
L166:
  movswl %r13w,%r13d
  jmp    L120
  nopl   0x0(%rax)
L367:
  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     L490
  mov    $0x1,%esi
  mov    %rbp,%rdx
  sub    %ebp,%esi
  mov    %esi,%r13d
  xchg   %ax,%ax
L157:
  lea    0x0(%r13,%rdx,1),%r14d
  add    $0x1,%rdx
  cmpb   $0x0,(%rdx)
  jne    L157
  cmp    %r14w,%ax
  jg     L531
  test   %rbx,%rbx
  je     L621
  test   %r12,%r12
  setne  %dl
  cmp    %r12,%rbx
  jb     L200
  test   %dl,%dl
  jne    L48
L200:
  mov    $0x1,%eax
  nopl   0x0(%rax)
L653:
  mov    %cl,(%rbx)
  movzbl 0x0(%rbp,%rax,1),%ecx
  add    $0x1,%rbx
  movswl %ax,%r13d
  test   %cl,%cl
  je     L120
  add    $0x1,%rax
  cmp    %rbx,%r12
  ja     L653
  test   %dl,%dl
  je     L653
  jmp    L48
  nopl   0x0(%rax)
L621:
  lea    0x0(%r13,%rbp,1),%ebx
  movsbl %cl,%edi
  add    $0x1,%rbp
  call   <putchar@plt>
  movzbl 0x0(%rbp),%ecx
  test   %cl,%cl
  jne    L621
  movswl %bx,%r13d
  jmp    L120
  nopw   0x0(%rax,%rax,1)
L531:
  cmp    $0x2,%r8d
  je     L137
  test   %rbx,%rbx
  je     L373
  test   %r12,%r12
  setne  %dil
  cmp    %r12,%rbx
  jb     L679
  test   %dil,%dil
  jne    L48
L679:
  mov    $0x1,%edx
  nopl   0x0(%rax)
L312:
  mov    %cl,(%rbx)
  movzbl 0x0(%rbp,%rdx,1),%ecx
  add    $0x1,%rbx
  mov    %edx,%esi
  test   %cl,%cl
  je     L535
  add    $0x1,%rdx
  cmp    %rbx,%r12
  ja     L312
  test   %dil,%dil
  je     L312
  jmp    L48
L490:
  test   %ax,%ax
  jle    L120
  xor    %r14d,%r14d
  xor    %esi,%esi
  cmp    $0x2,%r8d
  jne    L535
L137:
  xor    %r13d,%r13d
  nopl   0x0(%rax,%rax,1)
L614:
  mov    %r13d,%eax
  lea    0x1(%rax),%edx
  mov    %edx,%r13d
  test   %rbx,%rbx
  je     L86
  test   %r12,%r12
  setne  %cl
  cmp    %r12,%rbx
  jb     L508
  test   %cl,%cl
  jne    L48
L508:
  sub    $0x1,%r15d
  add    $0x1,%rbx
  movb   $0x20,-0x1(%rbx)
  cmp    %r14w,%r15w
  jg     L614
  movzbl 0x0(%rbp),%esi
  test   %sil,%sil
  je     L89
  add    $0x2,%eax
  cmp    %rbx,%r12
  ja     L347
  test   %cl,%cl
  jne    L48
L347:
  sub    %ebx,%eax
  xchg   %ax,%ax
L493:
  lea    (%rax,%rbx,1),%r13d
  add    $0x1,%rbp
  add    $0x1,%rbx
  mov    %sil,-0x1(%rbx)
  movzbl 0x0(%rbp),%esi
  test   %sil,%sil
  je     L166
  cmp    %rbx,%r12
  ja     L493
  test   %cl,%cl
  je     L493
  jmp    L48
L535:
  lea    0x1(%rsi,%rax,1),%esi
  nop
L122:
  mov    %esi,%r13d
  sub    %r15d,%r13d
  test   %rbx,%rbx
  je     L519
  test   %r12,%r12
  je     L674
  cmp    %r12,%rbx
  jae    L48
L674:
  sub    $0x1,%r15d
  add    $0x1,%rbx
  movb   $0x20,-0x1(%rbx)
  cmp    %r14w,%r15w
  jg     L122
  jmp    L166
L44:
  lea    D5(%rip),%rbx
  mov    $0x4e,%edi
  nopl   0x0(%rax)
L259:
  call   <putchar@plt>
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L259
  jmp    L400
L373:
  mov    %rbp,%rbx
  nopw   0x0(%rax,%rax,1)
L314:
  add    $0x1,%rbx
  movsbl %cl,%edi
  call   <putchar@plt>
  movzbl (%rbx),%ecx
  lea    0x1(%rbx),%r13d
  sub    %ebp,%r13d
  test   %cl,%cl
  jne    L314
L519:
  lea    -0x1(%r15,%r13,1),%r15d
  jmp    L657
  nopl   0x0(%rax)
L247:
  add    $0x1,%r13d
L657:
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    %r15d,%eax
  sub    %r13d,%eax
  cmp    %r14w,%ax
  jg     L247
  jmp    L166
L86:
  lea    -0x1(%r13,%r15,1),%r15d
  jmp    L444
  xchg   %ax,%ax
L504:
  add    $0x1,%r13d
L444:
  mov    $0x20,%edi
  call   <putchar@plt>
  mov    %r15d,%eax
  sub    %r13d,%eax
  cmp    %ax,%r14w
  jl     L504
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  je     L166
  sub    %ebp,%r13d
  lea    0x1(%r13),%ebx
L23:
  lea    (%rbx,%rbp,1),%r13d
  movsbl %al,%edi
  add    $0x1,%rbp
  call   <putchar@plt>
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  jne    L23
  jmp    L166
L89:
  movswl %dx,%r13d
  jmp    L120
```

tool_calls: name: disassemble_data
arguments: tag: D7
type_guessed: string
name: disassemble_data
arguments: tag: D5
type_guessed: string

tool: D7: s_printf buffer overflow

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