user: What is the c source code of the assembly code below?

```asm
<nc_getch>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  test   %rsi,%rsi
  je     L17
  test   %edi,%edi
  je     L204
  mov    D125(%rip),%rbx
  mov    %rsi,%rbp
  xor    %r12d,%r12d
L311:
  xor    %eax,%eax
  movq   $0x0,(%rbx)
  call   <getch@plt>
  test   %eax,%eax
  js     L297
  test   %r12d,%r12d
  jne    L2
L394:
  cmp    $0x1a,%eax
  je     L333
  cmp    $0xd,%eax
  je     L263
L4:
  cmp    $0x16,%eax
  jne    L257
L96:
  movl   $0x1,0x0(%rbp)
  xor    %eax,%eax
  movq   $0x0,(%rbx)
  call   <getch@plt>
  test   %eax,%eax
  js     L418
L2:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  xchg   %ax,%ax
L418:
  mov    D74(%rip),%rdx
  mov    (%rbx),%rcx
  cmp    %rcx,(%rdx)
  jne    L2
  mov    $0x1,%r12d
  jmp    L311
  nopw   0x0(%rax,%rax,1)
L297:
  mov    D74(%rip),%rdx
  mov    (%rdx),%rsi
  cmp    %rsi,(%rbx)
  je     L311
  test   %r12d,%r12d
  jne    L2
  cmp    $0x16,%eax
  je     L96
  nopl   0x0(%rax)
L257:
  movl   $0x0,0x0(%rbp)
L309:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L333:
  mov    D29(%rip),%rax
  mov    (%rax),%edi
  call   <raise@plt>
  xor    %eax,%eax
  movq   $0x0,(%rbx)
  call   <getch@plt>
  test   %eax,%eax
  jns    L394
  mov    D74(%rip),%rdx
  mov    (%rdx),%rcx
  cmp    %rcx,(%rbx)
  jne    L4
  jmp    L311
  nopl   0x0(%rax)
L17:
  test   %edi,%edi
  je     L379
  mov    D125(%rip),%rbx
  xor    %ebp,%ebp
L95:
  xor    %eax,%eax
  movq   $0x0,(%rbx)
  call   <getch@plt>
  test   %eax,%eax
  js     L138
  test   %ebp,%ebp
  jne    L2
L97:
  cmp    $0x1a,%eax
  je     L21
  cmp    $0xd,%eax
  je     L422
L395:
  cmp    $0x16,%eax
  jne    L2
  xor    %eax,%eax
  movq   $0x0,(%rbx)
  call   <getch@plt>
  test   %eax,%eax
  jns    L2
  mov    D74(%rip),%rdx
  mov    (%rdx),%rcx
  cmp    %rcx,(%rbx)
  jne    L2
  mov    $0x1,%ebp
  jmp    L95
  cs nopw 0x0(%rax,%rax,1)
L21:
  mov    D29(%rip),%rax
  mov    (%rax),%edi
  call   <raise@plt>
  xor    %eax,%eax
  movq   $0x0,(%rbx)
  call   <getch@plt>
  test   %eax,%eax
  jns    L97
  mov    D74(%rip),%rdx
  mov    (%rdx),%rcx
  cmp    %rcx,(%rbx)
  jne    L395
  jmp    L95
  nopl   0x0(%rax)
L138:
  mov    D74(%rip),%rdx
  mov    (%rdx),%rsi
  cmp    %rsi,(%rbx)
  je     L95
  test   %ebp,%ebp
  je     L395
  jmp    L2
  nopl   0x0(%rax,%rax,1)
L263:
  movl   $0x0,0x0(%rbp)
  mov    $0xa,%eax
  jmp    L309
L422:
  mov    $0xa,%eax
  jmp    L2
L204:
  mov    D125(%rip),%rbx
L18:
  xor    %eax,%eax
  movq   $0x0,(%rbx)
  call   <getch@plt>
  test   %eax,%eax
  js     L31
  cmp    $0x1a,%eax
  jne    L2
  mov    D29(%rip),%rax
  mov    (%rax),%edi
  call   <raise@plt>
  jmp    L18
L31:
  mov    D74(%rip),%rdx
  mov    (%rdx),%rsi
  cmp    %rsi,(%rbx)
  jne    L2
  jmp    L18
L379:
  mov    D125(%rip),%rbx
L74:
  xor    %eax,%eax
  movq   $0x0,(%rbx)
  call   <getch@plt>
  test   %eax,%eax
  js     L233
  cmp    $0x1a,%eax
  jne    L2
  mov    D29(%rip),%rax
  mov    (%rax),%edi
  call   <raise@plt>
  jmp    L74
L233:
  mov    D74(%rip),%rdx
  mov    (%rdx),%rcx
  cmp    %rcx,(%rbx)
  jne    L2
  jmp    L74
```

assistant: ```c
int nc_getch(bool mapraw, bool *wasraw) {
  bool ctrl_v = false;
  int ch;
restart:
  errno = 0;
  ch = getch();
  if (ch < 0 && errno == EINTR)
    goto restart;
  if (ctrl_v)
    return ch;
  if (ch == (('z') & 037)) {
    raise(SIGTSTP);
    goto restart;
  }
  if (mapraw) {
    if (ch == '\r') {
      ch = '\n';
    } else if (ch == (('v') & 037)) {
      if (wasraw)
        *wasraw = true;
      ctrl_v = true;
      goto restart;
    }
    if (wasraw)
      *wasraw = false;
  }
  return ch;
}
```