ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码:

```asm
<wyplata>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,0xc(%rsp)
  mov    %r9d,0x8(%rsp)
  test   %r9d,%r9d
  jle    L29
  movl   $0x0,0x4(%rsp)
  mov    %rdi,%rbx
  mov    %edx,%ebp
  mov    %ecx,%r14d
  mov    %r8d,%r12d
  lea    D1(%rip),%r13
  xchg   %ax,%ax
L32:
  call   <fork@plt>
  cmp    $0xffffffff,%eax
  je     L24
  test   %eax,%eax
  jne    L11
L25:
  mov    0x50(%rsp),%eax
  xor    %r15d,%r15d
  test   %eax,%eax
  jg     L72
  jmp    L64
  nop
L21:
  mov    %r14d,%edx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <jd_sem_lidl@plt>
L72:
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <jd_sem_up@plt>
  mov    (%rbx),%esi
  mov    %r13,%rdi
  call   <printf@plt>
  mov    (%rbx),%eax
  cmp    $0x63,%eax
  jle    L21
  sub    $0x64,%eax
  mov    $0x2710,%edi
  add    $0x1,%r15d
  mov    %eax,(%rbx)
  call   <usleep@plt>
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <jd_sem_down@plt>
  mov    $0x7530,%edi
  call   <usleep@plt>
  cmp    %r15d,0x50(%rsp)
  jne    L72
L64:
  mov    0xc(%rsp),%edi
  call   <close@plt>
  xor    %edi,%edi
  call   <exit@plt>
L11:
  addl   $0x1,0x4(%rsp)
  mov    0x4(%rsp),%eax
  cmp    %eax,0x8(%rsp)
  jne    L32
L29:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L24:
  lea    D19(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L25
```

tool_calls: name: extract_symbolic_data
arguments: tag: D1
type: string
name: extract_symbolic_data
arguments: tag: D19
type: string

tool: D1: wyplata -100 %d


tool: D19: fork error

assistant: ```c
void wyplata(int *value, int fd, int semid, int brak_kasy, int mutex, int count, int count_i) {
  int j, i, pid, trans;
  for (j = 0; j < count; j++) {
    switch (pid = fork()) {
    case -1:
      perror("fork error");
      exit(1);
    case 0:
      for (i = 0; i < count_i; i++) {
        while (1) {
          jd_sem_up(semid, mutex);
          printf("wyplata -100 %d\n", *value);
          trans = 100;
          if (*value - 100 >= 0) {
            (*value) -= trans;
            usleep(10000);
            break;
          } else {
            jd_sem_lidl(semid, mutex, brak_kasy);
          }
        }
        jd_sem_down(semid, mutex);
        usleep(30000);
      }
      close(fd);
      exit(0);
    }
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<wyplata>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,0xc(%rsp)
  mov    %r9d,0x8(%rsp)
  test   %r9d,%r9d
  jle    L89
  movl   $0x0,0x4(%rsp)
  mov    %rdi,%rbx
  mov    %edx,%ebp
  mov    %ecx,%r14d
  mov    %r8d,%r12d
  lea    D8(%rip),%r13
  xchg   %ax,%ax
L81:
  call   <fork@plt>
  cmp    $0xffffffff,%eax
  je     L35
  test   %eax,%eax
  jne    L20
L24:
  mov    0x50(%rsp),%eax
  xor    %r15d,%r15d
  test   %eax,%eax
  jg     L38
  jmp    L78
  nop
L1:
  mov    %r14d,%edx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <jd_sem_lidl@plt>
L38:
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <jd_sem_up@plt>
  mov    (%rbx),%esi
  mov    %r13,%rdi
  call   <printf@plt>
  mov    (%rbx),%eax
  cmp    $0x63,%eax
  jle    L1
  sub    $0x64,%eax
  mov    $0x2710,%edi
  add    $0x1,%r15d
  mov    %eax,(%rbx)
  call   <usleep@plt>
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <jd_sem_down@plt>
  mov    $0x7530,%edi
  call   <usleep@plt>
  cmp    %r15d,0x50(%rsp)
  jne    L38
L78:
  mov    0xc(%rsp),%edi
  call   <close@plt>
  xor    %edi,%edi
  call   <exit@plt>
L20:
  addl   $0x1,0x4(%rsp)
  mov    0x4(%rsp),%eax
  cmp    %eax,0x8(%rsp)
  jne    L81
L89:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L35:
  lea    D14(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L24
```

tool_calls: name: retrieve_data
arguments: label: D8
type_guessed: string
name: retrieve_data
arguments: label: D14
type_guessed: string

tool: D8: wyplata -100 %d


tool: D14: fork error

assistant: ```c
void wyplata(int *value, int fd, int semid, int brak_kasy, int mutex, int count, int count_i) {
  int j, i, pid, trans;
  for (j = 0; j < count; j++) {
    switch (pid = fork()) {
    case -1:
      perror("fork error");
      exit(1);
    case 0:
      for (i = 0; i < count_i; i++) {
        while (1) {
          jd_sem_up(semid, mutex);
          printf("wyplata -100 %d\n", *value);
          trans = 100;
          if (*value - 100 >= 0) {
            (*value) -= trans;
            usleep(10000);
            break;
          } else {
            jd_sem_lidl(semid, mutex, brak_kasy);
          }
        }
        jd_sem_down(semid, mutex);
        usleep(30000);
      }
      close(fd);
      exit(0);
    }
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<imprime>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L12
L19:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x4(%rbp)
L12:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L19
  mov    $0xa,%edi
  call   <putchar@plt>
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D1
type_guessed: string

tool: D1:  %d

assistant: ```c
void imprime(int *v, int tam) {
  int i;
  for (i = 0; i < tam; i++) {
    printf(" %d", v[i]);
  }
  printf("\n");
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<imprime>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  test   %esi,%esi
  jle    L6
  mov    %rdi,%rbx
  lea    -0x1(%rsi),%eax
  lea    0x4(%rdi,%rax,4),%r12
  lea    D0(%rip),%rbp
L9:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x4,%rbx
  cmp    %r12,%rbx
  jne    L9
L6:
  mov    $0xa,%edi
  call   <putchar@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D0
data_type: string

tool: D0:  %d

assistant: ```c
void imprime(int *v, int tam) {
  int i;
  for (i = 0; i < tam; i++) {
    printf(" %d", v[i]);
  }
  printf("\n");
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<imprime>:
  endbr64
  test   %esi,%esi
  jle    L1
  lea    -0x1(%rsi),%eax
  push   %r12
  lea    0x4(%rdi,%rax,4),%r12
  push   %rbp
  lea    D6(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  xchg   %ax,%ax
L5:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %r12,%rbx
  jne    L5
  pop    %rbx
  mov    $0xa,%edi
  pop    %rbp
  pop    %r12
  jmp    1060 <putchar@plt>
  nopl   0x0(%rax,%rax,1)
L1:
  mov    $0xa,%edi
  jmp    1060 <putchar@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D6
datatype: string

tool: D6:  %d

assistant: ```c
void imprime(int *v, int tam) {
  int i;
  for (i = 0; i < tam; i++) {
    printf(" %d", v[i]);
  }
  printf("\n");
}
```
user: What is the c source code of the assembly code below?

```asm
<imprime>:
  endbr64
  test   %esi,%esi
  jle    L0
  lea    -0x1(%rsi),%eax
  push   %r12
  lea    0x4(%rdi,%rax,4),%r12
  push   %rbp
  lea    D9(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  xchg   %ax,%ax
L19:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %r12,%rbx
  jne    L19
  pop    %rbx
  mov    $0xa,%edi
  pop    %rbp
  pop    %r12
  jmp    1060 <putchar@plt>
  nopl   0x0(%rax,%rax,1)
L0:
  mov    $0xa,%edi
  jmp    1060 <putchar@plt>
```

tool_calls: name: disassemble_data
arguments: label: D9
type_guessed: string

tool: D9:  %d

assistant: ```c
void imprime(int *v, int tam) {
  int i;
  for (i = 0; i < tam; i++) {
    printf(" %d", v[i]);
  }
  printf("\n");
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<Jump>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdx
  lea    D36(%rip),%rax
  mov    %rax,%rsi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <Inst_Printf@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdx
  lea    D26(%rip),%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <Inst_Printf@plt>
  nop
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D36
type_guessed: string
name: extract_symbolic_data
arguments: tag: D12
type_guessed: string
name: extract_symbolic_data
arguments: tag: D26
type_guessed: string
name: extract_symbolic_data
arguments: tag: D9
type_guessed: string

tool: D36: $3,%s

tool: D12: lda

tool: D26: $31,($3),%s

tool: D9: jmp

assistant: ```c
void Jump(char *label) {
  Inst_Printf("lda", "$3,%s", label);
  Inst_Printf("jmp", "$31,($3),%s", label);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<Jump>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    %rdi,%rdx
  lea    D0(%rip),%rsi
  lea    D22(%rip),%rdi
  call   <Inst_Printf@plt>
  mov    %rbx,%rdx
  lea    D14(%rip),%rsi
  lea    D33(%rip),%rdi
  call   <Inst_Printf@plt>
  pop    %rbx
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D0
datatype: string
name: unpack_data
arguments: data_label: D22
datatype: string
name: unpack_data
arguments: data_label: D14
datatype: string
name: unpack_data
arguments: data_label: D33
datatype: string

tool: D0: $3,%s

tool: D22: lda

tool: D14: $31,($3),%s

tool: D33: jmp

assistant: ```c
void Jump(char *label) {
  Inst_Printf("lda", "$3,%s", label);
  Inst_Printf("jmp", "$31,($3),%s", label);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Jump>:
  endbr64
  push   %r12
  mov    %rdi,%rdx
  mov    %rdi,%r12
  lea    D18(%rip),%rsi
  lea    D19(%rip),%rdi
  call   <Inst_Printf@plt>
  mov    %r12,%rdx
  pop    %r12
  lea    D11(%rip),%rsi
  lea    D7(%rip),%rdi
  jmp    1050 <Inst_Printf@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D18
type_guessed: string
name: extract_symbolic_data
arguments: label: D19
type_guessed: string
name: extract_symbolic_data
arguments: label: D11
type_guessed: string
name: extract_symbolic_data
arguments: label: D7
type_guessed: string

tool: D18: $3,%s

tool: D19: lda

tool: D11: $31,($3),%s

tool: D7: jmp

assistant: ```c
void Jump(char *label) {
  Inst_Printf("lda", "$3,%s", label);
  Inst_Printf("jmp", "$31,($3),%s", label);
}
```
user: Translate the below assembly code into C programming language:

```asm
<Jump>:
  endbr64
  push   %r12
  mov    %rdi,%rdx
  mov    %rdi,%r12
  lea    D38(%rip),%rsi
  lea    D28(%rip),%rdi
  call   <Inst_Printf@plt>
  mov    %r12,%rdx
  pop    %r12
  lea    D4(%rip),%rsi
  lea    D21(%rip),%rdi
  jmp    1050 <Inst_Printf@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D38
type: string
name: parse_data
arguments: data_tag: D28
type: string
name: parse_data
arguments: data_tag: D4
type: string
name: parse_data
arguments: data_tag: D21
type: string

tool: D38: $3,%s

tool: D28: lda

tool: D4: $31,($3),%s

tool: D21: jmp

assistant: ```c
void Jump(char *label) {
  Inst_Printf("lda", "$3,%s", label);
  Inst_Printf("jmp", "$31,($3),%s", label);
}
```
user: What is the c source code of the assembly code below?

```asm
<dumpRaw>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L4
L3:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x18(%rbp),%rax
  lea    D9(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  addl   $0x1,-0x4(%rbp)
L4:
  mov    -0x28(%rbp),%rax
  cmp    %eax,-0x4(%rbp)
  jl     L3
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  nop
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D9
type_guessed: string

tool: D9: %02x 

assistant: ```c
void dumpRaw(FILE *fp, unsigned char *buf, size_t len) {
  int i;
  for (i = 0; i < (signed int)len; ++i)
    fprintf(fp, "%02x ", buf[i]);
  fprintf(fp, "\n");
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<dumpRaw>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  test   %edx,%edx
  jle    L14
  mov    %rsi,%rbx
  lea    -0x1(%rdx),%eax
  lea    0x1(%rsi,%rax,1),%r13
  lea    D8(%rip),%r12
L11:
  movzbl (%rbx),%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x1,%rbx
  cmp    %r13,%rbx
  jne    L11
L14:
  mov    %rbp,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D8
type_guessed: string

tool: D8: %02x 

assistant: ```c
void dumpRaw(FILE *fp, unsigned char *buf, size_t len) {
  int i;
  for (i = 0; i < (signed int)len; ++i)
    fprintf(fp, "%02x ", buf[i]);
  fprintf(fp, "\n");
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<dumpRaw>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %edx,%edx
  jle    L2
  lea    -0x1(%rdx),%eax
  mov    %rsi,%rbx
  lea    D6(%rip),%r12
  lea    0x1(%rsi,%rax,1),%r13
  nopw   0x0(%rax,%rax,1)
L17:
  movzbl (%rbx),%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <fprintf@plt>
  cmp    %r13,%rbx
  jne    L17
L2:
  add    $0x8,%rsp
  mov    %rbp,%rsi
  mov    $0xa,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1060 <fputc@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D6
data_type: string

tool: D6: %02x 

assistant: ```c
void dumpRaw(FILE *fp, unsigned char *buf, size_t len) {
  int i;
  for (i = 0; i < (signed int)len; ++i)
    fprintf(fp, "%02x ", buf[i]);
  fprintf(fp, "\n");
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<dumpRaw>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %edx,%edx
  jle    L9
  lea    -0x1(%rdx),%eax
  mov    %rsi,%rbx
  lea    D8(%rip),%r12
  lea    0x1(%rsi,%rax,1),%r13
  nopw   0x0(%rax,%rax,1)
L4:
  movzbl (%rbx),%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <fprintf@plt>
  cmp    %r13,%rbx
  jne    L4
L9:
  add    $0x8,%rsp
  mov    %rbp,%rsi
  mov    $0xa,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1060 <fputc@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D8
datatype: string

tool: D8: %02x 

assistant: ```c
void dumpRaw(FILE *fp, unsigned char *buf, size_t len) {
  int i;
  for (i = 0; i < (signed int)len; ++i)
    fprintf(fp, "%02x ", buf[i]);
  fprintf(fp, "\n");
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<G_NewString>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <G_Alloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L42
L17:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L13
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x18(%rbp)
  jge    L13
  addl   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x6e,%al
  jne    L15
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0xa,(%rax)
  jmp    L23
L15:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x5c,(%rax)
  jmp    L23
L13:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rcx),%edx
  mov    %dl,(%rax)
L23:
  addl   $0x1,-0x18(%rbp)
L42:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L17
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *G_NewString(const char *string) {
  char *newb, *new_p;
  int i, l;
  l = strlen(string) + 1;
  newb = G_Alloc(l);
  new_p = newb;
  for (i = 0; i < l; i++) {
    if (string[i] == '\\' && i < l - 1) {
      i++;
      if (string[i] == 'n') {
        *new_p++ = '\n';
      } else {
        *new_p++ = '\\';
      }
    } else {
      *new_p++ = string[i];
    }
  }
  return newb;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<G_NewString>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  call   <strlen@plt>
  mov    %eax,%ebx
  lea    0x1(%rax),%r12d
  mov    %r12d,%edi
  call   <G_Alloc@plt>
  test   %r12d,%r12d
  jle    L45
  lea    0x1(%rax),%rsi
  mov    $0x0,%edx
  mov    $0x5c,%r9d
  mov    $0xa,%r8d
  jmp    L22
L9:
  mov    %edx,%ecx
L23:
  mov    %dil,-0x1(%rsi)
  lea    0x1(%rcx),%edx
  add    $0x1,%rsi
  cmp    %ecx,%ebx
  jle    L45
L22:
  movslq %edx,%rcx
  movzbl 0x0(%rbp,%rcx,1),%edi
  cmp    %edx,%ebx
  jle    L9
  cmp    $0x5c,%dil
  jne    L9
  lea    0x1(%rdx),%ecx
  movslq %ecx,%rdx
  cmpb   $0x6e,0x0(%rbp,%rdx,1)
  mov    %r8d,%edi
  cmovne %r9d,%edi
  jmp    L23
L45:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *G_NewString(const char *string) {
  char *newb, *new_p;
  int i, l;
  l = strlen(string) + 1;
  newb = G_Alloc(l);
  new_p = newb;
  for (i = 0; i < l; i++) {
    if (string[i] == '\\' && i < l - 1) {
      i++;
      if (string[i] == 'n') {
        *new_p++ = '\n';
      } else {
        *new_p++ = '\\';
      }
    } else {
      *new_p++ = string[i];
    }
  }
  return newb;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<G_NewString>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  call   <strlen@plt>
  lea    0x1(%rax),%r12d
  mov    %eax,%ebx
  mov    %r12d,%edi
  call   <G_Alloc@plt>
  test   %r12d,%r12d
  jle    L25
  mov    %rax,%rsi
  xor    %edx,%edx
  mov    $0x5c,%r9d
  mov    $0xa,%r8d
  nopl   0x0(%rax)
L24:
  movslq %edx,%rcx
  add    $0x1,%rsi
  movzbl 0x0(%rbp,%rcx,1),%edi
  cmp    %edx,%ebx
  jle    L27
  cmp    $0x5c,%dil
  je     L1
L27:
  mov    %edx,%ecx
L41:
  mov    %dil,-0x1(%rsi)
  lea    0x1(%rcx),%edx
  cmp    %ecx,%ebx
  jg     L24
L25:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L1:
  lea    0x1(%rdx),%ecx
  mov    %r8d,%edi
  movslq %ecx,%rdx
  cmpb   $0x6e,0x0(%rbp,%rdx,1)
  cmovne %r9d,%edi
  jmp    L41
```

assistant: ```c
char *G_NewString(const char *string) {
  char *newb, *new_p;
  int i, l;
  l = strlen(string) + 1;
  newb = G_Alloc(l);
  new_p = newb;
  for (i = 0; i < l; i++) {
    if (string[i] == '\\' && i < l - 1) {
      i++;
      if (string[i] == 'n') {
        *new_p++ = '\n';
      } else {
        *new_p++ = '\\';
      }
    } else {
      *new_p++ = string[i];
    }
  }
  return newb;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<G_NewString>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  call   <strlen@plt>
  lea    0x1(%rax),%r12d
  mov    %eax,%ebx
  mov    %r12d,%edi
  call   <G_Alloc@plt>
  test   %r12d,%r12d
  jle    L45
  mov    %rax,%rsi
  xor    %edx,%edx
  mov    $0xa,%r9d
  mov    $0x5c,%r8d
  nopl   0x0(%rax)
L11:
  movslq %edx,%rcx
  add    $0x1,%rsi
  movzbl 0x0(%rbp,%rcx,1),%edi
  cmp    %edx,%ebx
  jle    L21
  cmp    $0x5c,%dil
  je     L9
L21:
  mov    %edx,%ecx
L1:
  mov    %dil,-0x1(%rsi)
  lea    0x1(%rcx),%edx
  cmp    %ecx,%ebx
  jg     L11
L45:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L9:
  lea    0x1(%rdx),%ecx
  mov    %r8d,%edi
  movslq %ecx,%rdx
  cmpb   $0x6e,0x0(%rbp,%rdx,1)
  cmove  %r9d,%edi
  jmp    L1
```

assistant: ```c
char *G_NewString(const char *string) {
  char *newb, *new_p;
  int i, l;
  l = strlen(string) + 1;
  newb = G_Alloc(l);
  new_p = newb;
  for (i = 0; i < l; i++) {
    if (string[i] == '\\' && i < l - 1) {
      i++;
      if (string[i] == 'n') {
        *new_p++ = '\n';
      } else {
        *new_p++ = '\\';
      }
    } else {
      *new_p++ = string[i];
    }
  }
  return newb;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<tok>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <efp_stream_skip_space@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <efp_stream_eol@plt>
  test   %rax,%rax
  je     L9
  mov    $0x0,%eax
  jmp    L21
L9:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <efp_stream_get_ptr@plt>
  mov    %eax,%ecx
  mov    -0x20(%rbp),%rax
  mov    %ebx,%edx
  mov    %rax,%rsi
  mov    %ecx,%edi
  call   <efp_strncasecmp@plt>
  test   %rax,%rax
  jne    L11
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <efp_stream_advance@plt>
  jmp    L21
L11:
  mov    $0x0,%eax
L21:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int tok(struct stream *stream, const char *id) {
  efp_stream_skip_space(stream);
  if (efp_stream_eol(stream))
    return 0;
  if (efp_strncasecmp(efp_stream_get_ptr(stream), id, strlen(id)) == 0)
    return efp_stream_advance(stream, strlen(id));
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<tok>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  call   <efp_stream_skip_space@plt>
  mov    %rbx,%rdi
  call   <efp_stream_eol@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  je     L22
L1:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L22:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%r12d
  mov    %rbx,%rdi
  call   <efp_stream_get_ptr@plt>
  mov    %eax,%edi
  mov    %r12d,%edx
  mov    %rbp,%rsi
  call   <efp_strncasecmp@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L1
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%esi
  mov    %rbx,%rdi
  call   <efp_stream_advance@plt>
  jmp    L1
```

assistant: ```c
int tok(struct stream *stream, const char *id) {
  efp_stream_skip_space(stream);
  if (efp_stream_eol(stream))
    return 0;
  if (efp_strncasecmp(efp_stream_get_ptr(stream), id, strlen(id)) == 0)
    return efp_stream_advance(stream, strlen(id));
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<tok>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  call   <efp_stream_skip_space@plt>
  mov    %rbp,%rdi
  call   <efp_stream_eol@plt>
  test   %rax,%rax
  je     L18
L15:
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L18:
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%r13d
  call   <efp_stream_get_ptr@plt>
  mov    %r13d,%edx
  mov    %r12,%rsi
  mov    %eax,%edi
  call   <efp_strncasecmp@plt>
  test   %rax,%rax
  jne    L15
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  mov    %eax,%esi
  pop    %r13
  jmp    10c0 <efp_stream_advance@plt>
```

assistant: ```c
int tok(struct stream *stream, const char *id) {
  efp_stream_skip_space(stream);
  if (efp_stream_eol(stream))
    return 0;
  if (efp_strncasecmp(efp_stream_get_ptr(stream), id, strlen(id)) == 0)
    return efp_stream_advance(stream, strlen(id));
  return 0;
}
```