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

```asm
<config_read>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xc(%rbp)
  jmp    L18
L90:
  mov    -0x18(%rbp),%rdx
  lea    -0xd(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  movzbl -0xd(%rbp),%eax
  movsbl %al,%eax
  cmp    $0x7a,%eax
  jg     L182
  cmp    $0x31,%eax
  jge    L201
  cmp    $0x20,%eax
  je     L44
  cmp    $0x20,%eax
  jg     L182
  cmp    $0xa,%eax
  je     L44
  cmp    $0xd,%eax
  je     L44
  jmp    L182
L201:
  sub    $0x31,%eax
  cmp    $0x49,%eax
  ja     L182
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D16(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D16(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x2,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x4,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x8,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x10,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x20,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x40,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x80,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x200,(%rax)
  jmp    L49
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x100,(%rax)
  jmp    L49
L44:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  jmp    L49
L182:
  mov    $0xffffffff,%eax
  jmp    L121
L49:
  addl   $0x1,-0xc(%rbp)
L18:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %eax,%eax
  jne    L10
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L90
L10:
  mov    $0x0,%eax
L121:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L154
  call   <__stack_chk_fail@plt>
L154:
  leave
  ret
```

assistant: ```c
int config_read(FILE *f, int n, int *joymap) {
  for (int i = 0; !feof(f) && i < n; i++) {
    char c;
    fread(&c, sizeof(char), 1, f);
    switch (c) {
    case 'a':
      joymap[i] = (0x1);
      break;
    case 'q':
      joymap[i] = (0x1 << 1);
      break;
    case 'w':
      joymap[i] = (0x1 << 2);
      break;
    case 'e':
      joymap[i] = (0x1 << 3);
      break;
    case 'd':
      joymap[i] = (0x1 << 4);
      break;
    case 'c':
      joymap[i] = (0x1 << 5);
      break;
    case 'x':
      joymap[i] = (0x1 << 6);
      break;
    case 'z':
      joymap[i] = (0x1 << 7);
      break;
    case '1':
      joymap[i] = (0x1 << 9);
      break;
    case '3':
      joymap[i] = (0x1 << 8);
      break;
    case ' ':
    case '\r':
    case '\n':
      joymap[i] = 0x0;
      break;
    default:
      return -1;
    }
  }
  return 0;
}
```