ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的：

```asm
<get_file_name>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  xor    %edi,%edi
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x13(%rsp)
  lea    0x13(%rsp),%r12
  movq   $0x0,0x8(%rsp)
  movb   $0x0,0x17(%rsp)
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    $0x270f,%esi
  mov    $0x3e8,%edi
  call   <rand_x_y@plt>
  lea    D4(%rip),%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  call   <sprintf@plt>
  xor    %esi,%esi
  lea    0x8(%rsp),%rdi
  call   <get_local_time@plt>
  xor    %edi,%edi
  cmpq   $0x0,0x0(%rbp)
  sete   %dil
  mov    %eax,%ebx
  call   <assert@plt>
  lea    0x5(%rbx),%edi
  mov    $0x1,%esi
  call   <calloc@plt>
  mov    %rax,0x0(%rbp)
  test   %rax,%rax
  je     L28
  mov    0x8(%rsp),%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    0x0(%rbp),%rdi
  mov    %r12,%rsi
  call   <strcat@plt>
  lea    0x4(%rbx),%eax
L14:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L28:
  lea    D8(%rip),%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L14
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D4
type_guessed: string
name: retrieve_data
arguments: data_label: D8
type_guessed: string

tool: D4: %d

tool: D8: calloc

assistant: ```c
get_file_name(char **buffer) {
  char *buffer_tmp = NULL;
  char srval[5] = {0, 0, 0, 0, 0};
  int rval = 0;
  int size = 0;
  srand(time(NULL));
  rval = rand_x_y(1000, 9999);
  sprintf(srval, "%d", rval);
  size = get_local_time(&buffer_tmp, 0);
  assert(*buffer == NULL);
  if ((*buffer = calloc(size + 1 + 4, sizeof(char))) == NULL) {
    perror("calloc");
    return -1;
  }
  strcpy(*buffer, buffer_tmp);
  strcat(*buffer, srval);
  return (size + 4);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<get_file_name>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  xor    %edi,%edi
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x13(%rsp)
  lea    0x13(%rsp),%r12
  movq   $0x0,0x8(%rsp)
  movb   $0x0,0x17(%rsp)
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    $0x270f,%esi
  mov    $0x3e8,%edi
  call   <rand_x_y@plt>
  lea    D4(%rip),%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  call   <sprintf@plt>
  xor    %esi,%esi
  lea    0x8(%rsp),%rdi
  call   <get_local_time@plt>
  xor    %edi,%edi
  cmpq   $0x0,0x0(%rbp)
  sete   %dil
  mov    %eax,%ebx
  call   <assert@plt>
  lea    0x5(%rbx),%edi
  mov    $0x1,%esi
  call   <calloc@plt>
  mov    %rax,0x0(%rbp)
  test   %rax,%rax
  je     L25
  mov    0x8(%rsp),%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    0x0(%rbp),%rdi
  mov    %r12,%rsi
  call   <strcat@plt>
  lea    0x4(%rbx),%eax
L12:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L21
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L25:
  lea    D1(%rip),%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L12
L21:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D4
type_infered: string
name: read_data
arguments: label: D1
type_infered: string

tool: D4: %d

tool: D1: calloc

assistant: ```c
get_file_name(char **buffer) {
  char *buffer_tmp = NULL;
  char srval[5] = {0, 0, 0, 0, 0};
  int rval = 0;
  int size = 0;
  srand(time(NULL));
  rval = rand_x_y(1000, 9999);
  sprintf(srval, "%d", rval);
  size = get_local_time(&buffer_tmp, 0);
  assert(*buffer == NULL);
  if ((*buffer = calloc(size + 1 + 4, sizeof(char))) == NULL) {
    perror("calloc");
    return -1;
  }
  strcpy(*buffer, buffer_tmp);
  strcat(*buffer, srval);
  return (size + 4);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<BMI_sockio_nbrecv>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    D86(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x14(%rbp),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <fcntl@plt>
  mov    %eax,%edx
  mov    D53(%rip),%rax
  mov    (%rax),%eax
  and    %edx,%eax
  mov    %eax,%edi
  call   <assert@plt>
  jmp    L126
L21:
  nop
L49:
  mov    -0x8(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x14(%rbp),%eax
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <recv@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jne    L20
  mov    D54(%rip),%rax
  mov    (%rax),%rdx
  mov    D99(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L103
L20:
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L25
  mov    D99(%rip),%rax
  mov    (%rax),%rdx
  mov    D77(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L25
  jmp    L49
L25:
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L4
  mov    D99(%rip),%rax
  mov    (%rax),%rdx
  mov    D43(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L17
  mov    D99(%rip),%rax
  mov    (%rax),%rdx
  mov    D50(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L4
L17:
  mov    -0x18(%rbp),%eax
  sub    -0x8(%rbp),%eax
  jmp    L103
L4:
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L83
  mov    $0xffffffff,%eax
  jmp    L103
L83:
  mov    -0x4(%rbp),%eax
  sub    %eax,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,-0x20(%rbp)
L126:
  cmpl   $0x0,-0x8(%rbp)
  jne    L21
  mov    -0x18(%rbp),%eax
  sub    -0x8(%rbp),%eax
L103:
  leave
  ret
```

assistant: ```c
int BMI_sockio_nbrecv(int s, void *buf, int len) {
  int ret, comp = len;
  assert(fcntl(s, F_GETFL, 0) & O_NONBLOCK);
  while (comp) {
  nbrecv_restart:
    ret = recv(s, buf, comp, 0);
    if (ret == 0) {
      errno = EPIPE;
      return (-1);
    }
    if (ret == -1 && errno == EINTR) {
      goto nbrecv_restart;
    } else if (ret == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
      return (len - comp);
    } else if (ret == -1) {
      return (-1);
    }
    comp -= ret;
    buf = (char *)buf + ret;
  }
  return (len - comp);
}
```
user: Translate the below assembly code into C programming language:

```asm
<BMI_sockio_nbrecv>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r12d
  mov    %rsi,%rbx
  mov    %edx,%r13d
  mov    $0x0,%edx
  mov    D37(%rip),%rax
  mov    (%rax),%esi
  call   <fcntl@plt>
  mov    D76(%rip),%rdx
  and    (%rdx),%eax
  mov    %eax,%edi
  call   <assert@plt>
  test   %r13d,%r13d
  je     L25
  mov    %r13d,%ebp
  jmp    L23
L61:
  mov    D21(%rip),%rax
  mov    (%rax),%rdx
  mov    D22(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffff,%eax
L54:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L83:
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %eax,%ebp
  je     L25
L23:
  mov    $0x0,%ecx
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r12d,%edi
  call   <recv@plt>
  test   %eax,%eax
  je     L61
  cmp    $0xffffffff,%eax
  jne    L83
  mov    D22(%rip),%rdx
  mov    (%rdx),%rdx
  mov    D39(%rip),%rcx
  cmp    (%rcx),%rdx
  je     L23
  mov    D71(%rip),%rcx
  cmp    (%rcx),%rdx
  je     L30
  mov    D54(%rip),%rcx
  cmp    (%rcx),%rdx
  jne    L54
L30:
  mov    %r13d,%eax
  sub    %ebp,%eax
  jmp    L54
L25:
  mov    %r13d,%eax
  jmp    L54
```

assistant: ```c
int BMI_sockio_nbrecv(int s, void *buf, int len) {
  int ret, comp = len;
  assert(fcntl(s, F_GETFL, 0) & O_NONBLOCK);
  while (comp) {
  nbrecv_restart:
    ret = recv(s, buf, comp, 0);
    if (ret == 0) {
      errno = EPIPE;
      return (-1);
    }
    if (ret == -1 && errno == EINTR) {
      goto nbrecv_restart;
    } else if (ret == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
      return (len - comp);
    } else if (ret == -1) {
      return (-1);
    }
    comp -= ret;
    buf = (char *)buf + ret;
  }
  return (len - comp);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<BMI_sockio_nbrecv>:
  endbr64
  push   %r13
  mov    %edx,%r13d
  xor    %edx,%edx
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  mov    D32(%rip),%rax
  mov    (%rax),%esi
  call   <fcntl@plt>
  mov    D52(%rip),%rdx
  and    (%rdx),%eax
  mov    %eax,%edi
  call   <assert@plt>
  test   %r13d,%r13d
  je     L64
  mov    %r13d,%ebp
  jmp    L4
  nopl   (%rax)
L9:
  cmp    $0xffffffff,%eax
  jne    L91
  mov    D56(%rip),%rdx
  mov    D61(%rip),%rcx
  mov    (%rdx),%rdx
  cmp    (%rcx),%rdx
  jne    L58
L4:
  xor    %ecx,%ecx
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r12d,%edi
  call   <recv@plt>
  test   %eax,%eax
  jne    L9
  mov    D0(%rip),%rax
  mov    (%rax),%rdx
  mov    D56(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffff,%eax
L30:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L91:
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %eax,%ebp
  jne    L4
  mov    %r13d,%eax
  jmp    L30
  nop
L58:
  mov    D54(%rip),%rcx
  cmp    (%rcx),%rdx
  je     L38
  mov    D15(%rip),%rcx
  cmp    (%rcx),%rdx
  jne    L30
L38:
  mov    %r13d,%eax
  sub    %ebp,%eax
  jmp    L30
L64:
  xor    %eax,%eax
  jmp    L30
```

assistant: ```c
int BMI_sockio_nbrecv(int s, void *buf, int len) {
  int ret, comp = len;
  assert(fcntl(s, F_GETFL, 0) & O_NONBLOCK);
  while (comp) {
  nbrecv_restart:
    ret = recv(s, buf, comp, 0);
    if (ret == 0) {
      errno = EPIPE;
      return (-1);
    }
    if (ret == -1 && errno == EINTR) {
      goto nbrecv_restart;
    } else if (ret == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
      return (len - comp);
    } else if (ret == -1) {
      return (-1);
    }
    comp -= ret;
    buf = (char *)buf + ret;
  }
  return (len - comp);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<BMI_sockio_nbrecv>:
  endbr64
  push   %r13
  mov    %edx,%r13d
  xor    %edx,%edx
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  mov    D76(%rip),%rax
  mov    (%rax),%esi
  call   <fcntl@plt>
  mov    D47(%rip),%rdx
  and    (%rdx),%eax
  mov    %eax,%edi
  call   <assert@plt>
  test   %r13d,%r13d
  je     L25
  mov    %r13d,%ebp
  jmp    L62
  nopl   (%rax)
L64:
  cmp    $0xffffffff,%eax
  jne    L44
  mov    D46(%rip),%rdx
  mov    D75(%rip),%rcx
  mov    (%rdx),%rdx
  cmp    (%rcx),%rdx
  jne    L32
L62:
  xor    %ecx,%ecx
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r12d,%edi
  call   <recv@plt>
  test   %eax,%eax
  jne    L64
  mov    D23(%rip),%rax
  mov    (%rax),%rdx
  mov    D46(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffff,%eax
L60:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L44:
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %eax,%ebp
  jne    L62
  mov    %r13d,%eax
  jmp    L60
  nop
L32:
  mov    D25(%rip),%rcx
  cmp    (%rcx),%rdx
  je     L36
  mov    D10(%rip),%rcx
  cmp    (%rcx),%rdx
  jne    L60
L36:
  mov    %r13d,%eax
  sub    %ebp,%eax
  jmp    L60
L25:
  xor    %eax,%eax
  jmp    L60
```

assistant: ```c
int BMI_sockio_nbrecv(int s, void *buf, int len) {
  int ret, comp = len;
  assert(fcntl(s, F_GETFL, 0) & O_NONBLOCK);
  while (comp) {
  nbrecv_restart:
    ret = recv(s, buf, comp, 0);
    if (ret == 0) {
      errno = EPIPE;
      return (-1);
    }
    if (ret == -1 && errno == EINTR) {
      goto nbrecv_restart;
    } else if (ret == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
      return (len - comp);
    } else if (ret == -1) {
      return (-1);
    }
    comp -= ret;
    buf = (char *)buf + ret;
  }
  return (len - comp);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<print_doors>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L17
L12:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jne    L2
  lea    D2(%rip),%rax
  jmp    L34
L2:
  lea    D21(%rip),%rax
L34:
  mov    -0x4(%rbp),%edx
  lea    0x1(%rdx),%ecx
  mov    %rax,%rdx
  mov    %ecx,%esi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  addl   $0x1,-0x4(%rbp)
L17:
  cmpl   $0x63,-0x4(%rbp)
  jle    L12
  nop
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D2
datatype: string
name: unpack_data
arguments: label: D21
datatype: string
name: unpack_data
arguments: label: D0
datatype: string

tool: D2: Open

tool: D21: Closed

tool: D0: Door #%d: %s


assistant: ```c
void print_doors(int doors[]) {
  for (int i = 0; i <= 99; ++i)
    printf("Door #%d: %s\n", i + 1, doors[i] == 1 ? "Open" : "Closed");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<print_doors>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    $0x1,%ebx
  lea    D15(%rip),%r14
  lea    D4(%rip),%r13
  lea    D29(%rip),%r12
L4:
  cmpl   $0x1,-0x4(%rbp,%rbx,4)
  mov    %r13,%rdx
  cmove  %r14,%rdx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <printf@plt>
  add    $0x1,%rbx
  cmp    $0x65,%rbx
  jne    L4
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D15
datatype: string
name: disassemble_data
arguments: data_tag: D4
datatype: string
name: disassemble_data
arguments: data_tag: D29
datatype: string

tool: D15: Open

tool: D4: Closed

tool: D29: Door #%d: %s


assistant: ```c
void print_doors(int doors[]) {
  for (int i = 0; i <= 99; ++i)
    printf("Door #%d: %s\n", i + 1, doors[i] == 1 ? "Open" : "Closed");
}
```
user: Translate the below assembly code into C programming language:

```asm
<print_doors>:
  endbr64
  push   %r14
  lea    D9(%rip),%r14
  push   %r13
  lea    D14(%rip),%r13
  push   %r12
  lea    D12(%rip),%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    $0x1,%ebx
  nopl   0x0(%rax)
L9:
  cmpl   $0x1,-0x4(%rbp,%rbx,4)
  mov    %r12,%rdx
  mov    %ebx,%esi
  mov    %r14,%rdi
  cmove  %r13,%rdx
  add    $0x1,%rbx
  call   <printf@plt>
  cmp    $0x65,%rbx
  jne    L9
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D9
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D14
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D12
type_guessed: string

tool: D9: Door #%d: %s


tool: D14: Open

tool: D12: Closed

assistant: ```c
void print_doors(int doors[]) {
  for (int i = 0; i <= 99; ++i)
    printf("Door #%d: %s\n", i + 1, doors[i] == 1 ? "Open" : "Closed");
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<print_doors>:
  endbr64
  push   %r14
  lea    D26(%rip),%r14
  push   %r13
  lea    D3(%rip),%r13
  push   %r12
  lea    D22(%rip),%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    $0x1,%ebx
  nopl   0x0(%rax)
L16:
  cmpl   $0x1,-0x4(%rbp,%rbx,4)
  mov    %r14,%rdx
  je     L1
  mov    %r13,%rdx
L1:
  mov    %ebx,%esi
  mov    %r12,%rdi
  add    $0x1,%rbx
  call   <printf@plt>
  cmp    $0x65,%rbx
  jne    L16
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: disassemble_data
arguments: label: D26
data_type: string
name: disassemble_data
arguments: label: D3
data_type: string
name: disassemble_data
arguments: label: D22
data_type: string

tool: D26: Open

tool: D3: Closed

tool: D22: Door #%d: %s


assistant: ```c
void print_doors(int doors[]) {
  for (int i = 0; i <= 99; ++i)
    printf("Door #%d: %s\n", i + 1, doors[i] == 1 ? "Open" : "Closed");
}
```
user: Translate the below assembly code into C programming language:

```asm
<vstrbuild>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x14(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L67
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L69
  mov    $0x1,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  jmp    L11
L69:
  mov    -0x2c(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <va_copy@plt>
  mov    -0x10(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%ecx
  mov    %rax,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <vsnprintf@plt>
  add    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L70
  mov    $0x0,%eax
  jmp    L11
L70:
  mov    -0x2c(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <va_copy@plt>
  mov    -0x10(%rbp),%ecx
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%esi
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <vsnprintf@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
L13:
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%ecx
  mov    -0x8(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <is_asciiz@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jne    L64
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  addl   $0x10,-0x18(%rbp)
  mov    -0x18(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <va_copy@plt>
  mov    -0x10(%rbp),%ecx
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%esi
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <vsnprintf@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  jmp    L13
L67:
  movq   $0x0,-0x8(%rbp)
  jmp    L76
L64:
  nop
L76:
  mov    -0x8(%rbp),%rax
L11:
  leave
  ret
```

assistant: ```c
char *vstrbuild(const char *fmt, va_list ap) {
  char *out;
  int size, zeroindex;
  int last;
  va_list copy;
  last = 0;
  if (fmt != NULL) {
    if (!*fmt) {
      out = malloc(1);
      out[0] = '\0';
      return out;
    }
    va_copy(copy, ap);
    size = vsnprintf(NULL, 0, fmt, copy) + 1;
    va_end(copy);
    if ((out = malloc(size)) == NULL)
      return NULL;
    va_copy(copy, ap);
    vsnprintf(out, size, fmt, copy);
    va_end(copy);
    for (;;) {
      if ((zeroindex = is_asciiz(out, last, size)) != 0)
        break;
      last = size;
      size += 16;
      out = realloc(out, size);
      va_copy(copy, ap);
      vsnprintf(out, size, fmt, copy);
      va_end(copy);
    }
  } else
    out = NULL;
  return out;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<vstrbuild>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r14
  test   %rdi,%rdi
  je     L62
  mov    %esi,%r15d
  cmpb   $0x0,(%rdi)
  je     L36
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_copy@plt>
  mov    %ebp,%ecx
  mov    %r14,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <vsnprintf@plt>
  lea    0x1(%rax),%r12d
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L23
  mov    %r15d,%esi
  mov    %ebp,%edi
  call   <va_copy@plt>
  mov    %ebp,%ecx
  mov    %r14,%rdx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    $0x0,%esi
  jmp    L25
L36:
  mov    $0x1,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  movb   $0x0,(%rax)
  jmp    L23
L58:
  lea    0x10(%r12),%r13d
  mov    %r13d,%esi
  mov    %rbx,%rdi
  call   <realloc@plt>
  mov    %rax,%rbx
  mov    %r15d,%esi
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_copy@plt>
  mov    %ebp,%ecx
  mov    %r14,%rdx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    %r12d,%esi
  mov    %r13d,%r12d
L25:
  mov    %r12d,%edx
  mov    %rbx,%rdi
  call   <is_asciiz@plt>
  test   %eax,%eax
  je     L58
L23:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L62:
  mov    %rdi,%rbx
  jmp    L23
```

assistant: ```c
char *vstrbuild(const char *fmt, va_list ap) {
  char *out;
  int size, zeroindex;
  int last;
  va_list copy;
  last = 0;
  if (fmt != NULL) {
    if (!*fmt) {
      out = malloc(1);
      out[0] = '\0';
      return out;
    }
    va_copy(copy, ap);
    size = vsnprintf(NULL, 0, fmt, copy) + 1;
    va_end(copy);
    if ((out = malloc(size)) == NULL)
      return NULL;
    va_copy(copy, ap);
    vsnprintf(out, size, fmt, copy);
    va_end(copy);
    for (;;) {
      if ((zeroindex = is_asciiz(out, last, size)) != 0)
        break;
      last = size;
      size += 16;
      out = realloc(out, size);
      va_copy(copy, ap);
      vsnprintf(out, size, fmt, copy);
      va_end(copy);
    }
  } else
    out = NULL;
  return out;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<vstrbuild>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L37
  cmpb   $0x0,(%rdi)
  mov    %rdi,%r12
  je     L52
  xor    %r14d,%r14d
  mov    %esi,%r13d
  mov    %r14d,%edi
  call   <va_copy@plt>
  mov    %r14d,%ecx
  mov    %r12,%rdx
  xor    %esi,%esi
  xor    %edi,%edi
  call   <vsnprintf@plt>
  mov    %r14d,%edi
  lea    0x1(%rax),%ebx
  call   <va_end@plt>
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L37
  mov    %r13d,%esi
  mov    %r14d,%edi
  call   <va_copy@plt>
  mov    %ebx,%esi
  mov    %r14d,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rdi
  call   <vsnprintf@plt>
  mov    %r14d,%edi
  call   <va_end@plt>
  xor    %esi,%esi
  jmp    L65
  nopl   0x0(%rax)
L59:
  lea    0x10(%rbx),%r15d
  mov    %rbp,%rdi
  xor    %r14d,%r14d
  mov    %r15d,%esi
  call   <realloc@plt>
  mov    %r13d,%esi
  mov    %r14d,%edi
  mov    %rax,%rbp
  call   <va_copy@plt>
  mov    %r15d,%esi
  mov    %r14d,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rdi
  call   <vsnprintf@plt>
  mov    %r14d,%edi
  call   <va_end@plt>
  mov    %ebx,%esi
  mov    %r15d,%ebx
L65:
  mov    %ebx,%edx
  mov    %rbp,%rdi
  call   <is_asciiz@plt>
  test   %eax,%eax
  je     L59
L19:
  add    $0x8,%rsp
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L37:
  xor    %ebp,%ebp
  jmp    L19
  nopl   0x0(%rax)
L52:
  mov    $0x1,%edi
  call   <malloc@plt>
  movb   $0x0,(%rax)
  mov    %rax,%rbp
  jmp    L19
```

assistant: ```c
char *vstrbuild(const char *fmt, va_list ap) {
  char *out;
  int size, zeroindex;
  int last;
  va_list copy;
  last = 0;
  if (fmt != NULL) {
    if (!*fmt) {
      out = malloc(1);
      out[0] = '\0';
      return out;
    }
    va_copy(copy, ap);
    size = vsnprintf(NULL, 0, fmt, copy) + 1;
    va_end(copy);
    if ((out = malloc(size)) == NULL)
      return NULL;
    va_copy(copy, ap);
    vsnprintf(out, size, fmt, copy);
    va_end(copy);
    for (;;) {
      if ((zeroindex = is_asciiz(out, last, size)) != 0)
        break;
      last = size;
      size += 16;
      out = realloc(out, size);
      va_copy(copy, ap);
      vsnprintf(out, size, fmt, copy);
      va_end(copy);
    }
  } else
    out = NULL;
  return out;
}
```