user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Base64Encode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x24(%rsp)
  test   %edx,%edx
  jle    L43
  lea    0x24(%rsp),%r13
  mov    %ecx,%r12d
  mov    %r8d,%ebp
  mov    %edx,%r15d
  mov    $0x3,%r14d
  mov    %r13,%rbx
  nopl   0x0(%rax,%rax,1)
L74:
  mov    %r14d,%ecx
  lea    -0x3(%r14),%rax
L45:
  xor    %edx,%edx
  cmp    %eax,%r15d
  jle    L25
  mov    0x8(%rsp),%rsi
  movzbl (%rsi,%rax,1),%edx
L25:
  mov    %dl,(%rbx,%rax,1)
  add    $0x1,%rax
  cmp    %r14,%rax
  jne    L45
  sub    %r15d,%ecx
  test   %ebp,%ebp
  jne    L61
L79:
  mov    0x10(%rsp),%rsi
  mov    %r12d,%edx
  mov    %ebp,%r8d
  mov    %r13,%rdi
  add    $0x3,%r14
  sub    $0x3,%rbx
  call   <encodeblock@plt>
  lea    -0x3(%r14),%edx
  cmp    %edx,%r15d
  jg     L74
L53:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L32
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L61:
  mov    %r15d,%esi
  lea    D52(%rip),%rdi
  xor    %eax,%eax
  mov    %ecx,0x1c(%rsp)
  mov    %r14d,0x18(%rsp)
  call   <printf@plt>
  mov    0x18(%rsp),%esi
  lea    D65(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x1c(%rsp),%ecx
  lea    D18(%rip),%rdi
  xor    %eax,%eax
  mov    %ecx,%esi
  mov    %ecx,0x18(%rsp)
  call   <printf@plt>
  movzbl 0x24(%rsp),%esi
  lea    D49(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movzbl 0x25(%rsp),%esi
  lea    D49(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movzbl 0x26(%rsp),%esi
  lea    D49(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D62(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x18(%rsp),%ecx
  jmp    L79
L43:
  xor    %eax,%eax
  jmp    L53
L32:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D52
type: string
name: read_data
arguments: tag: D65
type: string
name: read_data
arguments: tag: D18
type: string
name: read_data
arguments: tag: D49
type: string
name: read_data
arguments: tag: D62
type: string

tool: D52: iplen = %i ,

tool: D65: ipindex = %i ,

tool: D18: delta = %i ,

tool: D49: %02x 

tool: D62:  => 

assistant: ```c
int Base64Encode(unsigned char *input, char *output, int inputlen, int oplen, int debug) {
  int rc = 0, del = 0;
  int index = 0, ipindex = 0, iplen = 0;
  unsigned char encoderinput[3 + 1] = "";
  iplen = inputlen;
  while (ipindex < iplen) {
    for (index = 0; index < 3; index++) {
      if (ipindex < iplen) {
        encoderinput[index] = input[ipindex];
      } else {
        encoderinput[index] = 0;
      }
      ipindex++;
    }
    del = ipindex - iplen;
    if (debug) {
      printf("iplen = %i ,", iplen);
      printf("ipindex = %i ,", ipindex);
      printf("delta = %i ,", del);
      printf("%02x ", encoderinput[0]);
      printf("%02x ", encoderinput[1]);
      printf("%02x ", encoderinput[2]);
      printf(" => ");
    }
    rc = encodeblock(encoderinput, output, oplen, del, debug);
  }
  return rc;
}
```