ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<s_read>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  mov    %rdx,%rsi
  mov    %rcx,%rdx
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x8,%rsp
  call   <read@plt>
  cmp    %rax,%rbx
  ja     L6
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L6:
  mov    %rbp,%rsi
  lea    D7(%rip),%rdi
  call   <warn@plt>
  add    $0x8,%rsp
  mov    $0xffffffffffffffff,%rax
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D7
type_infered: string

tool: D7: unexpected end-of-file: %s

assistant: ```c
ssize_t s_read(int fd, const char *fn, void *buf, size_t n) {
  ssize_t ret;
  ret = read(fd, buf, n);
  if (ret < n) {
    warn("unexpected end-of-file: %s", fn);
    return -1;
  } else {
    return ret;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<s_read>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  mov    %rdx,%rsi
  mov    %rcx,%rdx
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x8,%rsp
  call   <read@plt>
  cmp    %rax,%rbx
  ja     L0
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L0:
  mov    %rbp,%rsi
  lea    D1(%rip),%rdi
  call   <warn@plt>
  add    $0x8,%rsp
  mov    $0xffffffffffffffff,%rax
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: label: D1
data_type: string

tool: D1: unexpected end-of-file: %s

assistant: ```c
ssize_t s_read(int fd, const char *fn, void *buf, size_t n) {
  ssize_t ret;
  ret = read(fd, buf, n);
  if (ret < n) {
    warn("unexpected end-of-file: %s", fn);
    return -1;
  } else {
    return ret;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<ps_summary_register>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <obus_server_register_object@plt>
  leave
  ret
```

assistant: ```c
int ps_summary_register(struct obus_server *server, struct ps_summary *object) {
  struct obus_object *obj = (struct obus_object *)object;
  return obus_server_register_object(server, obj);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<ps_summary_register>:
  endbr64
  sub    $0x8,%rsp
  call   <obus_server_register_object@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
int ps_summary_register(struct obus_server *server, struct ps_summary *object) {
  struct obus_object *obj = (struct obus_object *)object;
  return obus_server_register_object(server, obj);
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<ps_summary_register>:
  endbr64
  jmp    1050 <obus_server_register_object@plt>
```

assistant: ```c
int ps_summary_register(struct obus_server *server, struct ps_summary *object) {
  struct obus_object *obj = (struct obus_object *)object;
  return obus_server_register_object(server, obj);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<ps_summary_register>:
  endbr64
  jmp    1050 <obus_server_register_object@plt>
```

assistant: ```c
int ps_summary_register(struct obus_server *server, struct ps_summary *object) {
  struct obus_object *obj = (struct obus_object *)object;
  return obus_server_register_object(server, obj);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x1,%edi
  call   <ATOMIC_VAR_INIT@plt>
  mov    %eax,-0xc(%rbp)
  mov    $0x0,%eax
  call   <test_inc_dec@plt>
  mov    $0x0,%eax
  call   <test_add_sub@plt>
  mov    $0x0,%eax
  call   <test_and@plt>
  mov    $0x0,%eax
  call   <test_xor@plt>
  mov    $0x0,%eax
  call   <test_or@plt>
  lea    -0xc(%rbp),%rax
  mov    %rax,%rdi
  call   <test_ptr@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L5
  call   <__stack_chk_fail@plt>
L5:
  leave
  ret
```

assistant: ```c
int main(void) {
  atomic_int i = ATOMIC_VAR_INIT(1);
  test_inc_dec();
  test_add_sub();
  test_and();
  test_xor();
  test_or();
  test_ptr(&i);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    $0x1,%edi
  call   <ATOMIC_VAR_INIT@plt>
  mov    %eax,0x4(%rsp)
  mov    $0x0,%eax
  call   <test_inc_dec@plt>
  mov    $0x0,%eax
  call   <test_add_sub@plt>
  mov    $0x0,%eax
  call   <test_and@plt>
  mov    $0x0,%eax
  call   <test_xor@plt>
  mov    $0x0,%eax
  call   <test_or@plt>
  lea    0x4(%rsp),%rdi
  call   <test_ptr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  mov    $0x0,%eax
  add    $0x18,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(void) {
  atomic_int i = ATOMIC_VAR_INIT(1);
  test_inc_dec();
  test_add_sub();
  test_and();
  test_xor();
  test_or();
  test_ptr(&i);
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    $0x1,%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <ATOMIC_VAR_INIT@plt>
  mov    %eax,0x4(%rsp)
  xor    %eax,%eax
  call   <test_inc_dec@plt>
  xor    %eax,%eax
  call   <test_add_sub@plt>
  xor    %eax,%eax
  call   <test_and@plt>
  xor    %eax,%eax
  call   <test_xor@plt>
  xor    %eax,%eax
  call   <test_or@plt>
  lea    0x4(%rsp),%rdi
  call   <test_ptr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(void) {
  atomic_int i = ATOMIC_VAR_INIT(1);
  test_inc_dec();
  test_add_sub();
  test_and();
  test_xor();
  test_or();
  test_ptr(&i);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    $0x1,%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <ATOMIC_VAR_INIT@plt>
  mov    %eax,0x4(%rsp)
  xor    %eax,%eax
  call   <test_inc_dec@plt>
  xor    %eax,%eax
  call   <test_add_sub@plt>
  xor    %eax,%eax
  call   <test_and@plt>
  xor    %eax,%eax
  call   <test_xor@plt>
  xor    %eax,%eax
  call   <test_or@plt>
  lea    0x4(%rsp),%rdi
  call   <test_ptr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(void) {
  atomic_int i = ATOMIC_VAR_INIT(1);
  test_inc_dec();
  test_add_sub();
  test_and();
  test_xor();
  test_or();
  test_ptr(&i);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<enhexFclose>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    D0(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L15
  mov    D15(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L15
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L15:
  nop
  leave
  ret
```

assistant: ```c
void enhexFclose(FILE *file) {
  if (!(stdin == file || stdout == file)) {
    fclose(file);
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<enhexFclose>:
  endbr64
  mov    D9(%rip),%rax
  cmp    %rdi,(%rax)
  je     L18
  mov    D6(%rip),%rax
  cmp    %rdi,(%rax)
  je     L18
  sub    $0x8,%rsp
  call   <fclose@plt>
  add    $0x8,%rsp
  ret
L18:
  ret
```

assistant: ```c
void enhexFclose(FILE *file) {
  if (!(stdin == file || stdout == file)) {
    fclose(file);
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<enhexFclose>:
  endbr64
  mov    D9(%rip),%rax
  cmp    %rdi,(%rax)
  je     L4
  mov    D8(%rip),%rax
  cmp    %rdi,(%rax)
  je     L4
  jmp    1050 <fclose@plt>
  nopl   0x0(%rax)
L4:
  ret
```

assistant: ```c
void enhexFclose(FILE *file) {
  if (!(stdin == file || stdout == file)) {
    fclose(file);
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<enhexFclose>:
  endbr64
  mov    D0(%rip),%rax
  cmp    %rdi,(%rax)
  je     L16
  mov    D16(%rip),%rax
  cmp    %rdi,(%rax)
  je     L16
  jmp    1050 <fclose@plt>
  nopl   0x0(%rax)
L16:
  ret
```

assistant: ```c
void enhexFclose(FILE *file) {
  if (!(stdin == file || stdout == file)) {
    fclose(file);
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<pic_eoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  cmpl   $0x7,-0x4(%rbp)
  jbe    L2
  mov    $0x20,%esi
  mov    $0xa0,%edi
  call   <outb@plt>
L2:
  mov    $0x20,%esi
  mov    $0x20,%edi
  call   <outb@plt>
  nop
  leave
  ret
```

assistant: ```c
void pic_eoi(unsigned int irq) {
  if (irq >= 8) {
    outb(0xA0, 0x20);
  }
  outb(0x20, 0x20);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<pic_eoi>:
  endbr64
  sub    $0x8,%rsp
  cmp    $0x7,%edi
  ja     L14
L2:
  mov    $0x20,%esi
  mov    $0x20,%edi
  call   <outb@plt>
  add    $0x8,%rsp
  ret
L14:
  mov    $0x20,%esi
  mov    $0xa0,%edi
  call   <outb@plt>
  jmp    L2
```

assistant: ```c
void pic_eoi(unsigned int irq) {
  if (irq >= 8) {
    outb(0xA0, 0x20);
  }
  outb(0x20, 0x20);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<pic_eoi>:
  endbr64
  cmp    $0x7,%edi
  ja     L8
  mov    $0x20,%esi
  mov    $0x20,%edi
  jmp    1050 <outb@plt>
  nopl   0x0(%rax,%rax,1)
L8:
  sub    $0x8,%rsp
  mov    $0x20,%esi
  mov    $0xa0,%edi
  call   <outb@plt>
  mov    $0x20,%esi
  mov    $0x20,%edi
  add    $0x8,%rsp
  jmp    1050 <outb@plt>
```

assistant: ```c
void pic_eoi(unsigned int irq) {
  if (irq >= 8) {
    outb(0xA0, 0x20);
  }
  outb(0x20, 0x20);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<pic_eoi>:
  endbr64
  cmp    $0x7,%edi
  ja     L4
  mov    $0x20,%esi
  mov    $0x20,%edi
  jmp    1050 <outb@plt>
  nopl   0x0(%rax,%rax,1)
L4:
  sub    $0x8,%rsp
  mov    $0x20,%esi
  mov    $0xa0,%edi
  call   <outb@plt>
  mov    $0x20,%esi
  mov    $0x20,%edi
  add    $0x8,%rsp
  jmp    1050 <outb@plt>
```

assistant: ```c
void pic_eoi(unsigned int irq) {
  if (irq >= 8) {
    outb(0xA0, 0x20);
  }
  outb(0x20, 0x20);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<s_decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r14
  mov    $0x1,%r15d
  mov    $0x0,%r12d
  mov    $0x0,%ebp
  mov    $0x0,%r13d
  jmp    L51
L4:
  cmpb   $0x0,(%rdx)
  je     L70
  sub    $0x1,%ebx
  mov    $0x1,%ebp
  jmp    L142
L57:
  movb   $0xa,(%rcx)
  mov    %r13d,%ebp
  jmp    L142
L94:
  mov    %r13d,%ebp
L142:
  add    $0x1,%ebx
  add    $0x1,%rdx
  movzbl -0x1(%rdx),%eax
  test   %al,%al
  je     L49
L114:
  cmp    $0x5c,%al
  jne    L70
  test   %ebp,%ebp
  je     L4
L70:
  test   %r12d,%r12d
  je     L94
  movslq %ebx,%rcx
  add    0x8(%rsp),%rcx
  mov    %al,(%rcx)
  test   %ebp,%ebp
  je     L142
  cmp    $0x6e,%al
  je     L57
  mov    %r13d,%ebp
  cmp    $0x72,%al
  jne    L142
  movb   $0xd,(%rcx)
  jmp    L142
L49:
  test   %r12d,%r12d
  je     L16
  cmp    $0x1,%r15d
  jg     L65
L103:
  add    $0x1,%r12d
  add    $0x1,%r15d
L51:
  movzbl (%r14),%eax
  lea    0x1(%r14),%rdx
  mov    $0x0,%ebx
  test   %al,%al
  jne    L114
  jmp    L49
L16:
  lea    0x1(%rbx),%edi
  call   <alloc@plt>
  mov    %rax,0x8(%rsp)
  movslq %ebx,%rbx
  movb   $0x0,(%rax,%rbx,1)
  jmp    L103
L65:
  mov    $0xd4,%ecx
  lea    D15(%rip),%rdx
  lea    D18(%rip),%rsi
  mov    %r14,%rdi
  call   <s_internal@plt>
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_label: D15
datatype: string
name: read_data
arguments: data_label: D18
datatype: string

tool: D15: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fukamachi/roswell/refs/heads/master/src/util.c

tool: D18: str

assistant: ```c
char *s_decode(char *str) {
  int count, i, write, escape = 0;
  char *ret;
  for (write = 0; write < 2; ++write) {
    for (i = 0, count = 0; str[i] != '\0'; ++i, ++count) {
      if (!escape && str[i] == '\\' && str[i + 1] != '\0')
        escape = 1, --count;
      else {
        if (write) {
          ret[count] = str[i];
          if (escape) {
            switch (str[i]) {
            case 'n':
              ret[count] = '\n';
              break;
            case 'r':
              ret[count] = '\r';
            }
          }
        }
        escape = 0;
      }
    }
    if (!write) {
      ret = alloc(sizeof(char) * (count + 1));
      ret[count] = '\0';
    }
  }
  (s_internal(str, "str", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fukamachi/roswell/refs/heads/master/src/util.c", 212));
  return ret;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<s_decode>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
L167:
  movzbl 0x0(%r13),%eax
  lea    0x1(%r13),%rdx
  xor    %ebx,%ebx
  test   %al,%al
  jne    L169
  jmp    L103
  nopl   (%rax)
L163:
  cmp    $0x5c,%al
  je     L37
L111:
  lea    0x1(%rbx),%ecx
  test   %r14d,%r14d
  je     L63
  mov    %al,(%r12,%rbx,1)
  movslq %ecx,%rbx
L102:
  movzbl (%rdx),%eax
  add    $0x1,%rdx
  test   %al,%al
  je     L103
L169:
  test   %ebp,%ebp
  je     L163
  lea    0x1(%rbx),%ecx
  test   %r14d,%r14d
  je     L63
  add    %r12,%rbx
  cmp    $0x6e,%al
  je     L113
  cmp    $0x72,%al
  je     L52
  add    $0x1,%rdx
  mov    %al,(%rbx)
  xor    %ebp,%ebp
  movslq %ecx,%rbx
  movzbl -0x1(%rdx),%eax
  test   %al,%al
  jne    L169
  nopl   0x0(%rax)
L103:
  add    $0x1,%r14d
  cmp    $0x1,%r14d
  je     L158
  cmp    $0x2,%r14d
  jne    L167
  mov    %r13,%rdi
  mov    $0xd4,%ecx
  lea    D1(%rip),%rdx
  lea    D18(%rip),%rsi
  call   <s_internal@plt>
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L63:
  movslq %ecx,%rbx
  xor    %ebp,%ebp
  jmp    L102
  nopw   0x0(%rax,%rax,1)
L37:
  cmpb   $0x0,(%rdx)
  je     L111
  mov    $0x1,%ebp
  jmp    L102
  nopl   0x0(%rax,%rax,1)
L52:
  movb   $0xd,(%rbx)
  xor    %ebp,%ebp
  movslq %ecx,%rbx
  jmp    L102
  nopl   (%rax)
L113:
  movb   $0xa,(%rbx)
  xor    %ebp,%ebp
  movslq %ecx,%rbx
  jmp    L102
  nopl   (%rax)
L158:
  lea    0x1(%rbx),%edi
  call   <alloc@plt>
  movb   $0x0,(%rax,%rbx,1)
  mov    %rax,%r12
  jmp    L167
```

tool_calls: name: unpack_data
arguments: tag: D1
data_type: string
name: unpack_data
arguments: tag: D18
data_type: string

tool: D1: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fukamachi/roswell/refs/heads/master/src/util.c

tool: D18: str

assistant: ```c
char *s_decode(char *str) {
  int count, i, write, escape = 0;
  char *ret;
  for (write = 0; write < 2; ++write) {
    for (i = 0, count = 0; str[i] != '\0'; ++i, ++count) {
      if (!escape && str[i] == '\\' && str[i + 1] != '\0')
        escape = 1, --count;
      else {
        if (write) {
          ret[count] = str[i];
          if (escape) {
            switch (str[i]) {
            case 'n':
              ret[count] = '\n';
              break;
            case 'r':
              ret[count] = '\r';
            }
          }
        }
        escape = 0;
      }
    }
    if (!write) {
      ret = alloc(sizeof(char) * (count + 1));
      ret[count] = '\0';
    }
  }
  (s_internal(str, "str", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fukamachi/roswell/refs/heads/master/src/util.c", 212));
  return ret;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<somar>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int somar(int a, int b) {
  int r = a + b;
  return r;
}
```
user: Translate the below assembly code into C programming language:

```asm
<somar>:
  endbr64
  lea    (%rdi,%rsi,1),%eax
  ret
```

assistant: ```c
int somar(int a, int b) {
  int r = a + b;
  return r;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<somar>:
  endbr64
  lea    (%rdi,%rsi,1),%eax
  ret
```

assistant: ```c
int somar(int a, int b) {
  int r = a + b;
  return r;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<somar>:
  endbr64
  lea    (%rdi,%rsi,1),%eax
  ret
```

assistant: ```c
int somar(int a, int b) {
  int r = a + b;
  return r;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<strtok_r>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L53
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L53
L63:
  addq   $0x1,-0x18(%rbp)
L53:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L36
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L63
L36:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L75
  mov    $0x0,%eax
  jmp    L37
L75:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L20
L64:
  addq   $0x1,-0x18(%rbp)
L20:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L50
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L64
L50:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L55
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x0,(%rax)
L55:
  mov    -0x28(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
L37:
  leave
  ret
```

assistant: ```c
char *strtok_r(char *s1, const char *s2, char **lasts) {
  char *ret;
  if (s1 == NULL)
    s1 = *lasts;
  while (*s1 && strchr(s2, *s1))
    ++s1;
  if (*s1 == '\0')
    return NULL;
  ret = s1;
  while (*s1 && !strchr(s2, *s1))
    ++s1;
  if (*s1)
    *s1++ = '\0';
  *lasts = s1;
  return ret;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<strtok_r>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%r12
  test   %rdi,%rdi
  je     L108
L25:
  movzbl (%rbx),%esi
  test   %sil,%sil
  je     L53
L112:
  movsbl %sil,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L6
  add    $0x1,%rbx
  movzbl (%rbx),%esi
  test   %sil,%sil
  jne    L112
L53:
  mov    $0x0,%eax
  jmp    L64
L108:
  mov    (%rdx),%rbx
  jmp    L25
L6:
  movzbl (%rbx),%esi
  test   %sil,%sil
  je     L11
  mov    %rbx,%r13
L0:
  movsbl %sil,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L80
  add    $0x1,%r13
  movzbl 0x0(%r13),%esi
  test   %sil,%sil
  jne    L0
  jmp    L3
L80:
  cmpb   $0x0,0x0(%r13)
  je     L3
  movb   $0x0,0x0(%r13)
  lea    0x1(%r13),%r13
L3:
  mov    %r13,(%r12)
  mov    %rbx,%rax
L64:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L11:
  mov    $0x0,%eax
  jmp    L64
```

assistant: ```c
char *strtok_r(char *s1, const char *s2, char **lasts) {
  char *ret;
  if (s1 == NULL)
    s1 = *lasts;
  while (*s1 && strchr(s2, *s1))
    ++s1;
  if (*s1 == '\0')
    return NULL;
  ret = s1;
  while (*s1 && !strchr(s2, *s1))
    ++s1;
  if (*s1)
    *s1++ = '\0';
  *lasts = s1;
  return ret;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<strtok_r>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  jne    L35
  jmp    L4
  nopl   0x0(%rax)
L95:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L92
  add    $0x1,%rbx
L35:
  movsbl (%rbx),%esi
  test   %sil,%sil
  jne    L95
L40:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  xchg   %ax,%ax
L92:
  movsbl (%rbx),%esi
  test   %sil,%sil
  je     L40
  mov    %rbx,%r13
  jmp    L13
  nopl   (%rax)
L48:
  movsbl 0x1(%r13),%esi
  add    $0x1,%r13
  test   %sil,%sil
  je     L47
L13:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L48
  cmpb   $0x0,0x0(%r13)
  je     L47
  movb   $0x0,0x0(%r13)
  add    $0x1,%r13
L47:
  mov    %r13,(%r12)
  add    $0x8,%rsp
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L4:
  mov    (%rdx),%rbx
  jmp    L35
```

assistant: ```c
char *strtok_r(char *s1, const char *s2, char **lasts) {
  char *ret;
  if (s1 == NULL)
    s1 = *lasts;
  while (*s1 && strchr(s2, *s1))
    ++s1;
  if (*s1 == '\0')
    return NULL;
  ret = s1;
  while (*s1 && !strchr(s2, *s1))
    ++s1;
  if (*s1)
    *s1++ = '\0';
  *lasts = s1;
  return ret;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<strtok_r>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  jne    L5
  jmp    L33
  nopl   0x0(%rax)
L47:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L89
  add    $0x1,%rbx
L5:
  movsbl (%rbx),%esi
  test   %sil,%sil
  jne    L47
L50:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  xchg   %ax,%ax
L89:
  movsbl (%rbx),%esi
  test   %sil,%sil
  je     L50
  mov    %rbx,%r13
  jmp    L64
  nopl   (%rax)
L86:
  movsbl 0x1(%r13),%esi
  add    $0x1,%r13
  test   %sil,%sil
  je     L52
L64:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L86
  cmpb   $0x0,0x0(%r13)
  je     L52
  movb   $0x0,0x0(%r13)
  add    $0x1,%r13
L52:
  mov    %r13,(%r12)
  add    $0x8,%rsp
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L33:
  mov    (%rdx),%rbx
  jmp    L5
```

assistant: ```c
char *strtok_r(char *s1, const char *s2, char **lasts) {
  char *ret;
  if (s1 == NULL)
    s1 = *lasts;
  while (*s1 && strchr(s2, *s1))
    ++s1;
  if (*s1 == '\0')
    return NULL;
  ret = s1;
  while (*s1 && !strchr(s2, *s1))
    ++s1;
  if (*s1)
    *s1++ = '\0';
  *lasts = s1;
  return ret;
}
```