user: Converte this assembly snippet into its equivalent C code:

```asm
<ceph_armor_line_break>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %r8d,0x14(%rsp)
  cmp    %rcx,%rdx
  jae    L89
  mov    %rsi,%rbx
  mov    %rdx,%r15
  mov    %rcx,%r13
  xor    %r12d,%r12d
  movl   $0x0,0x10(%rsp)
  lea    0x18(%rsp),%rbp
  jmp    L152
  nopl   0x0(%rax,%rax,1)
L112:
  movzbl 0x1(%r15),%r8d
  and    $0x30,%ecx
  lea    0x2(%r15),%r14
  mov    %r8d,%edi
  mov    %r8b,0xf(%rsp)
  shr    $0x4,%dil
  or     %ecx,%edi
  movzbl %dil,%edi
  call   <encode_bits@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsbl %al,%edx
  call   <set_str_val@plt>
  test   %eax,%eax
  js     L88
  movzbl 0xf(%rsp),%edi
  shl    $0x2,%edi
  cmp    %r14,%r13
  jbe    L36
  lea    0x3(%r15),%r14
  movzbl 0x2(%r15),%r15d
  and    $0x3c,%edi
  mov    %r15d,%eax
  shr    $0x6,%al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <encode_bits@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsbl %al,%edx
  call   <set_str_val@plt>
  test   %eax,%eax
  js     L88
  mov    %r15d,%edi
  and    $0x3f,%edi
  call   <encode_bits@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsbl %al,%edx
  call   <set_str_val@plt>
  test   %eax,%eax
  js     L88
L87:
  mov    0x14(%rsp),%eax
  mov    %r14,%r15
  add    $0x4,%r12d
  test   %eax,%eax
  je     L79
  cmp    %eax,%r12d
  jne    L79
  mov    $0xa,%edx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <set_str_val@plt>
  test   %eax,%eax
  js     L88
  addl   $0x5,0x10(%rsp)
  xor    %r12d,%r12d
  cmp    %r13,%r15
  jae    L156
L152:
  movzbl (%r15),%ecx
  lea    0x1(%r15),%r14
  mov    %ecx,%edi
  mov    %cl,0xf(%rsp)
  shr    $0x2,%dil
  movzbl %dil,%edi
  call   <encode_bits@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsbl %al,%edx
  call   <set_str_val@plt>
  test   %eax,%eax
  js     L88
  movzbl 0xf(%rsp),%ecx
  shl    $0x4,%ecx
  cmp    %r14,%r13
  ja     L112
  and    $0x30,%ecx
  mov    %ecx,%edi
  call   <encode_bits@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  movsbl %al,%edx
  call   <set_str_val@plt>
  test   %eax,%eax
  js     L88
  mov    $0x3d,%edx
L32:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <set_str_val@plt>
  test   %eax,%eax
  js     L88
  mov    $0x3d,%edx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <set_str_val@plt>
  test   %eax,%eax
  jns    L87
L88:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L79:
  addl   $0x4,0x10(%rsp)
  cmp    %r13,%r15
  jb     L152
L156:
  mov    0x10(%rsp),%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L36:
  and    $0x3c,%edi
  call   <encode_bits@plt>
  movsbl %al,%edx
  jmp    L32
L89:
  xor    %eax,%eax
  jmp    L88
```

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