ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么：

```asm
<fun3>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  call   <fun2@plt>
  mov    %ebp,%edi
  call   <fun1@plt>
  mov    %eax,%ebx
  mov    %ebp,%edi
  call   <fun2@plt>
  add    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int fun3(int n) {
  fun2(n);
  return fun1(n) + fun2(n);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<fun3>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <fun2@plt>
  mov    %ebp,%edi
  call   <fun1@plt>
  mov    %ebp,%edi
  mov    %eax,%ebx
  call   <fun2@plt>
  add    $0x8,%rsp
  add    %ebx,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int fun3(int n) {
  fun2(n);
  return fun1(n) + fun2(n);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<fun3>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <fun2@plt>
  mov    %ebp,%edi
  call   <fun1@plt>
  mov    %ebp,%edi
  mov    %eax,%ebx
  call   <fun2@plt>
  add    $0x8,%rsp
  add    %ebx,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int fun3(int n) {
  fun2(n);
  return fun1(n) + fun2(n);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<array_free>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  jmp    L13
L12:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  addq   $0x8,-0x8(%rbp)
L13:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L12
  nop
  nop
  leave
  ret
```

assistant: ```c
void array_free(const char **array) {
  while (*array) {
    free((void *)*array);
    array += 1;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<array_free>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%rdi
  test   %rdi,%rdi
  je     L2
L11:
  call   <free@plt>
  add    $0x8,%rbx
  mov    (%rbx),%rdi
  test   %rdi,%rdi
  jne    L11
L2:
  pop    %rbx
  ret
```

assistant: ```c
void array_free(const char **array) {
  while (*array) {
    free((void *)*array);
    array += 1;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<array_free>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%rdi
  test   %rdi,%rdi
  je     L14
L11:
  call   <free@plt>
  mov    0x8(%rbx),%rdi
  add    $0x8,%rbx
  test   %rdi,%rdi
  jne    L11
L14:
  pop    %rbx
  ret
```

assistant: ```c
void array_free(const char **array) {
  while (*array) {
    free((void *)*array);
    array += 1;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<array_free>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%rdi
  test   %rdi,%rdi
  je     L6
L9:
  call   <free@plt>
  mov    0x8(%rbx),%rdi
  add    $0x8,%rbx
  test   %rdi,%rdi
  jne    L9
L6:
  pop    %rbx
  ret
```

assistant: ```c
void array_free(const char **array) {
  while (*array) {
    free((void *)*array);
    array += 1;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<smp_sio_is_linebuffer>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  sete   %al
  movzbl %al,%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <__builtin_expect@plt>
  test   %rax,%rax
  je     L28
  mov    $0x0,%eax
  jmp    L16
L28:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%edx
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  and    %edx,%eax
  test   %eax,%eax
  je     L24
  mov    $0x1,%eax
  jmp    L16
L24:
  mov    $0x0,%eax
L16:
  leave
  ret
```

assistant: ```c
int smp_sio_is_linebuffer(FILE *fp) {
  if (__builtin_expect(!!(fp == NULL), 0))
    return (0);
  if (fp->_flags & _IOLBF)
    return (1);
  return (0);
}
```
user: What is the c source code of the assembly code below?

```asm
<smp_sio_is_linebuffer>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  test   %rdi,%rdi
  sete   %dil
  movzbl %dil,%edi
  mov    $0x0,%esi
  call   <__builtin_expect@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L3
  mov    (%rbx),%eax
  mov    D4(%rip),%rdx
  and    (%rdx),%eax
  setne  %al
  movzbl %al,%eax
L3:
  pop    %rbx
  ret
```

assistant: ```c
int smp_sio_is_linebuffer(FILE *fp) {
  if (__builtin_expect(!!(fp == NULL), 0))
    return (0);
  if (fp->_flags & _IOLBF)
    return (1);
  return (0);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<smp_sio_is_linebuffer>:
  endbr64
  test   %rdi,%rdi
  push   %rbx
  mov    %rdi,%rbx
  sete   %dil
  xor    %esi,%esi
  movzbl %dil,%edi
  call   <__builtin_expect@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  jne    L0
  mov    D3(%rip),%rdx
  mov    (%rbx),%eax
  and    (%rdx),%eax
  setne  %al
  movzbl %al,%eax
L0:
  pop    %rbx
  ret
```

assistant: ```c
int smp_sio_is_linebuffer(FILE *fp) {
  if (__builtin_expect(!!(fp == NULL), 0))
    return (0);
  if (fp->_flags & _IOLBF)
    return (1);
  return (0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<smp_sio_is_linebuffer>:
  endbr64
  test   %rdi,%rdi
  push   %rbx
  mov    %rdi,%rbx
  sete   %dil
  xor    %esi,%esi
  movzbl %dil,%edi
  call   <__builtin_expect@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  jne    L0
  mov    D2(%rip),%rdx
  mov    (%rbx),%eax
  and    (%rdx),%eax
  setne  %al
  movzbl %al,%eax
L0:
  pop    %rbx
  ret
```

assistant: ```c
int smp_sio_is_linebuffer(FILE *fp) {
  if (__builtin_expect(!!(fp == NULL), 0))
    return (0);
  if (fp->_flags & _IOLBF)
    return (1);
  return (0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L0
L10:
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L29
  addl   $0x1,-0x8(%rbp)
L29:
  addl   $0x1,-0x4(%rbp)
L0:
  cmpl   $0x4,-0x4(%rbp)
  jle    L10
  mov    -0x8(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int main() {
  int a = 0;
  for (int i = 0; i < 5; i = i + 1)
    if (i % 2)
      a = a + 1;
  return a;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  mov    $0x2,%eax
  ret
```

assistant: ```c
int main() {
  int a = 0;
  for (int i = 0; i < 5; i = i + 1)
    if (i % 2)
      a = a + 1;
  return a;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  mov    $0x2,%eax
  ret
```

assistant: ```c
int main() {
  int a = 0;
  for (int i = 0; i < 5; i = i + 1)
    if (i % 2)
      a = a + 1;
  return a;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  mov    $0x2,%eax
  ret
```

assistant: ```c
int main() {
  int a = 0;
  for (int i = 0; i < 5; i = i + 1)
    if (i % 2)
      a = a + 1;
  return a;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<direxist>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L13
  movb   $0x6e,-0x9(%rbp)
  jmp    L25
L13:
  movb   $0x79,-0x9(%rbp)
L25:
  lea    -0x9(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    $0x1,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L20
  call   <__stack_chk_fail@plt>
L20:
  leave
  ret
```

assistant: ```c
int direxist(int sock, char *path) {
  DIR *dir;
  char ans[1];
  if ((dir = opendir(path)) == NULL) {
    ans[0] = 'n';
  } else
    ans[0] = 'y';
  write(sock, ans, 1);
  closedir(dir);
  return 1;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<direxist>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebp
  mov    %rsi,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <opendir@plt>
  mov    %rax,%rbx
  cmp    $0x1,%rax
  sbb    %edx,%edx
  and    $0xfffffff5,%edx
  add    $0x79,%edx
  mov    %dl,0x7(%rsp)
  lea    0x7(%rsp),%rsi
  mov    $0x1,%edx
  mov    %ebp,%edi
  call   <write@plt>
  mov    %rbx,%rdi
  call   <closedir@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  mov    $0x1,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int direxist(int sock, char *path) {
  DIR *dir;
  char ans[1];
  if ((dir = opendir(path)) == NULL) {
    ans[0] = 'n';
  } else
    ans[0] = 'y';
  write(sock, ans, 1);
  closedir(dir);
  return 1;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<direxist>:
  endbr64
  push   %r12
  mov    %edi,%r12d
  mov    %rsi,%rdi
  push   %rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <opendir@plt>
  mov    %r12d,%edi
  lea    0x7(%rsp),%rsi
  cmp    $0x1,%rax
  mov    %rax,%rbp
  sbb    %edx,%edx
  and    $0xfffffff5,%edx
  add    $0x79,%edx
  mov    %dl,0x7(%rsp)
  mov    $0x1,%edx
  call   <write@plt>
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int direxist(int sock, char *path) {
  DIR *dir;
  char ans[1];
  if ((dir = opendir(path)) == NULL) {
    ans[0] = 'n';
  } else
    ans[0] = 'y';
  write(sock, ans, 1);
  closedir(dir);
  return 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<direxist>:
  endbr64
  push   %r12
  mov    %edi,%r12d
  mov    %rsi,%rdi
  push   %rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <opendir@plt>
  mov    %r12d,%edi
  lea    0x7(%rsp),%rsi
  cmp    $0x1,%rax
  mov    %rax,%rbp
  sbb    %edx,%edx
  and    $0xfffffff5,%edx
  add    $0x79,%edx
  mov    %dl,0x7(%rsp)
  mov    $0x1,%edx
  call   <write@plt>
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int direxist(int sock, char *path) {
  DIR *dir;
  char ans[1];
  if ((dir = opendir(path)) == NULL) {
    ans[0] = 'n';
  } else
    ans[0] = 'y';
  write(sock, ans, 1);
  closedir(dir);
  return 1;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<cabecalho>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D41(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getch@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: label: D41
type_guessed: string
name: retrieve_data
arguments: label: D19
type_guessed: string
name: retrieve_data
arguments: label: D6
type_guessed: string
name: retrieve_data
arguments: label: D1
type_guessed: string
name: retrieve_data
arguments: label: D24
type_guessed: string

tool: D41: 
Projeto	: Metodos de Ordenacao

tool: D19: 
Criado por: DjalmoCruzJr

tool: D6: 
Descricao : Implementacao em C e aplicacao dos conceitos

tool: D1: 
	referentes aos metodos de ordenacao sobre numeros inteiros.

tool: D24: 

Pressione qualquer tecla para continuar...

assistant: ```c
void cabecalho(void) {
  printf("\nProjeto	: Metodos de Ordenacao");
  printf("\nCriado por: DjalmoCruzJr");
  printf("\nDescricao : Implementacao em C e aplicacao dos conceitos");
  printf("\n\treferentes aos metodos de ordenacao sobre numeros inteiros.");
  printf("\n\nPressione qualquer tecla para continuar...");
  getch();
}
```
user: What is the c source code of the assembly code below?

```asm
<cabecalho>:
  endbr64
  sub    $0x8,%rsp
  lea    D25(%rip),%rdi
  call   <printf@plt>
  lea    D10(%rip),%rdi
  call   <printf@plt>
  lea    D45(%rip),%rdi
  call   <printf@plt>
  lea    D43(%rip),%rdi
  call   <printf@plt>
  lea    D6(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getch@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: tag: D25
type_infered: string
name: parse_data
arguments: tag: D10
type_infered: string
name: parse_data
arguments: tag: D45
type_infered: string
name: parse_data
arguments: tag: D43
type_infered: string
name: parse_data
arguments: tag: D6
type_infered: string

tool: D25: 
Projeto	: Metodos de Ordenacao

tool: D10: 
Criado por: DjalmoCruzJr

tool: D45: 
Descricao : Implementacao em C e aplicacao dos conceitos

tool: D43: 
	referentes aos metodos de ordenacao sobre numeros inteiros.

tool: D6: 

Pressione qualquer tecla para continuar...

assistant: ```c
void cabecalho(void) {
  printf("\nProjeto	: Metodos de Ordenacao");
  printf("\nCriado por: DjalmoCruzJr");
  printf("\nDescricao : Implementacao em C e aplicacao dos conceitos");
  printf("\n\treferentes aos metodos de ordenacao sobre numeros inteiros.");
  printf("\n\nPressione qualquer tecla para continuar...");
  getch();
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cabecalho>:
  endbr64
  sub    $0x8,%rsp
  lea    D36(%rip),%rdi
  call   <printf@plt>
  lea    D43(%rip),%rdi
  call   <printf@plt>
  lea    D13(%rip),%rdi
  call   <printf@plt>
  lea    D15(%rip),%rdi
  call   <printf@plt>
  lea    D41(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <getch@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D36
data_type: string
name: parse_data
arguments: data_tag: D43
data_type: string
name: parse_data
arguments: data_tag: D13
data_type: string
name: parse_data
arguments: data_tag: D15
data_type: string
name: parse_data
arguments: data_tag: D41
data_type: string

tool: D36: 
Projeto	: Metodos de Ordenacao

tool: D43: 
Criado por: DjalmoCruzJr

tool: D13: 
Descricao : Implementacao em C e aplicacao dos conceitos

tool: D15: 
	referentes aos metodos de ordenacao sobre numeros inteiros.

tool: D41: 

Pressione qualquer tecla para continuar...

assistant: ```c
void cabecalho(void) {
  printf("\nProjeto	: Metodos de Ordenacao");
  printf("\nCriado por: DjalmoCruzJr");
  printf("\nDescricao : Implementacao em C e aplicacao dos conceitos");
  printf("\n\treferentes aos metodos de ordenacao sobre numeros inteiros.");
  printf("\n\nPressione qualquer tecla para continuar...");
  getch();
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<cabecalho>:
  endbr64
  sub    $0x8,%rsp
  lea    D37(%rip),%rdi
  call   <printf@plt>
  lea    D36(%rip),%rdi
  call   <printf@plt>
  lea    D48(%rip),%rdi
  call   <printf@plt>
  lea    D38(%rip),%rdi
  call   <printf@plt>
  lea    D12(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <getch@plt>
```

tool_calls: name: unpack_data
arguments: tag: D37
type: string
name: unpack_data
arguments: tag: D36
type: string
name: unpack_data
arguments: tag: D48
type: string
name: unpack_data
arguments: tag: D38
type: string
name: unpack_data
arguments: tag: D12
type: string

tool: D37: 
Projeto	: Metodos de Ordenacao

tool: D36: 
Criado por: DjalmoCruzJr

tool: D48: 
Descricao : Implementacao em C e aplicacao dos conceitos

tool: D38: 
	referentes aos metodos de ordenacao sobre numeros inteiros.

tool: D12: 

Pressione qualquer tecla para continuar...

assistant: ```c
void cabecalho(void) {
  printf("\nProjeto	: Metodos de Ordenacao");
  printf("\nCriado por: DjalmoCruzJr");
  printf("\nDescricao : Implementacao em C e aplicacao dos conceitos");
  printf("\n\treferentes aos metodos de ordenacao sobre numeros inteiros.");
  printf("\n\nPressione qualquer tecla para continuar...");
  getch();
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<escape_json_attr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdx,%rbp
  test   %esi,%esi
  jle    L14
  mov    %rdi,%rbx
  mov    %esi,%esi
  lea    (%rdi,%rsi,1),%r12
  lea    D4(%rip),%r15
  lea    D2(%rip),%r14
  lea    D24(%rip),%r13
  jmp    L29
L148:
  cmp    $0x5c,%cl
  jne    L143
  mov    $0x2,%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  add    $0x2,%rbp
  jmp    L142
L37:
  mov    $0x2,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  add    $0x2,%rbp
L142:
  add    $0x1,%rbx
  cmp    %r12,%rbx
  je     L14
L29:
  movzbl (%rbx),%ecx
  cmp    $0x22,%cl
  je     L37
  jg     L148
  cmp    $0x9,%cl
  je     L67
  cmp    $0xa,%cl
  jne    L143
  mov    $0x2,%edx
  lea    D9(%rip),%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  add    $0x2,%rbp
  jmp    L142
L67:
  mov    $0x2,%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  add    $0x2,%rbp
  jmp    L142
L143:
  cmp    $0x1f,%cl
  jbe    L17
  cmp    $0x7f,%cl
  je     L17
  mov    %cl,0x0(%rbp)
  lea    0x1(%rbp),%rbp
  jmp    L142
L17:
  movzbl %cl,%ecx
  lea    D49(%rip),%rdx
  mov    $0x7,%esi
  mov    %rbp,%rdi
  call   <snprintf@plt>
  add    $0x6,%rbp
  jmp    L142
L14:
  movb   $0x0,0x0(%rbp)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D4
type: string
name: disassemble_data
arguments: tag: D2
type: string
name: disassemble_data
arguments: tag: D24
type: string
name: disassemble_data
arguments: tag: D9
type: string
name: disassemble_data
arguments: tag: D49
type: string

tool: D4: \"

tool: D2: \\

tool: D24: \t

tool: D9: \n

tool: D49: \u%04x

assistant: ```c
void escape_json_attr(const char *buf, int src_len, char *out) {
  char *o = out;
  const char *b;
  int i;
  for (i = 0, b = buf; i < src_len; ++i, ++b) {
    unsigned char c = *b;
    switch (c) {
    case '"':
      memcpy(o, "\\\"", ((sizeof("\\\"") / sizeof("\\\""[0])) - 1));
      o += ((sizeof("\\\"") / sizeof("\\\""[0])) - 1);
      break;
    case '\\':
      memcpy(o, "\\\\", ((sizeof("\\\\") / sizeof("\\\\"[0])) - 1));
      o += ((sizeof("\\\\") / sizeof("\\\\"[0])) - 1);
      break;
    case '\t':
      memcpy(o, "\\t", ((sizeof("\\t") / sizeof("\\t"[0])) - 1));
      o += ((sizeof("\\t") / sizeof("\\t"[0])) - 1);
      break;
    case '\n':
      memcpy(o, "\\n", ((sizeof("\\n") / sizeof("\\n"[0])) - 1));
      o += ((sizeof("\\n") / sizeof("\\n"[0])) - 1);
      break;
    default:
      if ((c < 0x20) || (c == 0x7f)) {
        snprintf(o, 7, "\\u%04x", c);
        o += 6;
      } else {
        *o++ = c;
      }
      break;
    }
  }
  *o = '\0';
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<escape_json_attr>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  jle    L64
  movslq %esi,%rsi
  mov    %rdi,%r15
  lea    D1(%rip),%r13
  lea    (%rdi,%rsi,1),%rbx
  lea    D4(%rip),%r12
  lea    D26(%rip),%rbp
  jmp    L112
  nopw   0x0(%rax,%rax,1)
L38:
  cmp    $0xa,%cl
  jne    L35
  mov    %r14,%rdi
  mov    $0x2,%edx
  lea    D19(%rip),%rsi
  add    $0x2,%r14
  call   <memcpy@plt>
L21:
  add    $0x1,%r15
  cmp    %r15,%rbx
  je     L64
L112:
  movzbl (%r15),%ecx
  cmp    $0x22,%cl
  je     L34
  jg     L99
  cmp    $0x9,%cl
  jne    L38
  mov    %r14,%rdi
  mov    $0x2,%edx
  mov    %rbp,%rsi
  add    $0x1,%r15
  call   <memcpy@plt>
  add    $0x2,%r14
  cmp    %r15,%rbx
  jne    L112
L64:
  movb   $0x0,(%r14)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L99:
  cmp    $0x5c,%cl
  jne    L35
  mov    %r14,%rdi
  mov    $0x2,%edx
  mov    %r12,%rsi
  add    $0x2,%r14
  call   <memcpy@plt>
  jmp    L21
  nopl   0x0(%rax,%rax,1)
L34:
  mov    %r14,%rdi
  mov    $0x2,%edx
  mov    %r13,%rsi
  add    $0x2,%r14
  call   <memcpy@plt>
  jmp    L21
  nopl   0x0(%rax)
L35:
  cmp    $0x1f,%cl
  jbe    L26
  cmp    $0x7f,%cl
  je     L26
  mov    %cl,(%r14)
  add    $0x1,%r14
  jmp    L21
  cs nopw 0x0(%rax,%rax,1)
L26:
  mov    %r14,%rdi
  lea    D30(%rip),%rdx
  mov    $0x7,%esi
  add    $0x6,%r14
  call   <snprintf@plt>
  jmp    L21
```

tool_calls: name: parse_data
arguments: tag: D1
data_type: string
name: parse_data
arguments: tag: D4
data_type: string
name: parse_data
arguments: tag: D26
data_type: string
name: parse_data
arguments: tag: D19
data_type: string
name: parse_data
arguments: tag: D30
data_type: string

tool: D1: \"

tool: D4: \\

tool: D26: \t

tool: D19: \n

tool: D30: \u%04x

assistant: ```c
void escape_json_attr(const char *buf, int src_len, char *out) {
  char *o = out;
  const char *b;
  int i;
  for (i = 0, b = buf; i < src_len; ++i, ++b) {
    unsigned char c = *b;
    switch (c) {
    case '"':
      memcpy(o, "\\\"", ((sizeof("\\\"") / sizeof("\\\""[0])) - 1));
      o += ((sizeof("\\\"") / sizeof("\\\""[0])) - 1);
      break;
    case '\\':
      memcpy(o, "\\\\", ((sizeof("\\\\") / sizeof("\\\\"[0])) - 1));
      o += ((sizeof("\\\\") / sizeof("\\\\"[0])) - 1);
      break;
    case '\t':
      memcpy(o, "\\t", ((sizeof("\\t") / sizeof("\\t"[0])) - 1));
      o += ((sizeof("\\t") / sizeof("\\t"[0])) - 1);
      break;
    case '\n':
      memcpy(o, "\\n", ((sizeof("\\n") / sizeof("\\n"[0])) - 1));
      o += ((sizeof("\\n") / sizeof("\\n"[0])) - 1);
      break;
    default:
      if ((c < 0x20) || (c == 0x7f)) {
        snprintf(o, 7, "\\u%04x", c);
        o += 6;
      } else {
        *o++ = c;
      }
      break;
    }
  }
  *o = '\0';
}
```