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

```asm
<get_input_line>:
  endbr64
  push   %r15
  xor    %eax,%eax
  mov    %r9d,%r15d
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rsi,%r12
  xor    %esi,%esi
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x18,%rsp
  mov    %r8d,0x4(%rsp)
  call   <message@plt>
  mov    %r14,%rdi
  call   <strlen@plt>
  cmpb   $0x0,(%r12)
  mov    %eax,%r14d
  jne    L52
L315:
  test   %r15d,%r15d
  je     L221
  jmp    L174
  nopl   0x0(%rax)
L246:
  test   %ebx,%ebx
  jle    L45
  cmp    $0x8,%eax
  sete   %al
  cmp    $0x1,%al
  adc    $0xffffffff,%ebx
L45:
  xor    %eax,%eax
  call   <refresh@plt>
L221:
  xor    %eax,%eax
  call   <rgetchar@plt>
  cmp    $0xd,%eax
  je     L209
  cmp    $0x1b,%eax
  je     L98
  cmp    $0xa,%eax
  je     L98
  lea    -0x20(%rax),%edx
  cmp    $0x5e,%edx
  ja     L246
  cmp    $0x1b,%ebx
  jg     L45
  cmp    $0x20,%eax
  jne    L68
  test   %ebx,%ebx
  jle    L45
L68:
  movslq %ebx,%rdx
  add    $0x1,%ebx
  mov    %al,0x0(%rbp,%rdx,1)
  jmp    L45
  nopw   0x0(%rax,%rax,1)
L141:
  cmp    $0x8,%eax
  jne    L154
  test   %ebx,%ebx
  jle    L154
  lea    (%rbx,%r14,1),%r15d
  mov    $0x20,%edx
  xor    %edi,%edi
  xor    %eax,%eax
  mov    %r15d,%esi
  sub    $0x1,%ebx
  call   <mvaddch@plt>
  mov    %r15d,%esi
  xor    %edi,%edi
  xor    %eax,%eax
  call   <move@plt>
L154:
  xor    %eax,%eax
  call   <refresh@plt>
L174:
  xor    %eax,%eax
  call   <rgetchar@plt>
  cmp    $0xd,%eax
  je     L209
  cmp    $0xa,%eax
  je     L98
  cmp    $0x1b,%eax
  je     L98
  lea    -0x20(%rax),%edx
  cmp    $0x5e,%edx
  ja     L141
  cmp    $0x1b,%ebx
  jg     L154
  cmp    $0x20,%eax
  jne    L203
  test   %ebx,%ebx
  jle    L154
L203:
  lea    0x1(%rbx),%r15d
  movslq %ebx,%rbx
  mov    %eax,%edi
  mov    %al,0x0(%rbp,%rbx,1)
  xor    %eax,%eax
  mov    %r15d,%ebx
  call   <addch@plt>
  xor    %eax,%eax
  call   <refresh@plt>
  jmp    L174
L209:
  xor    %r14d,%r14d
L254:
  xor    %eax,%eax
  call   <check_message@plt>
  mov    0x4(%rsp),%edx
  movslq %ebx,%rax
  test   %edx,%edx
  jne    L19
  mov    %ebx,%r12d
  test   %ebx,%ebx
  jg     L192
  nopl   0x0(%rax)
L247:
  movb   $0x0,0x0(%rbp,%rax,1)
  test   %r12d,%r12d
  je     L291
L93:
  test   %r14b,%r14b
  jne    L291
L108:
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L29:
  lea    -0x1(%rax),%r12d
  sub    $0x1,%rax
  je     L343
L192:
  cmpb   $0x20,-0x1(%rbp,%rax,1)
  mov    %eax,%r12d
  je     L29
  jmp    L247
  nopw   0x0(%rax,%rax,1)
L19:
  lea    0x1(%rbx),%r12d
  movb   $0x20,0x0(%rbp,%rax,1)
  movslq %r12d,%rax
  movb   $0x0,0x0(%rbp,%rax,1)
  cmp    $0x1,%r12d
  ja     L93
L291:
  xor    %r12d,%r12d
  test   %r13,%r13
  je     L108
  xor    %esi,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <message@plt>
  jmp    L108
  nopl   (%rax)
L98:
  cmp    $0x1b,%eax
  sete   %r14b
  jmp    L254
  nopl   0x0(%rax)
L52:
  mov    %r12,%rdx
  mov    %rax,0x8(%rsp)
  lea    0x1(%rax),%esi
  xor    %edi,%edi
  xor    %eax,%eax
  call   <mvaddstr@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    0x8(%rsp),%rcx
  xor    %edi,%edi
  mov    %eax,%ebx
  lea    0x1(%rax,%rcx,1),%esi
  xor    %eax,%eax
  call   <move@plt>
  xor    %eax,%eax
  call   <refresh@plt>
  jmp    L315
  nop
L343:
  movslq %r12d,%rax
  movb   $0x0,0x0(%rbp,%rax,1)
  test   %r12d,%r12d
  jne    L93
  jmp    L291
```

assistant: ```c
int get_input_line(prompt, insert, buf, if_cancelled, add_blank, do_echo)
char *prompt, *buf, *insert;
char *if_cancelled;
int add_blank;
int do_echo;
{
  int ch;
  int i = 0, n;
  message(prompt, 0);
  n = strlen(prompt);
  if (insert[0]) {
    mvaddstr(0, n + 1, insert);
    (void)strcpy(buf, insert);
    i = strlen(insert);
    move(0, (n + i + 1));
    refresh();
  }
  while (((ch = rgetchar()) != '\r') && (ch != '\n') && (ch != '\033')) {
    if ((ch >= ' ') && (ch <= '~') && (i < 30 - 2)) {
      if ((ch != ' ') || (i > 0)) {
        buf[i++] = ch;
        if (do_echo) {
          addch(ch);
        }
      }
    }
    if ((ch == '\b') && (i > 0)) {
      if (do_echo) {
        mvaddch(0, i + n, ' ');
        move(1 - 1, i + n);
      }
      i--;
    }
    refresh();
  }
  check_message();
  if (add_blank) {
    buf[i++] = ' ';
  } else {
    while ((i > 0) && (buf[i - 1] == ' ')) {
      i--;
    }
  }
  buf[i] = 0;
  if ((ch == '\033') || (i == 0) || ((i == 1) && add_blank)) {
    if (if_cancelled) {
      message(if_cancelled, 0);
    }
    return (0);
  }
  return (i);
}
```