ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  movl   $0x75,0x14(%rsp)
  lea    0x8(%rsp),%rbx
  mov    %rbx,%rdi
  call   <sigemptyset@plt>
  mov    D5(%rip),%rax
  mov    (%rax),%esi
  mov    %rbx,%rdi
  call   <sigaddset@plt>
  lea    0x10(%rsp),%rbx
  lea    0xc(%rsp),%rbp
  mov    %rbx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  movq   $0x0,0x18(%rsp)
  movl   $0x71,0x14(%rsp)
  mov    %rbx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <select@plt>
  movq   $0x0,0x18(%rsp)
  movl   $0x78,0x14(%rsp)
  mov    %rbx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rbp,%rsi
  mov    $0xffffffff,%edi
  call   <select@plt>
  movq   $0x0,0x18(%rsp)
  movl   $0x79,0x14(%rsp)
  mov    %rbx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    $0xffffffffffffffff,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  movq   $0x0,0x18(%rsp)
  movl   $0x7a,0x14(%rsp)
  mov    %rbx,%r8
  mov    $0x0,%ecx
  mov    $0xffffffffffffffff,%rdx
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  movq   $0x0,0x18(%rsp)
  movl   $0x7b,0x14(%rsp)
  mov    %rbx,%r8
  mov    $0xffffffffffffffff,%rcx
  mov    $0x0,%edx
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  mov    $0xffffffffffffffff,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  int fd;
  struct timespec tim = {0, 200000000};
  sigset_t sigs;
  fd_set rfds;
  struct timeval tv = {0, 117};
  sigemptyset(&sigs);
  sigaddset(&sigs, SIGUSR2);
  select(1, &rfds, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 113;
  select(1, NULL, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 120;
  select(-1, &rfds, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 121;
  select(1, (fd_set *)-1, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 122;
  select(1, &rfds, (fd_set *)-1, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 123;
  select(1, &rfds, NULL, (fd_set *)-1, &tv);
  select(1, &rfds, NULL, NULL, (struct timeval *)-1);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %rbp
  pxor   %xmm0,%xmm0
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rbp
  movaps %xmm0,0x10(%rsp)
  lea    0x10(%rsp),%rbx
  mov    %rbp,%rdi
  movl   $0x75,0x14(%rsp)
  movq   $0x0,0x20(%rsp)
  call   <sigemptyset@plt>
  mov    D4(%rip),%rax
  mov    %rbp,%rdi
  lea    0xc(%rsp),%rbp
  mov    (%rax),%esi
  call   <sigaddset@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %rbx,%r8
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %rbx,%r8
  mov    $0x1,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x71,0x14(%rsp)
  call   <select@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %rbx,%r8
  mov    %rbp,%rsi
  mov    $0xffffffff,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x78,0x14(%rsp)
  call   <select@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %rbx,%r8
  mov    $0xffffffffffffffff,%rsi
  mov    $0x1,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x79,0x14(%rsp)
  call   <select@plt>
  xor    %ecx,%ecx
  mov    %rbx,%r8
  mov    %rbp,%rsi
  mov    $0xffffffffffffffff,%rdx
  mov    $0x1,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x7a,0x14(%rsp)
  call   <select@plt>
  xor    %edx,%edx
  mov    %rbx,%r8
  mov    %rbp,%rsi
  mov    $0xffffffffffffffff,%rcx
  mov    $0x1,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x7b,0x14(%rsp)
  call   <select@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    $0xffffffffffffffff,%r8
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  int fd;
  struct timespec tim = {0, 200000000};
  sigset_t sigs;
  fd_set rfds;
  struct timeval tv = {0, 117};
  sigemptyset(&sigs);
  sigaddset(&sigs, SIGUSR2);
  select(1, &rfds, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 113;
  select(1, NULL, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 120;
  select(-1, &rfds, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 121;
  select(1, (fd_set *)-1, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 122;
  select(1, &rfds, (fd_set *)-1, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 123;
  select(1, &rfds, NULL, (fd_set *)-1, &tv);
  select(1, &rfds, NULL, NULL, (struct timeval *)-1);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbp
  pxor   %xmm0,%xmm0
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rbp
  movaps %xmm0,0x10(%rsp)
  lea    0x10(%rsp),%rbx
  mov    %rbp,%rdi
  movl   $0x75,0x14(%rsp)
  movq   $0x0,0x20(%rsp)
  call   <sigemptyset@plt>
  mov    D5(%rip),%rax
  mov    %rbp,%rdi
  lea    0xc(%rsp),%rbp
  mov    (%rax),%esi
  call   <sigaddset@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %rbx,%r8
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %rbx,%r8
  mov    $0x1,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x71,0x14(%rsp)
  call   <select@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %rbx,%r8
  mov    %rbp,%rsi
  mov    $0xffffffff,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x78,0x14(%rsp)
  call   <select@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %rbx,%r8
  mov    $0xffffffffffffffff,%rsi
  mov    $0x1,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x79,0x14(%rsp)
  call   <select@plt>
  xor    %ecx,%ecx
  mov    %rbx,%r8
  mov    %rbp,%rsi
  mov    $0xffffffffffffffff,%rdx
  mov    $0x1,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x7a,0x14(%rsp)
  call   <select@plt>
  xor    %edx,%edx
  mov    %rbx,%r8
  mov    %rbp,%rsi
  mov    $0xffffffffffffffff,%rcx
  mov    $0x1,%edi
  movq   $0x0,0x18(%rsp)
  movl   $0x7b,0x14(%rsp)
  call   <select@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    $0xffffffffffffffff,%r8
  mov    %rbp,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  int fd;
  struct timespec tim = {0, 200000000};
  sigset_t sigs;
  fd_set rfds;
  struct timeval tv = {0, 117};
  sigemptyset(&sigs);
  sigaddset(&sigs, SIGUSR2);
  select(1, &rfds, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 113;
  select(1, NULL, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 120;
  select(-1, &rfds, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 121;
  select(1, (fd_set *)-1, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 122;
  select(1, &rfds, (fd_set *)-1, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 123;
  select(1, &rfds, NULL, (fd_set *)-1, &tv);
  select(1, &rfds, NULL, NULL, (struct timeval *)-1);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <assert@plt>
  mov    -0x8(%rbp),%rdx
  finit
  ffree  %st(0)
  ffree  %st(1)
  ffree  %st(2)
  ffree  %st(3)
  ffree  %st(4)
  ffree  %st(5)
  ffree  %st(6)
  ffree  %st(7)
  andb   $0x80,(%rdx)
  fldz
  fldz
  fucompp
  fnstsw %ax
  sahf
  jp     L2
L2:
  nop
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main(void) {
  int *x = malloc(4);
  assert(x);
  __asm__ __volatile__("finit\n\t"
                       "ffree %%st(0)\n\t"
                       "ffree %%st(1)\n\t"
                       "ffree %%st(2)\n\t"
                       "ffree %%st(3)\n\t"
                       "ffree %%st(4)\n\t"
                       "ffree %%st(5)\n\t"
                       "ffree %%st(6)\n\t"
                       "ffree %%st(7)\n\t"
                       "andb $128, (%0)\n\t"
                       "fldz\n\t"
                       "fldz\n\t"
                       "fucompp\n\t"
                       "fnstsw %%ax\n\t"
                       "sahf\n\t"
                       "jp .Lfoobar\n"
                       ".Lfoobar:\n\t"
                       "nop"
                       :
                       : "r"(x)
                       : "eax", "cc");
  free(x);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <assert@plt>
  finit
  ffree  %st(0)
  ffree  %st(1)
  ffree  %st(2)
  ffree  %st(3)
  ffree  %st(4)
  ffree  %st(5)
  ffree  %st(6)
  ffree  %st(7)
  andb   $0x80,(%rbx)
  fldz
  fldz
  fucompp
  fnstsw %ax
  sahf
  jp     L4
L4:
  nop
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  pop    %rbx
  ret
```

assistant: ```c
int main(void) {
  int *x = malloc(4);
  assert(x);
  __asm__ __volatile__("finit\n\t"
                       "ffree %%st(0)\n\t"
                       "ffree %%st(1)\n\t"
                       "ffree %%st(2)\n\t"
                       "ffree %%st(3)\n\t"
                       "ffree %%st(4)\n\t"
                       "ffree %%st(5)\n\t"
                       "ffree %%st(6)\n\t"
                       "ffree %%st(7)\n\t"
                       "andb $128, (%0)\n\t"
                       "fldz\n\t"
                       "fldz\n\t"
                       "fucompp\n\t"
                       "fnstsw %%ax\n\t"
                       "sahf\n\t"
                       "jp .Lfoobar\n"
                       ".Lfoobar:\n\t"
                       "nop"
                       :
                       : "r"(x)
                       : "eax", "cc");
  free(x);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  mov    %rax,%rbp
  xor    %eax,%eax
  call   <assert@plt>
  finit
  ffree  %st(0)
  ffree  %st(1)
  ffree  %st(2)
  ffree  %st(3)
  ffree  %st(4)
  ffree  %st(5)
  ffree  %st(6)
  ffree  %st(7)
  andb   $0x80,0x0(%rbp)
  fldz
  fldz
  fucompp
  fnstsw %ax
  sahf
  jp     L9
L9:
  nop
  mov    %rbp,%rdi
  call   <free@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(void) {
  int *x = malloc(4);
  assert(x);
  __asm__ __volatile__("finit\n\t"
                       "ffree %%st(0)\n\t"
                       "ffree %%st(1)\n\t"
                       "ffree %%st(2)\n\t"
                       "ffree %%st(3)\n\t"
                       "ffree %%st(4)\n\t"
                       "ffree %%st(5)\n\t"
                       "ffree %%st(6)\n\t"
                       "ffree %%st(7)\n\t"
                       "andb $128, (%0)\n\t"
                       "fldz\n\t"
                       "fldz\n\t"
                       "fucompp\n\t"
                       "fnstsw %%ax\n\t"
                       "sahf\n\t"
                       "jp .Lfoobar\n"
                       ".Lfoobar:\n\t"
                       "nop"
                       :
                       : "r"(x)
                       : "eax", "cc");
  free(x);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  push   %rbp
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  mov    %rax,%rbp
  xor    %eax,%eax
  call   <assert@plt>
  finit
  ffree  %st(0)
  ffree  %st(1)
  ffree  %st(2)
  ffree  %st(3)
  ffree  %st(4)
  ffree  %st(5)
  ffree  %st(6)
  ffree  %st(7)
  andb   $0x80,0x0(%rbp)
  fldz
  fldz
  fucompp
  fnstsw %ax
  sahf
  jp     L7
L7:
  nop
  mov    %rbp,%rdi
  call   <free@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(void) {
  int *x = malloc(4);
  assert(x);
  __asm__ __volatile__("finit\n\t"
                       "ffree %%st(0)\n\t"
                       "ffree %%st(1)\n\t"
                       "ffree %%st(2)\n\t"
                       "ffree %%st(3)\n\t"
                       "ffree %%st(4)\n\t"
                       "ffree %%st(5)\n\t"
                       "ffree %%st(6)\n\t"
                       "ffree %%st(7)\n\t"
                       "andb $128, (%0)\n\t"
                       "fldz\n\t"
                       "fldz\n\t"
                       "fucompp\n\t"
                       "fnstsw %%ax\n\t"
                       "sahf\n\t"
                       "jp .Lfoobar\n"
                       ".Lfoobar:\n\t"
                       "nop"
                       :
                       : "r"(x)
                       : "eax", "cc");
  free(x);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<pthread_mutex_trylock>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <lksmith_prelock@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L19
  mov    -0x4(%rbp),%eax
  jmp    L0
L19:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <r_pthread_mutex_trylock@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <lksmith_postlock@plt>
  mov    -0x4(%rbp),%eax
L0:
  leave
  ret
```

assistant: ```c
int pthread_mutex_trylock(pthread_mutex_t *mutex) {
  int ret = lksmith_prelock(mutex, 1);
  if (ret)
    return ret;
  ret = r_pthread_mutex_trylock(mutex);
  lksmith_postlock(mutex, ret);
  return ret;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<pthread_mutex_trylock>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    $0x1,%esi
  call   <lksmith_prelock@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L17
L15:
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L17:
  mov    %rbp,%rdi
  call   <r_pthread_mutex_trylock@plt>
  mov    %eax,%ebx
  mov    %eax,%esi
  mov    %rbp,%rdi
  call   <lksmith_postlock@plt>
  jmp    L15
```

assistant: ```c
int pthread_mutex_trylock(pthread_mutex_t *mutex) {
  int ret = lksmith_prelock(mutex, 1);
  if (ret)
    return ret;
  ret = r_pthread_mutex_trylock(mutex);
  lksmith_postlock(mutex, ret);
  return ret;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<pthread_mutex_trylock>:
  endbr64
  push   %r12
  mov    $0x1,%esi
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <lksmith_prelock@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L3
  mov    %rbp,%rdi
  call   <r_pthread_mutex_trylock@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  mov    %eax,%r12d
  call   <lksmith_postlock@plt>
L3:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int pthread_mutex_trylock(pthread_mutex_t *mutex) {
  int ret = lksmith_prelock(mutex, 1);
  if (ret)
    return ret;
  ret = r_pthread_mutex_trylock(mutex);
  lksmith_postlock(mutex, ret);
  return ret;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<pthread_mutex_trylock>:
  endbr64
  push   %r12
  mov    $0x1,%esi
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <lksmith_prelock@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L6
  mov    %rbp,%rdi
  call   <r_pthread_mutex_trylock@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  mov    %eax,%r12d
  call   <lksmith_postlock@plt>
L6:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int pthread_mutex_trylock(pthread_mutex_t *mutex) {
  int ret = lksmith_prelock(mutex, 1);
  if (ret)
    return ret;
  ret = r_pthread_mutex_trylock(mutex);
  lksmith_postlock(mutex, ret);
  return ret;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<ceph_armor>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  cmp    %rdx,%rsi
  jae    L88
  mov    %rdi,%rbp
  mov    %rsi,%r12
  mov    %rdx,%r15
  movl   $0x0,0x8(%rsp)
  movl   $0x0,0xc(%rsp)
  jmp    L89
L85:
  lea    0x0(,%r13,4),%edi
  and    $0x3c,%edi
  call   <encode_bits@plt>
  lea    0x4(%rbp),%rdx
  jmp    L42
L34:
  mov    %ebx,%edi
  shl    $0x4,%edi
  and    $0x30,%edi
  call   <encode_bits@plt>
  mov    %al,0x1(%rbp)
  lea    0x4(%rbp),%rdx
  mov    $0x3d,%eax
L42:
  mov    %al,0x2(%rbp)
  movb   $0x3d,0x3(%rbp)
  cmpl   $0x3c,0x8(%rsp)
  jne    L86
L69:
  lea    0x1(%rdx),%rbp
  movb   $0xa,(%rdx)
  addl   $0x5,0xc(%rsp)
  mov    %r14,%r12
  movl   $0x0,0x8(%rsp)
L81:
  cmp    %r12,%r15
  jbe    L6
L89:
  lea    0x1(%r12),%r14
  movzbl (%r12),%ebx
  mov    %ebx,%edi
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <encode_bits@plt>
  mov    %al,0x0(%rbp)
  cmp    %r14,%r15
  jbe    L34
  lea    0x2(%r12),%r14
  movzbl 0x1(%r12),%r13d
  shl    $0x4,%ebx
  mov    %ebx,%edi
  and    $0x30,%edi
  mov    %r13d,%eax
  shr    $0x4,%al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <encode_bits@plt>
  mov    %al,0x1(%rbp)
  cmp    %r14,%r15
  jbe    L85
  lea    0x3(%r12),%r14
  movzbl 0x2(%r12),%ebx
  lea    0x0(,%r13,4),%edi
  and    $0x3c,%edi
  mov    %ebx,%eax
  shr    $0x6,%al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <encode_bits@plt>
  mov    %al,0x2(%rbp)
  mov    %ebx,%edi
  and    $0x3f,%edi
  call   <encode_bits@plt>
  lea    0x4(%rbp),%rdx
  mov    %al,0x3(%rbp)
  mov    0xc(%rsp),%eax
  add    $0x4,%eax
  addl   $0x4,0x8(%rsp)
  mov    0x8(%rsp),%ecx
  cmp    $0x40,%ecx
  je     L69
  mov    %r14,%r12
  mov    %eax,0xc(%rsp)
  mov    %rdx,%rbp
  jmp    L81
L88:
  movl   $0x0,0xc(%rsp)
  jmp    L6
L86:
  addl   $0x4,0xc(%rsp)
L6:
  mov    0xc(%rsp),%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int ceph_armor(char *dst, const char *src, const char *end) {
  int olen = 0;
  int line = 0;
  while (src < end) {
    unsigned char a, b, c;
    a = *src++;
    *dst++ = encode_bits(a >> 2);
    if (src < end) {
      b = *src++;
      *dst++ = encode_bits(((a & 3) << 4) | (b >> 4));
      if (src < end) {
        c = *src++;
        *dst++ = encode_bits(((b & 15) << 2) | (c >> 6));
        *dst++ = encode_bits(c & 63);
      } else {
        *dst++ = encode_bits((b & 15) << 2);
        *dst++ = '=';
      }
    } else {
      *dst++ = encode_bits(((a & 3) << 4));
      *dst++ = '=';
      *dst++ = '=';
    }
    olen += 4;
    line += 4;
    if (line == 64) {
      line = 0;
      *(dst++) = '\n';
      olen++;
    }
  }
  return olen;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ceph_armor>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  cmp    %rdx,%rsi
  jae    L55
  movl   $0x0,0x8(%rsp)
  mov    %rdi,%r15
  mov    %rsi,%r14
  xor    %ebp,%ebp
  mov    %rdx,%r12
  jmp    L60
  nopl   0x0(%rax,%rax,1)
L51:
  movzbl 0x1(%r14),%edx
  and    $0x30,%ebx
  lea    0x2(%r14),%r13
  mov    %edx,%edi
  mov    %dl,0xf(%rsp)
  shr    $0x4,%dil
  or     %ebx,%edi
  movzbl %dil,%edi
  call   <encode_bits@plt>
  movzbl 0xf(%rsp),%edx
  mov    %al,0x1(%r15)
  shl    $0x2,%edx
  cmp    %r13,%r12
  jbe    L86
  movzbl 0x2(%r14),%r13d
  and    $0x3c,%edx
  lea    0x3(%r14),%rbx
  mov    %rbx,%r14
  mov    %r13d,%edi
  shr    $0x6,%dil
  or     %edx,%edi
  movzbl %dil,%edi
  call   <encode_bits@plt>
  mov    %r13d,%edi
  mov    %al,0x2(%r15)
  and    $0x3f,%edi
  call   <encode_bits@plt>
L64:
  add    $0x4,%ebp
  mov    %al,0x3(%r15)
  cmp    $0x40,%ebp
  je     L78
L1:
  addl   $0x4,0x8(%rsp)
  mov    (%rsp),%r15
  cmp    %r12,%r14
  jae    L17
L60:
  movzbl (%r14),%ebx
  lea    0x1(%r14),%r13
  mov    %ebx,%edi
  shl    $0x4,%ebx
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <encode_bits@plt>
  mov    %al,(%r15)
  lea    0x4(%r15),%rax
  mov    %rax,(%rsp)
  cmp    %r13,%r12
  ja     L51
  and    $0x30,%ebx
  add    $0x4,%ebp
  mov    %r13,%r14
  mov    %ebx,%edi
  call   <encode_bits@plt>
  movb   $0x3d,0x2(%r15)
  mov    %al,0x1(%r15)
  mov    $0x3d,%eax
  mov    %al,0x3(%r15)
  cmp    $0x40,%ebp
  jne    L1
L78:
  movb   $0xa,0x4(%r15)
  xor    %ebp,%ebp
  add    $0x5,%r15
  addl   $0x5,0x8(%rsp)
  cmp    %r12,%r14
  jb     L60
L17:
  mov    0x8(%rsp),%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L86:
  and    $0x3c,%edx
  mov    %r13,%r14
  mov    %edx,%edi
  call   <encode_bits@plt>
  mov    %al,0x2(%r15)
  mov    $0x3d,%eax
  jmp    L64
  nopl   0x0(%rax,%rax,1)
L55:
  movl   $0x0,0x8(%rsp)
  jmp    L17
```

assistant: ```c
int ceph_armor(char *dst, const char *src, const char *end) {
  int olen = 0;
  int line = 0;
  while (src < end) {
    unsigned char a, b, c;
    a = *src++;
    *dst++ = encode_bits(a >> 2);
    if (src < end) {
      b = *src++;
      *dst++ = encode_bits(((a & 3) << 4) | (b >> 4));
      if (src < end) {
        c = *src++;
        *dst++ = encode_bits(((b & 15) << 2) | (c >> 6));
        *dst++ = encode_bits(c & 63);
      } else {
        *dst++ = encode_bits((b & 15) << 2);
        *dst++ = '=';
      }
    } else {
      *dst++ = encode_bits(((a & 3) << 4));
      *dst++ = '=';
      *dst++ = '=';
    }
    olen += 4;
    line += 4;
    if (line == 64) {
      line = 0;
      *(dst++) = '\n';
      olen++;
    }
  }
  return olen;
}
```