user: What would the C source look like for the assembly code provided here:

```asm
<pnm_parse_header>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    0x20(%rsp),%r10
  mov    0x28(%rsp),%r11
  test   %r10,%r10
  je     L143
  mov    %rdx,%rbp
  mov    %rcx,%r12
  mov    $0x0,%eax
  jmp    L301
L251:
  cmp    $0xa,%dl
  je     L113
L261:
  add    $0x1,%rax
  cmp    %rax,%r10
  je     L143
L301:
  movzbl (%r11,%rax,1),%edx
  mov    (%rdi),%ecx
  cmp    $0x9,%ecx
  je     L251
  test   %rsi,%rsi
  je     L212
  cmp    $0xa,%dl
  setne  %dl
  movzbl %dl,%edx
  mov    %edx,(%rsi)
  jmp    L261
L113:
  movl   $0xa,(%rdi)
  mov    %rax,%r10
L143:
  mov    %r10,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L212:
  cmp    $0x23,%dl
  je     L101
  cmp    $0x50,%dl
  jne    L300
  test   %ecx,%ecx
  je     L127
L300:
  lea    -0x1(%rcx),%ebx
  cmp    $0x1,%ebx
  jbe    L267
  lea    -0x3(%rcx),%ebx
  cmp    $0x1,%ebx
  ja     L199
  lea    -0x30(%rdx),%ebx
  cmp    $0x9,%bl
  ja     L32
  movl   $0x4,(%rdi)
  mov    (%r8),%rcx
  lea    (%rcx,%rcx,4),%rcx
  and    $0xf,%edx
  lea    (%rdx,%rcx,2),%rdx
  mov    %rdx,(%r8)
  jmp    L261
L101:
  movl   $0x1,0x0
  jmp    L261
L127:
  movl   $0x1,(%rdi)
  jmp    L261
L267:
  lea    -0x30(%rdx),%ebx
  cmp    $0x9,%bl
  ja     L70
  movl   $0x2,(%rdi)
  mov    0x0(%rbp),%ecx
  lea    (%rcx,%rcx,4),%ecx
  and    $0xf,%edx
  lea    (%rdx,%rcx,2),%edx
  mov    %edx,0x0(%rbp)
  jmp    L261
L199:
  lea    -0x5(%rcx),%ebx
  cmp    $0x1,%ebx
  ja     L70
  lea    -0x30(%rdx),%ebx
  cmp    $0x9,%bl
  ja     L32
  movl   $0x6,(%rdi)
  mov    (%r9),%rcx
  lea    (%rcx,%rcx,4),%rcx
  and    $0xf,%edx
  lea    (%rdx,%rcx,2),%rdx
  mov    %rdx,(%r9)
  jmp    L261
L70:
  lea    -0x7(%rcx),%ebx
  cmp    $0x1,%ebx
  ja     L32
  lea    -0x30(%rdx),%ebx
  cmp    $0x9,%bl
  ja     L68
  movl   $0x8,(%rdi)
  mov    (%r12),%ecx
  lea    (%rcx,%rcx,4),%ecx
  and    $0xf,%edx
  lea    (%rdx,%rcx,2),%edx
  mov    %edx,(%r12)
  jmp    L261
L32:
  test   $0x1,%cl
  jne    L261
  add    $0x1,%ecx
  mov    %ecx,(%rdi)
  cmp    $0x7,%ecx
  je     L7
L47:
  cmpl   $0x9,(%rdi)
  jne    L261
  cmp    $0xa,%dl
  jne    L261
  movl   $0xa,(%rdi)
  mov    %rax,%r10
  jmp    L143
L7:
  cmpl   $0x4,0x0(%rbp)
  jne    L261
  movl   $0x9,(%rdi)
  movl   $0x1,(%r12)
  jmp    L47
L68:
  test   $0x1,%cl
  jne    L261
  add    $0x1,%ecx
  mov    %ecx,(%rdi)
  jmp    L47
```

assistant: ```c
size_t pnm_parse_header(int *restrict state, int *restrict comment, int *restrict type, unsigned int *restrict maxval, size_t *restrict width, size_t *restrict height, size_t size, const char *image) {
  size_t i;
  char c;
  for (i = 0; i < size; i++)
    if (c = image[i], *state == 9) {
      if (c == '\n')
        return *state = 10, i;
    } else if (comment)
      *comment = c != '\n';
    else if (c == '#')
      *comment = 1;
    else if ((*state == 0) && (c == 'P'))
      ++*state;
    else if (((*state == 1) || (*state == 1 + 1)) && ('0' <= c) && (c <= '9'))
      *state = 2, *type = *type * 10 + (c & 15);
    else if (((*state == 3) || (*state == 3 + 1)) && ('0' <= c) && (c <= '9'))
      *state = 4, *width = *width * 10 + (c & 15);
    else if (((*state == 5) || (*state == 5 + 1)) && ('0' <= c) && (c <= '9'))
      *state = 6, *height = *height * 10 + (c & 15);
    else if (((*state == 7) || (*state == 7 + 1)) && ('0' <= c) && (c <= '9'))
      *state = 8, *maxval = *maxval * 10 + (c & 15);
    else if ((*state % 2) == 0) {
      ++*state;
      if ((*state == 7) && (*type == 4))
        *state = 9, *maxval = 1;
      if ((*state == 9) && (c == '\n'))
        return *state = 10, i;
    }
  return i;
}
```