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

```asm
<int_to_ext>:
  endbr64
  push   %r15
  movslq %esi,%rsi
  mov    %rdi,%r9
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  movb   $0xa,(%rdi,%rsi,1)
  movsbl (%rdi),%r14d
  cmp    $0xa,%r14b
  je     L12
  lea    0x1(%rdi),%rcx
  mov    %r14d,%ebp
  mov    %rdi,%r12
  mov    $0xffffffff,%ebx
  xor    %r15d,%r15d
  jmp    L102
  xchg   %ax,%ax
L146:
  mov    %rcx,%r12
  add    $0x1,%ebx
L133:
  movsbl (%r12),%r14d
  lea    0x1(%r12),%rcx
  mov    %r14d,%ebp
  cmp    $0xa,%r14b
  je     L104
L102:
  cmp    $0x20,%r14d
  je     L146
  lea    0x1(%r15),%r8d
  cmp    %r15d,%ebx
  jl     L61
  mov    %ebx,%eax
  mov    $0x20,%esi
  mov    %r9,0x18(%rsp)
  add    $0x1,%ebx
  sub    %r15d,%eax
  mov    %rcx,0x10(%rsp)
  lea    0x1(%rax),%r13
  mov    %r8d,0xc(%rsp)
  mov    %r13,%rdx
  call   <memset@plt>
  mov    0xc(%rsp),%r8d
  mov    0x10(%rsp),%rcx
  mov    0x18(%rsp),%r9
  lea    (%rax,%r13,1),%rax
  add    %ebx,%r8d
  sub    %r15d,%r8d
  mov    %r8d,%r15d
L84:
  lea    0x1(%rax),%rdi
  cmp    $0x7,%r14d
  je     L121
  mov    %bpl,(%rax)
  mov    %rcx,%r12
  jmp    L133
  cs nopw 0x0(%rax,%rax,1)
L121:
  movzbl 0x1(%r12),%edx
  cmp    $0x3f,%dl
  ja     L73
  cmp    $0x23,%dl
  jne    L170
  movb   $0x7f,(%rax)
  add    $0x2,%r12
  jmp    L133
  nopl   0x0(%rax)
L104:
  lea    0x1(%rdi),%rax
  sub    %r9d,%eax
L7:
  movb   $0xa,(%rdi)
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L170:
  sub    $0x30,%edx
  cmp    $0x7,%dl
  ja     L82
  movzbl 0x2(%r12),%ecx
  movsbl %dl,%esi
  sub    $0x30,%ecx
  cmp    $0x7,%cl
  ja     L55
  movsbl %cl,%ecx
  lea    (%rcx,%rsi,8),%edx
  movzbl 0x3(%r12),%esi
  lea    -0x30(%rsi),%ecx
  cmp    $0x7,%cl
  ja     L166
  lea    (%rcx,%rdx,8),%edx
  add    $0x4,%r12
  mov    %dl,(%rax)
  jmp    L133
  nopl   0x0(%rax,%rax,1)
L73:
  and    $0x1f,%edx
  add    $0x2,%r12
  mov    %dl,(%rax)
  jmp    L133
  xchg   %ax,%ax
L61:
  mov    %r8d,%r15d
  mov    %rdi,%rax
  add    $0x1,%ebx
  jmp    L84
L12:
  mov    $0x1,%eax
  jmp    L7
L55:
  mov    %dl,(%rax)
  add    $0x2,%r12
  jmp    L133
L82:
  xor    %edx,%edx
  mov    %rcx,%r12
  mov    %dl,(%rax)
  jmp    L133
L166:
  mov    %dl,(%rax)
  add    $0x3,%r12
  jmp    L133
```

assistant: ```c
int int_to_ext(line, nbytes)
char *line;
int nbytes;
{
  register char *fm, *to;
  register unsigned cc;
  int lnb;
  int cn;
  int i, j;
  line[nbytes] = '\n';
  fm = to = line;
  cn = -1;
  lnb = 0;
  while ((cc = *fm++) != '\n') {
    cn++;
    if (cc != ' ') {
      while (++lnb <= cn)
        *to++ = ' ';
      if (cc == 7) {
        if (*fm >= '@' || (unsigned)*fm > 0200) {
          *to++ = *fm++ & 037;
          continue;
        }
        if (*fm == '#') {
          *to++ = '\177';
          fm++;
          continue;
        }
        i = 0;
        j = 0;
        while (j++ < 3 && (*fm >= '0' && *fm <= '7'))
          i = (i << 3) + (*fm++ - '0');
        *to++ = i & 0377;
        continue;
      }
      *to++ = cc;
    }
  }
  *to++ = '\n';
  return (to - line);
}
```