user: 请从给定的汇编指令推导出C源代码：

```asm
<command_format>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %esi,-0x6c(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %rcx,-0x80(%rbp)
  mov    %r8d,-0x70(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x5c(%rbp)
  mov    -0x70(%rbp),%edx
  lea    -0x30(%rbp),%rax
  lea    D8(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x78(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  jmp    L72
L281:
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x25,%al
  jne    L40
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L40
  addq   $0x1,-0x48(%rbp)
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x50,%eax
  je     L3
  cmp    $0x50,%eax
  jg     L210
  cmp    $0x25,%eax
  je     L58
  cmp    $0x48,%eax
  jne    L210
  mov    -0x80(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4c(%rbp)
  cmpq   $0x0,-0x68(%rbp)
  je     L9
  mov    -0x5c(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jge    L9
  mov    -0x6c(%rbp),%eax
  sub    -0x5c(%rbp),%eax
  mov    %eax,-0x58(%rbp)
  mov    -0x4c(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jge    L182
  mov    -0x4c(%rbp),%eax
  mov    %eax,-0x58(%rbp)
L182:
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x58(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <strncpy@plt>
L9:
  mov    -0x4c(%rbp),%eax
  add    %eax,-0x5c(%rbp)
  jmp    L249
L3:
  lea    -0x30(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x50(%rbp)
  cmpq   $0x0,-0x68(%rbp)
  je     L137
  mov    -0x5c(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jge    L137
  mov    -0x6c(%rbp),%eax
  sub    -0x5c(%rbp),%eax
  mov    %eax,-0x54(%rbp)
  mov    -0x50(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jge    L111
  mov    -0x50(%rbp),%eax
  mov    %eax,-0x54(%rbp)
L111:
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x54(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <strncpy@plt>
L137:
  mov    -0x50(%rbp),%eax
  add    %eax,-0x5c(%rbp)
  jmp    L249
L58:
  cmpq   $0x0,-0x68(%rbp)
  je     L62
  mov    -0x5c(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jge    L62
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movb   $0x25,(%rax)
L62:
  addl   $0x1,-0x5c(%rbp)
  jmp    L249
L210:
  cmpq   $0x0,-0x68(%rbp)
  je     L184
  mov    -0x5c(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jge    L184
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movb   $0x25,(%rax)
L184:
  addl   $0x1,-0x5c(%rbp)
  cmpq   $0x0,-0x68(%rbp)
  je     L19
  mov    -0x5c(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jge    L19
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rax,%rdx
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%rdx)
L19:
  addl   $0x1,-0x5c(%rbp)
  nop
L249:
  jmp    L87
L40:
  cmpq   $0x0,-0x68(%rbp)
  je     L43
  mov    -0x5c(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jge    L43
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rax,%rdx
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%rdx)
L43:
  addl   $0x1,-0x5c(%rbp)
L87:
  addq   $0x1,-0x48(%rbp)
L72:
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L281
  cmpq   $0x0,-0x68(%rbp)
  je     L250
  mov    -0x5c(%rbp),%eax
  cmp    -0x6c(%rbp),%eax
  jge    L250
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L250:
  addl   $0x1,-0x5c(%rbp)
  mov    -0x5c(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L269
  call   <__stack_chk_fail@plt>
L269:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D8
data_type: string

tool: D8: %d

assistant: ```c
int command_format(char *buffer, int buflen, const char *format, const char *host, int port) {
  int len = 0;
  char portbuf[32];
  sprintf(portbuf, "%d", port);
  for (const char *f = format; *f; f++) {
    if (*f == '%' && f[1]) {
      switch (*++f) {
      case 'H':
        do {
          const char *scp = (host);
          int sl = strlen(scp);
          if (buffer && len < buflen) {
            int cp = buflen - len;
            if (sl < cp)
              cp = sl;
            strncpy(buffer + len, (scp), cp);
          }
          len += sl;
        } while (0);
        break;
      case 'P':
        do {
          const char *scp = (portbuf);
          int sl = strlen(scp);
          if (buffer && len < buflen) {
            int cp = buflen - len;
            if (sl < cp)
              cp = sl;
            strncpy(buffer + len, (scp), cp);
          }
          len += sl;
        } while (0);
        break;
      case '%':
        do {
          if (buffer && len < buflen) {
            buffer[len] = ('%');
          }
          len++;
        } while (0);
        break;
      default:
        do {
          if (buffer && len < buflen) {
            buffer[len] = ('%');
          }
          len++;
        } while (0);
        do {
          if (buffer && len < buflen) {
            buffer[len] = (*f);
          }
          len++;
        } while (0);
        break;
      }
    } else {
      do {
        if (buffer && len < buflen) {
          buffer[len] = (*f);
        }
        len++;
      } while (0);
    }
  }
  do {
    if (buffer && len < buflen) {
      buffer[len] = ('\0');
    }
    len++;
  } while (0);
  return len;
}
```