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

```asm
<uuencode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  cmpl   $0x3f,-0x34(%rbp)
  jle    L131
  mov    $0x0,%eax
  jmp    L66
L131:
  mov    -0x34(%rbp),%eax
  and    $0x3f,%eax
  test   %eax,%eax
  je     L14
  mov    -0x34(%rbp),%eax
  and    $0x3f,%eax
  add    $0x20,%eax
  mov    %eax,%ecx
  jmp    L67
L14:
  mov    $0x60,%ecx
L67:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    %cl,(%rax)
  jmp    L100
L136:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  shr    $0x2,%al
  movzbl %al,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x4,%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x1,-0x34(%rbp)
  jle    L185
  mov    -0x1c(%rbp),%edx
  mov    -0x30(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  shr    $0x4,%al
  movzbl %al,%eax
  or     %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x30(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x2,%eax
  mov    %eax,-0x18(%rbp)
  cmpl   $0x2,-0x34(%rbp)
  jle    L185
  mov    -0x18(%rbp),%edx
  mov    -0x30(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  shr    $0x6,%al
  movzbl %al,%eax
  or     %edx,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x14(%rbp)
L185:
  mov    -0x20(%rbp),%eax
  and    $0x3f,%eax
  test   %eax,%eax
  je     L126
  mov    -0x20(%rbp),%eax
  and    $0x3f,%eax
  add    $0x20,%eax
  mov    %eax,%ecx
  jmp    L91
L126:
  mov    $0x60,%ecx
L91:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    %cl,(%rax)
  mov    -0x1c(%rbp),%eax
  and    $0x3f,%eax
  test   %eax,%eax
  je     L137
  mov    -0x1c(%rbp),%eax
  and    $0x3f,%eax
  add    $0x20,%eax
  mov    %eax,%ecx
  jmp    L112
L137:
  mov    $0x60,%ecx
L112:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    %cl,(%rax)
  cmpl   $0x1,-0x34(%rbp)
  jle    L36
  mov    -0x18(%rbp),%eax
  and    $0x3f,%eax
  test   %eax,%eax
  je     L28
  mov    -0x18(%rbp),%eax
  and    $0x3f,%eax
  add    $0x20,%eax
  mov    %eax,%ecx
  jmp    L43
L28:
  mov    $0x60,%ecx
L43:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    %cl,(%rax)
L36:
  cmpl   $0x2,-0x34(%rbp)
  jle    L83
  mov    -0x14(%rbp),%eax
  and    $0x3f,%eax
  test   %eax,%eax
  je     L10
  mov    -0x14(%rbp),%eax
  and    $0x3f,%eax
  add    $0x20,%eax
  mov    %eax,%ecx
  jmp    L174
L10:
  mov    $0x60,%ecx
L174:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    %cl,(%rax)
L83:
  addq   $0x3,-0x30(%rbp)
  subl   $0x3,-0x34(%rbp)
L100:
  cmpl   $0x0,-0x34(%rbp)
  jg     L136
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x1,%eax
L66:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L49
  call   <__stack_chk_fail@plt>
L49:
  leave
  ret
```

assistant: ```c
int uuencode(char *target, unsigned char *source, int length) {
  int split[4] = {0, 0, 0, 0};
  if (length > 0x3f)
    return 0;
  *target++ = (char)(((length)&0x3f) == 0 ? 0x60 : ((length)&0x3f) + ' ');
  while (length > 0) {
    split[0] = source[0] >> 2;
    split[1] = source[0] << 4;
    if (length > 1) {
      split[1] |= source[1] >> 4;
      split[2] = source[1] << 2;
      if (length > 2) {
        split[2] |= source[2] >> 6;
        split[3] = source[2];
      }
    }
    *target++ = (char)(((split[0]) & 0x3f) == 0 ? 0x60 : ((split[0]) & 0x3f) + ' ');
    *target++ = (char)(((split[1]) & 0x3f) == 0 ? 0x60 : ((split[1]) & 0x3f) + ' ');
    if (length > 1)
      *target++ = (char)(((split[2]) & 0x3f) == 0 ? 0x60 : ((split[2]) & 0x3f) + ' ');
    if (length > 2)
      *target++ = (char)(((split[3]) & 0x3f) == 0 ? 0x60 : ((split[3]) & 0x3f) + ' ');
    source += 3;
    length -= 3;
  }
  *target = '\0';
  return 1;
}
```