ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<listto>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  cmpb   $0x0,-0x1(%rdi)
  je     L29
  mov    %rdi,%rbx
  lea    D1(%rip),%r13
  lea    D14(%rip),%r12
  jmp    L92
  nopw   0x0(%rax,%rax,1)
L103:
  movsbl (%rbx),%edi
  mov    %rbp,%rsi
  call   <putc@plt>
L35:
  add    $0x1,%rbx
  cmpb   $0x0,-0x1(%rbx)
  je     L29
L92:
  movsbl (%rbx),%edi
  call   <isprint@plt>
  test   %rax,%rax
  jne    L103
  mov    %rbp,%rsi
  mov    $0x5c,%edi
  call   <putc@plt>
  movsbl (%rbx),%edx
  lea    -0x8(%rdx),%eax
  cmp    $0x13,%al
  ja     L7
  movzbl %al,%eax
  movslq (%r12,%rax,4),%rax
  add    %r12,%rax
  notrack jmp *%rax
  cs nopw 0x0(%rax,%rax,1)
L7:
  mov    %r13,%rsi
  mov    %rbp,%rdi
  add    $0x1,%rbx
  call   <fprintf@plt>
  cmpb   $0x0,-0x1(%rbx)
  jne    L92
L29:
  add    $0x8,%rsp
  mov    %rbp,%rsi
  mov    $0xa,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1070 <putc@plt>
  nopl   0x0(%rax)
  mov    %rbp,%rsi
  mov    $0x65,%edi
  call   <putc@plt>
  jmp    L35
  nopw   0x0(%rax,%rax,1)
  mov    %rbp,%rsi
  mov    $0x72,%edi
  call   <putc@plt>
  jmp    L35
  nopw   0x0(%rax,%rax,1)
  mov    %rbp,%rsi
  mov    $0x6e,%edi
  call   <putc@plt>
  jmp    L35
  nopw   0x0(%rax,%rax,1)
  mov    %rbp,%rsi
  mov    $0x74,%edi
  call   <putc@plt>
  jmp    L35
  nopw   0x0(%rax,%rax,1)
  mov    %rbp,%rsi
  mov    $0x62,%edi
  call   <putc@plt>
  jmp    L35
```

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

tool: D1: %02x

assistant: ```c
void listto(char *p1, FILE *fp) {
  p1--;
  while (*p1++)
    if (isprint(*p1))
      putc(*p1, fp);
    else {
      putc('\\', fp);
      switch (*p1) {
      case '\b':
        putc('b', fp);
        break;
      case '\t':
        putc('t', fp);
        break;
      case '\n':
        putc('n', fp);
        break;
      case '\r':
        putc('r', fp);
        break;
      case '\33':
        putc('e', fp);
        break;
      default:
        fprintf(fp, "%02x", *p1 & 0xFF);
      }
    }
  putc('\n', fp);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<init_allocator>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    $0x0,%eax
  call   <lwgeom_init_allocators@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <lwalloc_var@plt>
  leave
  ret
```

assistant: ```c
void *init_allocator(size_t size) {
  lwgeom_init_allocators();
  return lwalloc_var(size);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<init_allocator>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x0,%eax
  call   <lwgeom_init_allocators@plt>
  mov    %rbx,%rdi
  call   <lwalloc_var@plt>
  pop    %rbx
  ret
```

assistant: ```c
void *init_allocator(size_t size) {
  lwgeom_init_allocators();
  return lwalloc_var(size);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<init_allocator>:
  endbr64
  push   %rbp
  xor    %eax,%eax
  mov    %rdi,%rbp
  call   <lwgeom_init_allocators@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1070 <lwalloc_var@plt>
```

assistant: ```c
void *init_allocator(size_t size) {
  lwgeom_init_allocators();
  return lwalloc_var(size);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<init_allocator>:
  endbr64
  push   %rbp
  xor    %eax,%eax
  mov    %rdi,%rbp
  call   <lwgeom_init_allocators@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1070 <lwalloc_var@plt>
```

assistant: ```c
void *init_allocator(size_t size) {
  lwgeom_init_allocators();
  return lwalloc_var(size);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<do_gfmt>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %esi,%r12d
  mov    %edx,%edi
  mov    %ecx,%r13d
  mov    %r8d,%r14d
  mov    %r9d,0x4(%rsp)
  test   %edx,%edx
  mov    $0x1,%eax
  cmove  %eax,%edi
  mov    %rbx,%rsi
  call   <gcvt@plt>
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <strlen@plt>
  test   %ebp,%ebp
  je     L24
  movslq %ebp,%rbp
  mov    %eax,%r15d
  test   %r14d,%r14d
  je     L31
  cmpb   $0x2d,0x0(%rbp)
  jne    L87
L31:
  test   %r13d,%r13d
  je     L45
  mov    $0x2e,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L48
L45:
  cmpl   $0x0,0x58(%rsp)
  je     L125
  mov    $0x65,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L125
  movb   $0x45,(%rax)
L125:
  cmp    %r12d,%r15d
  jl     L124
L72:
  mov    %rbx,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L24:
  movb   $0x0,(%rbx)
  jmp    L72
L87:
  lea    0x1(%rax),%r15d
  movslq %r15d,%rdx
  lea    0x1(%rbx),%rdi
  mov    %rbx,%rsi
  call   <memmove@plt>
  movb   $0x2b,(%rbx)
  jmp    L31
L48:
  lea    D3(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcspn@plt>
  mov    %rax,%r14
  cltq
  mov    %rax,0x8(%rsp)
  lea    (%rbx,%rax,1),%r13
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %rax,%rbp
  test   %eax,%eax
  jne    L7
L139:
  movb   $0x2e,0x0(%r13)
  lea    0x1(%r14,%rbp,1),%eax
  cltq
  movb   $0x0,(%rbx,%rax,1)
  jmp    L45
L7:
  movslq %eax,%rdx
  mov    0x8(%rsp),%rax
  lea    0x1(%rbx,%rax,1),%rdi
  mov    %r13,%rsi
  call   <memmove@plt>
  jmp    L139
L124:
  mov    0x50(%rsp),%ecx
  mov    0x4(%rsp),%edx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <Fill@plt>
  movslq %eax,%rbx
  jmp    L72
```

tool_calls: name: unpack_data
arguments: data_tag: D3
type_guessed: string

tool: D3: eE

assistant: ```c
char *do_gfmt(d, obuf, Width, Precision, Alt, Plus, Minus, Zero, UpperCase)
char *obuf;
double d;
{
  char *Ecvt = gcvt(d, Precision ? Precision : 1, obuf);
  int len = strlen(obuf);
  if (!Ecvt) {
    *obuf = '\0';
    return obuf;
  }
  if (Plus && (Ecvt[0] != '-')) {
    memmove(obuf + 1, obuf, len + 1);
    obuf[0] = '+';
    ++len;
  }
  if (Alt && !strchr(Ecvt, '.')) {
    int LenUpTo_E = strcspn(obuf, "eE");
    int E_etc_len = strlen(&obuf[LenUpTo_E]);
    if (E_etc_len)
      memmove(obuf + LenUpTo_E + 1, obuf + LenUpTo_E, E_etc_len);
    obuf[LenUpTo_E] = '.';
    obuf[LenUpTo_E + 1 + E_etc_len] = '\0';
  }
  {
    char *E_loc;
    if (UpperCase && (E_loc = strchr(obuf, 'e'))) {
      *E_loc = 'E';
    }
  }
  if (Width > len)
    return Fill(obuf, Width, Minus, Zero);
  else
    return obuf;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<do_gfmt>:
  endbr64
  push   %r15
  mov    $0x1,%eax
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %r8d,%r13d
  push   %r12
  mov    %rdi,%r12
  mov    %edx,%edi
  push   %rbp
  mov    %esi,%ebp
  mov    %r12,%rsi
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x18,%rsp
  test   %edx,%edx
  cmove  %eax,%edi
  call   <gcvt@plt>
  mov    %r12,%rdi
  mov    %eax,%r15d
  call   <strlen@plt>
  test   %r15d,%r15d
  je     L68
  movslq %r15d,%r8
  mov    %eax,%r15d
  test   %r13d,%r13d
  je     L53
  cmpb   $0x2d,(%r8)
  jne    L122
L53:
  test   %ebx,%ebx
  je     L1
L91:
  mov    $0x2e,%esi
  mov    %r8,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L102
L1:
  mov    0x58(%rsp),%eax
  test   %eax,%eax
  je     L41
  mov    $0x65,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L41
  movb   $0x45,(%rax)
L41:
  cmp    %ebp,%r15d
  jl     L124
L87:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L124:
  mov    0x50(%rsp),%ecx
  mov    %r12,%rdi
  mov    %r14d,%edx
  mov    %ebp,%esi
  xor    %eax,%eax
  call   <Fill@plt>
  movslq %eax,%r12
  jmp    L87
L68:
  movb   $0x0,(%r12)
  jmp    L87
  nopw   0x0(%rax,%rax,1)
L122:
  lea    0x1(%rax),%r15d
  lea    0x1(%r12),%rdi
  mov    %r12,%rsi
  mov    %r8,(%rsp)
  movslq %r15d,%rdx
  call   <memmove@plt>
  movb   $0x2b,(%r12)
  mov    (%rsp),%r8
  test   %ebx,%ebx
  je     L1
  jmp    L91
  xchg   %ax,%ax
L102:
  lea    D8(%rip),%rsi
  mov    %r12,%rdi
  call   <strcspn@plt>
  movslq %eax,%rsi
  mov    %rax,%r13
  lea    (%r12,%rsi,1),%rcx
  mov    %rsi,0x8(%rsp)
  mov    %rcx,%rdi
  mov    %rcx,(%rsp)
  call   <strlen@plt>
  mov    (%rsp),%rcx
  mov    0x8(%rsp),%rsi
  test   %eax,%eax
  mov    %rax,%rbx
  jne    L19
L42:
  lea    0x1(%r13,%rbx,1),%eax
  movb   $0x2e,(%rcx)
  cltq
  movb   $0x0,(%r12,%rax,1)
  jmp    L1
  xchg   %ax,%ax
L19:
  lea    0x1(%r12,%rsi,1),%rdi
  movslq %eax,%rdx
  mov    %rcx,%rsi
  call   <memmove@plt>
  mov    (%rsp),%rcx
  jmp    L42
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D8
data_type: string

tool: D8: eE

assistant: ```c
char *do_gfmt(d, obuf, Width, Precision, Alt, Plus, Minus, Zero, UpperCase)
char *obuf;
double d;
{
  char *Ecvt = gcvt(d, Precision ? Precision : 1, obuf);
  int len = strlen(obuf);
  if (!Ecvt) {
    *obuf = '\0';
    return obuf;
  }
  if (Plus && (Ecvt[0] != '-')) {
    memmove(obuf + 1, obuf, len + 1);
    obuf[0] = '+';
    ++len;
  }
  if (Alt && !strchr(Ecvt, '.')) {
    int LenUpTo_E = strcspn(obuf, "eE");
    int E_etc_len = strlen(&obuf[LenUpTo_E]);
    if (E_etc_len)
      memmove(obuf + LenUpTo_E + 1, obuf + LenUpTo_E, E_etc_len);
    obuf[LenUpTo_E] = '.';
    obuf[LenUpTo_E + 1 + E_etc_len] = '\0';
  }
  {
    char *E_loc;
    if (UpperCase && (E_loc = strchr(obuf, 'e'))) {
      *E_loc = 'E';
    }
  }
  if (Width > len)
    return Fill(obuf, Width, Minus, Zero);
  else
    return obuf;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<do_gfmt>:
  endbr64
  push   %r15
  mov    $0x1,%eax
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %r8d,%r13d
  push   %r12
  mov    %rdi,%r12
  mov    %edx,%edi
  push   %rbp
  mov    %esi,%ebp
  mov    %r12,%rsi
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x18,%rsp
  test   %edx,%edx
  cmove  %eax,%edi
  call   <gcvt@plt>
  mov    %r12,%rdi
  mov    %eax,%r15d
  call   <strlen@plt>
  test   %r15d,%r15d
  je     L85
  movslq %r15d,%r8
  mov    %eax,%r15d
  test   %r13d,%r13d
  je     L59
  cmpb   $0x2d,(%r8)
  jne    L81
L59:
  test   %ebx,%ebx
  je     L25
L10:
  mov    $0x2e,%esi
  mov    %r8,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L117
L25:
  mov    0x58(%rsp),%eax
  test   %eax,%eax
  je     L62
  mov    $0x65,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L62
  movb   $0x45,(%rax)
L62:
  cmp    %ebp,%r15d
  jl     L108
L133:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L108:
  mov    0x50(%rsp),%ecx
  mov    %r12,%rdi
  mov    %r14d,%edx
  mov    %ebp,%esi
  xor    %eax,%eax
  call   <Fill@plt>
  movslq %eax,%r12
  jmp    L133
L85:
  movb   $0x0,(%r12)
  jmp    L133
  nopw   0x0(%rax,%rax,1)
L81:
  lea    0x1(%rax),%r15d
  lea    0x1(%r12),%rdi
  mov    %r12,%rsi
  mov    %r8,(%rsp)
  movslq %r15d,%rdx
  call   <memmove@plt>
  movb   $0x2b,(%r12)
  mov    (%rsp),%r8
  test   %ebx,%ebx
  je     L25
  jmp    L10
  xchg   %ax,%ax
L117:
  lea    D5(%rip),%rsi
  mov    %r12,%rdi
  call   <strcspn@plt>
  movslq %eax,%rsi
  mov    %rax,%r13
  lea    (%r12,%rsi,1),%rcx
  mov    %rsi,0x8(%rsp)
  mov    %rcx,%rdi
  mov    %rcx,(%rsp)
  call   <strlen@plt>
  mov    (%rsp),%rcx
  mov    0x8(%rsp),%rsi
  test   %eax,%eax
  mov    %rax,%rbx
  jne    L58
L54:
  lea    0x1(%r13,%rbx,1),%eax
  movb   $0x2e,(%rcx)
  cltq
  movb   $0x0,(%r12,%rax,1)
  jmp    L25
  xchg   %ax,%ax
L58:
  lea    0x1(%r12,%rsi,1),%rdi
  movslq %eax,%rdx
  mov    %rcx,%rsi
  call   <memmove@plt>
  mov    (%rsp),%rcx
  jmp    L54
```

tool_calls: name: read_data
arguments: label: D5
type_guessed: string

tool: D5: eE

assistant: ```c
char *do_gfmt(d, obuf, Width, Precision, Alt, Plus, Minus, Zero, UpperCase)
char *obuf;
double d;
{
  char *Ecvt = gcvt(d, Precision ? Precision : 1, obuf);
  int len = strlen(obuf);
  if (!Ecvt) {
    *obuf = '\0';
    return obuf;
  }
  if (Plus && (Ecvt[0] != '-')) {
    memmove(obuf + 1, obuf, len + 1);
    obuf[0] = '+';
    ++len;
  }
  if (Alt && !strchr(Ecvt, '.')) {
    int LenUpTo_E = strcspn(obuf, "eE");
    int E_etc_len = strlen(&obuf[LenUpTo_E]);
    if (E_etc_len)
      memmove(obuf + LenUpTo_E + 1, obuf + LenUpTo_E, E_etc_len);
    obuf[LenUpTo_E] = '.';
    obuf[LenUpTo_E + 1 + E_etc_len] = '\0';
  }
  {
    char *E_loc;
    if (UpperCase && (E_loc = strchr(obuf, 'e'))) {
      *E_loc = 'E';
    }
  }
  if (Width > len)
    return Fill(obuf, Width, Minus, Zero);
  else
    return obuf;
}
```
user: What is the c source code of the assembly code below?

```asm
<strlcat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L42
L63:
  addq   $0x1,-0x28(%rbp)
L42:
  mov    -0x20(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  test   %rax,%rax
  je     L56
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L63
L56:
  mov    -0x28(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  sub    -0x8(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  test   %rax,%rax
  jne    L11
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    -0x8(%rbp),%rdx
  add    %rdx,%rax
  jmp    L21
L23:
  cmpq   $0x0,-0x20(%rbp)
  je     L8
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    -0x30(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subq   $0x1,-0x20(%rbp)
L8:
  addq   $0x1,-0x30(%rbp)
L11:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L23
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x30(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
L21:
  leave
  ret
```

assistant: ```c
size_t strlcat(char *dst, const char *src, size_t dsize) {
  const char *odst = dst;
  const char *osrc = src;
  size_t n = dsize;
  size_t dlen;
  while (n-- != 0 && *dst != '\0')
    dst++;
  dlen = dst - odst;
  n = dsize - dlen;
  if (n-- == 0)
    return (dlen + strlen(src));
  while (*src != '\0') {
    if (n != 0) {
      *dst++ = *src;
      n--;
    }
    src++;
  }
  *dst = '\0';
  return (dlen + (src - osrc));
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<strlcat>:
  endbr64
  push   %rbx
  test   %rdx,%rdx
  je     L21
  mov    %rdi,%r8
  lea    (%rdi,%rdx,1),%rcx
  mov    %rdi,%rax
L60:
  cmpb   $0x0,(%rax)
  je     L43
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L60
  mov    %rcx,%rax
L43:
  mov    %rax,%rbx
  sub    %r8,%rbx
  sub    %rbx,%rdx
  je     L45
  movzbl (%rsi),%r8d
  sub    $0x1,%rdx
  mov    %rsi,%rcx
  test   %r8b,%r8b
  jne    L58
L8:
  movb   $0x0,(%rax)
  sub    %rsi,%rcx
  lea    (%rcx,%rbx,1),%rax
L74:
  pop    %rbx
  ret
L21:
  mov    %rdx,%rbx
L45:
  mov    %rsi,%rdi
  call   <strlen@plt>
  add    %rbx,%rax
  jmp    L74
L27:
  add    $0x1,%rcx
  movzbl (%rcx),%r8d
  test   %r8b,%r8b
  je     L8
L58:
  test   %rdx,%rdx
  je     L27
  mov    %r8b,(%rax)
  sub    $0x1,%rdx
  lea    0x1(%rax),%rax
  jmp    L27
```

assistant: ```c
size_t strlcat(char *dst, const char *src, size_t dsize) {
  const char *odst = dst;
  const char *osrc = src;
  size_t n = dsize;
  size_t dlen;
  while (n-- != 0 && *dst != '\0')
    dst++;
  dlen = dst - odst;
  n = dsize - dlen;
  if (n-- == 0)
    return (dlen + strlen(src));
  while (*src != '\0') {
    if (n != 0) {
      *dst++ = *src;
      n--;
    }
    src++;
  }
  *dst = '\0';
  return (dlen + (src - osrc));
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<strlcat>:
  endbr64
  push   %r12
  test   %rdx,%rdx
  je     L64
  mov    %rdi,%r8
  lea    (%rdi,%rdx,1),%rcx
  mov    %rdi,%rax
  jmp    L87
  nopw   0x0(%rax,%rax,1)
L79:
  add    $0x1,%rax
  cmp    %rcx,%rax
  je     L1
L87:
  cmpb   $0x0,(%rax)
  jne    L79
L1:
  mov    %rax,%r12
  sub    %r8,%r12
  sub    %r12,%rdx
  je     L99
  movzbl (%rsi),%r9d
  sub    $0x1,%rdx
  mov    %rsi,%rcx
  test   %r9b,%r9b
  jne    L100
  jmp    L48
  nopl   0x0(%rax,%rax,1)
L82:
  mov    %r9b,(%rax)
  sub    $0x1,%rdx
  mov    %rcx,%r8
  add    $0x1,%rax
L58:
  movzbl 0x1(%r8),%r9d
  lea    0x1(%r8),%rcx
  test   %r9b,%r9b
  je     L35
L100:
  lea    0x1(%rcx),%r8
  test   %rdx,%rdx
  jne    L82
  cmpb   $0x0,0x1(%rcx)
  jne    L58
  sub    %rsi,%r8
  add    %r8,%r12
L48:
  movb   $0x0,(%rax)
  mov    %r12,%rax
  pop    %r12
  ret
L64:
  xor    %r12d,%r12d
L99:
  mov    %rsi,%rdi
  call   <strlen@plt>
  add    %rax,%r12
  mov    %r12,%rax
  pop    %r12
  ret
  xchg   %ax,%ax
L35:
  sub    %rsi,%rcx
  add    %rcx,%r12
  jmp    L48
```

assistant: ```c
size_t strlcat(char *dst, const char *src, size_t dsize) {
  const char *odst = dst;
  const char *osrc = src;
  size_t n = dsize;
  size_t dlen;
  while (n-- != 0 && *dst != '\0')
    dst++;
  dlen = dst - odst;
  n = dsize - dlen;
  if (n-- == 0)
    return (dlen + strlen(src));
  while (*src != '\0') {
    if (n != 0) {
      *dst++ = *src;
      n--;
    }
    src++;
  }
  *dst = '\0';
  return (dlen + (src - osrc));
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<strlcat>:
  endbr64
  push   %r12
  test   %rdx,%rdx
  je     L102
  mov    %rdi,%r8
  lea    (%rdi,%rdx,1),%rcx
  mov    %rdi,%rax
  jmp    L105
  nopw   0x0(%rax,%rax,1)
L56:
  add    $0x1,%rax
  cmp    %rcx,%rax
  je     L24
L105:
  cmpb   $0x0,(%rax)
  jne    L56
L24:
  mov    %rax,%r12
  sub    %r8,%r12
  sub    %r12,%rdx
  je     L16
  movzbl (%rsi),%r9d
  sub    $0x1,%rdx
  mov    %rsi,%rcx
  test   %r9b,%r9b
  jne    L106
  jmp    L98
  nopl   0x0(%rax,%rax,1)
L78:
  mov    %r9b,(%rax)
  sub    $0x1,%rdx
  mov    %rcx,%r8
  add    $0x1,%rax
L58:
  movzbl 0x1(%r8),%r9d
  lea    0x1(%r8),%rcx
  test   %r9b,%r9b
  je     L25
L106:
  lea    0x1(%rcx),%r8
  test   %rdx,%rdx
  jne    L78
  cmpb   $0x0,0x1(%rcx)
  jne    L58
  sub    %rsi,%r8
  add    %r8,%r12
L98:
  movb   $0x0,(%rax)
  mov    %r12,%rax
  pop    %r12
  ret
L102:
  xor    %r12d,%r12d
L16:
  mov    %rsi,%rdi
  call   <strlen@plt>
  add    %rax,%r12
  mov    %r12,%rax
  pop    %r12
  ret
  xchg   %ax,%ax
L25:
  sub    %rsi,%rcx
  add    %rcx,%r12
  jmp    L98
```

assistant: ```c
size_t strlcat(char *dst, const char *src, size_t dsize) {
  const char *odst = dst;
  const char *osrc = src;
  size_t n = dsize;
  size_t dlen;
  while (n-- != 0 && *dst != '\0')
    dst++;
  dlen = dst - odst;
  n = dsize - dlen;
  if (n-- == 0)
    return (dlen + strlen(src));
  while (*src != '\0') {
    if (n != 0) {
      *dst++ = *src;
      n--;
    }
    src++;
  }
  *dst = '\0';
  return (dlen + (src - osrc));
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<mnemonic2words>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  lea    D9(%rip),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x1,-0xc(%rbp)
  jmp    L4
L48:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  jne    L6
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x20,(%rax)
  addq   $0x1,-0x18(%rbp)
  movl   $0x1,-0xc(%rbp)
  jmp    L4
L6:
  cmpl   $0x0,-0xc(%rbp)
  je     L44
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %eax,%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  movl   $0x0,-0xc(%rbp)
  jmp    L4
L44:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <tolower@plt>
  mov    %eax,%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
L4:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L48
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  lea    D9(%rip),%rax
  leave
  ret
```

assistant: ```c
char *mnemonic2words(char *mnemonic) {
  static char a[1024 + 1];
  char *ptr = a;
  int first_letter_of_word = 1;
  while (*mnemonic) {
    if (*mnemonic == '_') {
      *ptr++ = ' ';
      mnemonic++;
      first_letter_of_word = 1;
    } else if (first_letter_of_word) {
      *ptr++ = toupper(*mnemonic++);
      first_letter_of_word = 0;
    } else {
      *ptr++ = tolower(*mnemonic++);
    }
  }
  *ptr = '\0';
  return a;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<mnemonic2words>:
  endbr64
  movzbl (%rdi),%eax
  lea    D8(%rip),%rdx
  test   %al,%al
  je     L5
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  lea    0x1(%rdi),%rbp
  lea    0x1(%rdx),%rbx
  mov    $0x1,%r13d
  mov    $0x0,%r15d
  mov    $0x1,%r14d
  jmp    L39
L33:
  mov    %rbx,%rdx
  mov    %rbp,%r12
  mov    $0x20,%eax
  mov    %r14d,%r13d
L51:
  mov    %al,-0x1(%rbx)
  movzbl (%r12),%eax
  add    $0x1,%rbp
  add    $0x1,%rbx
  test   %al,%al
  je     L56
L39:
  cmp    $0x5f,%al
  je     L33
  test   %r13d,%r13d
  je     L9
  mov    %rbp,%r12
  movsbl %al,%edi
  call   <toupper@plt>
  mov    %rbx,%rdx
  mov    %r15d,%r13d
  jmp    L51
L9:
  mov    %rbp,%r12
  movsbl %al,%edi
  call   <tolower@plt>
  mov    %rbx,%rdx
  jmp    L51
L56:
  movb   $0x0,(%rdx)
  lea    D8(%rip),%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  movb   $0x0,(%rdx)
  lea    D8(%rip),%rax
  ret
```

assistant: ```c
char *mnemonic2words(char *mnemonic) {
  static char a[1024 + 1];
  char *ptr = a;
  int first_letter_of_word = 1;
  while (*mnemonic) {
    if (*mnemonic == '_') {
      *ptr++ = ' ';
      mnemonic++;
      first_letter_of_word = 1;
    } else if (first_letter_of_word) {
      *ptr++ = toupper(*mnemonic++);
      first_letter_of_word = 0;
    } else {
      *ptr++ = tolower(*mnemonic++);
    }
  }
  *ptr = '\0';
  return a;
}
```
user: Translate the below assembly code into C programming language:

```asm
<mnemonic2words>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  lea    D7(%rip),%r12
  push   %rbp
  mov    %r12,%rbp
  push   %rbx
  mov    %rdi,%rbx
  movsbl (%rdi),%edi
  test   %dil,%dil
  je     L50
L55:
  cmp    $0x5f,%dil
  je     L59
  call   <toupper@plt>
  lea    0x1(%rbx),%r14
  lea    0x1(%rbp),%r13
  mov    %al,0x0(%rbp)
  movsbl 0x1(%rbx),%edi
  test   %dil,%dil
  je     L31
L26:
  cmp    $0x5f,%dil
  je     L52
  call   <tolower@plt>
  add    $0x1,%r14
  add    $0x1,%r13
  mov    %al,-0x1(%r13)
  movsbl (%r14),%edi
  test   %dil,%dil
  jne    L26
L31:
  mov    %r13,%rbp
L50:
  movb   $0x0,0x0(%rbp)
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L52:
  mov    %r13,%rbp
  mov    %r14,%rbx
L59:
  add    $0x1,%rbx
  movb   $0x20,0x0(%rbp)
  add    $0x1,%rbp
  movsbl (%rbx),%edi
  test   %dil,%dil
  jne    L55
  movb   $0x0,0x0(%rbp)
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char *mnemonic2words(char *mnemonic) {
  static char a[1024 + 1];
  char *ptr = a;
  int first_letter_of_word = 1;
  while (*mnemonic) {
    if (*mnemonic == '_') {
      *ptr++ = ' ';
      mnemonic++;
      first_letter_of_word = 1;
    } else if (first_letter_of_word) {
      *ptr++ = toupper(*mnemonic++);
      first_letter_of_word = 0;
    } else {
      *ptr++ = tolower(*mnemonic++);
    }
  }
  *ptr = '\0';
  return a;
}
```