user: Translate the below assembly code into C programming language:

```asm
<old_str_rtrim>:
  endbr64
  test   %rsi,%rsi
  je     L83
  cmpb   $0x0,(%rsi)
  mov    %edx,%r9d
  je     L83
  nopl   0x0(%rax)
L212:
  mov    %rsi,%rax
  nopl   0x0(%rax,%rax,1)
L267:
  mov    %rax,%rcx
  movzbl 0x1(%rax),%edx
  add    $0x1,%rax
  cmp    $0xa,%dl
  je     L196
  test   %dl,%dl
  jne    L267
L196:
  sub    %rsi,%rax
  sub    %r9d,%eax
  test   %eax,%eax
  jg     L129
  cmpb   $0x0,0x2(%rcx)
  lea    0x2(%rcx),%rsi
  jne    L212
L83:
  movb   $0x0,(%rdi)
  ret
  nopl   0x0(%rax)
L129:
  push   %r12
  push   %rbp
  push   %rbx
L75:
  lea    0x1(%rsi),%r8
  mov    %rdi,%rdx
  lea    -0x1(%rax),%r10d
  sub    %r8,%rdx
  cmp    $0xe,%rdx
  jbe    L130
  cmp    $0x6,%r10d
  jbe    L130
  cmp    $0xe,%r10d
  jbe    L184
  mov    %eax,%r8d
  xor    %edx,%edx
  shr    $0x4,%r8d
  shl    $0x4,%r8
  nopl   (%rax)
L219:
  movdqu (%rsi,%rdx,1),%xmm0
  movups %xmm0,(%rdi,%rdx,1)
  add    $0x10,%rdx
  cmp    %r8,%rdx
  jne    L219
  mov    %eax,%edx
  mov    %r10d,%r11d
  and    $0xfffffff0,%edx
  mov    %edx,%r8d
  sub    %edx,%r11d
  lea    (%rdi,%r8,1),%rbx
  add    %rsi,%r8
  cmp    %edx,%eax
  je     L98
L52:
  mov    %eax,%ebp
  sub    %edx,%ebp
  lea    -0x1(%rbp),%r12d
  cmp    $0x6,%r12d
  jbe    L242
  mov    (%rsi,%rdx,1),%rsi
  mov    %rsi,(%rdi,%rdx,1)
  mov    %ebp,%edx
  and    $0xfffffff8,%edx
  mov    %edx,%esi
  sub    %edx,%r11d
  add    %rsi,%rbx
  add    %rsi,%r8
  cmp    %edx,%ebp
  je     L98
L242:
  movzbl (%r8),%edx
  mov    %dl,(%rbx)
  test   %r11d,%r11d
  je     L98
  movzbl 0x1(%r8),%edx
  mov    %dl,0x1(%rbx)
  cmp    $0x1,%r11d
  je     L98
  movzbl 0x2(%r8),%edx
  mov    %dl,0x2(%rbx)
  cmp    $0x2,%r11d
  je     L98
  movzbl 0x3(%r8),%edx
  mov    %dl,0x3(%rbx)
  cmp    $0x3,%r11d
  je     L98
  movzbl 0x4(%r8),%edx
  mov    %dl,0x4(%rbx)
  cmp    $0x4,%r11d
  je     L98
  movzbl 0x5(%r8),%edx
  mov    %dl,0x5(%rbx)
  cmp    $0x5,%r11d
  je     L98
  movzbl 0x6(%r8),%edx
  mov    %dl,0x6(%rbx)
L98:
  cltq
  movslq %r10d,%r10
  lea    0x2(%rcx),%rsi
  add    %rdi,%rax
  lea    0x2(%rdi,%r10,1),%rdi
  movb   $0xa,(%rax)
  cmpb   $0x0,0x2(%rcx)
  je     L110
L4:
  mov    %rsi,%rax
  nop
L249:
  mov    %rax,%rcx
  movzbl 0x1(%rax),%edx
  add    $0x1,%rax
  cmp    $0xa,%dl
  je     L60
  test   %dl,%dl
  jne    L249
L60:
  sub    %rsi,%rax
  sub    %r9d,%eax
  test   %eax,%eax
  jg     L75
  cmpb   $0x0,0x2(%rcx)
  lea    0x2(%rcx),%rsi
  jne    L4
L110:
  movb   $0x0,(%rdi)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L130:
  mov    %eax,%r11d
  xor    %edx,%edx
  nopl   0x0(%rax)
L120:
  movzbl (%rsi,%rdx,1),%r8d
  mov    %r8b,(%rdi,%rdx,1)
  add    $0x1,%rdx
  cmp    %r11,%rdx
  jne    L120
  jmp    L98
L184:
  mov    %r10d,%r11d
  mov    %rsi,%r8
  mov    %rdi,%rbx
  xor    %edx,%edx
  jmp    L52
```

assistant: ```c
void old_str_rtrim(char *output, const char *input, size_t offset) {
  int len;
  char *op;
  if (!input) {
    *output = 0;
    return;
  }
  while (*input) {
    op = (char *)input;
    do {
      input++;
    } while (*input != '\n' && *input != '\0');
    len = (int)(input - op) - offset;
    if (len > 0) {
      while (len--) {
        *output++ = *op++;
      }
      *output++ = '\n';
    }
    input++;
  }
  *output++ = 0;
}
```