user: Converte this assembly snippet into its equivalent C code:

```asm
<z80_OpcodeLen>:
  endbr64
  sub    $0x18,%rsp
  mov    %rdx,%rax
  mov    %fs:0x28,%rdx
  mov    %rdx,0x8(%rsp)
  xor    %edx,%edx
  lea    0x4(%rsp),%rdx
  test   %rax,%rax
  cmove  %rdx,%rax
  movzbl (%rdi,%rsi,1),%ecx
  cmp    $0xff,%cl
  je     L175
  cmp    $0xda,%cl
  jbe    L192
  add    $0x25,%ecx
  cmp    $0x23,%cl
  ja     L376
  movzbl %cl,%ecx
  lea    D1(%rip),%r8
  movslq (%r8,%rcx,4),%rdx
  add    %r8,%rdx
  notrack jmp *%rdx
L192:
  cmp    $0x3e,%cl
  ja     L119
  test   %cl,%cl
  je     L299
  mov    $0x1,%edx
  shl    %cl,%rdx
  movabs $0x4040404040404040,%rcx
  test   %rcx,%rdx
  jne    L257
  movabs $0x406040600020002,%rcx
  test   %rcx,%rdx
  jne    L287
  movabs $0x101010101010000,%rcx
  test   %rcx,%rdx
  jne    L457
  mov    $0x1,%eax
L551:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L492
  add    $0x18,%rsp
  ret
L299:
  mov    $0x1,%eax
  jmp    L551
  mov    $0x2,%eax
  jmp    L551
L119:
  add    $0x3e,%ecx
  cmp    $0x18,%cl
  ja     L476
  mov    $0x1,%edx
  shl    %cl,%rdx
  test   $0x121210,%edx
  jne    L100
  test   $0x1010103,%edx
  jne    L140
  test   $0x40c04,%edx
  jne    L261
  mov    $0x1,%eax
  jmp    L551
L476:
  mov    $0x1,%eax
  jmp    L551
L457:
  movl   $0x62,(%rax)
  mov    $0x2,%eax
  jmp    L551
L261:
  movl   $0x63,(%rax)
  mov    $0x3,%eax
  jmp    L551
L140:
  movl   $0x62,(%rax)
  mov    $0x3,%eax
  jmp    L551
  movzbl 0x1(%rdi,%rsi,1),%ecx
  cmp    $0x86,%cl
  ja     L218
  cmp    $0x4d,%cl
  ja     L383
  sub    $0x21,%ecx
  mov    $0x2,%eax
  cmp    $0x25,%cl
  ja     L551
  mov    $0x1,%eax
  shl    %cl,%rax
  test   $0x200203,%eax
  jne    L246
  movabs $0x2000180000,%rdx
  and    %rdx,%rax
  cmp    $0x1,%rax
  mov    $0x2,%eax
  sbb    $0xff,%al
  jmp    L551
L383:
  sub    $0x4e,%ecx
  movabs $0x10102fd01010101,%rax
  shr    %cl,%rax
  and    $0x1,%eax
  add    $0x2,%eax
  jmp    L551
L218:
  add    $0x72,%ecx
  mov    $0x2,%eax
  cmp    $0x3d,%cl
  ja     L551
  mov    $0x1,%eax
  shl    %cl,%rax
  movabs $0x1010101010101,%rdx
  test   %rdx,%rax
  jne    L315
  cmp    $0x3d,%cl
  sete   %al
  lea    0x2(%rax,%rax,1),%eax
  jmp    L551
  movzbl 0x1(%rdi,%rsi,1),%ecx
  sub    $0x43,%ecx
  cmp    $0x38,%cl
  ja     L328
  mov    $0x1,%edx
  shl    %cl,%rdx
  movabs $0x101000001010101,%rsi
  test   %rsi,%rdx
  jne    L548
  cmp    $0xa,%cl
  je     L366
  mov    $0x2,%eax
  jmp    L551
L366:
  movl   $0x72,(%rax)
  mov    $0x2,%eax
  jmp    L551
  movzbl 0x1(%rdi,%rsi,1),%ecx
  cmp    $0xa6,%cl
  ja     L18
  cmp    $0x6d,%cl
  ja     L316
  cmp    $0x22,%cl
  jbe    L171
  sub    $0x2a,%ecx
  mov    $0x2,%eax
  cmp    $0x3c,%cl
  ja     L551
  mov    $0x1,%eax
  shl    %cl,%rax
  movabs $0x1010101010000c00,%rdx
  test   %rdx,%rax
  jne    L438
  and    $0x1001,%eax
  cmp    $0x1,%rax
  sbb    %eax,%eax
  and    $0xfffffffe,%eax
  add    $0x4,%eax
  jmp    L551
L171:
  cmp    $0x21,%cl
  sbb    %eax,%eax
  and    $0xfffffffe,%eax
  add    $0x4,%eax
  jmp    L551
L316:
  sub    $0x6e,%ecx
  movabs $0x1010101010102fd,%rax
  shr    %cl,%rax
  and    $0x1,%eax
  add    $0x2,%eax
  jmp    L551
L18:
  cmp    $0xe9,%cl
  jne    L596
  movl   $0x62,(%rax)
  mov    $0x2,%eax
  jmp    L551
L596:
  mov    $0x2,%eax
  ja     L551
  mov    $0x4,%eax
  cmp    $0xcb,%cl
  je     L551
  mov    $0x2,%eax
  ja     L551
  cmp    $0xb6,%cl
  je     L92
  and    $0xffffffef,%ecx
  cmp    $0xae,%cl
  sete   %al
  add    $0x2,%eax
  jmp    L551
L175:
  mov    $0x1,%eax
  jmp    L551
L376:
  mov    $0x1,%eax
  jmp    L551
L100:
  mov    $0x2,%eax
  jmp    L551
L257:
  mov    $0x2,%eax
  jmp    L551
L287:
  mov    $0x3,%eax
  jmp    L551
L315:
  mov    $0x3,%eax
  jmp    L551
L246:
  mov    $0x4,%eax
  jmp    L551
L328:
  mov    $0x2,%eax
  jmp    L551
L548:
  mov    $0x4,%eax
  jmp    L551
L438:
  mov    $0x3,%eax
  jmp    L551
L92:
  mov    $0x3,%eax
  jmp    L551
L492:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned char z80_OpcodeLen(unsigned char *Opcodes, unsigned long p, int *type) {
  unsigned char len = 1;
  int type_tmp;
  if (type == NULL)
    type = &type_tmp;
  switch (Opcodes[p]) {
  case 0x10:
  case 0x18:
  case 0x20:
  case 0x28:
  case 0x30:
  case 0x38:
    *type = 'b';
  case 0x06:
  case 0x0E:
  case 0x16:
  case 0x1E:
  case 0x26:
  case 0x2E:
  case 0x36:
  case 0x3E:
  case 0xC6:
  case 0xCE:
  case 0xD3:
  case 0xD6:
  case 0xDB:
  case 0xDE:
  case 0xE6:
  case 0xEE:
  case 0xF6:
  case 0xFE:
  case 0xCB:
    len = 2;
    break;
  case 0x01:
  case 0x11:
  case 0x21:
  case 0x22:
  case 0x2A:
  case 0x31:
  case 0x32:
  case 0x3A:
    len = 3;
    break;
  case 0xC4:
  case 0xCC:
  case 0xCD:
  case 0xD4:
  case 0xDC:
  case 0xE4:
  case 0xEC:
  case 0xF4:
  case 0xFC:
    len = 3;
    *type = 'c';
    break;
  case 0xC2:
  case 0xC3:
  case 0xCA:
  case 0xD2:
  case 0xDA:
  case 0xE2:
  case 0xEA:
  case 0xF2:
  case 0xFA:
    *type = 'b';
    len = 3;
    break;
  case 0xDD:
    len = 2;
    switch (Opcodes[p + 1]) {
    case 0x34:
    case 0x35:
    case 0x46:
    case 0x4E:
    case 0x56:
    case 0x5E:
    case 0x66:
    case 0x6E:
    case 0x70:
    case 0x71:
    case 0x72:
    case 0x73:
    case 0x74:
    case 0x75:
    case 0x77:
    case 0x7E:
    case 0x86:
    case 0x8E:
    case 0x96:
    case 0x9E:
    case 0xA6:
    case 0xAE:
    case 0xB6:
    case 0xBE:
      len = 3;
      break;
    case 0x21:
    case 0x22:
    case 0x2A:
    case 0x36:
    case 0xCB:
      len = 4;
      break;
    }
    break;
  case 0xED:
    len = 2;
    switch (Opcodes[p + 1]) {
    case 0x4D:
      *type = 'r';
      break;
    case 0x43:
    case 0x4B:
    case 0x53:
    case 0x5B:
    case 0x73:
    case 0x7B:
      len = 4;
      break;
    }
    break;
  case 0xFD:
    len = 2;
    switch (Opcodes[p + 1]) {
    case 0x34:
    case 0x35:
    case 0x46:
    case 0x4E:
    case 0x56:
    case 0x5E:
    case 0x66:
    case 0x6E:
    case 0x70:
    case 0x71:
    case 0x72:
    case 0x73:
    case 0x74:
    case 0x75:
    case 0x77:
    case 0x7E:
    case 0x86:
    case 0x8E:
    case 0x96:
    case 0x9E:
    case 0xA6:
    case 0xAE:
    case 0xB6:
    case 0xBE:
      len = 3;
      break;
    case 0xe9:
      *type = 'b';
      break;
    case 0x21:
    case 0x22:
    case 0x2A:
    case 0x36:
    case 0xCB:
      len = 4;
      break;
    }
    break;
  }
  return (len);
}
```