user: Demonstrate the C code that generates the assembly output below:

```asm
<pnm_parse_header>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8,-0x38(%rbp)
  mov    %r9,-0x40(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L163
L358:
  mov    0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x9(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x9,%eax
  jne    L76
  cmpb   $0xa,-0x9(%rbp)
  jne    L147
  mov    -0x18(%rbp),%rax
  movl   $0xa,(%rax)
  mov    -0x8(%rbp),%rax
  jmp    L96
L76:
  cmpq   $0x0,-0x20(%rbp)
  je     L244
  cmpb   $0xa,-0x9(%rbp)
  setne  %al
  movzbl %al,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L147
L244:
  cmpb   $0x23,-0x9(%rbp)
  jne    L165
  mov    -0x20(%rbp),%rax
  movl   $0x1,(%rax)
  jmp    L147
L165:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L41
  cmpb   $0x50,-0x9(%rbp)
  jne    L41
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L147
L41:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  je     L236
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x2,%eax
  jne    L362
L236:
  cmpb   $0x2f,-0x9(%rbp)
  jle    L362
  cmpb   $0x39,-0x9(%rbp)
  jg     L362
  mov    -0x18(%rbp),%rax
  movl   $0x2,(%rax)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  movsbl -0x9(%rbp),%eax
  and    $0xf,%eax
  add    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L147
L362:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x3,%eax
  je     L311
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x4,%eax
  jne    L282
L311:
  cmpb   $0x2f,-0x9(%rbp)
  jle    L282
  cmpb   $0x39,-0x9(%rbp)
  jg     L282
  mov    -0x18(%rbp),%rax
  movl   $0x4,(%rax)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  mov    %rax,%rdx
  movsbq -0x9(%rbp),%rax
  and    $0xf,%eax
  add    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
  jmp    L147
L282:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x5,%eax
  je     L194
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x6,%eax
  jne    L141
L194:
  cmpb   $0x2f,-0x9(%rbp)
  jle    L141
  cmpb   $0x39,-0x9(%rbp)
  jg     L141
  mov    -0x18(%rbp),%rax
  movl   $0x6,(%rax)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  mov    %rax,%rdx
  movsbq -0x9(%rbp),%rax
  and    $0xf,%eax
  add    %rax,%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,(%rax)
  jmp    L147
L141:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x7,%eax
  je     L255
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x8,%eax
  jne    L296
L255:
  cmpb   $0x2f,-0x9(%rbp)
  jle    L296
  cmpb   $0x39,-0x9(%rbp)
  jg     L296
  mov    -0x18(%rbp),%rax
  movl   $0x8,(%rax)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  movsbl -0x9(%rbp),%eax
  and    $0xf,%eax
  add    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L147
L296:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L147
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x7,%eax
  jne    L317
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x4,%eax
  jne    L317
  mov    -0x18(%rbp),%rax
  movl   $0x9,(%rax)
  mov    -0x30(%rbp),%rax
  movl   $0x1,(%rax)
L317:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x9,%eax
  jne    L147
  cmpb   $0xa,-0x9(%rbp)
  jne    L147
  mov    -0x18(%rbp),%rax
  movl   $0xa,(%rax)
  mov    -0x8(%rbp),%rax
  jmp    L96
L147:
  addq   $0x1,-0x8(%rbp)
L163:
  mov    -0x8(%rbp),%rax
  cmp    0x10(%rbp),%rax
  jb     L358
  mov    -0x8(%rbp),%rax
L96:
  pop    %rbp
  ret
```

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;
}
```